Fix awaits
This commit is contained in:
@@ -42,18 +42,18 @@ def command(func):
|
||||
@command
|
||||
async def join_server(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
|
||||
if 'bot_running' not in bot_status or not bot_status['bot_running']:
|
||||
# Run the bot if not
|
||||
drb_api.start_bot()
|
||||
await drb_api.start_bot()
|
||||
# Update status
|
||||
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
|
||||
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:
|
||||
# TODO - handle not having channel details
|
||||
pass
|
||||
@@ -76,7 +76,7 @@ async def join_server(system_id, guild_id, channel_id):
|
||||
@command
|
||||
async def leave_server(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
|
||||
if 'bot_running' not in bot_status or not bot_status['bot_running']:
|
||||
@@ -88,7 +88,7 @@ async def leave_server(guild_id):
|
||||
return
|
||||
|
||||
# Leave the server specified
|
||||
drb_api.leave_voice_channel(guild_id)
|
||||
await drb_api.leave_voice_channel(guild_id)
|
||||
|
||||
# Update status
|
||||
client_status = StatusValues.ONLINE
|
||||
|
||||
Reference in New Issue
Block a user