Update Jarvis2_4windows.py

This commit is contained in:
TallGorilla 2021-10-09 12:46:14 +02:00
parent 6b701ce3c7
commit a4bed18e5b

View File

@ -37,57 +37,54 @@ popular_websites = {
def main(search_engine, take_command, debug): def main(search_engine, take_command, debug):
while True: while True:
try: query = take_command()
query = take_command()
# logic for executing commands without arguments # logic for executing commands without arguments
phrases = { phrases = {
"what's up": command_whatsup, "what's up": command_whatsup,
"nothing": command_nothing, "nothing": command_nothing,
"abort": command_nothing, "abort": command_nothing,
"stop": command_nothing, "stop": command_nothing,
"hello": command_hello, "hello": command_hello,
"bye": command_bye, "bye": command_bye,
"play music": command_play_music, "play music": command_play_music,
"unpause": command_unpause_music, "unpause": command_unpause_music,
"pause music": command_pause_music, "pause music": command_pause_music,
"stop music": command_stop_music "stop music": command_stop_music
} }
for phrase, command in phrases.items(): for phrase, command in phrases.items():
if phrase in query: if phrase in query:
command() command()
# logic for executing commands with arguments # logic for executing commands with arguments
if "wikipedia" in query: if "wikipedia" in query:
command_wikipedia(speak, debug, query) command_wikipedia(speak, debug, query)
elif "open" in query: elif "open" in query:
command_open( command_open(
query, query,
popular_websites, popular_websites,
debug, debug,
search_engine, search_engine,
take_command take_command
) )
elif "search" in query: elif "search" in query:
command_search(query, search_engine) command_search(query, search_engine)
elif "mail" in query: elif "mail" in query:
command_mail(take_command) command_mail(take_command)
elif "change rate" in query: elif "change rate" in query:
change_rate(query, take_command) change_rate(query, take_command)
elif "change voice" in query.lower(): elif "change voice" in query.lower():
change_voice(query, take_command) change_voice(query, take_command)
elif "change volume" in query.lower(): elif "change volume" in query.lower():
change_volume(query, take_command) change_volume(query, take_command)
speak("Next Command! Sir!") speak("Next Command! Sir!")
except Exception:
pass
def run(): def run():