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.4.tar.gz (30.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.4-py3-none-any.whl (35.2 kB view details)

Uploaded Python 3

File details

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

File metadata

  • Download URL: metaverse-0.0.4.tar.gz
  • Upload date:
  • Size: 30.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.4.tar.gz
Algorithm Hash digest
SHA256 9a881b88c97efe7138c28111ec4edf502bd60bdd68ee586b0a495a78f3d4ae9f
MD5 fe02eda6982d222b58615858a4faa3a3
BLAKE2b-256 975ca700661dd6ee6c81360174ac0fddc20495af26e0e757a066da48fbd5b47b

See more details on using hashes here.

File details

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

File metadata

  • Download URL: metaverse-0.0.4-py3-none-any.whl
  • Upload date:
  • Size: 35.2 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.4-py3-none-any.whl
Algorithm Hash digest
SHA256 9989df1cfe582a8ac760a663ac905c87adb21b8a9985a9613784ed6c47276e47
MD5 1b91b1391aa56be093211ba6a04cc09d
BLAKE2b-256 8b90dc4a37cc8414b71856a1b9c716a09285c13ccfeaff3da3f62e623f3aefc4

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