aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorGravatar Chris Lovering <[email protected]>2021-10-25 13:11:37 +0100
committerGravatar Chris Lovering <[email protected]>2021-10-31 20:14:44 +0000
commita2ec6f93403ee77aef803c0eefb90fa16f60f181 (patch)
tree1e19cb32185f083f664e19d80a7ad283c9e7b972
parentMerge pull request #1923 from Lainika/GH-1873_Fix_embeds (diff)
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