aboutsummaryrefslogtreecommitdiffstats
path: root/cogs
diff options
context:
space:
mode:
authorSamlon <stankiewiczgracjan2019@gmail.com>2025-08-12 22:21:52 +0200
committerSamlon <stankiewiczgracjan2019@gmail.com>2025-08-12 22:21:52 +0200
commit34f58b6b4c735456f138f756092f1d1550a0c128 (patch)
tree3c785400387ffc0f3972efd25d49e36ccd27368c /cogs
parentrework ai and tts (diff)
downloadsenator-sperma-34f58b6b4c735456f138f756092f1d1550a0c128.tar.gz
senator-sperma-34f58b6b4c735456f138f756092f1d1550a0c128.zip
further improvements to tts
Diffstat (limited to 'cogs')
-rw-r--r--cogs/tts.py7
1 files changed, 4 insertions, 3 deletions
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):
15 @commands.slash_command(name="tts", description="Generuje TTS dla danego tekstu") 15 @commands.slash_command(name="tts", description="Generuje TTS dla danego tekstu")
16 async def tts(self, ctx, 16 async def tts(self, ctx,
17 text: str = discord.Option(str, "Tekst do przeczytania", required=True), 17 text: str = discord.Option(str, "Tekst do przeczytania", required=True),
18 output: str = discord.Option(str, "Wybierz sposób odtwarzania", choices=["file", "vc"], required=True) 18 output: str = discord.Option(str, "Wybierz sposób odtwarzania", choices=["file", "vc"], default="vc")
19 ): 19 ):
20 tts = gTTS(text=text, lang='pl') 20 tts = gTTS(text=text, lang='pl')
21 tts.save('tts.mp3') 21 tts.save('tts.mp3')
@@ -25,8 +25,8 @@ class TTS(commands.Cog):
25 logger.info("TTS file sent") 25 logger.info("TTS file sent")
26 os.remove('tts.mp3') 26 os.remove('tts.mp3')
27 elif output == "vc": 27 elif output == "vc":
28 # Defer the response to avoid "Bot did not respond" message 28 await ctx.respond(content="\u200b", ephemeral=True)
29 await ctx.defer() 29 await ctx.interaction.delete_original_message()
30 30
31 # Check if the user is in a voice channel 31 # Check if the user is in a voice channel
32 if not (ctx.author.voice and ctx.author.voice.channel): 32 if not (ctx.author.voice and ctx.author.voice.channel):
@@ -56,3 +56,4 @@ class TTS(commands.Cog):
56 56
57def setup(bot): 57def setup(bot):
58 bot.add_cog(TTS(bot)) 58 bot.add_cog(TTS(bot))
591 \ No newline at end of file