1
0
Fork 0
mirror of synced 2024-06-03 03:04:33 +12:00

Force disconnection if we're stuck between connection states

This commit is contained in:
Phxntxm 2017-05-14 14:18:32 -05:00
parent 97ae123c71
commit e9354febc4

View file

@ -326,6 +326,12 @@ class Music:
except asyncio.TimeoutError: except asyncio.TimeoutError:
await ctx.send("Sorry, but I couldn't connect right now! Please try again later") await ctx.send("Sorry, but I couldn't connect right now! Please try again later")
return False return False
except discord.ClientException:
if state.voice:
await state.voice.disconnect(force=True)
log.warning("Force cleared voice connection on guild {} after being stuck between connected/not connected".format(ctx.message.guild.id))
await channel.connect()
@commands.command() @commands.command()
@commands.guild_only() @commands.guild_only()