mirror of
https://github.com/nexy7574/LCC-bot.git
synced 2024-09-20 02:26:32 +01:00
fix speech gen
This commit is contained in:
parent
b22ee7c36f
commit
8fd8022115
1 changed files with 9 additions and 6 deletions
|
@ -832,12 +832,15 @@ class OtherCog(commands.Cog):
|
||||||
|
|
||||||
async def callback(self, interaction: discord.Interaction):
|
async def callback(self, interaction: discord.Interaction):
|
||||||
def _convert(text: str) -> BytesIO():
|
def _convert(text: str) -> BytesIO():
|
||||||
engine = pyttsx3.init()
|
with tempfile.makestemp(suffix=".mp3") as temp:
|
||||||
_io = BytesIO()
|
engine = pyttsx3.init()
|
||||||
engine.save_to_file(text, _io)
|
_io = BytesIO()
|
||||||
engine.runAndWait()
|
engine.save_to_file(text, temp)
|
||||||
_io.seek(0)
|
engine.runAndWait()
|
||||||
return _io
|
with open(temp, "rb") as f:
|
||||||
|
_io.write(f.read())
|
||||||
|
_io.seek(0)
|
||||||
|
return _io
|
||||||
|
|
||||||
await interaction.response.defer()
|
await interaction.response.defer()
|
||||||
_msg = await interaction.followup.send("Converting text to MP3...")
|
_msg = await interaction.followup.send("Converting text to MP3...")
|
||||||
|
|
Loading…
Reference in a new issue