Fix awaits

This commit is contained in:
Logan Cusano
2025-04-27 01:06:21 -04:00
parent 0e4da902a8
commit 82ee620ea4

View File

@@ -42,18 +42,18 @@ def command(func):
@command @command
async def join_server(system_id, guild_id, channel_id): async def join_server(system_id, guild_id, channel_id):
# Takes system ID, guild ID, channel ID # Takes system ID, guild ID, channel ID
bot_status = drb_api.get_bot_status() bot_status = await drb_api.get_bot_status()
# Check if the bot is running # Check if the bot is running
if 'bot_running' not in bot_status or not bot_status['bot_running']: if 'bot_running' not in bot_status or not bot_status['bot_running']:
# Run the bot if not # Run the bot if not
drb_api.start_bot() await drb_api.start_bot()
# Update status # Update status
client_status = StatusValues.LISTENING client_status = StatusValues.LISTENING
op25_status = drb_api.get_op25_status() op25_status = await drb_api.get_op25_status()
# Check if OP25 is stopped, if so set the selected channel, otherwise # Check if OP25 is stopped, if so set the selected channel, otherwise
if op25_status == "stopped": if op25_status == "stopped":
chn_details = srv_api.get_channel_details(channel_id) chn_details = await srv_api.get_channel_details(channel_id)
if not chn_details: if not chn_details:
# TODO - handle not having channel details # TODO - handle not having channel details
pass pass
@@ -76,7 +76,7 @@ async def join_server(system_id, guild_id, channel_id):
@command @command
async def leave_server(guild_id): async def leave_server(guild_id):
# Takes guild ID # Takes guild ID
bot_status = drb_api.get_bot_status() bot_status = await drb_api.get_bot_status()
# Check if the bot is running # Check if the bot is running
if 'bot_running' not in bot_status or not bot_status['bot_running']: if 'bot_running' not in bot_status or not bot_status['bot_running']:
@@ -88,7 +88,7 @@ async def leave_server(guild_id):
return return
# Leave the server specified # Leave the server specified
drb_api.leave_voice_channel(guild_id) await drb_api.leave_voice_channel(guild_id)
# Update status # Update status
client_status = StatusValues.ONLINE client_status = StatusValues.ONLINE