Add endpoint to fetch a token
This commit is contained in:
@@ -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()
|
||||
|
||||
Reference in New Issue
Block a user