diff options
| author | 2020-06-12 13:34:34 +0200 | |
|---|---|---|
| committer | 2020-06-12 13:55:06 +0200 | |
| commit | e8bb1aa59dece803a920efb5ebbdd6098025bdc6 (patch) | |
| tree | 02d38b7eab91a65de6ef3d8ac4bd69d336375b65 | |
| parent | Incidents: implement `add_signals` helper (diff) | |
Incidents: implement `on_message` listener & guards
| -rw-r--r-- | bot/cogs/moderation/incidents.py | 23 |
1 files changed, 20 insertions, 3 deletions
diff --git a/bot/cogs/moderation/incidents.py b/bot/cogs/moderation/incidents.py index 2424c008d..91b949173 100644 --- a/bot/cogs/moderation/incidents.py +++ b/bot/cogs/moderation/incidents.py @@ -6,7 +6,7 @@ import discord from discord.ext.commands import Cog from bot.bot import Bot -from bot.constants import Emojis, Roles +from bot.constants import Channels, Emojis, Roles log = logging.getLogger(__name__) @@ -38,5 +38,22 @@ class Incidents(Cog): @Cog.listener() async def on_message(self, message: discord.Message) -> None: - """Pass each incident sent in #incidents to `add_signals`.""" - ... + """ + Pass each incident sent in #incidents to `add_signals`. + + We recognize several exceptions. The following will be ignored: + * Messages sent outside of #incidents + * Messages Sent by bots + * Messages starting with the hash symbol # + + Prefix message with # in situations where a verbal response is necessary. + Each such message must be deleted manually. + """ + if message.channel.id != Channels.incidents or message.author.bot: + return + + if message.content.startswith("#"): + log.debug(f"Ignoring comment message: {message.content=}") + return + + await self.add_signals(message) |