import pyttsx3
from datetime import date
from datetime import datetime
engine = pyttsx3.init()
voices = engine.getProperty('voices')
engine.setProperty('voice', voices[1].id)
rb = ""
rate = engine.getProperty('rate')
engine.setProperty('rate', 130)
print("Just ask if you want")
print("Disclaimer: Don't capital in the first letter")
print("Remember to capital in name of people or whatever")
while True:
you = input()
print("You: " + you)
if you == "":
rb = "I can't understand, type again"
elif "hello" in you:
rb = "Hello Hai Anh"
elif "today" in you:
today = date.today()
rb = today.strftime("%B %d, %Y")
elif "time" in you:
now = datetime.now()
rb = now.strftime("%H hours %M minutes %S seconds")
elif "number one of Osu" in you:
rb = "WhiteCat"
elif "bye" in you:
rb = "Bye Hai Anh ^_^"
engine.say(rb)
engine.runAndWait()
break
else:
rb = "I can't understand, please let me know"
print("Bot: " + rb)
engine.say(rb)
engine.runAndWait()
Hiện tại cái dòng code của em là như thế này, em không thấy tìm thấy lỗi nhưng nó cứ báo lỗi, em mới học ạ