diff options
author | 2022-02-25 01:28:50 +0000 | |
---|---|---|
committer | 2022-02-25 01:28:50 +0000 | |
commit | 5593a0c95e2b4fd9515c8875ea6e51c0ab88eb00 (patch) | |
tree | db5293c101a8fd204cb2afd185c9856420c1ae87 /botcore/utils/channel.py | |
parent | Merge pull request #29 from python-discord/port-utilities (diff) | |
parent | Custom css to de-bold index page (diff) |
Merge pull request #32 from python-discord/disnake-migrationv2.0.0
Disnake migration
Diffstat (limited to 'botcore/utils/channel.py')
-rw-r--r-- | botcore/utils/channel.py | 20 |
1 files changed, 10 insertions, 10 deletions
diff --git a/botcore/utils/channel.py b/botcore/utils/channel.py index 17e70a2a..d586098f 100644 --- a/botcore/utils/channel.py +++ b/botcore/utils/channel.py @@ -1,14 +1,14 @@ -"""Useful helper functions for interacting with various discord.py channel objects.""" +"""Useful helper functions for interacting with various disnake channel objects.""" -import discord -from discord.ext.commands import Bot +import disnake +from disnake.ext.commands import Bot from botcore.utils import logging log = logging.get_logger(__name__) -def is_in_category(channel: discord.TextChannel, category_id: int) -> bool: +def is_in_category(channel: disnake.TextChannel, category_id: int) -> bool: """ Return whether the given ``channel`` in the the category with the id ``category_id``. @@ -22,22 +22,22 @@ def is_in_category(channel: discord.TextChannel, category_id: int) -> bool: return getattr(channel, "category_id", None) == category_id -async def get_or_fetch_channel(bot: Bot, channel_id: int) -> discord.abc.GuildChannel: +async def get_or_fetch_channel(bot: Bot, channel_id: int) -> disnake.abc.GuildChannel: """ Attempt to get or fetch the given ``channel_id`` from the bots cache, and return it. Args: - bot: The :obj:`discord.ext.commands.Bot` instance to use for getting/fetching. + bot: The :obj:`disnake.ext.commands.Bot` instance to use for getting/fetching. channel_id: The channel to get/fetch. Raises: - :exc:`discord.InvalidData` + :exc:`disnake.InvalidData` An unknown channel type was received from Discord. - :exc:`discord.HTTPException` + :exc:`disnake.HTTPException` Retrieving the channel failed. - :exc:`discord.NotFound` + :exc:`disnake.NotFound` Invalid Channel ID. - :exc:`discord.Forbidden` + :exc:`disnake.Forbidden` You do not have permission to fetch this channel. Returns: |