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

社区适配器

适配器 安装 路径
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-satori 0.5.0

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-satori 0.5.0
File Size Uploaded Provenance
satori_python_adapter_satori-0.5.0.tar.gz 5.1 kB Without provenance Details

Built distribution (wheel)

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

Total release size: 10.9 kB

Release files / satori_python_adapter_satori-0.5.0.tar.gz

Download URL satori_python_adapter_satori-0.5.0.tar.gz
Size 5.1 kB
Tags Source
SHA-256 checksum
How to use checksums
e1c6d518da415292a5eb73081e871cb77a99e5f4134cc6026d4774792e9863e2
BLAKE2b-256 checksum
How to use checksums
2582e006dab39e1b28582da489ff6f325ada0c132e1ce0c6eee0d81ee957b972
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
Yes
Uploaded via pdm/2.13.2 CPython/3.11.15 Linux/6.17.0-1018-azure

Release files / satori_python_adapter_satori-0.5.0-py3-none-any.whl

Download URL satori_python_adapter_satori-0.5.0-py3-none-any.whl
Size 5.9 kB
Tags Python 3
SHA-256 checksum
How to use checksums
219ba514a487e34d1a176f22b1b71734f7067afb5af287162ab6269a59bbc8cd
BLAKE2b-256 checksum
How to use checksums
be38beb41bfbeb343c1f9720d229df4e44e462a3bd29b628f196230da2144b97
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
Yes
Uploaded via pdm/2.13.2 CPython/3.11.15 Linux/6.17.0-1018-azure

Security for satori-python-adapter-satori 0.5.0

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.

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