Ejemplo n.º 1
0
def listen(text):
    if (text != "") and (text != " "):
        words = text.split()

        if words[0] == "run":
            maiatos_voice.speak("Running " + words[1])
            maiatos_cmd.run(words[1])

        elif words[0] == "check":
            if words[1] == "weather":
                try:
                    maiatos_voice.speak(maiatos_cmd.weather(words[2]))
                except:
                    maiatos_voice.speak(maiatos_cmd.weather("default"))

        elif words [0] == "search":
            if words[1] == "wolfram":
                question = str(' '.join(words[2::]))
                print("Searching about: \""+question+"\"")
                try:
                    maiatos_voice.speak(maiatos_cmd.ask_wolframalpha(question))
                except:
                    maiatos_voice.speak("Sorry, I could not find the answer.")

            elif words[1] == "web":
                question = str('+'.join(words[2::]))
                maiatos_cmd.search_duckduckgo(question)

            else:
                question = str(' '.join(words[1::]))
                print("Searching about: \""+question+"\"")
                try:
                    maiatos_voice.speak(maiatos_cmd.ask_wikipedia(question))
                except:
                    maiatos_voice.speak("Sorry, I could not find the answer.")


        elif words[0] == "say":
            maiatos_voice.speak(str(''.join(words[1::])))

        else:
            maiatos_voice.chat(text)
Ejemplo n.º 2
0
                    maiatos_voice.speak("Sorry, I could not find the answer.")

            elif words[1] == "web":
                question = str('+'.join(words[2::]))
                maiatos_cmd.search_duckduckgo(question)

            else:
                question = str(' '.join(words[1::]))
                print("Searching about: \""+question+"\"")
                try:
                    maiatos_voice.speak(maiatos_cmd.ask_wikipedia(question))
                except:
                    maiatos_voice.speak("Sorry, I could not find the answer.")


        elif words[0] == "say":
            maiatos_voice.speak(str(''.join(words[1::])))

        else:
            maiatos_voice.chat(text)




maiatos_voice.speak("Initialized")

#Main Loop for user input
while True:
    print("[ I am seeing "+str(maiatos_eye.check_people_in_sight())+" people. ]")
    input = raw_input("> ")
    listen(input)