Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/ArcletProject/Entari
A simple IM framework based on Satori Protocol. 基于 Satori 跨平台协议的 IM 框架
https://github.com/ArcletProject/Entari
asyncio framework python satori satori-protocol
Last synced: 2 months ago
JSON representation
A simple IM framework based on Satori Protocol. 基于 Satori 跨平台协议的 IM 框架
- Host: GitHub
- URL: https://github.com/ArcletProject/Entari
- Owner: ArcletProject
- License: mit
- Created: 2021-12-29T09:29:38.000Z (about 3 years ago)
- Default Branch: main
- Last Pushed: 2024-11-04T06:26:10.000Z (3 months ago)
- Last Synced: 2024-11-04T07:18:42.792Z (3 months ago)
- Topics: asyncio, framework, python, satori, satori-protocol
- Language: Python
- Homepage: https://arclet.top
- Size: 505 KB
- Stars: 14
- Watchers: 1
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
README
# Entari> _lí no etheclim, nann ze entám rish._
[![Licence](https://img.shields.io/github/license/ArcletProject/Entari)](https://github.com/ArcletProject/Entari/blob/main/LICENSE)
[![PyPI](https://img.shields.io/pypi/v/arclet-entari)](https://pypi.org/project/arclet-entari)
[![PyPI - Python Version](https://img.shields.io/pypi/pyversions/arclet-entari)](https://www.python.org/)
![Entari](https://img.shields.io/badge/Arclet-Entari-2564c2.svg)一个基于 `Satori` 协议的简易 IM framework
## 示例
复读:
```python
from arclet.entari import Session, Entari, WSapp = 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}`:
```python
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()
```编写插件:
```python
from arclet.entari import Session, MessageCreatedEvent, metadatametadata(
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!")
```加载插件:
```python
from arclet.entari import Entari, WS, load_pluginload_plugin("example_plugin")
load_plugin("::echo")
load_plugin("::auto_reload", {"watch_dirs": ["plugins"]})app = Entari(WS(port=5140, path="satori"))
app.run()
```使用配置文件:
```yaml
# config.yml
basic:
network:
- type: ws
port: 5140
path: satori
plugins:
example_plugin: true
::echo: true
::auto_reload: true
plugin:
::auto_reload:
watch_dirs: ["plugins"]
``````python
from arclet.entari import Entariapp = Entari.load("config.yml")
app.run()
```