Spaces:
Running
on
CPU Upgrade
Running
on
CPU Upgrade
safeguards for bot (dm exp, self react exp)
Browse files
app.py
CHANGED
@@ -636,10 +636,12 @@ async def on_reaction_add(reaction, user):
|
|
636 |
try:
|
637 |
if user.id not in bot_ids:
|
638 |
print(f"adding exp from react {user}")
|
639 |
-
await asyncio.sleep(0.1)
|
640 |
-
|
|
|
641 |
await asyncio.sleep(0.1)
|
642 |
-
|
|
|
643 |
except Exception as e:
|
644 |
print(f"on_reaction_add Error: {e}")
|
645 |
|
|
|
636 |
try:
|
637 |
if user.id not in bot_ids:
|
638 |
print(f"adding exp from react {user}")
|
639 |
+
await asyncio.sleep(0.1)
|
640 |
+
if not isinstance(message.channel, discord.DMChannel): # can't earn exp from DMing the bot, which is harder to track
|
641 |
+
await add_exp(user.id)
|
642 |
await asyncio.sleep(0.1)
|
643 |
+
if reaction.message.author.id != user.id: # can't earn while self-reacting, which is abuseable
|
644 |
+
await add_exp(reaction.message.author.id)
|
645 |
except Exception as e:
|
646 |
print(f"on_reaction_add Error: {e}")
|
647 |
|