From 71b5e064d3b64f7133d9feca8d8a70c57d4dd286 Mon Sep 17 00:00:00 2001 From: rzmk Date: Fri, 21 May 2021 03:28:47 -0400 Subject: [PATCH] join command --- cogs/musicCog.py | 14 +++++++++++--- 1 file changed, 11 insertions(+), 3 deletions(-) diff --git a/cogs/musicCog.py b/cogs/musicCog.py index 74198f1..2dea118 100644 --- a/cogs/musicCog.py +++ b/cogs/musicCog.py @@ -107,12 +107,20 @@ class MusicCog(commands.Cog): voice = ctx.voice_client voice.stop() - '''@commands.command(aliases=['join']) + @commands.command(aliases=['join']) async def connect(self, ctx): channel = ctx.author.voice.channel - await channel.connect() + try: + await channel.connect() + except: + voice = ctx.voice_client + if voice.is_connected(): + await voice.disconnect() + await channel.connect() + else: + await channel.connect() - @commands.command(aliases=['dc','leave']) + '''@commands.command(aliases=['dc','leave']) async def disconnect(self, ctx): await ctx.voice_client.disconnect()'''