aboutsummaryrefslogtreecommitdiffstats
path: root/cogs/tts.py
diff options
context:
space:
mode:
Diffstat (limited to '')
-rw-r--r--cogs/tts.py12
1 files changed, 5 insertions, 7 deletions
diff --git a/cogs/tts.py b/cogs/tts.py
index 3dc4c09..68eb27f 100644
--- a/cogs/tts.py
+++ b/cogs/tts.py
@@ -54,19 +54,17 @@ class TTS(commands.Cog):
54 if not voice_client: 54 if not voice_client:
55 await ctx.respond("Failed to connect to voice channel", ephemeral=True) 55 await ctx.respond("Failed to connect to voice channel", ephemeral=True)
56 return 56 return
57 57
58 # Play the TTS audio with volume adjustment 58 if voice_client.is_playing():
59 await ctx.respond("Audio is already playing, try again later", ephemeral=True)
60 return
61
59 audio_source = discord.FFmpegPCMAudio( 62 audio_source = discord.FFmpegPCMAudio(
60 temp_path, 63 temp_path,
61 options=f'-filter:a "volume={volume}"' 64 options=f'-filter:a "volume={volume}"'
62 ) 65 )
63 voice_client.play(audio_source)
64 logger.info(f"Playing TTS: {text}") 66 logger.info(f"Playing TTS: {text}")
65 67
66 # Wait for the audio to finish playing
67 while voice_client.is_playing():
68 await asyncio.sleep(0.1)
69
70 except Exception as e: 68 except Exception as e:
71 logger.error(f"Error in voice channel handling: {e}") 69 logger.error(f"Error in voice channel handling: {e}")
72 await ctx.respond("eror :c", ephemeral=True) 70 await ctx.respond("eror :c", ephemeral=True)