Add endpoint to fetch a token

This commit is contained in:
Logan Cusano
2025-04-27 01:42:45 -04:00
parent 941843bbb1
commit 3ab2d06411
2 changed files with 15 additions and 1 deletions

View File

@@ -45,8 +45,12 @@ async def join_server(system_id, guild_id, channel_id):
bot_status = await drb_api.get_bot_status()
# Check if the bot is running
if 'bot_running' not in bot_status or not bot_status['bot_running']:
# Get a token
bot_token = await srv_api.request_token()
if not bot_token or "token" not in bot_token or not bot_token['token']:
raise Exception("No bot token received") # TODO - Handle this better
# Run the bot if not
await drb_api.start_bot()
await drb_api.start_bot(bot_token['token'])
# Update status
client_status = StatusValues.LISTENING
op25_status = await drb_api.get_op25_status()