Skip to content

Commit

Permalink
add
Browse files Browse the repository at this point in the history
  • Loading branch information
apmapmapm committed Sep 17, 2024
1 parent 51c4657 commit aafe862
Showing 1 changed file with 14 additions and 3 deletions.
17 changes: 14 additions & 3 deletions mastermelon/cookiegame.py
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,7 @@ async def triggercookieclaim(message: discord.Message, ax: pymongo.collection, b
mention_author=True)
await msg.add_reaction("🍪")
await msg.add_reaction("👎")
duuid = message.author.id
try:
def check2(reaction1: discord.Reaction, user1: discord.Member):
approved_roles = ["Admin (Discord)", "Mod (Discord)", "Admin (Mindustry)", "Mod (Mindustry)", "Admin (Minecraft)", "Mod (Minecraft)"]
Expand All @@ -20,8 +21,7 @@ def check2(reaction1: discord.Reaction, user1: discord.Member):
has_perms = True
return has_perms and (str(reaction1.emoji) in ["🍪", "👎"]) and reaction1.message == msg

reaction2, user2 = await bot.wait_for('reaction_add', timeout=3600.0 * 24, check=check2)
duuid = message.author.id
reaction2, user2 = await bot.wait_for('reaction_add', timeout=600, check=check2) # wait 10mins
if str(reaction2.emoji) == "🍪": # approved
balance = 0
if ax.find_one({"duuid": duuid}) is None:
Expand All @@ -37,6 +37,17 @@ def check2(reaction1: discord.Reaction, user1: discord.Member):
await message.reply(f"Claim rejected by {user2.mention}.", mention_author=True)

except asyncio.TimeoutError:
await message.reply("Claim not processed, please ping a moderator.", mention_author=True)
#await message.reply("Claim not processed, please ping a moderator.", mention_author=True)
# auto approves after timeout.
balance = 0
if ax.find_one({"duuid": duuid}) is None:
ax.insert_one({"duuid": duuid, "ax": 0})
else:
balance = ax.find_one({"duuid": duuid})["ax"]
ax.find_one_and_replace({"duuid": duuid}, {"duuid": duuid, "ax": balance + 10})
msg_react = await message.reply(
f"Claim approved by watermelonbot. 10{ej.ax_emoji} awarded to {message.author.mention}."
f"\nYou now have {balance + 10} {ej.ax_emoji}.", mention_author=True)
await msg_react.add_reaction(ej.blob_emoji)
else:
await message.reply("Please attach 1 screenshot for review.", mention_author=True)

0 comments on commit aafe862

Please sign in to comment.