Skip to content

Commit

Permalink
Merge pull request #249 from python-discord/hemlock/codeblock_retribu…
Browse files Browse the repository at this point in the history
…tion

Hopefully the final fix to the code block on-edit deletion thing
  • Loading branch information
tagptroll1 committed Jan 3, 2019
2 parents 8144c8a + 13cedba commit 450a580
Showing 1 changed file with 2 additions and 1 deletion.
3 changes: 2 additions & 1 deletion bot/cogs/bot.py
Expand Up @@ -372,7 +372,7 @@ async def on_raw_message_edit(self, payload: RawMessageUpdateEvent):
return

# Retrieve channel and message objects for use later
channel = self.bot.get_channel(payload.data.get("channel_id"))
channel = self.bot.get_channel(int(payload.data.get("channel_id")))
user_message = await channel.get_message(payload.message_id)

# Checks to see if the user has corrected their codeblock. If it's fixed, has_fixed_codeblock will be None
Expand All @@ -383,6 +383,7 @@ async def on_raw_message_edit(self, payload: RawMessageUpdateEvent):
bot_message = await channel.get_message(self.codeblock_message_ids[payload.message_id])
await bot_message.delete()
del self.codeblock_message_ids[payload.message_id]
log.trace("User's incorrect code block has been fixed. Removing bot formatting message.")


def setup(bot):
Expand Down

0 comments on commit 450a580

Please sign in to comment.