lunarflu HF staff commited on
Commit
f81413e
1 Parent(s): 42641d6

remove give_verified_roles (move to different bot)

Browse files
Files changed (1) hide show
  1. app.py +1 -25
app.py CHANGED
@@ -121,7 +121,6 @@ async def on_ready():
121
 
122
 
123
  # updates both leaderboards
124
- give_verified_roles.start()
125
  remove_huggingfolks.start()
126
 
127
  print("------------------------------------------------------------------------")
@@ -209,29 +208,7 @@ def update_hub_stats():
209
  print(f"Hub stats successfully updated at {timestamp}! \n{global_df}")
210
  print("------------------------------------------------------------------------")
211
 
212
-
213
- @tasks.loop(minutes=1)
214
- async def give_verified_roles():
215
- global global_df
216
- guild = bot.get_guild(879548962464493619)
217
- role = guild.get_role(900063512829755413)
218
- org_link = "https://huggingface.co/organizations/discord-community/share/wPKRAHYbAlaEaCxUxcqVyaaaeZcYagDvqc"
219
- invite_message = "Click to join our community org on the HF Hub!"
220
- await guild.chunk()
221
- for index, row in global_df.iterrows():
222
- hf_user_name = row['hf_user_name']
223
- if pd.notna(hf_user_name) and hf_user_name.lower() != 'n/a':
224
- discord_id = row['discord_user_id'].strip('L')
225
- member = guild.get_member(int(discord_id))
226
- if not member:
227
- continue
228
- if role not in member.roles:
229
- await member.add_roles(role)
230
- lunar = bot.get_user(811235357663297546)
231
- await lunar.send(f"Verified role given to {member}!")
232
- await member.send(f"Verification successful! [{member} <---> {row['discord_user_name']}] \n🤗 {org_link} {invite_message}")
233
-
234
-
235
  thread_pool_executor = ThreadPoolExecutor(max_workers=2)
236
  asyncio_executor = AsyncIOExecutor()
237
  scheduler = BackgroundScheduler(executors={
@@ -239,7 +216,6 @@ scheduler = BackgroundScheduler(executors={
239
  })
240
  scheduler.add_job(update_google_sheet, trigger='interval', minutes=1, max_instances=2, executor='default')
241
  scheduler.add_job(update_hub_stats, trigger='interval', minutes=1.5, max_instances=2, executor='default')
242
- #scheduler.add_job(give_verified_roles, trigger='interval', minutes=1, max_instances=1, executor='asyncio')
243
  scheduler.start()
244
  #asyncio.get_event_loop().run_forever()
245
 
 
121
 
122
 
123
  # updates both leaderboards
 
124
  remove_huggingfolks.start()
125
 
126
  print("------------------------------------------------------------------------")
 
208
  print(f"Hub stats successfully updated at {timestamp}! \n{global_df}")
209
  print("------------------------------------------------------------------------")
210
 
211
+
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
212
  thread_pool_executor = ThreadPoolExecutor(max_workers=2)
213
  asyncio_executor = AsyncIOExecutor()
214
  scheduler = BackgroundScheduler(executors={
 
216
  })
217
  scheduler.add_job(update_google_sheet, trigger='interval', minutes=1, max_instances=2, executor='default')
218
  scheduler.add_job(update_hub_stats, trigger='interval', minutes=1.5, max_instances=2, executor='default')
 
219
  scheduler.start()
220
  #asyncio.get_event_loop().run_forever()
221