From 4a61bd195fb7acad23748b003e85add95965f6b1 Mon Sep 17 00:00:00 2001 From: Logan Cusano Date: Sat, 24 May 2025 23:24:18 -0400 Subject: [PATCH] Added new node route to get online bots --- app/routers/nodes.py | 11 ++++++++++- 1 file changed, 10 insertions(+), 1 deletion(-) diff --git a/app/routers/nodes.py b/app/routers/nodes.py index bb85164..218057e 100644 --- a/app/routers/nodes.py +++ b/app/routers/nodes.py @@ -112,4 +112,13 @@ async def leave(): return jsonify({"status": "command sent", "client_id": client_id, "command": NodeCommands.LEAVE}), 200 except Exception as e: - return jsonify({"error": f"Failed to send command: {e}"}), 500 \ No newline at end of file + return jsonify({"error": f"Failed to send command: {e}"}), 500 + + +@nodes_bp.route("/get_online_bots", methods=['GET']) +async def get_online_bots(): + active_bots = [] + for client in current_app.active_clients: + active_bots.append(client.active_token.to_dict()) + + return jsonify(active_bots) \ No newline at end of file