Handle an edge case with voice disconnection
This commit is contained in:
parent
78afa83970
commit
f221a0eee5
|
@ -664,8 +664,20 @@ class Music:
|
||||||
# So our workaround here is try to connect (this may timeout, and force it to now be visually disconnected) then disconnect
|
# So our workaround here is try to connect (this may timeout, and force it to now be visually disconnected) then disconnect
|
||||||
else:
|
else:
|
||||||
if ctx.message.guild.me.voice:
|
if ctx.message.guild.me.voice:
|
||||||
|
channel = ctx.message.guild.me.voice.channel
|
||||||
|
else:
|
||||||
|
# Get a list of all channels that we can connect to
|
||||||
|
channels = [c for c in ctx.message.guild.voice_channels if c.permissions_for(ctx.message.guild.me).connect]
|
||||||
|
if len(channels) > 0:
|
||||||
|
channel = channels[0]
|
||||||
|
# If we can't connect to any channels but we're stuck in a voice channel what is this server doing .-.
|
||||||
|
# Don't handle this, just return
|
||||||
|
else:
|
||||||
|
return
|
||||||
|
|
||||||
|
# Now simply connect then disconnect
|
||||||
try:
|
try:
|
||||||
await ctx.message.guild.me.voice.channel.connect()
|
await channel.connect()
|
||||||
except asyncio.TimeoutError:
|
except asyncio.TimeoutError:
|
||||||
pass
|
pass
|
||||||
else:
|
else:
|
||||||
|
|
Loading…
Reference in a new issue