0

I basically want the bot to get the channel ID of all text channels in all servers. I've looked for multiple hours but I can't seem to find anything. I'm guessing it would look something like this:

for server in bot.guilds:
    for channel in server.channels(Channeltype=text)
        print(channel.id)
MoonGoose
  • 11
  • 3
  • Does this answer your question? [How to get all text channels using discord.py?](https://stackoverflow.com/questions/49446882/how-to-get-all-text-channels-using-discord-py) – TheFungusAmongUs Aug 05 '22 at 22:46

1 Answers1

1

discord.Guild has an attribute called text_channels.

for guild in bot.guilds:
    for text_ch in guild.text_channels:
        print(text_ch.id)
puncher
  • 1,570
  • 4
  • 15
  • 38