nroggendorff commited on
Commit
7ddc3d9
1 Parent(s): b64de75

fixes stuff idk

Browse files
Files changed (1) hide show
  1. app.py +19 -14
app.py CHANGED
@@ -546,15 +546,13 @@ async def on_message(message):
546
  invite_message = "Click to join our community org on the HF Hub!"
547
  try:
548
  if message.author.id not in bot_ids: # could change to if author does not have bot role (roleid)
549
- print(f"adding exp from message {message.author}")
550
- await asyncio.sleep(0.1)
551
- await add_exp(message.author.id)
552
-
553
- # add check for verification
554
- if message.content.find("!help") != -1:
555
- await message.channel.send(
556
- "To verify your 🤗 account, generate a login link in the verification channel! "
557
- )
558
  await bot.process_commands(message)
559
  except Exception as e:
560
  print(f"on_message Error: {e}")
@@ -564,12 +562,19 @@ async def on_message(message):
564
  async def on_reaction_add(reaction, user):
565
  try:
566
  if user.id not in bot_ids:
567
- print(f"adding exp from react {user}")
568
  await asyncio.sleep(0.1)
569
- if not isinstance(reaction.message.channel, discord.DMChannel) and reaction.message.author.id != user.id: # can't earn exp from reacting in bot DMs, which is harder to track, and can't earn while self-reacting, which is abuseable
570
- await add_exp(reaction.message.author.id)
571
- await asyncio.sleep(0.1)
572
-
 
 
 
 
 
 
 
573
  except Exception as e:
574
  print(f"on_reaction_add Error: {e}")
575
 
 
546
  invite_message = "Click to join our community org on the HF Hub!"
547
  try:
548
  if message.author.id not in bot_ids: # could change to if author does not have bot role (roleid)
549
+ if message.guild is not None: # can't earn exp from messaging in bot DMs, which is harder to track
550
+ print(f"adding exp from message {message.author}")
551
+ await add_exp(message.author.id)
552
+ await asyncio.sleep(0.1)
553
+ else:
554
+ print("Messaged in DM channel, skipping..")
555
+ await asyncio.sleep(0.1)
 
 
556
  await bot.process_commands(message)
557
  except Exception as e:
558
  print(f"on_message Error: {e}")
 
562
  async def on_reaction_add(reaction, user):
563
  try:
564
  if user.id not in bot_ids:
565
+ message = reaction.message
566
  await asyncio.sleep(0.1)
567
+ if message.guild is not None: # can't earn exp from reacting in bot DMs, which is harder to track
568
+ if message.author.id != user.id: # can't earn while self-reacting, which is abuseable
569
+ print(f"adding exp from react {user}")
570
+ await add_exp(message.author.id)
571
+ await asyncio.sleep(0.1)
572
+ else:
573
+ print("Self-reacted, skipping..")
574
+ await asyncio.sleep(0.1)
575
+ else:
576
+ print("Reacted in DM channel, skipping..")
577
+ await asyncio.sleep(0.1)
578
  except Exception as e:
579
  print(f"on_reaction_add Error: {e}")
580