From 03b94f61318675f1df83d384670b506a0df6e118 Mon Sep 17 00:00:00 2001 From: salmonik Date: Wed, 20 May 2026 15:37:14 +0200 Subject: Fix TTS and AI voice playback bugs MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit - tts.py _handle_voice_output: add missing voice_client.play() call via VoiceManager.play_source() — was creating the audio source and then doing nothing - ai.py: use VoiceManager.play_source() instead of passing an FFmpegPCMAudio object to play() which expects a string path --- cogs/ai.py | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) (limited to 'cogs/ai.py') diff --git a/cogs/ai.py b/cogs/ai.py index c9237c4..ef2ba7c 100644 --- a/cogs/ai.py +++ b/cogs/ai.py @@ -9,7 +9,6 @@ from discord.ext import commands import logging import httpx from gtts import gTTS -from cogs.music import audio_playback import io logger = logging.getLogger(__name__) @@ -61,12 +60,14 @@ class AI(commands.Cog): else: response_text = response_data["choices"][0]["message"]["content"] if tts: - # Generate TTS tts_obj = gTTS(text=response_text, lang='pl') tts_buffer = io.BytesIO() tts_obj.write_to_fp(tts_buffer) tts_buffer.seek(0) - await audio_playback.AudioPlaybackManager.play(ctx, discord.FFmpegPCMAudio(tts_buffer), delete_after_play=True, interrupt=False) + from cogs.voice import get_voice_manager + vm = get_voice_manager(self.bot) + channel = ctx.author.voice.channel + await vm.play_source(channel, discord.FFmpegPCMAudio(tts_buffer), interrupt=False) else: await ctx.send_followup(response_text) -- cgit v1.2.3