Spaces:
Running on CPU Upgrade

lunarflu HF staff commited on
Commit
908c0c7
·
verified ·
1 Parent(s): 618c2d9

fetch_member instead of get_member

Browse files
Files changed (1) hide show
  1. app.py +18 -1
app.py CHANGED
@@ -826,12 +826,29 @@ async def send_lunar_verification_logs(lunar, member, username):
826
  def send_lunar_verification_logs_def(lunar, member, username):
827
  loop = asyncio.get_event_loop()
828
  loop.run_until_complete(send_lunar_verification_logs(lunar, member, username))
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
829
 
830
  def verify_button(profile: gr.OAuthProfile | None, request: gr.Request) -> str:
831
  url_str = str(request.url)
832
  query_params = parse_qs(urlparse(url_str).query)
833
  user_id = query_params.get('user_id', [None])[0]
 
834
  token = query_params.get('token', [None])[0]
 
835
 
836
  print(f"||| token:{token}||| user_id:{user_id}||| profile:{profile}||| user_tokens:{user_tokens}")
837
 
@@ -847,7 +864,7 @@ def verify_button(profile: gr.OAuthProfile | None, request: gr.Request) -> str:
847
  server = bot.get_guild(879548962464493619)
848
  print(f"server={server}")
849
  role = server.get_role(900063512829755413)
850
- member = server.get_member(user_id)
851
  print(f"member={member}")
852
  verified_date = datetime.now().strftime("%m/%d/%Y, %H:%M:%S")
853
  likes = 0
 
826
  def send_lunar_verification_logs_def(lunar, member, username):
827
  loop = asyncio.get_event_loop()
828
  loop.run_until_complete(send_lunar_verification_logs(lunar, member, username))
829
+
830
+
831
+
832
+
833
+
834
+ async def get_member_async(user_id, server):
835
+ member = await server.fetch_member(user_id)
836
+ return member
837
+
838
+
839
+
840
+ def get_member_def(user_id, server):
841
+ loop = asyncio.get_event_loop()
842
+ return loop.run_until_complete(get_member_async(user_id, server))
843
+
844
 
845
  def verify_button(profile: gr.OAuthProfile | None, request: gr.Request) -> str:
846
  url_str = str(request.url)
847
  query_params = parse_qs(urlparse(url_str).query)
848
  user_id = query_params.get('user_id', [None])[0]
849
+ print(f"user_id={user_id}")
850
  token = query_params.get('token', [None])[0]
851
+ print(f"token={token}")
852
 
853
  print(f"||| token:{token}||| user_id:{user_id}||| profile:{profile}||| user_tokens:{user_tokens}")
854
 
 
864
  server = bot.get_guild(879548962464493619)
865
  print(f"server={server}")
866
  role = server.get_role(900063512829755413)
867
+ member = get_member_def(user_id, server)
868
  print(f"member={member}")
869
  verified_date = datetime.now().strftime("%m/%d/%Y, %H:%M:%S")
870
  likes = 0