Clear Reactions after selection

This commit is contained in:
Dusty.P 2018-05-09 20:40:33 -08:00
parent aa785de50c
commit 3243cd2771

View File

@ -1,4 +1,5 @@
import asyncio import asyncio
import discord
from discord.ext import commands from discord.ext import commands
from io import BytesIO from io import BytesIO
from .imports import process_files, utils from .imports import process_files, utils
@ -56,6 +57,10 @@ class Uploader:
f'Canceling request due to timeout.') f'Canceling request due to timeout.')
return return
else: else:
try:
await msg.clear_reactions()
except (discord.Forbidden, discord.HTTPException):
pass
if str(reaction.emoji) == self.bot.unicode_emojis["o"]: if str(reaction.emoji) == self.bot.unicode_emojis["o"]:
await msg.edit(content="You chose to process as official.") await msg.edit(content="You chose to process as official.")
await asyncio.sleep(4.0) await asyncio.sleep(4.0)
@ -87,7 +92,7 @@ class Uploader:
game_msg.attachments[0].save(f) game_msg.attachments[0].save(f)
game_ini = process_files.process_file(f, 'game.ini') game_ini = process_files.process_file(f, 'game.ini')
elif str(reaction.emoji) == self.bot.unicode_emojis['x']: elif str(reaction.emoji) == self.bot.unicode_emojis['x']:
await msg.edit('Your request has been canceled.') await msg.edit(content='Your request has been canceled.')
return return
if official == 'official' and game_ini == ConfigParser(): if official == 'official' and game_ini == ConfigParser():
@ -109,6 +114,10 @@ class Uploader:
f'Canceling request due to timeout.') f'Canceling request due to timeout.')
return return
else: else:
try:
await msg.clear_reactions()
except (discord.Forbidden, discord.HTTPException):
pass
if str(reaction.emoji) == self.bot.unicode_emojis["y"]: if str(reaction.emoji) == self.bot.unicode_emojis["y"]:
await msg.edit(content="You selected SinglePlayer.") await msg.edit(content="You selected SinglePlayer.")
await asyncio.sleep(4.0) await asyncio.sleep(4.0)