Skip to main content

Simple IM Framework based on satori-python

Project description

Entari

lí no etheclim, nann ze entám rish.

Licence PyPI PyPI - Python Version Entari

一个基于 Satori 协议的简易 IM framework

示例

复读:

from arclet.entari import Session, Entari, WS

app = Entari(WS(host="127.0.0.1", port=5140, path="satori"))

@app.on_message()
async def repeat(session: Session):
    await session.send(session.content)


app.run()

指令 add {a} {b}:

from arclet.entari import Session, Entari, WS, command

@command.on("add {a} {b}")
async def add(a: int, b: int, session: Session):
    await session.send(f"{a + b = }")


app = Entari(WS(port=5500, token="XXX"))
app.run()

编写插件:

from arclet.entari import Session, MessageCreatedEvent, metadata

metadata(
    name="Hello, World!",
    author=["Arclet"],
    version="0.1.0",
    description="A simple plugin that replies 'Hello, World!' to every message."
)
# or __plugin_metadata__ = PluginMetadata(...)

@MessageCreatedEvent.dispatch()
async def _(session: Session):
    await session.send("Hello, World!")

加载插件:

from arclet.entari import Entari, WS, load_plugin

load_plugin("example_plugin")
load_plugin("::echo")
load_plugin("::auto_reload", {"watch_dirs": ["plugins"]})

app = Entari(WS(port=5140, path="satori"))
app.run()

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

arclet_entari-0.8.0.tar.gz (23.2 kB view details)

Uploaded Source

Built Distribution

arclet_entari-0.8.0-py3-none-any.whl (29.2 kB view details)

Uploaded Python 3

File details

Details for the file arclet_entari-0.8.0.tar.gz.

File metadata

  • Download URL: arclet_entari-0.8.0.tar.gz
  • Upload date:
  • Size: 23.2 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? Yes
  • Uploaded via: pdm/2.19.3 CPython/3.10.12 Linux/6.5.0-1025-azure

File hashes

Hashes for arclet_entari-0.8.0.tar.gz
Algorithm Hash digest
SHA256 6ed6705702aae518e07b4cd54f4763bbe82b6e2bb64031ba0d236460e1b7412f
MD5 dfc8ac8af22469e3ef52b3fdc9044178
BLAKE2b-256 2dea724a10bc25a34487800706476fbf677c3e4fd5dfe2b9632a4701d28b49e3

See more details on using hashes here.

File details

Details for the file arclet_entari-0.8.0-py3-none-any.whl.

File metadata

  • Download URL: arclet_entari-0.8.0-py3-none-any.whl
  • Upload date:
  • Size: 29.2 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? Yes
  • Uploaded via: pdm/2.19.3 CPython/3.10.12 Linux/6.5.0-1025-azure

File hashes

Hashes for arclet_entari-0.8.0-py3-none-any.whl
Algorithm Hash digest
SHA256 c441aaefa0ddacb948b5a2e1220071c4883f007d270506ed62469509837b4455
MD5 030d4b45bea1813c1737f02ea87786bd
BLAKE2b-256 3cea052f11121f9710868cb6ffef18c915ab2ffac1064741a6271e55b9c241ef

See more details on using hashes here.

Supported by

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