diff options
| author | Samlon <stankiewiczgracjan2019@gmail.com> | 2025-08-11 20:28:20 +0200 |
|---|---|---|
| committer | Samlon <stankiewiczgracjan2019@gmail.com> | 2025-08-11 20:28:20 +0200 |
| commit | 77e6c02ab7cfe89c03f33ffaa81efabd2cdbb7ba (patch) | |
| tree | 2de3135ad9ac3d8aebfe3cb4323692e10964bea3 /cogs | |
| parent | small join.py fix and better vc handling for logs (diff) | |
| download | senator-sperma-77e6c02ab7cfe89c03f33ffaa81efabd2cdbb7ba.tar.gz senator-sperma-77e6c02ab7cfe89c03f33ffaa81efabd2cdbb7ba.zip | |
revert voice changes
Diffstat (limited to '')
| -rw-r--r-- | cogs/vclogs.py | 15 |
1 files changed, 2 insertions, 13 deletions
diff --git a/cogs/vclogs.py b/cogs/vclogs.py index 64c356d..a9672ac 100644 --- a/cogs/vclogs.py +++ b/cogs/vclogs.py | |||
| @@ -50,22 +50,11 @@ class VcLogs(commands.Cog): | |||
| 50 | tts = gTTS(text=text, lang='pl') | 50 | tts = gTTS(text=text, lang='pl') |
| 51 | tts.save('temp_tts.mp3') | 51 | tts.save('temp_tts.mp3') |
| 52 | 52 | ||
| 53 | # Get the voice client for the guild | 53 | # Connect to the voice channel if not already connected |
| 54 | voice_client = discord.utils.get(self.bot.voice_clients, guild=channel.guild) | 54 | voice_client = discord.utils.get(self.bot.voice_clients, guild=channel.guild) |
| 55 | |||
| 56 | # Handle connection state | ||
| 57 | if not voice_client or not voice_client.is_connected(): | 55 | if not voice_client or not voice_client.is_connected(): |
| 58 | # If no voice client or not connected, create a new connection | 56 | voice_client = await channel.connect() |
| 59 | try: | ||
| 60 | voice_client = await channel.connect() | ||
| 61 | except discord.ClientException as e: | ||
| 62 | if 'already connected' in str(e).lower(): | ||
| 63 | # If already connected, find the existing connection | ||
| 64 | voice_client = next((vc for vc in self.bot.voice_clients if vc.guild == channel.guild), None) | ||
| 65 | else: | ||
| 66 | raise | ||
| 67 | elif voice_client.channel != channel: | 57 | elif voice_client.channel != channel: |
| 68 | # If connected to a different channel, move to the new one | ||
| 69 | await voice_client.move_to(channel) | 58 | await voice_client.move_to(channel) |
| 70 | 59 | ||
| 71 | # Play the TTS audio | 60 | # Play the TTS audio |
