using tmpefiles for tts so now we dont step on eachothers memes
This commit is contained in:
parent
cb59d090b5
commit
6dfb5b2d8d
@ -447,15 +447,15 @@ async def tts(ctx):
|
||||
"Ok {}, check your DMs".format(ctx.message.author.mention)
|
||||
)
|
||||
return await ctx.message.author.send(tts.get_all_langs())
|
||||
|
||||
file_path = tts.text_to_speech(ctx.message.content)
|
||||
await ctx.send(
|
||||
file=discord.File(
|
||||
tts.text_to_speech(ctx.message.content),
|
||||
file_path,
|
||||
filename="A Message From {}.mp3".format(ctx.message.author.name)
|
||||
)
|
||||
)
|
||||
await ctx.message.delete()
|
||||
os.remove('/tmp/memes.mp3')
|
||||
os.remove(file_path)
|
||||
|
||||
@bot.command(name='issue')
|
||||
async def issue(ctx):
|
||||
|
@ -1,4 +1,5 @@
|
||||
from gtts import gTTS, lang
|
||||
import tempfile
|
||||
|
||||
def text_to_speech(input):
|
||||
"""
|
||||
@ -8,7 +9,7 @@ def text_to_speech(input):
|
||||
that language. eg: what are you doing; ja, will return a file read by a japanese
|
||||
robot
|
||||
"""
|
||||
file_path = '/tmp/memes.mp3'
|
||||
file, file_path = tempfile.mkstemp()
|
||||
message = ' '.join(input.split()[1:])
|
||||
|
||||
language = 'en'
|
||||
|
Loading…
x
Reference in New Issue
Block a user