Skip to main content

A library for handling Second Life things.

Project description

License PyPI version shields.io

PyMetaverse

A library for connecting to Second Life, OpenSimulator, or other compatible grids.

Simple bot example

import asyncio
import datetime
from metaverse import login
from metaverse.bot import SimpleBot
from metaverse.const import *

bot = SimpleBot()

@bot.on("message", name="ChatFromSimulator")
def ChatFromSimulator(simulator, message):
    # Ignore start / stop
    if message.ChatData.ChatType in (4, 5):
        return
    
    sender = message.ChatData.FromName.rstrip(b"\0").decode()
    text = message.ChatData.Message.rstrip(b"\0").decode()
    
    if text == "logout":
        bot.say(0, "Ok!")
        bot.logout()
        
    print("[{}] {}: {}".format(
        datetime.datetime.now().strftime("%Y-%M-%d %H:%m:%S"),
        sender,
        text
    ))

async def main():
    await bot.login(("Example", "Resident"), "password")
    await bot.run()

# Run everything
asyncio.run(main())

Similar Projects

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

metaverse-0.0.3.tar.gz (12.1 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

metaverse-0.0.3-py3-none-any.whl (13.3 kB view details)

Uploaded Python 3

File details

Details for the file metaverse-0.0.3.tar.gz.

File metadata

  • Download URL: metaverse-0.0.3.tar.gz
  • Upload date:
  • Size: 12.1 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.1.0 CPython/3.11.9

File hashes

Hashes for metaverse-0.0.3.tar.gz
Algorithm Hash digest
SHA256 7d68792432c82e482078c51bab125c68ec6cb3d3d6aeb23d745f4d15e80650ca
MD5 57e85e83abf4281df07ea26dc64c9440
BLAKE2b-256 faa15b61e014c88f04d08affc47ab6a0dea8e1e56ceff1c384143e0311f0f527

See more details on using hashes here.

File details

Details for the file metaverse-0.0.3-py3-none-any.whl.

File metadata

  • Download URL: metaverse-0.0.3-py3-none-any.whl
  • Upload date:
  • Size: 13.3 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.1.0 CPython/3.11.9

File hashes

Hashes for metaverse-0.0.3-py3-none-any.whl
Algorithm Hash digest
SHA256 932a95416ed6ab6fb43e99c976317574fa3b2e0b866cc6f159b2c94136f6a822
MD5 9e8ce9a6b6046b41763d11c9f4e66404
BLAKE2b-256 1c3c982fce87507f764ec71b1dc2633aa5ce54a4d54f1f9e7c41852a87d28047

See more details on using hashes here.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page