Added emjoi functionnality to remove error messages early
This commit is contained in:
parent
483305a645
commit
fd3bef9240
@ -85,11 +85,19 @@ class MainClass(BaseClassPython):
|
|||||||
self.objects.save_object('errorsList', self.errorsList)
|
self.objects.save_object('errorsList', self.errorsList)
|
||||||
|
|
||||||
# Wait 60 seconds and delete message
|
# Wait 60 seconds and delete message
|
||||||
await asyncio.sleep(60)
|
#await asyncio.sleep(60)
|
||||||
try:
|
try:
|
||||||
channel = self.client.get_channel(msg_id["channel_id"])
|
# channel = self.client.get_channel(msg_id["channel_id"])
|
||||||
delete_message = await channel.fetch_message(msg_id["msg_id"])
|
# delete_message = await channel.fetch_message(msg_id["msg_id"])
|
||||||
await delete_message.delete()
|
# await delete_message.delete()
|
||||||
|
await message.add_reaction("🗑️")
|
||||||
|
|
||||||
|
try:
|
||||||
|
reaction, user = await self.client.wait_for('reaction_add', timeout=60.0, check=lambda r, u: r.emoji == "🗑️" and not u.bot)
|
||||||
|
except asyncio.TimeoutError:
|
||||||
|
await message.delete()
|
||||||
|
else:
|
||||||
|
await reaction.message.delete()
|
||||||
except:
|
except:
|
||||||
raise
|
raise
|
||||||
finally:
|
finally:
|
||||||
|
Loading…
Reference in New Issue
Block a user