discord.py获取特定类别下的所有文本通道-在python中

discord.py获取特定类别下的所有文本通道-在python中,discord.py,Discord.py,我看到了@Patrick Haugh的以下片段: from discord import CategoryChannel @bot.command() async def comm(ctx, *, category: CategoryChannel): channels = category.channels print(channels) 但是,我希望能够获得一个类别中的所有频道,而不必向bot发送消息,例如,沿着这些路线: def get_channels(categor

我看到了@Patrick Haugh的以下片段:

from discord import CategoryChannel

@bot.command()
async def comm(ctx, *, category: CategoryChannel):
    channels = category.channels
    print(channels)
但是,我希望能够获得一个类别中的所有频道,而不必向bot发送消息,例如,沿着这些路线:

def get_channels(category):
   channels = all_channels_in_category
   return channels

我想直接在python代码中获取通道

有没有办法做到这一点


事先谢谢

这与您的命令基本相同

def get_频道(类别):
频道=类别。频道
返回通道