channel#
Useful helper functions for interacting with various disnake 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) – Thedisnake.ext.commands.Botinstance to use for getting/fetching.channel_id (
int) – The channel to get/fetch.
- Raises
disnake.InvalidData – An unknown channel type was received from Discord.
disnake.HTTPException – Retrieving the channel failed.
disnake.NotFound – Invalid Channel ID.
disnake.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 idcategory_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.