mirror of
https://github.com/nexy7574/LCC-bot.git
synced 2024-09-19 18:16:34 +01:00
Add voices
This commit is contained in:
parent
8d3159f71b
commit
ffb6f51fed
1 changed files with 13 additions and 2 deletions
|
@ -34,6 +34,11 @@ from selenium.webdriver.firefox.service import Service as FirefoxService
|
|||
|
||||
from utils import console
|
||||
|
||||
_engine = pyttsx3.init()
|
||||
# noinspection PyTypeChecker
|
||||
VOICES = [x.id for x in _engine.getProperty("voices")]
|
||||
del _engine
|
||||
|
||||
|
||||
# noinspection DuplicatedCode
|
||||
class OtherCog(commands.Cog):
|
||||
|
@ -822,6 +827,12 @@ class OtherCog(commands.Cog):
|
|||
"The speed of the voice. Default is 150.",
|
||||
required=False,
|
||||
default=150
|
||||
),
|
||||
voice: discord.Option(
|
||||
str,
|
||||
"The voice to use. Some may cause timeout.",
|
||||
choices=VOICES,
|
||||
default="default"
|
||||
)
|
||||
):
|
||||
"""Converts text to MP3. 5 uses per 10 minutes."""
|
||||
|
@ -848,7 +859,7 @@ class OtherCog(commands.Cog):
|
|||
target_fn = Path(tmp_dir) / f"jimmy-tts-{ctx.user.id}-{ctx.interaction.id}.mp3"
|
||||
target_fn = str(target_fn)
|
||||
engine = pyttsx3.init()
|
||||
# engine.setProperty("voice", "english-north")
|
||||
engine.setProperty("voice", voice)
|
||||
engine.setProperty("rate", speed)
|
||||
_io = BytesIO()
|
||||
engine.save_to_file(text, target_fn)
|
||||
|
|
Loading…
Reference in a new issue