1
0
Fork 0
mirror of synced 2024-05-20 04:22:29 +12:00

Couple edge case checks

This commit is contained in:
Phxntxm 2017-05-18 21:03:09 -05:00
parent 32be71d4ec
commit 13643bd1a2

View file

@ -274,7 +274,7 @@ class Music:
# Make sure we're playing first
state = self.voice_states.get(ctx.message.guild.id)
if state is None or not state.playing:
if state is None or not state.playing or state.current is None:
await ctx.send('Not playing anything.')
else:
progress = state.current.progress
@ -436,7 +436,10 @@ class Music:
# Then erase the voice_state entirely, and disconnect from the channel
state.audio_player.cancel()
await state.voice.disconnect()
del self.voice_states[ctx.message.guild.id]
try:
del self.voice_states[ctx.message.guild.id]
except KeyError:
pass
@commands.command(pass_context=True)
@commands.guild_only()