Update the presence of the bot when the op25 config is set, or the bot is started

This commit is contained in:
Logan Cusano
2025-06-29 18:48:55 -04:00
parent 0a82a9b6e6
commit ef8045559c
2 changed files with 11 additions and 0 deletions

View File

@@ -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):

View File

@@ -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."""