Update get_status to actively fetch the status

This commit is contained in:
Logan Cusano
2025-05-25 23:59:25 -04:00
parent ffec7e2045
commit 3434e5ff65

View File

@@ -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}