From 97ae123c717d2851ec347a8e4ddd6cf41d0fe513 Mon Sep 17 00:00:00 2001 From: phxntxm Date: Sun, 14 May 2017 05:10:40 -0500 Subject: [PATCH] Reorder some parts with join, to ensure we detect the right status --- cogs/music.py | 9 ++++----- 1 file changed, 4 insertions(+), 5 deletions(-) diff --git a/cogs/music.py b/cogs/music.py index 27772bf..963e450 100644 --- a/cogs/music.py +++ b/cogs/music.py @@ -308,6 +308,8 @@ class Music: perms = channel.permissions_for(ctx.message.guild.me) + log.info("Joining channel {} in guild {}".format(channel.id, ctx.message.guild.id)) + if not perms.connect or not perms.speak or not perms.use_voice_activation: await ctx.send("I do not have correct permissions in {}! Please turn on `connect`, `speak`, and `use " "voice activation`".format(channel.name)) @@ -317,13 +319,10 @@ class Music: try: if state and state.voice and state.voice.channel: await state.voice.move_to(channel) - await ctx.send("Joined {} and ready to play".format(channel.name)) - return True else: - self.voice_states[ctx.message.guild.id] = VoiceState(ctx.message.guild, self.bot) await channel.connect() - await ctx.send("Joined {} and ready to play".format(channel.name)) - return True + self.voice_states[ctx.message.guild.id] = VoiceState(ctx.message.guild, self.bot) + return True except asyncio.TimeoutError: await ctx.send("Sorry, but I couldn't connect right now! Please try again later") return False