lunarflu HF staff commited on
Commit
f32640e
1 Parent(s): 4d30ea2

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +15 -5
app.py CHANGED
@@ -229,16 +229,26 @@ async def on_reaction_add(reaction, user):
229
 
230
  @bot.command(name='update_leaderboard')
231
  async def update_leaderboard(ctx, num_pairs: int = 10):
232
- worksheet = gspread_bot.open("levelbot").sheet1
233
- levels_list = worksheet.col_values(4)[1:]
 
 
 
 
 
 
234
  names_list = worksheet.col_values(2)[1:]
 
235
 
 
 
 
236
  channel = bot.get_channel(1197143964994773023)
237
  message = await channel.fetch_message(1197148293164187678)
238
 
239
- # get position, then find that value in names_list
240
  levels_list = list(map(int, levels_list))
241
- data_pairs = list(zip(names_list, levels_list))
242
  sorted_data_pairs = sorted(data_pairs, key=lambda x: x[1], reverse=True)
243
  top_data_pairs = sorted_data_pairs[:num_pairs]
244
 
@@ -276,7 +286,7 @@ async def send_message(ctx):
276
 
277
 
278
  # might need cell location data to pull both level and username at same time
279
-
280
 
281
 
282
  """"""
 
229
 
230
  @bot.command(name='update_leaderboard')
231
  async def update_leaderboard(ctx, num_pairs: int = 10):
232
+ # remove huggingfolks
233
+ guild = ctx.guild
234
+ role = discord.utils.get(guild.roles, id=role_id)
235
+ if role is None:
236
+ await ctx.send("Role not found.")
237
+ return
238
+
239
+ members_with_role = [member.name for member in guild.members if role in member.roles]
240
  names_list = worksheet.col_values(2)[1:]
241
+ updated_names_list = [name for name in names_list if name not in members_with_role]
242
 
243
+ worksheet = gspread_bot.open("levelbot").sheet1
244
+ levels_list = worksheet.col_values(4)[1:]
245
+
246
  channel = bot.get_channel(1197143964994773023)
247
  message = await channel.fetch_message(1197148293164187678)
248
 
249
+ # get position, then find that value in updated_names_list
250
  levels_list = list(map(int, levels_list))
251
+ data_pairs = list(zip(updated_names_list, levels_list))
252
  sorted_data_pairs = sorted(data_pairs, key=lambda x: x[1], reverse=True)
253
  top_data_pairs = sorted_data_pairs[:num_pairs]
254
 
 
286
 
287
 
288
  # might need cell location data to pull both level and username at same time
289
+ # add emojis for some color
290
 
291
 
292
  """"""