diff options
| -rw-r--r-- | bot/exts/moderation/infraction/_scheduler.py | 6 | ||||
| -rw-r--r-- | bot/utils/channel.py | 19 | 
2 files changed, 13 insertions, 12 deletions
| diff --git a/bot/exts/moderation/infraction/_scheduler.py b/bot/exts/moderation/infraction/_scheduler.py index 12d831453..7f18017ac 100644 --- a/bot/exts/moderation/infraction/_scheduler.py +++ b/bot/exts/moderation/infraction/_scheduler.py @@ -137,11 +137,7 @@ class InfractionScheduler:              )              if reason:                  end_msg = f" (reason: {textwrap.shorten(reason, width=1500, placeholder='...')})" -        elif not is_mod_channel(ctx.channel): -            log.trace( -                f"Infraction #{id_} context is not in a mod channel; omitting infraction count." -            ) -        else: +        elif is_mod_channel(ctx.channel):              log.trace(f"Fetching total infraction count for {user}.")              infractions = await self.bot.api_client.get( diff --git a/bot/utils/channel.py b/bot/utils/channel.py index 1e67d1a9b..6bf70bfde 100644 --- a/bot/utils/channel.py +++ b/bot/utils/channel.py @@ -17,13 +17,18 @@ def is_help_channel(channel: discord.TextChannel) -> bool:  def is_mod_channel(channel: discord.TextChannel) -> bool: -    """Return True if `channel` is one of the moderation channels or in one of the moderation categories.""" -    log.trace(f"Checking if #{channel} is a mod channel.") - -    return ( -        channel.id in constants.MODERATION_CHANNELS -        or any(is_in_category(channel, category) for category in constants.MODERATION_CATEGORIES) -    ) +    """True if `channel` is considered a mod channel.""" +    if channel.id in constants.MODERATION_CHANNELS: +        log.trace(f"Channel #{channel} is a configured mod channel") +        return True + +    elif any(is_in_category(channel, category) for category in constants.MODERATION_CATEGORIES): +        log.trace(f"Channel #{channel} is in a configured mod category") +        return True + +    else: +        log.trace(f"Channel #{channel} is not a mod channel") +        return False  def is_in_category(channel: discord.TextChannel, category_id: int) -> bool: | 
