{"id":20390247,"url":"https://github.com/nonebot/adapter-satori","last_synced_at":"2025-04-04T14:04:33.022Z","repository":{"id":199024611,"uuid":"701789931","full_name":"nonebot/adapter-satori","owner":"nonebot","description":"NoneBot2 Satori 适配器 / Satori Protocol adapter for nonebot2","archived":false,"fork":false,"pushed_at":"2024-10-16T11:11:49.000Z","size":246,"stargazers_count":85,"open_issues_count":2,"forks_count":5,"subscribers_count":2,"default_branch":"main","last_synced_at":"2024-10-29T23:44:19.129Z","etag":null,"topics":[],"latest_commit_sha":null,"homepage":"","language":"Python","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"mit","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/nonebot.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":"LICENSE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null},"funding":{"open_collective":"nonebot","custom":["https://afdian.com/@nonebot"]}},"created_at":"2023-10-07T15:06:22.000Z","updated_at":"2024-10-16T11:11:53.000Z","dependencies_parsed_at":null,"dependency_job_id":"801e3054-4878-4446-8ea2-a409cc6f6728","html_url":"https://github.com/nonebot/adapter-satori","commit_stats":{"total_commits":80,"total_committers":7,"mean_commits":"11.428571428571429","dds":"0.23750000000000004","last_synced_commit":"fcd1ee06528033a1df65f625b93a61577dcfa2c5"},"previous_names":["nonebot/adapter-satori"],"tags_count":48,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/nonebot%2Fadapter-satori","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/nonebot%2Fadapter-satori/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/nonebot%2Fadapter-satori/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/nonebot%2Fadapter-satori/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/nonebot","download_url":"https://codeload.github.com/nonebot/adapter-satori/tar.gz/refs/heads/main","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":246458185,"owners_count":20780708,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":[],"created_at":"2024-11-15T03:23:51.322Z","updated_at":"2025-04-04T14:04:33.005Z","avatar_url":"https://github.com/nonebot.png","language":"Python","funding_links":["https://opencollective.com/nonebot","https://afdian.com/@nonebot"],"categories":[],"sub_categories":[],"readme":"\u003cdiv align=\"center\"\u003e\n\n# NoneBot-Adapter-Satori\n\n_✨ NoneBot2 Satori Protocol适配器 / Satori Protocol Adapter for NoneBot2 ✨_\n\n\u003c/div\u003e\n\n## 协议介绍\n\n[Satori Protocol](https://satori.js.org/zh-CN/)\n\n### 协议端\n\n目前提供了 `satori` 协议实现的有：\n- [Chronocat](https://chronocat.vercel.app)\n- [nekobox](https://github.com/wyapx/nekobox)\n- Koishi （搭配 `@koishijs/plugin-server`, 其余内容请自行阅读 koishi 文档）\n\n## 配置\n\n修改 NoneBot 配置文件 `.env` 或者 `.env.*`。\n\n### Driver\n\n参考 [driver](https://nonebot.dev/docs/appendices/config#driver) 配置项，添加 `HTTPClient` 和 `WebSocketClient` 支持。\n\n如：\n\n```dotenv\nDRIVER=~httpx+~websockets\n```\n\n或\n\n```dotenv\nDRIVER=~aiohttp\n```\n\n### SATORI_CLIENTS\n\n配置连接配置，如：\n\n```dotenv\nSATORI_CLIENTS='\n[\n  {\n    \"host\": \"localhost\",\n    \"port\": \"5500\",\n    \"path\": \"\",\n    \"token\": \"xxx\"\n  }\n]\n'\n```\n\n`host` 与 `port` 为 Satori 服务端的监听地址与端口，\n\n`path` 为 Satori 服务端自定义的监听路径，如 `\"/satori\"`，默认为 `\"\"`\n\n`token` 由 Satori 服务端决定是否需要 (例如，对接 Chronocat 就需要此项)。\n\n### 以对接 Chronocat 为例\n\n你需要从 Chronocat 的配置文件 `~/.chronocat/config/chronocat.yml` 中获取 `port`、`token`、`host`。\n\n在单账号下，\n- `host` 与配置文件下的 `servers[X].listen` 一致\n- `port` 与配置文件下的 `servers[X].port` 一致\n- `token` 与配置文件下的 `servers[X].token` 一致\n\n```yaml\n# ~/.chronocat/config/chronocat.yml\nservers:\n  - type: satori\n    # Chronocat 已经自动生成了随机 token。要妥善保存哦！\n    # 客户端使用服务时需要提供这个 token！\n    token: DEFINE_CHRONO_TOKEN  # token\n    # Chronocat 开启 satori 服务的端口，默认为 5500。\n    port: 5500  # port\n    # 服务器监听的地址。 如果你不知道这是什么，那么不填此项即可！\n    listen: localhost  # host\n```\n\n而多账号下，\n- `host` 与配置文件下下的 `overrides[QQ].servers[X].listen` 一致\n- `port` 与配置文件下下的 `overrides[QQ].servers[X].port` 一致，并且一个 `QQ` 只能对应一个 `port`\n- `token` 与配置文件下下的 `overrides[QQ].servers[X].token` 一致\n\n```yaml\n# ~/.chronocat/config/chronocat.yml\noverrides:\n  1234567890:\n    servers:\n      - type: satori\n        # Chronocat 已经自动生成了随机 token。要妥善保存哦！\n        # 客户端使用服务时需要提供这个 token！\n        token: DEFINE_CHRONO_TOKEN  # token\n        # Chronocat 开启 satori 服务的端口，默认为 5500。\n        port: 5501  # port\n        # 服务器监听的地址。 如果你不知道这是什么，那么不填此项即可！\n        listen: localhost\n```\n\n配置文件详细内容请参考 [Chronocat/config](https://chronocat.vercel.app/guide/config/)。\n\n### 以对接 nekobox 为例\n\n你可以通过 `nekobox show` 命令来获取当前的配置信息。\n\n```shell\n$ nekobox show xxxxxx\nSignUrl:        xxxxxxxxxxxxx\n协议类型:       linux\n验证 token:     *************\n服务器绑定地址: 127.0.0.1\n服务器绑定端口: 7788\n服务器部署路径: neko\n默认日志等级:   INFO\n```\n\n此时\n- `host` 与 `服务器绑定地址` 一致\n- `port` 与 `服务器绑定端口` 一致\n- `path` 与 `服务器部署路径` 一致\n- `token` 与 `验证 token` 一致\n\n## 示例\n\n```python\nfrom nonebot import on_command\nfrom nonebot.adapters.satori import Bot\nfrom nonebot.adapters.satori.event import MessageEvent\nfrom nonebot.adapters.satori.message import MessageSegment\n\n\nmatcher = on_command(\"test\")\n\n@matcher.handle()\nasync def handle_receive(bot: Bot, event: MessageEvent):\n    if event.is_private:\n        await bot.send(event, MessageSegment.text(\"Hello, world!\"))\n```\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fnonebot%2Fadapter-satori","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fnonebot%2Fadapter-satori","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fnonebot%2Fadapter-satori/lists"}