diff options
| author | 2018-09-15 20:37:26 +0000 | |
|---|---|---|
| committer | 2018-09-15 20:37:26 +0000 | |
| commit | 0473806438fb23303857f09f11e0c342a632e543 (patch) | |
| tree | 35376049da264f28afcea1370fdafac074f43752 | |
| parent | Merge branch 'hemlock/codeblock-embed-reaction-deletion' into 'master' (diff) | |
Final Patch to Delete via Reaction for Bot Embed
| -rw-r--r-- | bot/cogs/bot.py | 5 |
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 |