配置
修改 NoneBot 配置文件 .env 或者 .env.*。
Driver
如果使用 WebSocket 连接方式,请参考 driver 配置项,添加 HTTPClient 和 WebSocketClient 支持。如:
DRIVER=~httpx+~websockets
DRIVER=~aiohttp
如果使用 WebHook 连接方式,则添加 ASGIServer 支持。如:
DRIVER=~fastapi
QQ_IS_SANDBOX
是否为沙盒模式,默认为 False。
QQ_IS_SANDBOX=true
QQ_BOTS
配置机器人帐号 id secret,intent 需要根据机器人类型以及需要的事件进行配置。
Webhook / WebSocket
通过配置项 use_websocket 来选择是否启用 WebSocket 连接,当前默认为 True。如果关闭 WebSocket 连接方式,则可以通过 WebHook 方式来连接机器人,请在 QQ 开放平台中配置机器人回调地址:https://host:port/qq/webhook。
Intent
Intent 仅对 WebSocket 连接方式生效。以下为所有 Intent 配置项以及默认值:
{
// 频道事件
"guilds": true,
// 频道成员事件
"guild_members": true,
// 频道消息事件
"guild_messages": false,
// 频道消息表态事件
"guild_message_reactions": true,
// 频道私信事件
"direct_message": false,
// 频道公域论坛事件
"open_forum_event": false,
// 频道音频或直播成员事件
"audio_live_member": false,
// 群成员变更事件
"group_members": false,
// 私聊与群聊消息事件
"c2c_group_at_messages": false,
// 互动事件
"interaction": false,
// 频道消息审核事件
"message_audit": true,
// 频道私域论坛事件
"forum_event": false,
// 频道音频操作事件
"audio_action": false,
// 频道@机器人消息事件
"at_messages": true
}
示例
私域频道机器人示例
QQ_BOTS='
[
{
"id": "xxx",
"secret": "xxx",
"intent": {
"guild_messages": true,
"at_messages": false
},
"use_websocket": false
}
]
'
公域群机器人示例
QQ_BOTS='
[
{
"id": "xxx",
"secret": "xxx",
"intent": {
"c2c_group_at_messages": true,
"group_members": true
},
"use_websocket": false
}
]
'
Metadata
Release files for nonebot-adapter-qq 1.7.3
For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.
Source distribution (sdist)
| File | Size | Uploaded | |
|---|---|---|---|
| nonebot_adapter_qq-1.7.3.tar.gz | 35.9 kB | Details |
Built distribution (wheel)
| File | Interpreter | ABI | Platform | Reset |
|---|---|---|---|---|
| nonebot_adapter_qq-1.7.3-py3-none-any.whl | Python 3 | none | any | Details |
Total release size: 76.7 kB
Release files / nonebot_adapter_qq-1.7.3.tar.gz
| Download URL | nonebot_adapter_qq-1.7.3.tar.gz |
|---|---|
| Size | 35.9 kB |
| Tags | Source |
|
SHA-256 checksum How to use checksums |
54d6427894ca1443bdab8d3101e7efdbf4407a6385d032cbda883c396fb2025e
|
|
BLAKE2b-256 checksum How to use checksums |
44b6cfbf1098d0c564031ca71c7cad083153d433687dc1bf07e09e8f6c0682da
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
Yes |
| Uploaded via |
uv/0.12.19 {"installer":{"name":"uv","version":"0.12.19","subcommand":["publish"]},"python":null,"implementation":{"name":null,"version":null},"distro":{"name":"Ubuntu","version":"24.04","id":"noble","libc":null},"system":{"name":null,"release":null},"cpu":null,"openssl_version":null,"setuptools_version":null,"rustc_version":null,"ci":true}
|
Release files / nonebot_adapter_qq-1.7.3-py3-none-any.whl
| Download URL | nonebot_adapter_qq-1.7.3-py3-none-any.whl |
|---|---|
| Size | 40.7 kB |
| Tags | Python 3 |
|
SHA-256 checksum How to use checksums |
fe59b6b9dbde979f1eb8a4a33dc6f27634feb92ecb4ceb9dc3ea8d04c979ac77
|
|
BLAKE2b-256 checksum How to use checksums |
6a9bf81f100a625e15e9749ab35236f0e5f6a700d4480c0a01abc8d0a88d2251
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
Yes |
| Uploaded via |
uv/0.12.19 {"installer":{"name":"uv","version":"0.12.19","subcommand":["publish"]},"python":null,"implementation":{"name":null,"version":null},"distro":{"name":"Ubuntu","version":"24.04","id":"noble","libc":null},"system":{"name":null,"release":null},"cpu":null,"openssl_version":null,"setuptools_version":null,"rustc_version":null,"ci":true}
|