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 pymetaverse import login
from pymetaverse.bot import SimpleBot
from pymetaverse.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.2.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.2-py3-none-any.whl (13.3 kB view details)

Uploaded Python 3

File details

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

File metadata

  • Download URL: metaverse-0.0.2.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.2.tar.gz
Algorithm Hash digest
SHA256 0ea8fcf95b51f06676ef7d51355010b5436b0faf771e830bbf3d5ede8316d187
MD5 4d063e318e9e1c97186ee36f45f3ae4d
BLAKE2b-256 a4f8d2d5400c541c31d167d63bcbf0691a1139384ffe7da3351e717fe5aaed4c

See more details on using hashes here.

File details

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

File metadata

  • Download URL: metaverse-0.0.2-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.2-py3-none-any.whl
Algorithm Hash digest
SHA256 509c25723780b3db839c0f50740aabc0557b9c17ae7b99f3bff1f1b108516f38
MD5 770550e838df32cd8f0f5020b03d35a2
BLAKE2b-256 db114e822d06671bb33fd14862b3d2ecc259420986f6a5247348b6d45ac4181e

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