Skip to main content

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

Metadata

Release files for Metaverse 0.0.5

For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.

Source distribution (sdist)

Source distribution for Metaverse 0.0.5
File Size Uploaded
metaverse-0.0.5.tar.gz 28.5 kB Details

Built distribution (wheel)

Table of built distributions (wheels) for Metaverse 0.0.5
File Interpreter ABI Platform
metaverse-0.0.5-py3-none-any.whl Python 3 none any Details

Total release size: 60.6 kB

Release files / metaverse-0.0.5.tar.gz

Download URL metaverse-0.0.5.tar.gz
Size 28.5 kB
Tags Source
SHA-256 checksum
How to use checksums
691874754a62def58a6bb92949104627f8b29d2df3ce4461e0c2b514b777a4cf
BLAKE2b-256 checksum
How to use checksums
e15ee0c876cfc3bf9ffa6df75bfef581dd145621922dee94f78865c69841d6a1
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/6.1.0 CPython/3.13.7

Release files / metaverse-0.0.5-py3-none-any.whl

Download URL metaverse-0.0.5-py3-none-any.whl
Size 32.1 kB
Tags Python 3
SHA-256 checksum
How to use checksums
077181434be514d0aaa43f6a3fa349e8b4c91a3de977f444a2e356da32d3d138
BLAKE2b-256 checksum
How to use checksums
69be54c56a04647ed09dbf14e94e4eddfe0ff48bde4149c678fb8f1982b93620
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/6.1.0 CPython/3.13.7

Release history Release notifications | RSS feed

This release

0.0.5 This release

2 release files

0.0.4

2 release files

0.0.3

2 release files

0.0.2

2 release files

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page