diff --git a/bot.py b/bot.py index 711fac0..6924761 100644 --- a/bot.py +++ b/bot.py @@ -542,16 +542,20 @@ async def connect(ctx, arg=None): """ if ctx and arg: logger.info("Ctx and arg defined for connect") - voice_channel = client.get_channel(1060349757349974066) if client.voice_clients: - voice_client = client.voice_clients[0] - if voice_client.is_connected(): + logger.info("Already connected with other client") + else: + vc = None + if ctx.author.voice.channel: + vc = await ctx.author.voice.channel.connect() + else: + voice_channel = client.get_channel(1060349757349974066) + vc = await voice_channel.connect() + if not vc: + logger.error("Not possible to connect to voice") return - voice_channel_connection = await voice_channel.connect() - if not voice_channel_connection: - logger.error("Not possible to connect to voice") - logger.info("Connecting to voice") + logger.info("Connected to voice") async def disconnect(ctx):