获取子频道列表

get_channels 获取子频道列表

使用示例

import botpy
from botpy.message import Message

class MyClient(botpy.Client):
    async def on_at_message_create(self, message: Message):
        await self.api.get_channels(guild_id="xxxx")

intents = botpy.Intents(public_guild_messages=True)
client = MyClient(intents=intents)
client.run(appid={appid}, token={token})

参数说明

字段名必填类型描述
guild_idstring频道 ID

返回说明

返回 Channel 数组。

Channel

字段名类型描述
idstring子频道 ID
guild_idstring频道 ID
namestring子频道名
typenumber子频道类型 ChannelType
sub_typenumber子频道子类型 ChannelSubType
positionnumber排序,必填,而且不能够和其他子频道的值重复
parent_idstring分组 ID
owner_idstring创建人 ID

ChannelType

描述
0文字子频道
1保留,不可用
2语音子频道
3保留,不可用
4子频道分组
10005直播子频道
10006应用子频道
10007论坛子频道

注:由于 QQ 频道还在持续的迭代中,经常会有新的子频道类型增加,文档更新不一定及时,开发者识别 ChannelType 时,请注意相关的未知 ID 的处理。

ChannelSubType

描述
0闲聊
1公告
2攻略
3开黑

返回示例

data

[
    {
        "id":"channel_id",
        "guild_id":"guild_id",
        "name":"子频道名",
        "type":4,
        "position":2,
        "parent_id":"0",
        "owner_id":"0",
        "sub_type":0
    },
    {
        "id":"channel_id",
        "guild_id":"guild_id",
        "name":"子频道名",
        "type":4,
        "position":3,
        "parent_id":"0",
        "owner_id":"0",
        "sub_type":0
    }
]