fix speech gen

This commit is contained in:
Nexus 2023-03-16 22:49:11 +00:00
parent b22ee7c36f
commit 8fd8022115

View file

@ -832,10 +832,13 @@ class OtherCog(commands.Cog):
async def callback(self, interaction: discord.Interaction):
def _convert(text: str) -> BytesIO():
with tempfile.makestemp(suffix=".mp3") as temp:
engine = pyttsx3.init()
_io = BytesIO()
engine.save_to_file(text, _io)
engine.save_to_file(text, temp)
engine.runAndWait()
with open(temp, "rb") as f:
_io.write(f.read())
_io.seek(0)
return _io