From 3434e5ff653bbc7f8fc37118ff2a663d0d1a239c Mon Sep 17 00:00:00 2001 From: Logan Cusano Date: Sun, 25 May 2025 23:59:25 -0400 Subject: [PATCH] Update get_status to actively fetch the status --- app/client.py | 16 ++++++++++++++++ 1 file changed, 16 insertions(+) diff --git a/app/client.py b/app/client.py index fbe2d5e..3b74e54 100644 --- a/app/client.py +++ b/app/client.py @@ -141,6 +141,22 @@ async def leave_server(websocket, guild_id): # Get the client status @command async def get_status(websocket, request_id): + # Get the OP25 Status + op25_status = await drb_api.get_op25_status() + if 'status' not in op25_status or op25_status['status'] == "stopped": + client_status['op25_status'] = OP25StatusValues.OFFLINE + else: + client_status['op25_status'] = OP25StatusValues.LISTENING + + # Get the discord Status + discord_status = await drb_api.get_bot_status() + if 'bot_running' not in discord_status or not discord_status['bot_running']: + client_status['discord_status'] = DiscordStatusValues.OFFLINE + elif discord_status['bot_running'] and ('connected_guilds' in bot_status and len(bot_status['connected_guilds']) > 0): + client_status['discord_status'] = DiscordStatusValues.INVOICE + else: + client_status['discord_status'] = DiscordStatusValues.ONLINE + # Return the status object response_payload = {"status": client_status}