From dd0b679bfcce63f007553178193dc90311a54ad4 Mon Sep 17 00:00:00 2001 From: mtuszowski Date: Thu, 19 Sep 2024 16:55:09 +0200 Subject: [PATCH] fx --- bot.py | 18 +++++++++++------- 1 file changed, 11 insertions(+), 7 deletions(-) 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):