Просмотр исходного кода

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 лет назад
Родитель
Сommit
7003cf7bd1
1 измененных файлов: 4 добавлений и 3 удалений
  1. +4
    -3
      roxbot/utils.py

+ 4
- 3
roxbot/utils.py Просмотреть файл

@@ -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)


Загрузка…
Отмена
Сохранить