Browse Source

edited check so it knows only to delete the message being reacted to and also made the output nicer.

tags/v1.7.0
Roxie Gibson 6 years ago
parent
commit
7003cf7bd1
1 changed files with 4 additions and 3 deletions
  1. +4
    -3
      roxbot/utils.py

+ 4
- 3
roxbot/utils.py View File

@@ -7,12 +7,13 @@ async def delete_option(bot, ctx, message, delete_emoji, timeout=20):
await message.add_reaction(delete_emoji)

def check(r, u):
return str(r) == str(delete_emoji) and u == ctx.author
return str(r) == str(delete_emoji) and u == ctx.author and r.message == message

try:
await bot.wait_for("reaction_add", timeout=timeout, check=check)
await message.delete()
return await ctx.send("{} requested output be deleted.".format(ctx.author))
await message.remove_reaction(delete_emoji, bot.user)
await message.remove_reaction(delete_emoji, ctx.author)
return await message.edit(content="{} requested output be deleted.".format(ctx.author))
except TimeoutError:
await message.remove_reaction(delete_emoji, bot.user)


Loading…
Cancel
Save