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.7.0.tar.gz (22.4 kB view details)

Uploaded Source

Built Distribution

arclet_entari-0.7.0-py3-none-any.whl (28.4 kB view details)

Uploaded Python 3

File details

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

File metadata

  • Download URL: arclet_entari-0.7.0.tar.gz
  • Upload date:
  • Size: 22.4 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? Yes
  • Uploaded via: pdm/2.19.1 CPython/3.10.12 Linux/6.8.0-1014-azure

File hashes

Hashes for arclet_entari-0.7.0.tar.gz
Algorithm Hash digest
SHA256 9229d58f7d31e22bbb9ba9be9d1d2e2ab457a751b2069e95277c0ae0aa637f86
MD5 d6d509f4817913234c3399a41e093292
BLAKE2b-256 d431830eadd32b232f08ce22cc0a892fcb87930f0c146768473458671eb7fdf7

See more details on using hashes here.

File details

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

File metadata

  • Download URL: arclet_entari-0.7.0-py3-none-any.whl
  • Upload date:
  • Size: 28.4 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? Yes
  • Uploaded via: pdm/2.19.1 CPython/3.10.12 Linux/6.8.0-1014-azure

File hashes

Hashes for arclet_entari-0.7.0-py3-none-any.whl
Algorithm Hash digest
SHA256 8ff25c644d504dda1f0c830eb88ac6afdd2af3a306ec9ee453e4d494b7a0f080
MD5 229266189714dd4dd37791d096359fa1
BLAKE2b-256 4fa804d7ecb0a3a445a21b2662b0da44ff0ff40e04f777bc1cf147e4f650874e

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