aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorGravatar Chris Lovering <[email protected]>2022-11-01 18:53:40 +0000
committerGravatar Chris Lovering <[email protected]>2022-11-25 22:43:45 +0000
commita2b3c06b467a80f610488f95aca55e0abf1ca7e8 (patch)
treea615e38d40e726ab29f503602e5cef03861e101a
parentUpdate help channel system to use forum channels (diff)
Use help channel util from help channels cog
This removes the need for the old helper entirely
-rw-r--r--bot/exts/info/codeblock/_cog.py4
-rw-r--r--bot/utils/channel.py9
2 files changed, 2 insertions, 11 deletions
diff --git a/bot/exts/info/codeblock/_cog.py b/bot/exts/info/codeblock/_cog.py
index 9027105d9..0605a26e7 100644
--- a/bot/exts/info/codeblock/_cog.py
+++ b/bot/exts/info/codeblock/_cog.py
@@ -10,10 +10,10 @@ from bot import constants
from bot.bot import Bot
from bot.exts.filters.token_remover import TokenRemover
from bot.exts.filters.webhook_remover import WEBHOOK_URL_RE
+from bot.exts.help_channels._channel import is_help_forum_post
from bot.exts.info.codeblock._instructions import get_instructions
from bot.log import get_logger
from bot.utils import has_lines
-from bot.utils.channel import is_help_channel
from bot.utils.messages import wait_for_deletion
log = get_logger(__name__)
@@ -98,7 +98,7 @@ class CodeBlockCog(Cog, name="Code Block"):
"""Return True if `channel` is a help channel, may be on a cooldown, or is whitelisted."""
log.trace(f"Checking if #{channel} qualifies for code block detection.")
return (
- is_help_channel(channel)
+ is_help_forum_post(channel)
or channel.id in self.channel_cooldowns
or channel.id in constants.CodeBlock.channel_whitelist
)
diff --git a/bot/utils/channel.py b/bot/utils/channel.py
index 954a10e56..821a3732a 100644
--- a/bot/utils/channel.py
+++ b/bot/utils/channel.py
@@ -4,20 +4,11 @@ import discord
import bot
from bot import constants
-from bot.constants import Categories
from bot.log import get_logger
log = get_logger(__name__)
-def is_help_channel(channel: discord.TextChannel) -> bool:
- """Return True if `channel` is in one of the help categories (excluding dormant)."""
- log.trace(f"Checking if #{channel} is a help channel.")
- categories = (Categories.help_available, Categories.help_in_use)
-
- return any(is_in_category(channel, category) for category in categories)
-
-
def is_mod_channel(channel: Union[discord.TextChannel, discord.Thread]) -> bool:
"""True if channel, or channel.parent for threads, is considered a mod channel."""
if isinstance(channel, discord.Thread):