aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorGravatar Joseph Banks <[email protected]>2018-09-15 20:37:26 +0000
committerGravatar Joseph Banks <[email protected]>2018-09-15 20:37:26 +0000
commite72b257963a7076ab3484ad6a3df1a718fba3ffd (patch)
tree35376049da264f28afcea1370fdafac074f43752
parentMerge branch 'hemlock/codeblock-embed-reaction-deletion' into 'master' (diff)
parentFinal Patch to Delete via Reaction for Bot Embed (diff)
Merge branch 'hemlock/hopeful-final-fix' into 'master'
Final Patch to Delete via Reaction for Bot Embed See merge request python-discord/projects/bot!63
-rw-r--r--bot/cogs/bot.py5
1 files changed, 4 insertions, 1 deletions
diff --git a/bot/cogs/bot.py b/bot/cogs/bot.py
index 9e73a97bb..fcc642313 100644
--- a/bot/cogs/bot.py
+++ b/bot/cogs/bot.py
@@ -367,10 +367,11 @@ class Bot:
if has_fixed_codeblock:
bot_message = await after.channel.get_message(self.codeblock_message_ids[after.id])
await bot_message.delete()
+ del self.codeblock_message_ids[after.id]
async def on_reaction_add(self, reaction: Reaction, user: Member):
# Ignores reactions added by the bot or added to non-codeblock correction embed messages
- if user.id == self.user.id or reaction.message.id not in self.codeblock_message_ids.values():
+ if user.bot or reaction.message.id not in self.codeblock_message_ids.values():
return
# Finds the appropriate bot message/ user message pair and assigns them to variables
@@ -383,12 +384,14 @@ class Bot:
# If the reaction was clicked on by the author of the user message, deletes the bot message
if user.id == user_message.author.id:
await bot_message.delete()
+ del self.codeblock_message_ids[user_message_id]
return
# If the reaction was clicked by staff (mod or higher), deletes the bot message
for role in user.roles:
if role.id in (Roles.owner, Roles.admin, Roles.moderator):
await bot_message.delete()
+ del self.codeblock_message_ids[user_message_id]
return