Skip to main content

satori-python

latest release Licence PyPI PyPI - Python Version

基于 Satori 协议的 Python 开发工具包

协议介绍

Satori Protocol

协议端

目前提供了 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
QQ 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()

文档

请阅读 仓库文档

示例

架构

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.2

For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.

Source distribution (sdist)

Source distribution for satori-python-adapter-milky 0.5.2
File Size Uploaded Provenance
satori_python_adapter_milky-0.5.2.tar.gz 18.5 kB Without provenance Details

Built distribution (wheel)

Table of built distributions (wheels) for satori-python-adapter-milky 0.5.2
File Interpreter ABI Platform
satori_python_adapter_milky-0.5.2-py3-none-any.whl Python 3 none any Details

Total release size: 41.5 kB

Release files / satori_python_adapter_milky-0.5.2.tar.gz

Download URL satori_python_adapter_milky-0.5.2.tar.gz
Size 18.5 kB
Tags Source
SHA-256 checksum
How to use checksums
65875517c7c141a0e2ee2c1bc5ee6a575cc04c7329b8ada8a5a5541d497293f1
BLAKE2b-256 checksum
How to use checksums
87612a34e7fd89250f6df479fa04717a496c3e933bf02c5531b538dfb4c22861
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.2-py3-none-any.whl

Download URL satori_python_adapter_milky-0.5.2-py3-none-any.whl
Size 23.0 kB
Tags Python 3
SHA-256 checksum
How to use checksums
45f267866329956d074e734b088cb294c97baea514643fd3f6b432c4bd24a3d9
BLAKE2b-256 checksum
How to use checksums
286fb8597b9a3b1d8b1caca129fdf24131402da2abd83b3f0d5fe4202034f9c9
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.2

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.

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page