diff options
| author | 2020-05-07 11:09:44 -0700 | |
|---|---|---|
| committer | 2020-06-13 11:21:07 -0700 | |
| commit | b86d9a66519b2c8b8c50c255c8b23d924be35f5a (patch) | |
| tree | f44da927810a2fd665bada8886b64e91aae34590 | |
| parent | Code block: edit instructions if edited message is still invalid (diff) | |
Code block: clarify log messages in message edit event
If statement was separated so there could be separate messages that are
more specific. The message ID was also included to distinguish events.
Diffstat (limited to '')
| -rw-r--r-- | bot/cogs/codeblock/cog.py | 15 |
1 files changed, 6 insertions, 9 deletions
diff --git a/bot/cogs/codeblock/cog.py b/bot/cogs/codeblock/cog.py index 5844f4d16..0f0a8cd51 100644 --- a/bot/cogs/codeblock/cog.py +++ b/bot/cogs/codeblock/cog.py @@ -123,15 +123,12 @@ class CodeBlockCog(Cog, name="Code Block"): @Cog.listener() async def on_raw_message_edit(self, payload: RawMessageUpdateEvent) -> None: """Delete the instructions message if an edited message had its code blocks fixed.""" - if ( - # Checks to see if the message was called out by the bot - payload.message_id not in self.codeblock_message_ids - # Makes sure that there is content in the message - or payload.data.get("content") is None - # Makes sure there's a channel id in the message payload - or payload.data.get("channel_id") is None - ): - log.trace("Message edit does not qualify for code block detection.") + if payload.message_id not in self.codeblock_message_ids: + log.trace(f"Ignoring message edit {payload.message_id}: message isn't being tracked.") + return + + if payload.data.get("content") is None or payload.data.get("channel_id") is None: + log.trace(f"Ignoring message edit {payload.message_id}: missing content or channel ID.") return # Parse the message to see if the code blocks have been fixed. |