lunarflu HF staff commited on
Commit
eb0e82f
1 Parent(s): e63a0f9

guild chunk + trying member in def

Browse files
Files changed (1) hide show
  1. app.py +3 -0
app.py CHANGED
@@ -105,6 +105,8 @@ async def on_ready():
105
  print(f'Logged in as {bot.user.name}')
106
  print(f"XP_PER_MESSAGE: {XP_PER_MESSAGE}")
107
 
 
 
108
 
109
  channel = bot.get_channel(900125909984624713)
110
  if channel:
@@ -869,6 +871,7 @@ def verify_button(profile: gr.OAuthProfile | None, request: gr.Request) -> str:
869
 
870
  if pd.isnull(hf_user_name) or hf_user_name == 'n/a':
871
  # empty (no link created yet between discord_user_id and hf_user_name) so we can update
 
872
  verified_date = datetime.now().strftime("%m/%d/%Y, %H:%M:%S")
873
  global_df.loc[global_df['discord_user_id'] == altered_member_id, 'hf_user_name'] = profile.username
874
  global_df.loc[global_df['discord_user_id'] == altered_member_id, 'verified_date'] = verified_date
 
105
  print(f'Logged in as {bot.user.name}')
106
  print(f"XP_PER_MESSAGE: {XP_PER_MESSAGE}")
107
 
108
+ guild = bot.get_guild(879548962464493619)
109
+ await guild.chunk() # get all users into bot cache
110
 
111
  channel = bot.get_channel(900125909984624713)
112
  if channel:
 
871
 
872
  if pd.isnull(hf_user_name) or hf_user_name == 'n/a':
873
  # empty (no link created yet between discord_user_id and hf_user_name) so we can update
874
+ member = bot.get_member(user_id) # only works if we allow some time after bot restarts
875
  verified_date = datetime.now().strftime("%m/%d/%Y, %H:%M:%S")
876
  global_df.loc[global_df['discord_user_id'] == altered_member_id, 'hf_user_name'] = profile.username
877
  global_df.loc[global_df['discord_user_id'] == altered_member_id, 'verified_date'] = verified_date