satori-python
基于 Satori 协议的 Python 开发工具包
协议介绍
协议端
目前提供了 satori 协议实现的有:
使用该 SDK 的框架
安装
安装完整体:
pip install satori-python
只安装基础部分:
pip install satori-python-core
只安装客户端部分:
pip install satori-python-client
只安装服务端部分:
pip install satori-python-server
官方适配器
| 适配器 | 安装 | 路径 |
|---|---|---|
| Satori | pip install satori-python-adapter-satori |
satori.adapters.satori |
| OneBot V11 | pip install satori-python-adapter-onebot11 |
satori.adapters.onebot11.forward, satori.adapters.onebot11.reverse |
| Console | pip install satori-python-adapter-console |
satori.adapters.console |
| Milky | pip install satori-python-adapter-milky |
satori.adapters.milky.main, satori.adapters.milky.webhook, satori.adapters.milky.sse |
pip install satori-python-adapter-qq |
satori.adapters.qq.main, satori.adapters.qq.websocket | |
| WxClaw | pip install satori-python-adapter-wxclaw |
satori.adapters.wxclaw |
社区适配器
| 适配器 | 安装 | 路径 |
|---|---|---|
| nekobox(Lagrange) | pip install nekobox |
nekobox.main |
使用
客户端:
from satori import EventType
from satori.event import MessageEvent
from satori.client import Account, App, WebsocketsInfo
app = App(WebsocketsInfo(port=5140))
@app.register_on(EventType.MESSAGE_CREATED)
async def on_message(account: Account, event: MessageEvent):
if event.user.id == "xxxxxxxxxxx":
await account.send(event, "Hello, World!")
app.run()
服务端:
from satori import Api
from satori.server import Server
server = Server(port=5140)
@server.route(Api.MESSAGE_CREATE)
async def on_message_create(*args, **kwargs):
return [{"id": "1234", "content": "example"}]
server.run()
文档
请阅读 仓库文档
示例
- 客户端:client.py
- 服务端:server.py
- 服务端(使用适配器):server_with_adapter.py
- 客户端(webhook):client_webhook
- 服务端(webhook):server_webhook
- 适配器:adapter.py
架构
graph LR
subgraph Server
server -- run --> asgi
server -- register --> router -- mount --> asgi
server -- apply --> provider -- mount --> asgi
provider -- event,logins --> server
end
subgraph Client
config -- apply --> app -- run --> network
app -- register --> listener
network -- account,event --> listener
listener -- handle --> account -- session --> api
end
api -- request --> asgi -- response --> api
server -- raw-event --> asgi -- websocket/webhook --> network
Metadata
Release files for satori-python-adapter-milky 0.5.3
For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.
Source distribution (sdist)
| File | Size | Uploaded | Provenance | |
|---|---|---|---|---|
| satori_python_adapter_milky-0.5.3.tar.gz | 18.5 kB | Without provenance | Details |
Built distribution (wheel)
| File | Interpreter | ABI | Platform | Reset |
|---|---|---|---|---|
| satori_python_adapter_milky-0.5.3-py3-none-any.whl | Python 3 | none | any | Details |
Total release size: 41.5 kB
Release files / satori_python_adapter_milky-0.5.3.tar.gz
| Download URL | satori_python_adapter_milky-0.5.3.tar.gz |
|---|---|
| Size | 18.5 kB |
| Tags | Source |
|
SHA-256 checksum How to use checksums |
50c75ced4876c5869949e4df7818a3749f43f63f393c05c45433bb868032e25f
|
|
BLAKE2b-256 checksum How to use checksums |
dcd102e056946919cb88d63cb45104d276c4edd04a69110d8bcc75dff1deff5a
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
Yes |
| Uploaded via |
pdm/2.13.2 CPython/3.11.17 Linux/7.0.0-1017-azure
|
Release files / satori_python_adapter_milky-0.5.3-py3-none-any.whl
| Download URL | satori_python_adapter_milky-0.5.3-py3-none-any.whl |
|---|---|
| Size | 23.0 kB |
| Tags | Python 3 |
|
SHA-256 checksum How to use checksums |
890b042d6f6274e2f2830be1b5a5aaa1a9841ee8d00c0548b900c8ae141c86b4
|
|
BLAKE2b-256 checksum How to use checksums |
120761d152819b5acbf54621385ef0b6c0cbcf468c759992d59da25bce8ff705
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
Yes |
| Uploaded via |
pdm/2.13.2 CPython/3.11.17 Linux/7.0.0-1017-azure
|
Security for satori-python-adapter-milky 0.5.3
Provenance
Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.
No provenance found
None of the files in this release were uploaded with provenance metadata.
A note on package security
PyPI is a repository for distributing packages, not a service for auditing them. While third-party security researchers and our staff do their best to detect and remove malicious packages, PyPI cannot guarantee the quality, security or suitability of any given package.
To learn more about protecting yourself from malicious actors, visit our package security documentation.