def discover(self, text):
        if "what" in text and "your name" in text:
            if "my" in text:
                self.respond("You have not told me your name yet")

        else:
            f = Fetcher("https://www.google.com/search?q=")
            answer = f.lookup()
            self.respond(answer)
示例#2
0
 def discover(self, command):
     if "what" in command and " name" in command:
         if "my" in command:
             self.respond("You haven't told me your name.")
         else:
             self.respond("My name is Python Commander. How are you?")
     else:
         f = Fetcher("https://www.google.co.in/search?source=hp&ei=k9e2XeP2JrfTz7sP-LaigAY&q="+command)
         answer = f.lookup()
         self.respond(answer)
示例#3
0
 def discover(self, text):
     if "what" in text and "name" in text:
         if "my" in text:
             self.respond("You haven't told me your name yet")
         else:
             self.respond("My name is python commander.  How are you?")
     else:
         f = Fetcher("https://www.google.ca/search?q=" + text)
         answer = f.lookup()
         self.respond(answer)
 def discover(self, text):
     if "what" in text and "your name" in text:
         if "my" in text:
             self.respond("You haven't told your name is..")
         else:
             self.respond("My name is PyBot.")
     else:
         f = Fetcher("https://www.google.co.uk/search?q=" + text)
         answer = f.lookup()
         self.respond(answer)
    def discover(self, text):
        if "what" in text and "name" in text:
            if "my" in text:
                self.respond("you haven't told me your name yet!")
            else:
                self.respond("my name is shanta. How are you deer?")

        else:
            f = Fetcher("https://www.google.com/search?q=" + text)
            answer = f.lookup()
            self.respond(answer)
