Language Support Added
Supports Language as [p]tts <lang> <text>
This commit is contained in:
		
							parent
							
								
									20d8acc800
								
							
						
					
					
						commit
						960b66a5b8
					
				@ -28,12 +28,12 @@ class TTS(Cog):
 | 
			
		||||
        return
 | 
			
		||||
 | 
			
		||||
    @commands.command(aliases=["t2s", "text2"])
 | 
			
		||||
    async def tts(self, ctx: commands.Context, *, text: str):
 | 
			
		||||
        """
 | 
			
		||||
        Send Text to speech messages as an mp3
 | 
			
		||||
    async def tts(self, ctx: commands.Context, *, lang: str, text: str):
 | 
			
		||||
        """
 | 
			
		||||
       Send Text to speech messages as an mp3
 | 
			
		||||
       """
 | 
			
		||||
        mp3_fp = io.BytesIO()
 | 
			
		||||
        tts = gTTS(text, lang="en")
 | 
			
		||||
        tts = gTTS(text, lang=lang)
 | 
			
		||||
        tts.write_to_fp(mp3_fp)
 | 
			
		||||
        mp3_fp.seek(0)
 | 
			
		||||
        await ctx.send(file=discord.File(mp3_fp, "text.mp3"))
 | 
			
		||||
 | 
			
		||||
		Loading…
	
	
			
			x
			
			
		
	
		Reference in New Issue
	
	Block a user