From 34f58b6b4c735456f138f756092f1d1550a0c128 Mon Sep 17 00:00:00 2001 From: Samlon Date: Tue, 12 Aug 2025 22:21:52 +0200 Subject: further improvements to tts --- cogs/tts.py | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) (limited to 'cogs/tts.py') diff --git a/cogs/tts.py b/cogs/tts.py index 07212ee..c00259f 100644 --- a/cogs/tts.py +++ b/cogs/tts.py @@ -15,7 +15,7 @@ class TTS(commands.Cog): @commands.slash_command(name="tts", description="Generuje TTS dla danego tekstu") async def tts(self, ctx, text: str = discord.Option(str, "Tekst do przeczytania", required=True), - output: str = discord.Option(str, "Wybierz sposób odtwarzania", choices=["file", "vc"], required=True) + output: str = discord.Option(str, "Wybierz sposób odtwarzania", choices=["file", "vc"], default="vc") ): tts = gTTS(text=text, lang='pl') tts.save('tts.mp3') @@ -25,8 +25,8 @@ class TTS(commands.Cog): logger.info("TTS file sent") os.remove('tts.mp3') elif output == "vc": - # Defer the response to avoid "Bot did not respond" message - await ctx.defer() + await ctx.respond(content="\u200b", ephemeral=True) + await ctx.interaction.delete_original_message() # Check if the user is in a voice channel if not (ctx.author.voice and ctx.author.voice.channel): @@ -56,3 +56,4 @@ class TTS(commands.Cog): def setup(bot): bot.add_cog(TTS(bot)) +1 \ No newline at end of file -- cgit v1.2.3