aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorGravatar Matteo Bertucci <[email protected]>2021-09-19 15:24:34 +0200
committerGravatar GitHub <[email protected]>2021-09-19 15:24:34 +0200
commit50243809d73323688a2320bbb11ec6cdd0e4b8aa (patch)
tree163d8f7f39aa23c91658c4d4d25d33187fd4d00d
parentModlog: thread support (diff)
Modlog: reuse logic for the message blacklist
Co-authored-by: Bluenix <[email protected]>
-rw-r--r--bot/exts/moderation/modlog.py17
1 files changed, 4 insertions, 13 deletions
diff --git a/bot/exts/moderation/modlog.py b/bot/exts/moderation/modlog.py
index 817b6af41..ae71a18a3 100644
--- a/bot/exts/moderation/modlog.py
+++ b/bot/exts/moderation/modlog.py
@@ -519,22 +519,13 @@ class ModLog(Cog, name="ModLog"):
channel_id=Channels.user_log
)
- @staticmethod
- def is_message_blacklisted(message: Message) -> bool:
+ def is_message_blacklisted(self, message: Message) -> bool:
"""Return true if the message is in a blacklisted thread or channel."""
- # Ignore DMs or messages outside of the main guild
- if not message.guild or message.guild.id != GuildConstant.id:
- return True
-
- # Ignore bots
- if message.author.bot:
+ # Ignore bots or DMs
+ if message.author.bot or not message.guild:
return True
- # Look at the parent channel of a thread
- if isinstance(message.channel, Thread):
- return message.channel.parent.id in GuildConstant.modlog_blacklist
-
- return message.channel.id in GuildConstant.modlog_blacklist
+ return self.is_raw_message_blacklisted(message.guild.id, message.channel.id)
def is_raw_message_blacklisted(self, guild_id: t.Optional[int], channel_id: int) -> bool:
"""Return true if the message constructed from raw parameter is in a blacklisted thread or channel."""