summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorGravatar Amrou Bellalouna <[email protected]>2023-07-10 21:12:11 +0100
committerGravatar GitHub <[email protected]>2023-07-10 21:12:11 +0100
commit4c1060a334301265dd8b620c91a815a5ed72bb34 (patch)
treea8aeaa8d3686850d3ab01a527bec3abbdbee2d69
parentUpdate expiry label from 1 month to 30 days (#185) (diff)
Update get_or_fetch_channel's return type (#187)
* update get_or_fetch_channel's return type * unindent overly indented signature * update changelog
-rw-r--r--docs/changelog.rst3
-rw-r--r--pydis_core/utils/channel.py5
2 files changed, 7 insertions, 1 deletions
diff --git a/docs/changelog.rst b/docs/changelog.rst
index e78f5715..a6b1d193 100644
--- a/docs/changelog.rst
+++ b/docs/changelog.rst
@@ -3,6 +3,9 @@
Changelog
=========
+
+- :bug:`187` Fix :obj:`pydis_core.utils.channel.get_or_fetch_channel`'s return type to include :obj:`discord.abc.PrivateChannel` and :obj:`discord.Thread`.
+
- :release:`9.9.2 <2nd July 2023>`
- :bug:`185` Update expiry label from 1 month to 30 days in paste service.
diff --git a/pydis_core/utils/channel.py b/pydis_core/utils/channel.py
index 854c64fd..7a29de9e 100644
--- a/pydis_core/utils/channel.py
+++ b/pydis_core/utils/channel.py
@@ -22,7 +22,10 @@ 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,
+) -> discord.abc.GuildChannel | discord.abc.PrivateChannel | discord.Thread:
"""
Attempt to get or fetch the given ``channel_id`` from the bots cache, and return it.