From ef8045559cf90c17918ff35e92c6db50c3ce60a7 Mon Sep 17 00:00:00 2001 From: Logan Cusano Date: Sun, 29 Jun 2025 18:48:55 -0400 Subject: [PATCH] Update the presence of the bot when the op25 config is set, or the bot is started --- app/client.py | 6 ++++++ app/drb_cdb_api.py | 5 +++++ 2 files changed, 11 insertions(+) diff --git a/app/client.py b/app/client.py index ca0951e..1ed6998 100644 --- a/app/client.py +++ b/app/client.py @@ -128,6 +128,9 @@ async def join_server(websocket, system_id, guild_id, channel_id): # Start OP25 await drb_api.start_op25() + # Update the presence of the discord bot + await drb_api.update_bot_presence() + client_status['op25_status'] = OP25StatusValues.LISTENING print("OP25 Startup Complete") @@ -214,6 +217,9 @@ async def op25_set(websocket, system_id): await drb_api.generate_op25_config(temp_config) + # Update the presence of the discord bot (if running) + await drb_api.update_bot_presence() + # Example command @command async def run_task(websocket, task_id, duration_seconds): diff --git a/app/drb_cdb_api.py b/app/drb_cdb_api.py index acb1fb1..6b654f3 100644 --- a/app/drb_cdb_api.py +++ b/app/drb_cdb_api.py @@ -100,6 +100,11 @@ class DRBCDBAPI(BaseAPI): print("Getting bot status") return await self._get("/bot/status") + async def update_bot_presence(self): + """Updates the bot's precense with the configured system.""" + print("Getting bot status") + return await self._post("/op25/update-presence") + # Example Usage (assuming your FastAPI app is running on http://localhost:8000) async def example_usage(): """Demonstrates asynchronous API interaction using httpx."""