qqbot-channel
Compare original and translation side by side
🇺🇸
Original
English🇨🇳
Translation
ChineseQQ 频道 API 请求指导
QQ Channel API Request Guide
qqbot_channel_apiqqbot_channel_api📚 详细参考文档
📚 Detailed Reference Documentation
每个接口的完整参数说明、返回值结构和枚举值定义:
references/api_references.md
Complete parameter descriptions, return value structures and enum value definitions for each interface:
references/api_references.md
🔧 工具参数
🔧 Tool Parameters
| 参数 | 类型 | 必填 | 说明 |
|---|---|---|---|
| string | 是 | HTTP 方法: |
| string | 是 | API 路径(不含域名),如 |
| object | 否 | 请求体 JSON(POST/PUT/PATCH 使用) |
| object | 否 | URL 查询参数键值对,值为字符串类型 |
基础 URL:,鉴权头https://api.sgroup.qq.com由工具自动填充。Authorization: QQBot {token}
| Parameter | Type | Required | Description |
|---|---|---|---|
| string | Yes | HTTP methods: |
| string | Yes | API path (excluding domain name), e.g. |
| object | No | Request body JSON (used for POST/PUT/PATCH) |
| object | No | URL query parameter key-value pairs, values are string type |
Base URL:, the authentication headerhttps://api.sgroup.qq.comis automatically filled by the tool.Authorization: QQBot {token}
⭐ 接口速查
⭐ Quick API Reference
频道(Guild)
Guild
| 操作 | 方法 | 路径 | 参数说明 |
|---|---|---|---|
| 获取频道列表 | | | query: |
| 获取频道 API 权限 | | | — |
| Operation | Method | Path | Parameter Description |
|---|---|---|---|
| Get guild list | | | query: |
| Get guild API permissions | | | — |
子频道(Channel)
Channel
| 操作 | 方法 | 路径 | 参数说明 |
|---|---|---|---|
| 获取子频道列表 | | | — |
| 获取子频道详情 | | | — |
| 创建子频道 | | | body: |
| 修改子频道 | | | body: |
| 删除子频道 | | | ⚠️ 不可逆 |
子频道类型(type):=文字, =语音, =分组(position≥2), =直播, =应用, =论坛
024100051000610007| Operation | Method | Path | Parameter Description |
|---|---|---|---|
| Get sub-channel list | | | — |
| Get sub-channel details | | | — |
| Create sub-channel | | | body: |
| Modify sub-channel | | | body: |
| Delete sub-channel | | | ⚠️ Irreversible |
Sub-channel type (type): =text, =voice, =category(position≥2), =live, =application, =forum
024100051000610007成员(Member)
Member
| 操作 | 方法 | 路径 | 参数说明 |
|---|---|---|---|
| 获取成员列表 | | | query: |
| 获取成员详情 | | | — |
| 获取身份组成员列表 | | | query: |
| 获取在线成员数 | | | — |
| Operation | Method | Path | Parameter Description |
|---|---|---|---|
| Get member list | | | query: |
| Get member details | | | — |
| Get role member list | | | query: |
| Get online member count | | | — |
公告(Announces)
Announces
| 操作 | 方法 | 路径 | 参数说明 |
|---|---|---|---|
| 创建公告 | | | body: |
| 删除公告 | | | message_id 设 |
| Operation | Method | Path | Parameter Description |
|---|---|---|---|
| Create announcement | | | body: |
| Delete announcement | | | set |
论坛(Forum)— 仅私域机器人
Forum — For private domain bots only
| 操作 | 方法 | 路径 | 参数说明 |
|---|---|---|---|
| 获取帖子列表 | | | — |
| 获取帖子详情 | | | — |
| 发表帖子 | | | body: |
| 删除帖子 | | | ⚠️ 不可逆 |
| 发表评论 | | | body: |
| Operation | Method | Path | Parameter Description |
|---|---|---|---|
| Get post list | | | — |
| Get post details | | | — |
| Publish post | | | body: |
| Delete post | | | ⚠️ Irreversible |
| Publish comment | | | body: |
日程(Schedule)
Schedule
| 操作 | 方法 | 路径 | 参数说明 |
|---|---|---|---|
| 创建日程 | | | body: |
| 修改日程 | | | body: |
| 删除日程 | | | ⚠️ 不可逆 |
提醒类型(remind_type):=不提醒, =开始时, =5分钟前, =15分钟前, =30分钟前, =60分钟前
"0""1""2""3""4""5"表示必填参数*
| Operation | Method | Path | Parameter Description |
|---|---|---|---|
| Create schedule | | | body: |
| Modify schedule | | | body: |
| Delete schedule | | | ⚠️ Irreversible |
Remind type (remind_type): =no reminder, =when starting, =5 minutes in advance, =15 minutes in advance, =30 minutes in advance, =60 minutes in advance
"0""1""2""3""4""5"indicates required parameters*
💡 调用示例
💡 Call Examples
获取频道列表
Get guild list
json
{
"method": "GET",
"path": "/users/@me/guilds",
"query": { "limit": "100" }
}json
{
"method": "GET",
"path": "/users/@me/guilds",
"query": { "limit": "100" }
}获取子频道列表
Get sub-channel list
json
{
"method": "GET",
"path": "/guilds/123456/channels"
}json
{
"method": "GET",
"path": "/guilds/123456/channels"
}创建子频道
Create sub-channel
json
{
"method": "POST",
"path": "/guilds/123456/channels",
"body": {
"name": "新频道",
"type": 0,
"position": 1,
"sub_type": 0
}
}json
{
"method": "POST",
"path": "/guilds/123456/channels",
"body": {
"name": "新频道",
"type": 0,
"position": 1,
"sub_type": 0
}
}获取成员列表(分页)
Get member list (pagination)
json
{
"method": "GET",
"path": "/guilds/123456/members",
"query": { "after": "0", "limit": "100" }
}json
{
"method": "GET",
"path": "/guilds/123456/members",
"query": { "after": "0", "limit": "100" }
}发表论坛帖子
Publish forum post
json
{
"method": "PUT",
"path": "/channels/789012/threads",
"body": {
"title": "公告标题",
"content": "# 标题\n\n公告内容",
"format": 3
}
}json
{
"method": "PUT",
"path": "/channels/789012/threads",
"body": {
"title": "公告标题",
"content": "# 标题\n\n公告内容",
"format": 3
}
}创建日程
Create schedule
json
{
"method": "POST",
"path": "/channels/456789/schedules",
"body": {
"schedule": {
"name": "周会",
"start_timestamp": "1770733800000",
"end_timestamp": "1770737400000",
"remind_type": "2"
}
}
}json
{
"method": "POST",
"path": "/channels/456789/schedules",
"body": {
"schedule": {
"name": "周会",
"start_timestamp": "1770733800000",
"end_timestamp": "1770737400000",
"remind_type": "2"
}
}
}创建推荐子频道公告
Create recommended sub-channel announcement
json
{
"method": "POST",
"path": "/guilds/123456/announces",
"body": {
"announces_type": 0,
"recommend_channels": [
{ "channel_id": "789012", "introduce": "欢迎来到攻略频道" }
]
}
}json
{
"method": "POST",
"path": "/guilds/123456/announces",
"body": {
"announces_type": 0,
"recommend_channels": [
{ "channel_id": "789012", "introduce": "欢迎来到攻略频道" }
]
}
}删除所有公告
Delete all announcements
json
{
"method": "DELETE",
"path": "/guilds/123456/announces/all"
}json
{
"method": "DELETE",
"path": "/guilds/123456/announces/all"
}🔄 常用操作流程
🔄 Common Operation Processes
获取频道和子频道信息
Get guild and sub-channel information
1. GET /users/@me/guilds → 获取频道列表,拿到 guild_id
2. GET /guilds/{guild_id}/channels → 获取子频道列表,拿到 channel_id
3. GET /channels/{channel_id} → 获取子频道详情1. GET /users/@me/guilds → Get guild list, get guild_id
2. GET /guilds/{guild_id}/channels → Get sub-channel list, get channel_id
3. GET /channels/{channel_id} → Get sub-channel details论坛发帖 + 评论
Forum posting + commenting
1. GET /guilds/{guild_id}/channels → 找到论坛子频道(type=10007)
2. PUT /channels/{channel_id}/threads → 发表帖子
3. GET /channels/{channel_id}/threads → 获取帖子列表
4. GET /channels/{channel_id}/threads/{thread_id} → 获取帖子详情(含 author_id)
5. POST /channels/{channel_id}/threads/{thread_id}/comment → 发表评论1. GET /guilds/{guild_id}/channels → Find forum sub-channel (type=10007)
2. PUT /channels/{channel_id}/threads → Publish post
3. GET /channels/{channel_id}/threads → Get post list
4. GET /channels/{channel_id}/threads/{thread_id} → Get post details (including author_id)
5. POST /channels/{channel_id}/threads/{thread_id}/comment → Publish comment成员管理
Member management
1. GET /users/@me/guilds → 获取 guild_id
2. GET /guilds/{guild_id}/members?after=0&limit=100 → 获取成员列表
翻页:用上次最后一个 user.id 作为 after,直到返回空数组
3. GET /guilds/{guild_id}/members/{user_id} → 获取指定成员详情1. GET /users/@me/guilds → Get guild_id
2. GET /guilds/{guild_id}/members?after=0&limit=100 → Get member list
Pagination: Use the last user.id of the previous request as after, until an empty array is returned
3. GET /guilds/{guild_id}/members/{user_id} → Get specified member details展示成员头像
Display member avatar
成员详情返回的 是头像 URL,必须使用 Markdown 图片语法展示,让用户直接看到头像图片,而非纯文本链接:
user.avatar成员信息:
· 昵称:{nick}
· 头像:
禁止将头像 URL 作为纯文本或超链接展示(如),必须用查看头像语法内联显示。频道的字段同理。icon
The returned in member details is the avatar URL, must be displayed using Markdown image syntax, so that users can see the avatar image directly instead of plain text links:
user.avatar成员信息:
· 昵称:{nick}
· 头像:
It is forbidden to display the avatar URL as plain text or hyperlink (e.g.), you must use the查看头像syntax to display it inline. The same applies to thefield of guilds.icon
🚨 错误码处理
🚨 Error Code Handling
| 错误码 | 说明 | 解决方案 |
|---|---|---|
| 401 | Token 鉴权失败 | 检查 AppID 和 ClientSecret 配置 |
| 11241 | 频道 API 无权限 | 前往 QQ 开放平台申请权限,或调用 |
| 11242 | 仅私域机器人可用 | 需在 QQ 开放平台将机器人切换为私域模式 |
| 11243 | 需要管理频道权限 | 确保机器人拥有管理权限 |
| 11281 | 日程频率限制 | 单管理员/天限 10 次,单频道/天限 100 次 |
| 304023 | 推荐子频道超限 | 推荐子频道最多 3 条 |
| Error Code | Description | Solution |
|---|---|---|
| 401 | Token authentication failed | Check AppID and ClientSecret configuration |
| 11241 | No guild API permission | Go to QQ Open Platform to apply for permissions, or call |
| 11242 | Only available for private domain bots | You need to switch the bot to private domain mode in QQ Open Platform |
| 11243 | Guild management permission required | Ensure the bot has management permissions |
| 11281 | Schedule frequency limit | 10 times per administrator/day, 100 times per channel/day |
| 304023 | Recommended sub-channels exceed limit | Maximum 3 recommended sub-channels |
⚠️ 注意事项
⚠️ Notes
- 路径中的占位符(如 、
{guild_id})必须替换为实际值{channel_id} - query 参数的值必须为字符串类型,如 而非
{ "limit": "100" }{ "limit": 100 } - 成员列表翻页时可能返回重复成员,需按 去重
user.id - 公告的两种类型(消息公告和推荐子频道公告)会互相顶替
- 日程的时间戳为毫秒级字符串
- 删除操作不可逆,请谨慎使用
- 论坛操作仅私域机器人可用
- 子频道分组(type=4)的 必须 >= 2
position - 日程操作有频率限制:单个管理员每天 10 次,单个频道每天 100 次
- 头像/图标展示:成员 和频道
user.avatar等图片 URL 必须使用 Markdown 图片语法icon展示,禁止作为纯文本或超链接展示
- Placeholders in the path (e.g. ,
{guild_id}) must be replaced with actual values{channel_id} - The values of query parameters must be string type, e.g. instead of
{ "limit": "100" }{ "limit": 100 } - Duplicate members may be returned when paging the member list, you need to deduplicate by
user.id - The two types of announcements (message announcements and recommended sub-channel announcements) will replace each other
- The timestamp of schedule is a millisecond-level string
- Delete operations are irreversible, please use with caution
- Forum operations are only available for private domain bots
- The of sub-channel category (type=4) must be >= 2
position - Schedule operations have frequency limits: 10 times per administrator per day, 100 times per channel per day
- Avatar/icon display: Image URLs such as member and guild
user.avatarmust be displayed using Markdown image syntaxicon, it is forbidden to display them as plain text or hyperlinks