channel#
Useful helper functions for interacting with various discord channel objects.
- async get_or_fetch_channel(bot, channel_id)[source]#
- Attempt to get or fetch the given - channel_idfrom the bots cache, and return it.- Parameters
- bot ( - Bot) – The- discord.ext.commands.Botinstance to use for getting/fetching.
- channel_id ( - int) – The channel to get/fetch.
 
- Raises
- discord.InvalidData – An unknown channel type was received from Discord. 
- discord.HTTPException – Retrieving the channel failed. 
- discord.NotFound – Invalid Channel ID. 
- discord.Forbidden – You do not have permission to fetch this channel. 
 
- Return type
- Returns
- The channel from the ID. 
 
- is_in_category(channel, category_id)[source]#
- Return whether the given - channelin the the category with the id- category_id.- Parameters
- channel ( - TextChannel) – The channel to check.
- category_id ( - int) – The category to check for.
 
- Return type
- Returns
- A bool depending on whether the channel is in the category.