aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorGravatar ChrisJL <[email protected]>2021-10-31 20:17:23 +0000
committerGravatar GitHub <[email protected]>2021-10-31 20:17:23 +0000
commit379a16ccc9a015dc74d8a14bf207915cb849df29 (patch)
tree1e19cb32185f083f664e19d80a7ad283c9e7b972
parentMerge pull request #1923 from Lainika/GH-1873_Fix_embeds (diff)
parentconsider parent channels when checking mod channels (diff)
Merge pull request #1910 from python-discord/consider-parent-channels-when-checking-mod-channels
Consider parent channels when checking mod channels
-rw-r--r--bot/utils/channel.py9
1 files changed, 7 insertions, 2 deletions
diff --git a/bot/utils/channel.py b/bot/utils/channel.py
index b9e234857..954a10e56 100644
--- a/bot/utils/channel.py
+++ b/bot/utils/channel.py
@@ -1,3 +1,5 @@
+from typing import Union
+
import discord
import bot
@@ -16,8 +18,11 @@ def is_help_channel(channel: discord.TextChannel) -> bool:
return any(is_in_category(channel, category) for category in categories)
-def is_mod_channel(channel: discord.TextChannel) -> bool:
- """True if `channel` is considered a mod channel."""
+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):
+ channel = channel.parent
+
if channel.id in constants.MODERATION_CHANNELS:
log.trace(f"Channel #{channel} is a configured mod channel")
return True