lunarflu HF staff commited on
Commit
ac377ac
1 Parent(s): 4ef1ea4

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +14 -8
app.py CHANGED
@@ -146,7 +146,7 @@ async def add_exp(member_id):
146
  try:
147
  global global_df
148
 
149
- #guild = bot.get_guild(879548962464493619)
150
  member = guild.get_member(member_id)
151
  lvl1 = guild.get_role(1171861537699397733)
152
  lvl2 = guild.get_role(1171861595115245699)
@@ -337,6 +337,17 @@ async def xp_help(ctx):
337
  print(f"on_message Error: {e}")
338
 
339
 
 
 
 
 
 
 
 
 
 
 
 
340
 
341
  # embeds with user pfps?
342
  # name, pfp, time in server....
@@ -389,13 +400,8 @@ with demo:
389
  try:
390
  role_id = 897376942817419265 # huggingfolks
391
  dataframe1 = pd.read_csv(csv_url)
392
- # removing huggingfolks, display community members instead
393
- for index, row in dataframe1.iterrows():
394
- user_id = int(row['discord_user_id'])
395
- print(guild)
396
- member = guild.get_member(user_id)
397
- if member is not None and discord.utils.get(member.roles, id=role_id_to_check) is not None:
398
- dataframe1.drop(index, inplace=True)
399
 
400
  column_values_unique = sorted(dataframe1.iloc[:, 3].unique())
401
  dataframe2 = pd.DataFrame({'Levels': column_values_unique})
 
146
  try:
147
  global global_df
148
 
149
+ guild = bot.get_guild(879548962464493619)
150
  member = guild.get_member(member_id)
151
  lvl1 = guild.get_role(1171861537699397733)
152
  lvl2 = guild.get_role(1171861595115245699)
 
337
  print(f"on_message Error: {e}")
338
 
339
 
340
+ async def get_guild_info(dataframe1):
341
+ guild = bot.get_guild(879548962464493619)
342
+ # removing huggingfolks, display community members instead
343
+ for index, row in dataframe1.iterrows():
344
+ user_id = int(row['discord_user_id'])
345
+ print(guild)
346
+ member = guild.get_member(user_id)
347
+ if member is not None and discord.utils.get(member.roles, id=role_id_to_check) is not None:
348
+ dataframe1.drop(index, inplace=True)
349
+ return dataframe1
350
+
351
 
352
  # embeds with user pfps?
353
  # name, pfp, time in server....
 
400
  try:
401
  role_id = 897376942817419265 # huggingfolks
402
  dataframe1 = pd.read_csv(csv_url)
403
+
404
+ dataframe1 = await get_guild_info(dataframe1)
 
 
 
 
 
405
 
406
  column_values_unique = sorted(dataframe1.iloc[:, 3].unique())
407
  dataframe2 = pd.DataFrame({'Levels': column_values_unique})