[英]discord.py text to speech module?
Are there any good modules for text to speech that i can use with discord.py.是否有任何好的文本到语音模块可以与 discord.py 一起使用。 I was looking at pyttsx but from what I know you it transfers the text into an mp3, I would be able to play the mp3 file on discord.py but it would make things a little harder.
我正在查看 pyttsx,但据我所知,它将文本传输到 mp3,我可以在 discord.py 上播放 mp3 文件,但这会使事情变得更难。 Anyone know a better way?
有人知道更好的方法吗?
Other than discords built in /tts除了 /tts 内置的不和谐
You can send a message to any messageable using text-to-speech by passing tts=True
to your send
call:您可以通过将
tts=True
传递给您的send
调用来使用文本到语音转换向任何可发送消息发送消息:
from discord.ext.commands import Bot
bot = Bot('!')
@bot.command()
async def test(ctx):
await ctx.send("This is a tts message", tts=True)
bot.run("token")
Your bot will need the send_tts_messages
permission.你的机器人需要
send_tts_messages
权限。
Discord has inbuilt text to speech, just send the message from the bot with /tts [text_goes_here]
. Discord 具有内置的文本转语音功能,只需使用
/tts [text_goes_here]
从机器人发送消息/tts [text_goes_here]
。 Make sure it has TTS permissions enabled.确保它已启用 TTS 权限。
The only reason this wouldn't work is if you are wanting to make a bot that converts all text typed by users to be read aloud?这不起作用的唯一原因是,如果您想要制作一个机器人来将用户输入的所有文本转换为大声朗读? (Sounds weird.) Although in that case use
pyttsx
which can read instantly or save as mp3. (听起来很奇怪。)尽管在这种情况下使用
pyttsx
可以立即读取或另存为 mp3。
/tts
is the thing you're looking for. /tts
是你要找的东西。
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.