diff options
| author | salmonik <raisersoft@proton.me> | 2026-04-17 15:36:12 +0200 |
|---|---|---|
| committer | salmonik <raisersoft@proton.me> | 2026-04-17 15:36:12 +0200 |
| commit | d135265798da8c2698f363237f4cb74b682f3f9e (patch) | |
| tree | bca914d297e74a6188478a773ba7333c10fe4a34 /cogs/tts.py | |
| parent | Merge branch 'main' of https://codeberg.org/salmonik/senator-sperma (diff) | |
| download | senator-sperma-d135265798da8c2698f363237f4cb74b682f3f9e.tar.gz senator-sperma-d135265798da8c2698f363237f4cb74b682f3f9e.zip | |
make voice great again
Signed-off-by: salmonik <raisersoft@proton.me>
Diffstat (limited to 'cogs/tts.py')
| -rw-r--r-- | cogs/tts.py | 8 |
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 | ||
