1
0
Fork 0
mirror of synced 2024-05-19 20:12:30 +12:00

Split state and voice disconnections

This commit is contained in:
Phxntxm 2017-06-17 18:04:11 -05:00
parent d1662e1a82
commit fd1fddc450

View file

@ -522,21 +522,24 @@ class Music:
This also clears the queue.
"""
state = self.voice_states.get(ctx.message.guild.id)
voice = ctx.message.guild.voice_client
# Stop playing whatever song is playing.
if state and state.voice:
state.voice.stop()
# If we have a state, clear the songs, dj's, then skip the current song
if state:
state.songs.clear()
# This will cancel the audio event we're using to loop through the queue
# Then erase the voice_state entirely, and disconnect from the channel
await state.voice.disconnect()
state.djs.clear()
state.skip()
try:
del self.voice_states[ctx.message.guild.id]
except KeyError:
pass
# If we have a voice connection (separate from state...just in case....)
# Then stop playing, and disconnect
if voice:
voice.stop()
await state.voice.disconnect()
@commands.command()
@commands.guild_only()
@utils.custom_perms(send_messages=True)