randydev commited on
Commit
97c2ebc
·
verified ·
1 Parent(s): de5e9fe

Update main.py

Browse files
Files changed (1) hide show
  1. main.py +10 -4
main.py CHANGED
@@ -96,12 +96,18 @@ async def get_author_chat_admin(username: str = None):
96
  @fast_app.get("/user/raw/getchat")
97
  async def get_chat_raw(username: str = None):
98
  try:
 
99
  chat_raw = (await client.get_chat(username)).raw
100
  ok = await user_client.get_chat(username)
101
- response = await js.get_creation_date(
102
- api_key="akeno_OSrXhljIomunACd5JY18jFIeIuuB6Pdx",
103
- user_id=ok.pinned_message.from_user.id
104
- )
 
 
 
 
 
105
  except Exception as e:
106
  return {"error": f"Error try again invalid: {str(e)}"}
107
  return {
 
96
  @fast_app.get("/user/raw/getchat")
97
  async def get_chat_raw(username: str = None):
98
  try:
99
+ user_id = None
100
  chat_raw = (await client.get_chat(username)).raw
101
  ok = await user_client.get_chat(username)
102
+ if ok.pinned_message.from_user:
103
+ user_id = ok.pinned_message.from_user.id if ok.pinned_message.from_user else None
104
+ if not user_id:
105
+ user_id = None
106
+ if user_id:
107
+ response = await js.get_creation_date(
108
+ api_key="akeno_OSrXhljIomunACd5JY18jFIeIuuB6Pdx",
109
+ user_id=user_id
110
+ )
111
  except Exception as e:
112
  return {"error": f"Error try again invalid: {str(e)}"}
113
  return {