mirror of
https://github.com/nexy7574/LCC-bot.git
synced 2024-09-20 02:26:32 +01:00
you can do it jimmy
This commit is contained in:
parent
5493c6b0ba
commit
dde0ce6ce7
1 changed files with 3 additions and 3 deletions
|
@ -832,12 +832,12 @@ 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():
|
||||||
with tempfile.TemporaryFile(suffix=".mp3") as temp:
|
with tempfile.NamedTemporaryFile(suffix=".mp3") as temp:
|
||||||
engine = pyttsx3.init()
|
engine = pyttsx3.init()
|
||||||
_io = BytesIO()
|
_io = BytesIO()
|
||||||
engine.save_to_file(text, temp)
|
engine.save_to_file(text, temp.name)
|
||||||
engine.runAndWait()
|
engine.runAndWait()
|
||||||
with open(temp, "rb") as f:
|
with open(temp.name, "rb") as f:
|
||||||
_io.write(f.read())
|
_io.write(f.read())
|
||||||
_io.seek(0)
|
_io.seek(0)
|
||||||
return _io
|
return _io
|
||||||
|
|
Loading…
Reference in a new issue