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-console 0.6.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-console 0.6.0
File Size Uploaded Provenance
satori_python_adapter_console-0.6.0.tar.gz 9.0 kB Without provenance Details

Built distribution (wheel)

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

Total release size: 18.7 kB

Release files / satori_python_adapter_console-0.6.0.tar.gz

Download URL satori_python_adapter_console-0.6.0.tar.gz
Size 9.0 kB
Tags Source
SHA-256 checksum
How to use checksums
411865a37a492e21e0c5e117f2759c0781b0b44a69b066fddc929c15393fa3ca
BLAKE2b-256 checksum
How to use checksums
96acdc8656b3c55ab46842f7e289f57db9d6e1ea0b9d2bb8d8bb5f49d8800e6e
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_console-0.6.0-py3-none-any.whl

Download URL satori_python_adapter_console-0.6.0-py3-none-any.whl
Size 9.6 kB
Tags Python 3
SHA-256 checksum
How to use checksums
042365b28ac2adbf2edbcf848f8d8833c5687baf83d6472c0a7e9eba6726e7c5
BLAKE2b-256 checksum
How to use checksums
5414e5e6c1f3b46e206a37a2b4dc0ef033d8a9fc152fbcb15d676d14117a1cfd
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-console 0.6.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