diff options
Diffstat (limited to 'cogs/tts.py')
| -rw-r--r-- | cogs/tts.py | 5 |
1 files changed, 4 insertions, 1 deletions
diff --git a/cogs/tts.py b/cogs/tts.py index dceb26c..8076a2d 100644 --- a/cogs/tts.py +++ b/cogs/tts.py | |||
| @@ -22,12 +22,13 @@ class TTS(commands.Cog): | |||
| 22 | tts.save('tts.mp3') | 22 | tts.save('tts.mp3') |
| 23 | if output == "file": | 23 | if output == "file": |
| 24 | await ctx.respond(file=discord.File('tts.mp3')) | 24 | await ctx.respond(file=discord.File('tts.mp3')) |
| 25 | logger.info("TTS file sent") | ||
| 25 | os.remove('tts.mp3') | 26 | os.remove('tts.mp3') |
| 26 | elif output == "vc": | 27 | elif output == "vc": |
| 27 | # Check if the user is in a voice channel | 28 | # Check if the user is in a voice channel |
| 28 | if not (ctx.author.voice and ctx.author.voice.channel): | 29 | if not (ctx.author.voice and ctx.author.voice.channel): |
| 29 | await ctx.respond("Musisz być na kanale głosowym, aby odtworzyć TTS!", ephemeral=True) | 30 | await ctx.respond("Musisz być na kanale głosowym, aby odtworzyć TTS!", ephemeral=True) |
| 30 | logger.info("tts: User is not in a voice channel") | 31 | logger.info("User is not in a voice channel") |
| 31 | os.remove('tts.mp3') | 32 | os.remove('tts.mp3') |
| 32 | return | 33 | return |
| 33 | channel = ctx.author.voice.channel | 34 | channel = ctx.author.voice.channel |
| @@ -40,6 +41,7 @@ class TTS(commands.Cog): | |||
| 40 | # Play the TTS audio | 41 | # Play the TTS audio |
| 41 | if not voice_client.is_playing(): | 42 | if not voice_client.is_playing(): |
| 42 | audio_source = discord.FFmpegPCMAudio('tts.mp3', options='-filter:a "volume=6"') | 43 | audio_source = discord.FFmpegPCMAudio('tts.mp3', options='-filter:a "volume=6"') |
| 44 | logger.info("TTS audio played") | ||
| 43 | voice_client.play(audio_source) | 45 | voice_client.play(audio_source) |
| 44 | # Wait for playback to finish | 46 | # Wait for playback to finish |
| 45 | while voice_client.is_playing(): | 47 | while voice_client.is_playing(): |
| @@ -47,6 +49,7 @@ class TTS(commands.Cog): | |||
| 47 | os.remove('tts.mp3') | 49 | os.remove('tts.mp3') |
| 48 | else: | 50 | else: |
| 49 | await ctx.respond("Nieznany sposób odtwarzania.", ephemeral=True) | 51 | await ctx.respond("Nieznany sposób odtwarzania.", ephemeral=True) |
| 52 | logger.info("Unknown playback method") | ||
| 50 | os.remove('tts.mp3') | 53 | os.remove('tts.mp3') |
| 51 | 54 | ||
| 52 | 55 | ||