示例#6
0
 def discover(self, text):
     if "what" in text and "name" in text:
         if "my" in text:
             self.respond("you have not told me your name yet")
         else:
             self.respond("my name is python commander. how are you?")
     else:
         f = Fetcher(
             "https://www.google.com/search?sxsrf=ALeKk00gCIH5APt1HILNIDUoIcCQ69yKng%3A1589124948400&ei=VB-4XrH6F8GZkwXy7KXwDQ&q="
             + text)
         answer = f.lookup()
         self.respond(answer)
     '''if "launch" or "open" in text:
示例#7
0
 def discover(self, text):
     if "what" in text and "your name" in text:
         if "my" in text:
             self.respond("You haven't told me your name yet")
         else:
             self.respond("My name is python commander. How are you??")
     if "launch" or "open" in text:
         app = text.split(" ", 1)[-1]
         self.respond("Opening " + app)
         os.system("open -a" + app + ".app")
     else:
         f = Fetcher("https://www.google.com/search?q=" + text)
         answer = f.lookup()
         self.respond(answer)
示例#8
0
    def discover(self, text):
        if "what" in text and "name" in text:
            if "my" in text:
                self.respond("You haven't told me your name yet")
            else:
                self.respond("My name is python commander. How are you?")
        else:
            f = Fetcher("https://www.google.com/search?sxsrf=ACYBGNTeZ6qqc_TMKB89RIRNgfBEQE9g4Q%3A1568993598414&source=hp&ei=PvGEXd2OF4Xkgwf0rYuYBA&q=" + text)
            answer = f.lookup()
            self.respond(answer)

        if "launch" or "open" in text:
            app = text.split(" ", 1)[-1]
            self.respond("Opening " + app)
            os.system("open -a " + app + ".app")
示例#9
0
    def discover(self, text):
        if 'what' in text and 'name' in text:
            if 'my' in text:
                self.respond("You haven't told me your name yet")
            else:
                self.respond('My name is python commander. How are you?')
        else:
            f = Fetcher("https://www.google.com/search?q=" + text)
            answer = f.lookup()
            self.respond(answer)

        if 'launch' in 'open' in text:
            app = text.split(' ', 1)[-1]
            self.respond('Opening ' + app)
            os.system('open -a ' + app + '.app')
示例#10
0
    def discover(self, text):
        if "what" in text and "name" in text:
            if "my" in text:
                self.respond("You haven't told me your name yet")
            else:
                self.respond("My name is Python Commander. How are you?")
        else:
            f = Fetcher("https://www.google.com/search?source=hp&ei=Sg9pWveDAc7OjwONy4m4Cw&q=" + text)
            answer = f.lookup()
            self.respond(answer)

        if "launch" or "open" in text:
            app = text.split(" ", 1)[-1]
            self.respond("Opening " + app)
            os.system("start " + app + ".exe")
示例#11
0
    def discover(self, text):
        if 'what' in text and 'name' in text:
            if 'my' in text:
                self.respond('You have not told me your name yet')
            else:
                self.respond('My name is python commander. How are you?')

        if 'launch' or 'open' in text:
            app = text.split(' ', 1)[-1]
            self.respond('Opening '+app)
            os.system('open -a' + app + '.app')

        else:
            f = Fetcher('https://www.google.com/search?safe=active&source=hp&ei=ccCTW-SCNoLjsAfo_IrQBQ&q=' + text.replace(" ", "+"))
            ans = f.lookup()
            self.respond(ans)
示例#12
0
    def discover(self, text):
        if 'what' in text and 'name' in text:
            if 'my' in text:
                self.respond('You have not told me your name yet')
            else:
                self.respond('I am PySiri. How are you?')
        else:
            f = Fetcher("https://www.google.com/search?q=" + text)
            answer = f.lookup()
            self.respond(answer)

        if 'open' or 'launch' in text:
            app = text.split(" ", 1)[-1]
            # MacOS only/ Linux probably
            self.respond("Opening " + app)
            os.system('open -a ' + app + '.app')
示例#13
0
    def Discover(self, text):
        if "what" in text and "your name" in text:
            self.respond("Hi my name is Ravi. How Are You ?")
            if "How are you " in text:
                self.respond("I am fine and you ?")

        else:
            f = Fetcher("https://www.google.co.in/search?q=" + text)
示例#14
0
 def discover(self, text):
     if "what" in text and "name" in text:
         if "my" in text:
             self.respond("You haven't told me your name yet")
         else:
             self.respond(
                 "My name is Ar chill.  By the way Lay is CHUUTTIYA")
     if ".com" in text:
         app = text.split(" ", 1)[-1]
         self.respond("Opening" + app)
         wb.get(
             'C:/Program Files (x86)/Google/Chrome/Application/chrome.exe %s'
         ).open(text)
     else:
         f = Fetcher("https://www.google.ca/search?q=" + text)
         answer = f.lookup()
         self.respond(answer)
	def discover(self, text):
		# Get name
		if "what" in text and "your name" in text:
			if "my" in text and "name" in text:
				self.respond("You have not tole me your name yet")
			else:
				self.respond("My name is python commander. How are you?")
	
		# Open app from cmd prompt, used before web search added
		# elif "open" in text or "launch" or "start" in text: 
			# app = text.split(" ", 1)[-1]
			# self.respond("Opening " + app)
			# os.system("Start " + app + ".exe")

		# Get data from web to answer questions
		else:																
			f = Fetcher("https://www.google.com/search?q=" + text)
			answer = f.lookup()
			self.respond(answer)
示例#16
0
def discover(text):
    if "what" in text and "name" in text:
        if "my" in text:
            respond("You have not told me your name yet")
        else:
                respond("My name is companion , How are you?")
    elif  "launch" in text   or "open" in text:
        app = text.split(" ", 1)[-1]
        if app == "browser":
            respond("Opening browser")
            subprocess.call("google-chrome")
        elif app == "editor":
            respond("Opening text-editor")
            subprocess.call("subl")
        else:
            respond("I dont think I am allowed to do that")
    else:
        f = Fetcher("https://www.google.com/search?q=" + text)
        ans = f.lookup()
        respond(ans)	
示例#17
0
 def discover(self, text):
     """
     Handles various requests submitted as text
     """
     # Handles names
     if "what" in text and "name" in text:
         if "my" in text:
             self.respond("You have not told me your name yet")
         else:
             self.respond("My name is Monty. How are you?")
     # Handles app launch
     elif "launch" in text or "open" in text:
         # 'Launch Mozilla Firefox' becomes 'Mozilla Firefox'
         app = text.split(" ", 1)[-1]
         self.respond("Opening " + app)
         os.system('open -a ' + app + ".app")
     # Handles response lookup
     else:
         fetch = Fetcher("https://www.google.com/search?q=" + text)
         answer = fetch.lookup()
         self.respond(answer)
示例#18
0
 def discover(self, text):
     if "what" in text and "your name" in text:
         respond("My name is George.")
     else:
         if "define" in text:
             text = text.replace(" ", "+")
             f = Fetcher("https://www.google.com/search?q=" + text, "def")
             answers = f.look_up()
             i = 0
             for answer in answers:
                 i += 1
                 respond(str(i) + ". " + answer.getText())
         elif "weather in" in text:
             text = text.replace(" ", "+")
             f = Fetcher("https://www.google.com/search?q=" + text,
                         "weather")
             answers = f.look_up()
             respond(answers[0].getText() + " degrees celsius")
         else:
             text = text.replace(" ", "+")
             f = Fetcher("https://www.google.com/search?q=" + text, "other")
             answers = f.look_up()
             respond(answers[0].getText())