Skip to content

Commit

Permalink
show bot username
Browse files Browse the repository at this point in the history
  • Loading branch information
DeekshithSH committed May 10, 2024
1 parent 8550bd8 commit b9f1b39
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 4 deletions.
4 changes: 3 additions & 1 deletion WebStreamer/bot/clients.py
Original file line number Diff line number Diff line change
Expand Up @@ -46,7 +46,9 @@ async def start_client(client_id, token):
session_string=session_string,
in_memory=True,
).start()
client.id = (await client.get_me()).id
me = await client.get_me()
client.id = me.id
client.username = me.username
work_loads[client_id] = 0
return client_id, client
except Exception:
Expand Down
6 changes: 3 additions & 3 deletions WebStreamer/server/stream_routes.py
Original file line number Diff line number Diff line change
Expand Up @@ -16,16 +16,16 @@
routes = web.RouteTableDef()

@routes.get("/status", allow_head=True)
async def root_route_handler(_):
async def root_route_handler(request):
return web.json_response(
{
"server_status": "running",
"uptime": utils.get_readable_time(time.time() - StartTime),
"telegram_bot": "@" + StreamBot.username,
"connected_bots": len(multi_clients),
"loads": dict(
("bot" + str(c), l)
for c, l in sorted(work_loads.items())
(multi_clients[c].username if request.rel_url.query.get("id") else "bot" +str(c), l)
for c, l in work_loads.items()
# for c, (_, l) in enumerate(
# sorted(work_loads.items(), key=lambda x: x[1], reverse=True)
# )
Expand Down

0 comments on commit b9f1b39

Please sign in to comment.