aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--bot/exts/info/patreon.py2
-rw-r--r--bot/exts/info/subscribe.py2
-rw-r--r--bot/exts/moderation/watchchannels/_watchchannel.py2
-rw-r--r--bot/exts/recruitment/talentpool/_cog.py2
-rw-r--r--bot/exts/recruitment/talentpool/_review.py2
-rw-r--r--bot/utils/channel.py15
6 files changed, 5 insertions, 20 deletions
diff --git a/bot/exts/info/patreon.py b/bot/exts/info/patreon.py
index e3c8c07d1..9065b0a11 100644
--- a/bot/exts/info/patreon.py
+++ b/bot/exts/info/patreon.py
@@ -3,13 +3,13 @@ import datetime
import arrow
import discord
from discord.ext import commands, tasks
+from pydis_core.utils.channel import get_or_fetch_channel
from bot import constants
from bot.bot import Bot
from bot.constants import Channels, Guild, Roles, STAFF_PARTNERS_COMMUNITY_ROLES
from bot.decorators import in_whitelist
from bot.log import get_logger
-from bot.utils.channel import get_or_fetch_channel
log = get_logger(__name__)
diff --git a/bot/exts/info/subscribe.py b/bot/exts/info/subscribe.py
index 4f57f7c0f..0b204e3b2 100644
--- a/bot/exts/info/subscribe.py
+++ b/bot/exts/info/subscribe.py
@@ -5,12 +5,12 @@ import discord
from discord.ext import commands
from discord.interactions import Interaction
from pydis_core.utils import members
+from pydis_core.utils.channel import get_or_fetch_channel
from bot import constants
from bot.bot import Bot
from bot.decorators import redirect_output
from bot.log import get_logger
-from bot.utils.channel import get_or_fetch_channel
@dataclass(frozen=True)
diff --git a/bot/exts/moderation/watchchannels/_watchchannel.py b/bot/exts/moderation/watchchannels/_watchchannel.py
index 57a64f9d0..eb6b6ebf3 100644
--- a/bot/exts/moderation/watchchannels/_watchchannel.py
+++ b/bot/exts/moderation/watchchannels/_watchchannel.py
@@ -11,6 +11,7 @@ from discord import Color, DMChannel, Embed, HTTPException, Message, errors
from discord.ext.commands import Cog, Context
from pydis_core.site_api import ResponseCodeError
from pydis_core.utils import scheduling
+from pydis_core.utils.channel import get_or_fetch_channel
from bot.bot import Bot
from bot.constants import BigBrother as BigBrotherConfig, Guild as GuildConfig, Icons
@@ -20,7 +21,6 @@ from bot.exts.moderation.modlog import ModLog
from bot.log import CustomLogger, get_logger
from bot.pagination import LinePaginator
from bot.utils import CogABCMeta, messages, time
-from bot.utils.channel import get_or_fetch_channel
from bot.utils.members import get_or_fetch_member
log = get_logger(__name__)
diff --git a/bot/exts/recruitment/talentpool/_cog.py b/bot/exts/recruitment/talentpool/_cog.py
index 547de4cc9..b26771022 100644
--- a/bot/exts/recruitment/talentpool/_cog.py
+++ b/bot/exts/recruitment/talentpool/_cog.py
@@ -9,6 +9,7 @@ from discord import Color, Embed, Member, PartialMessage, RawReactionActionEvent
from discord.ext import commands, tasks
from discord.ext.commands import BadArgument, Cog, Context, group, has_any_role
from pydis_core.site_api import ResponseCodeError
+from pydis_core.utils.channel import get_or_fetch_channel
from bot.bot import Bot
from bot.constants import Bot as BotConfig, Channels, Emojis, Guild, MODERATION_ROLES, Roles, STAFF_ROLES
@@ -18,7 +19,6 @@ from bot.exts.recruitment.talentpool._review import Reviewer
from bot.log import get_logger
from bot.pagination import LinePaginator
from bot.utils import time
-from bot.utils.channel import get_or_fetch_channel
from bot.utils.members import get_or_fetch_member
AUTOREVIEW_ENABLED_KEY = "autoreview_enabled"
diff --git a/bot/exts/recruitment/talentpool/_review.py b/bot/exts/recruitment/talentpool/_review.py
index 241656853..7c40f737a 100644
--- a/bot/exts/recruitment/talentpool/_review.py
+++ b/bot/exts/recruitment/talentpool/_review.py
@@ -11,13 +11,13 @@ import discord
from async_rediscache import RedisCache
from discord import Embed, Emoji, Member, Message, NotFound, PartialMessage, TextChannel
from pydis_core.site_api import ResponseCodeError
+from pydis_core.utils.channel import get_or_fetch_channel
from bot.bot import Bot
from bot.constants import Channels, Colours, Emojis, Guild, Roles
from bot.exts.recruitment.talentpool._api import Nomination, NominationAPI
from bot.log import get_logger
from bot.utils import time
-from bot.utils.channel import get_or_fetch_channel
from bot.utils.members import get_or_fetch_member
from bot.utils.messages import count_unique_users_reaction
diff --git a/bot/utils/channel.py b/bot/utils/channel.py
index 05afbe009..b819237c4 100644
--- a/bot/utils/channel.py
+++ b/bot/utils/channel.py
@@ -44,18 +44,3 @@ def is_staff_channel(channel: discord.TextChannel) -> bool:
def is_in_category(channel: discord.TextChannel, category_id: int) -> bool:
"""Return True if `channel` is within a category with `category_id`."""
return getattr(channel, "category_id", None) == category_id
-
-
-async def get_or_fetch_channel(
- channel_id: int
-) -> discord.abc.GuildChannel | discord.abc.PrivateChannel | discord.Thread:
- """Attempt to get or fetch a channel and return it."""
- log.trace(f"Getting the channel {channel_id}.")
-
- channel = bot.instance.get_channel(channel_id)
- if not channel:
- log.debug(f"Channel {channel_id} is not in cache; fetching from API.")
- channel = await bot.instance.fetch_channel(channel_id)
-
- log.trace(f"Channel #{channel} ({channel_id}) retrieved.")
- return channel