Update the presence of the bot when the op25 config is set, or the bot is started
This commit is contained in:
@@ -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):
|
||||
|
||||
@@ -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."""
|
||||
|
||||
Reference in New Issue
Block a user