diff --git a/WebStreamer/bot/clients.py b/WebStreamer/bot/clients.py index 947e041..884ab92 100644 --- a/WebStreamer/bot/clients.py +++ b/WebStreamer/bot/clients.py @@ -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: diff --git a/WebStreamer/server/stream_routes.py b/WebStreamer/server/stream_routes.py index 93a1249..4988ada 100644 --- a/WebStreamer/server/stream_routes.py +++ b/WebStreamer/server/stream_routes.py @@ -16,7 +16,7 @@ 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", @@ -24,8 +24,8 @@ async def root_route_handler(_): "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) # )