Skip to content Skip to sidebar Skip to footer

Discord.py Getting All Text Channels Under A Certain Category

I'm trying to get all text channels under a category as a list but I can only do for guild in client.guilds: print(guild.text_channels) I want to specify it with a certain ca

Solution 1:

Use CategoryChannel.channels. Below, I use a converter to get the CategoryChannel from the command, but you could also use guild.categories

from discord import CategoryChannel

@bot.command()
async def comm(ctx, *, category: CategoryChannel):
    channels = category.channels
    print(channels)

Post a Comment for "Discord.py Getting All Text Channels Under A Certain Category"