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.5.tar.gz (28.5 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.5-py3-none-any.whl (32.1 kB view details)

Uploaded Python 3

File details

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

File metadata

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

File hashes

Hashes for metaverse-0.0.5.tar.gz
Algorithm Hash digest
SHA256 691874754a62def58a6bb92949104627f8b29d2df3ce4461e0c2b514b777a4cf
MD5 c3c60b9177bcd6a0a523f69aa4f76ec2
BLAKE2b-256 e15ee0c876cfc3bf9ffa6df75bfef581dd145621922dee94f78865c69841d6a1

See more details on using hashes here.

File details

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

File metadata

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

File hashes

Hashes for metaverse-0.0.5-py3-none-any.whl
Algorithm Hash digest
SHA256 077181434be514d0aaa43f6a3fa349e8b4c91a3de977f444a2e356da32d3d138
MD5 08006be28d4e97590526caabf19f37ff
BLAKE2b-256 69be54c56a04647ed09dbf14e94e4eddfe0ff48bde4149c678fb8f1982b93620

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