From a2ec6f93403ee77aef803c0eefb90fa16f60f181 Mon Sep 17 00:00:00 2001 From: Chris Lovering Date: Mon, 25 Oct 2021 13:11:37 +0100 Subject: consider parent channels when checking mod channels --- bot/utils/channel.py | 9 +++++++-- 1 file 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 -- cgit v1.2.3