Skip to content

Commit

Permalink
fix multiple deletion bug
Browse files Browse the repository at this point in the history
  • Loading branch information
Zennara committed Jan 13, 2022
1 parent f96b5e5 commit b6b1026
Show file tree
Hide file tree
Showing 2 changed files with 11 additions and 6 deletions.
2 changes: 1 addition & 1 deletion database.json
Original file line number Diff line number Diff line change
@@ -1 +1 @@
"{'players': ObservedDict(value={'427968672980533269': ObservedDict(value={'scrap': 105, 'trading': '', '806706495466766366': ObservedList(value=['\ud83e\udde6|Uncommon|Chilling|Socks|+2', '\ud83c\udf57|Uncommon|Spiky|Drumstick|+0']), '761036747504484392': ObservedList(value=['\ud83d\udc38|Common|Bawdy|Frog|+1'])}), '187227540962672640': ObservedDict(value={'scrap': 62, 'trading': '', '806706495466766366': ObservedList(value=[])}), '529381965804077067': ObservedDict(value={'scrap': 10, 'trading': '', '806706495466766366': ObservedList(value=['\ud83c\udf48|Common|Ultimate|Melon|+1'])})}), '761036747504484392': ObservedDict(value={'prefix': '!', 'name': 'test this is', 'join': True}), '806706495466766366': ObservedDict(value={'prefix': '!', 'name': \"Zenn's Dev Portal\", 'join': True})}"
"{'761036747504484392': ObservedDict(value={'prefix': '!', 'name': 'test this is', 'join': True}), 'players': ObservedDict(value={'427968672980533269': ObservedDict(value={'scrap': 130, 'trading': '', '806706495466766366': ObservedList(value=['\ud83c\udf57|Uncommon|Spiky|Drumstick|+0', '\ud83e\uddf0|Uncommon|Sundering|Toolbox|+0']), '761036747504484392': ObservedList(value=['\ud83d\udc38|Common|Bawdy|Frog|+1'])}), '187227540962672640': ObservedDict(value={'scrap': 62, 'trading': '', '806706495466766366': ObservedList(value=[])}), '529381965804077067': ObservedDict(value={'scrap': 10, 'trading': '', '806706495466766366': ObservedList(value=['\ud83c\udf48|Common|Ultimate|Melon|+1'])})}), '806706495466766366': ObservedDict(value={'prefix': '!', 'name': \"Zenn's Dev Portal\", 'join': True})}"
15 changes: 10 additions & 5 deletions main.py
Original file line number Diff line number Diff line change
Expand Up @@ -550,11 +550,11 @@ def check(reaction, user):
done = False
def checkR(reaction, user):
if not user.bot and user.id == message.author.id:
if str(reaction.emoji) == "✅":
asyncio.create_task(reaction.message.clear_reactions())
return True
if reaction.message == msg:
if str(reaction.emoji) == "✅":
asyncio.create_task(reaction.message.clear_reactions())
return True
elif str(reaction.emoji) == "❌":
if str(reaction.emoji) == "❌":
asyncio.create_task(reaction.message.clear_reactions())
return True
await msg.add_reaction("✅")
Expand All @@ -567,7 +567,11 @@ def checkR(reaction, user):
break
else:
if str(reaction.emoji) == "✅":
break
if reaction.message == msg:
break
else:
done=True
break
if str(reaction.emoji) == "❌":
done = True
break
Expand All @@ -576,6 +580,7 @@ def checkR(reaction, user):
embed = discord.Embed(description=deletedItem,color=0x000000, title="🗑️ Item deleted.")
await msg.edit(embed=embed)
else:
asyncio.create_task(msg.clear_reactions())
embed = discord.Embed(description="✅ Deletion cancelled.",color=0x000000)
await msg.edit(embed=embed)
else:
Expand Down

0 comments on commit b6b1026

Please sign in to comment.