Skip to content

Commit

Permalink
Fix query bug
Browse files Browse the repository at this point in the history
  • Loading branch information
vanhbakaa authored Nov 16, 2024
1 parent 8830ec1 commit 8ded2eb
Showing 1 changed file with 8 additions and 3 deletions.
11 changes: 8 additions & 3 deletions bot/utils/launcher.py
Original file line number Diff line number Diff line change
Expand Up @@ -44,8 +44,13 @@ def fetch_username(query):
json_data = json.loads(fetch_data)
return json_data['username']
except:
logger.warning(f"Invaild query: {query}")
sys.exit()
try:
fetch_data = unquote(query).split("user=")[1].split("&auth_date=")[0]
json_data = json.loads(fetch_data)
return json_data['username']
except:
logger.warning(f"Invaild query: {query}")
sys.exit()

async def get_token(session_name):
async with AIOFile('token.json', 'r') as file:
Expand Down Expand Up @@ -233,4 +238,4 @@ async def run_tasks(tg_clients: list[Client]):
for tg_client in tg_clients
]

await asyncio.gather(*tasks)
await asyncio.gather(*tasks)

0 comments on commit 8ded2eb

Please sign in to comment.