https://github.com/nonebot/adapter-qq
NoneBot2 QQ 适配器 / QQ adapter for nonebot2
https://github.com/nonebot/adapter-qq
qq qq-bot qq-guild
Last synced: 6 months ago
JSON representation
NoneBot2 QQ 适配器 / QQ adapter for nonebot2
- Host: GitHub
- URL: https://github.com/nonebot/adapter-qq
- Owner: nonebot
- License: mit
- Created: 2021-12-23T09:22:44.000Z (almost 4 years ago)
- Default Branch: master
- Last Pushed: 2024-04-14T03:42:02.000Z (over 1 year ago)
- Last Synced: 2024-04-14T06:49:43.950Z (over 1 year ago)
- Topics: qq, qq-bot, qq-guild
- Language: Python
- Homepage:
- Size: 897 KB
- Stars: 183
- Watchers: 7
- Forks: 15
- Open Issues: 2
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
README
# NoneBot-Adapter-QQ
_✨ QQ 协议适配 ✨_
## 配置
修改 NoneBot 配置文件 `.env` 或者 `.env.*`。
### Driver
如果使用 WebSocket 连接方式,请参考 [driver](https://nonebot.dev/docs/appendices/config#driver) 配置项,添加 `HTTPClient` 和 `WebSocketClient` 支持。如:
```dotenv
DRIVER=~httpx+~websockets
DRIVER=~aiohttp
```如果使用 WebHook 连接方式,则添加 `ASGIServer` 支持。如:
```dotenv
DRIVER=~fastapi
```### QQ_IS_SANDBOX
是否为沙盒模式,默认为 `False`。
```dotenv
QQ_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
}
```#### 示例
私域频道机器人示例
```dotenv
QQ_BOTS='
[
{
"id": "xxx",
"token": "xxx",
"secret": "xxx",
"intent": {
"guild_messages": true,
"at_messages": false
},
"use_websocket": false
}
]
'
```公域群机器人示例
```dotenv
QQ_BOTS='
[
{
"id": "xxx",
"token": "xxx",
"secret": "xxx",
"intent": {
"c2c_group_at_messages": true
},
"use_websocket": false
}
]
'
```