i hate tts now

This commit is contained in:
Nexus 2023-03-16 23:04:41 +00:00
parent 74b6b7026b
commit 802d5b23e7

View file

@ -4,7 +4,6 @@ import os
import random import random
import re import re
import tempfile import tempfile
import time
import textwrap import textwrap
from datetime import timedelta from datetime import timedelta
from io import BytesIO from io import BytesIO
@ -13,7 +12,7 @@ import dns.resolver
from dns import asyncresolver from dns import asyncresolver
import aiofiles import aiofiles
import pyttsx3 import pyttsx3
from time import time, time_ns from time import time, time_ns, sleep
from typing import Literal from typing import Literal
from typing import Tuple, Optional, Dict from typing import Tuple, Optional, Dict
from pathlib import Path from pathlib import Path
@ -839,7 +838,7 @@ class OtherCog(commands.Cog):
engine.save_to_file(text, target_fn) engine.save_to_file(text, target_fn)
engine.runAndWait() engine.runAndWait()
while not os.path.exists(target_fn): while not os.path.exists(target_fn):
time.sleep(0.5) time_sleep(0.5)
with open(target_fn, "rb") as f: with open(target_fn, "rb") as f:
_io.write(f.read()) _io.write(f.read())
os.remove(target_fn) os.remove(target_fn)