aboutsummaryrefslogtreecommitdiffstats
path: root/cogs/tts.py
diff options
context:
space:
mode:
Diffstat (limited to 'cogs/tts.py')
-rw-r--r--cogs/tts.py8
1 files changed, 6 insertions, 2 deletions
diff --git a/cogs/tts.py b/cogs/tts.py
index 5e6945c..65f1fce 100644
--- a/cogs/tts.py
+++ b/cogs/tts.py
@@ -94,7 +94,8 @@ class TTS(commands.Cog):
94 try: 94 try:
95 # Generate and save TTS to temp file 95 # Generate and save TTS to temp file
96 tts = gTTS(text=text, lang='pl') 96 tts = gTTS(text=text, lang='pl')
97 tts.save(temp_path) 97 loop = asyncio.get_event_loop()
98 await loop.run_in_executor(None, tts.save, temp_path)
98 99
99 # Load settings 100 # Load settings
100 volume = get_volume() 101 volume = get_volume()
@@ -104,7 +105,10 @@ class TTS(commands.Cog):
104 await self._handle_file_output(ctx, temp_path, text) 105 await self._handle_file_output(ctx, temp_path, text)
105 elif output == "vc": 106 elif output == "vc":
106 await self._handle_voice_output(ctx, temp_path, text, volume) 107 await self._handle_voice_output(ctx, temp_path, text, volume)
107 108
109 except Exception as e:
110 logger.error(f"TTS generation error: {e}")
111 await ctx.respond("Error generating TTS", ephemeral=True)
108 finally: 112 finally:
109 await self._cleanup_temp_file(temp_path) 113 await self._cleanup_temp_file(temp_path)
110 114