Adapter qq
NoneBot2 QQ 适配器 / QQ adapter for nonebot2
如果使用 WebSocket 连接方式,请参考 [driver](https://nonebot.dev/docs/appendices/config#driver) 配置项,添加 `HTTPClient` 和 `WebSocketClient` 支持。如: The project is written primarily in Python, distributed under the MIT License license, first published in 2021. Key topics include: qq, qq-bot, qq-guild.
NoneBot-Adapter-QQ
✨ QQ 协议适配 ✨
</div>配置
修改 NoneBot 配置文件 .env 或者 .env.*。
Driver
如果使用 WebSocket 连接方式,请参考 driver 配置项,添加 HTTPClient 和 WebSocketClient 支持。如:
dotenvDRIVER=~httpx+~websockets DRIVER=~aiohttp
如果使用 WebHook 连接方式,则添加 ASGIServer 支持。如:
dotenvDRIVER=~fastapi
QQ_IS_SANDBOX
是否为沙盒模式,默认为 False。
dotenvQQ_IS_SANDBOX=true
QQ_BOTS
配置机器人帐号 id token secret,intent 需要根据机器人类型以及需要的事件进行配置。
Webhook / WebSocket
通过配置项 use_websocket 来选择是否启用 WebSocket 连接,当前默认为 True。如果关闭 WebSocket 连接方式,则可以通过 WebHook 方式来连接机器人,请在 QQ 开放平台中配置机器人回调地址:https://host:port/qq/webhook。
Intent
Intent 仅对 WebSocket 连接方式生效。以下为所有 Intent 配置项以及默认值:
json{ "guilds": true, "guild_members": true, "guild_messages": false, "guild_message_reactions": true, "direct_message": false, "open_forum_event": false, "audio_live_member": false, "c2c_group_at_messages": false, "interaction": false, "message_audit": true, "forum_event": false, "audio_action": false, "at_messages": true }
示例
私域频道机器人示例
dotenvQQ_BOTS=' [ { "id": "xxx", "token": "xxx", "secret": "xxx", "intent": { "guild_messages": true, "at_messages": false }, "use_websocket": false } ] '
公域群机器人示例
dotenvQQ_BOTS=' [ { "id": "xxx", "token": "xxx", "secret": "xxx", "intent": { "c2c_group_at_messages": true }, "use_websocket": false } ] '
Contributors
Showing top 12 contributors by commit count.
