def run_jarvis(): command=take_command() print(command) if 'play' in command: song=command.replace('play', '') talk('playing'+ song) pywhatkit.playonyt(song) elif 'google' in command: results=command.replace('google', '') talk('googling'+ results) pywhatkit.search(results) talk(results) elif 'time' in command: time=datetime.datetime.now().strftime('%I:%M %p') talk(' the time is ' + time) print(time) elif 'wikipedia' in command: query=command.replace('wikipedia', '') info=wikipedia.summary(query,2) print(info) talk(info) elif 'joke' in command: talk(pyjokes.get_joke()) elif 'send' in command: message=command.replace('send', '') talk('sending' + message) pywhatkit.sendwhatmsg('+6591913519', message ,16,13) else: talk(' Please repeat your question or request')
def run_alexa(): command = take_command() if 'time' in command: time = datetime.datetime.now().strftime('%I:%M %p') print(time) talk('Current time is ' + time) elif 'play' in command: song = command.replace('play', '') talk('playing ' + song) pywhatkit.playonyt(song) elif 'tell me about' in command: look_for = command.replace('tell me about', '') info = wikipedia.summary(look_for, 100) print(info) talk(info) elif 'tell me a joke' in command: talk(pyjokes.get_joke()) elif "note" in command: pyttsx3.speak("opening notepad") os.system("Notepad") else: talk('Okay,Please wait') pywhatkit.search(command)
def search_web(input): if 'youtube' in input: assistant_speaks("Opening in youtube") #indx = input.lower().split().index('youtube') #query = input.split()[indx + 1:] query = input.replace('youtube','') query = query.replace('play','') query = query.replace('search','') query = query.replace('on','') pywhatkit.playonyt(query) return elif 'wikipedia' in input: assistant_speaks("Here is your search from Wikipedia") query = input.replace('wikipedia','') pywhatkit.info(query,lines=5) return else: assistant_speaks("here is your search result") query = input.replace("search",'') query = query.replace("google",'') pywhatkit.search(query) time.sleep(15) return
def run_max(): try: command = take_command() if 'time' in command: time = datetime.datetime.now().strftime('%I:%M %p') talk(time) elif 'joke' in command: talk(pyjokes.get_joke()) elif 'search' in command: to_serach = command.replace('search', '') talk('seacrhing' + to_serach) pywhatkit.search(to_serach) elif 'play' in command: song = command.replace('play', '') talk('playing' + song) pywhatkit.playonyt(song) talk('Now the time is' + time) elif 'who is' or 'what is' in command: to_check = command.replace('what is', '') to_check = command.replace('who is', '') info = wikipedia.summary(to_check, 2) talk('From wikipedia, ' + info) elif 'quit' in command: sys.exit(2) else: talk('Please say a valid command and do try again') except SystemExit: sys.exit(2) except: sys.exit(2)
def run_alexa(): command = take_command() if 'play' in command: command = command.replace('play', '') talk("Playing "+ command) pywhatkit.playonyt(command) elif 'what is' in command: command = command.replace('what is ', '') if 'time' in command: timenow = datetime.datetime.now() print("Time is ", str(timenow.strftime("%-I:%M:%S %p"))) talk("Time is "+ str(timenow.strftime("%-I:%M:%S %p"))) elif 'date' in command: date = datetime.datetime.now() print("date is ", str(date.strftime("%A, %d %b %Y"))) talk("The date is "+ str(date.strftime("%A, %d %b %Y"))) else: pywhatkit.search(command) elif "hello" in command: talk("what can i do for you") run_alexa() elif "sleep" in command: talk("sleeping") time.sleep(500) run_alexa() else: talk("No command was recieved") talk("Say sleep to go into sleep mode") run_alexa()
def run_luna(): command = take_command() if not command: return if 'time' in command: time = datetime.datetime.now().strftime('%I:%M %p') print(time) talk('Current time is ' + time) elif 'play' in command: song = command.replace('play', '') talk('playing ' + song) pywhatkit.playonyt(song) elif 'tell me about' in command: look_for = command.replace('tell me about', '') info = wikipedia.summary(look_for, 1) print(info) talk(info) elif 'joke' in command: talk(pyjokes.get_joke()) elif 'say hello' in command: words = command.split(" ", -1) # name = command.replace('say hello to', '') name = words[len(words) - 1] talk(f'Hello {name}, Happy new year') else: talk('I did not get it but I am going to search it for you') pywhatkit.search(command)
def run_alexa(): command = take_command() if 'play' in command: song = command.replace('play','') talk('playing') print('playing' + song) pywhatkit.playonyt(song) elif 'time' in command: time = datetime.datetime.now().strftime("%I:%M %p") print(time) talk("Current time is "+time) elif 'who' in command: person = command.replace('who is','') info = wikipedia.summary(person, 1) print(info) talk(info ) elif 'search' in command: command = command.replace('search','') pywhatkit.search(command) else: talk("Please say it again")
def run_alexa(): command = listen() print(command) if command: if 'play' in command: song = command.replace('play', '') talk('playing ' + song) pywhatkit.playonyt(song) elif 'search' in command: command = command.replace("search", '') pywhatkit.search(command) elif 'time' in command: time = datetime.datetime.now().strftime('%I:%M %p') talk('Current time is ' + time) elif 'who is' in command: person = command.replace('who the heck is', '') info = wikipedia.summary(person, 1) talk(info) elif 'date' in command: talk('sorry, I have a headache') elif 'are you single' in command: talk('I am in a relationship with wifi') elif 'joke' in command: talk(pyjokes.get_joke()) else: talk('Please say the command again.')
def topic_search(query): topic = query.lower().replace("make", "").replace("search", "").replace("on google", "") je.speak("making the google search...") kit.search(topic) #Will perform a Google search return
def run_jarvis(): command = take_command() print(command) if 'play' in command: song = command.replace('play', '') talk('Playing' + song) pywhatkit.playonyt(song) print(song) elif 'time' in command: time = datetime.datetime.now().strftime('%I:%M %p') print(time) talk('The current time is ' + time) elif 'search' in command: search1 = command.replace('search', '') pywhatkit.search(command) google = search1.summary(search1, 2) talk(google) print(google) elif 'Who' or 'What' or 'Where' in command: person = command.replace('who' or 'what' or 'where', '') info = wikipedia.summary(person, 2) talk(info) print(info) elif 'funny' or 'joke' or 'sarcastic' or 'silly' or 'bored' in command: talk(pyjokes.get_joke()) print(pyjokes.get_joke()) else: talk('Could you please repeat that?')
def llamar_comando(comand, valor): if comand == 'saludo': saludo() elif comand == 'hora': hora = time.strftime('%Y-%m-%d %H:%M:%S', time.localtime()) decir(hora) elif comand == 'wikipedia_search': if valor: decir(wikiSearch(valor)) elif comand == 'traducir': if valor: traducir(valor) elif comand == 'google_search': if valor: pywhatkit.search(valor) elif comand == 'buscar_musica': if valor: buscar_musica(valor) elif comand == 'mensaje': if valor: hora = time.strftime('%H', time.localtime()) min = time.strftime('%M', time.localtime()) seg = time.strftime('%S', time.localtime()) m = int(min) + 1 decir("que quieres poner en el mensaje") texto = escuchar() pywhatkit.sendwhatmsg("+55555555555", texto, int(hora), m) elif comand == 'youtube_search': if valor: pywhatkit.playonyt(valor)
def perform_task(command): command = command.split(' ') command = [x.lower() for x in command] print(command) if command[0] in robot_name: if command[1] == 'play': video = ' '.join(command[2:]) engine.say(f'Sure playing {video}') pywhatkit.playonyt(video) elif command[1] == 'search': query = ' '.join(command[2:]) engine.say('Searching on google ') pywhatkit.search(query) elif len(command) > 3 and (command[1] == 'give' or command[1] == 'gave') and (command[2] == 'info' or command[2] == 'in'): query = ' '.join(command[3:]) try: info = wikipedia.summary(query, sentences=3) engine.say(info) print(info) except: engine.say('Sorry coudnt find what you were looking for ') elif command[1] == 'stop': global running engine.say('Shutting down ') running = False else: engine.say('Hey how are you doing ') else: engine.say('hey please Give an valid command ') print_current_commands()
def run_alexa(): command = take_command() if 'time' in command: time = datetime.datetime.now().strftime('%I:%M %p') print(time) talk('Current time is ' + time) elif 'play' in command: song = command.replace('play', '') talk('playing ' + song) pywhatkit.playonyt(song) elif 'tell me about' in command: look_for = command.replace('tell me about', '') info = wikipedia.summary(look_for, 1) print(info) talk(info) elif 'joke' in command: talk(pyjokes.get_joke()) elif 'date' in command: talk('Sorry vaiya, I am in another relation') elif 'how are you' in command: talk('I am fine. Thank you') elif 'what is your name' in command: talk('my name is alexa') elif "what's your name" in command: talk('my name is alexa') elif 'who are you' in command: talk( 'my name is alexa. I am intelligent virtual assistant robot and developed by Abdur Rouf' ) else: talk('I did not get it but I am going to search it for you') pywhatkit.search(command)
def run_sara(): talk("Hi, I am your personal desktop assistant") command=take_command() print(command) if 'play' in command: song=command.replace('play','') talk('playing'+song) pywhatkit.playonyt(song) elif 'time' in command: tm=datetime.datetime.now().strftime('%I %M %p') print(tm) talk('Current time is' +tm) elif 'who is' in command: person=command.replace('who is','') info=wikipedia.summary(person,1) talk(info) elif 'joke' in command: talk(pyjokes.get_joke()) elif 'sleep' in command: talk("Ok bye and take care") exit() elif 'search' in command: sear = command.replace('search','') pywhatkit.search(sear) else: talk('Sorry, Please say the command again')
def run_siri(): command = take_command() if 'play' in command: talk('playing') print('playing') kit.playonyt(command) if 'send' in command: talk('sending') print('sending...') #sorry this number is random you can change the mobile number to whom ever you want to send the message!! kit.sendwhatmsg("+919452380123", command[4:], 23, 20, 1) if 'search' in command: talk('searching') print('searching') kit.search(command[6:]) if 'find about' in command: talk('finding information about {}'.format(command[10:])) print("Finding") kit.info(command[10:], lines=5) else: talk("I don't know what are you talking about")
def run_alexa(): command = take_command() if 'play' in command: command = command.replace('play', '').replace('on youtube','') talk('Playing' + command) kit.playonyt(command) elif 'time' in command: time = datetime.datetime.now().strftime('%I:%M %p') print(time) talk('Currently time is ' + time) elif 'google' in command: command = command.replace('on google', '').replace('search', '').replace('could you please','') print(command) kit.search(command) elif 'wikipedia' in command: data = command.replace('on wikipedia', '').replace('search', '').replace('could you please','') print(data) info = wikipedia.summary(data,2) print(info) talk(info) elif 'joke' in command: talk(joke.get_joke()) elif 'read' in command: read_pdf() elif 'thank' in command: talk('your welcome, tell me how can i help you ') elif bool(command): print(command) talk('Sorry i dont understand, Please say again..') print('Executed')
def google(self, chunk, keywords): print("Buscando en google") toSearch = [] for word in chunk: if word[0] not in commands_key_words["GOOGLE"]: toSearch.append(word[0]) separator = ' ' pywhatkit.search(separator.join(toSearch))
def search_google(): try: if google.get() != "": kit.search(google.get()) else: tkinter.messagebox.showerror("Eroor", "Please Enter Search Name") except: tkinter.messagebox.showerror("Error", "Network Error")
def searching(): r=sr.Recognizer() with sr.Microphone() as mic: audio=r.listen(mic) print(r.recognize_google(audio)) find=r.recognize_google(audio) #find=input() print('Searching........') kit.search(find)
def run_dude(): xyz=takecommands() song=xyz.replace("play","") if "play" in xyz.lower(): talk("Playing " + song) pywhatkit.playonyt(song) if "send message" in xyz.lower(): pywhatkit.sendwhatmsg("","",11,40) if "search" in xyz.lower(): pywhatkit.search(xyz)
def websiteRecoganizer(): if '.com' in query: webbrowser.open(query) elif 'search on google' in query: kit.search(query) elif 'show my browsing history' in query: # bh = browserhistory.get_browserhistory() # for key,value in bh: # print(key,value) pass
def run_alexa(): command = take_command() if "play" in command: video = command.replace('play', '') talk(f"I am playing {video}") pywhatkit.playonyt(video) elif "search" in command: search = command.replace('search', '') talk("okey, I will search") pywhatkit.search(search) elif 'about' in command: search = command.replace('about', '') talk(wikipedia.summary(search))
def run_sunday(): command = take_command() print(command) if 'youtube' in command: command = command.replace('youtube','') talk("Open " + command) print("final : "+command) pywhatkit.playonyt(command) if 'google' in command: command = command.replace('google','') talk('searching '+command) pywhatkit.search(command)
def run_ai(): command = take_command() print(command) if 'play' in command: song = command.replace('play','') talk("playing " + song) # print(song) pywhatkit.playonyt(song) elif 'search' in command: result = command.replace('search','') talk('searching ' + result) pywhatkit.search(result) elif 'time' in command: time = datetime.datetime.now().strftime('%I :%M %p') print(time) talk("Time is " + time) elif 'tell me about' in command: person = command.replace('tell me about','') info = wikipedia.summary(person,2) print(info) talk(info) elif 'who made you' in command: talk('Mr Mohamed Alalamey') print('Mr Mohamed Alalamey') elif 'boyfriend' in command: print('Yes i have') talk('Yes i have') elif 'joke' in command: talk(pyjokes.get_joke()) # print(laugh()) laugh() elif 'thanks' in command: talk('You are welcomed') print('You are welcomed') elif 'bye' in command: talk('Bye') exit() else: talk('Please say the command again.')
def run_alexa(): command = take_command() print(command) if 'play' in command: song = command.replace('play', '') talk('playing ' + song) pywhatkit.playonyt(song) elif 'time' in command: time = datetime.datetime.now().strftime('%I:%M %p') talk('The time right now is ' + time) elif 'tell me about' in command: person = command.replace('tell me about', '') info = wikipedia.summary(person, 2) print(info) talk(info) elif 'sad' in command: talk('Everything will be fine') elif 'bored' in command: talk('You can ask me to say some Jokes, Sir') elif 'joke' in command: talk(pyjokes.get_joke()) elif 'how are you' in command: talk('I am very happy and glad to help you') elif 'happy' in command: talk('I am happy because you are happy') elif 'funny' in command: talk('Oh nice, may i tell you another joke?') elif 'who are you' in command: talk('I am Jarvis your personal assistant and always at you service') elif 'who is your developer' in command: talk( 'Mehul Totala made me and gave me this life. I am thankful to him for making me.' ) elif 'search' in command: search = command.replace('search', '') pywhatkit.search(search) elif 'message' in command: talk('please type the message') number = input('Number: ') message = input('message: ') hrs = int(input('Hours: ')) min = int(input('Min: ')) pywhatkit.sendwhatmsg(number, message, hrs, min) elif 'shutdown' in command: talk('OK, Closing pc down in 50 seconds') pywhatkit.shutdown(50) elif 'cancel' in command: talk('OK') pywhatkit.cancelShutdown() else: talk('Please ask Mehul to add answer to your command')
def hello_dear(): command = take_command() if 'time' in command: time = datetime.datetime.now().strftime('%I:%m:%p') print(time) talk(time) elif 'play' in command: print(command) command = command.replace('play','') pywhatkit.playonyt(command) elif 'about' in command or 'search' in command: print(command) command = command.replace('search','').replace('about','') pywhatkit.search(command)
def run_cyber(): global emptyCount if emptyCount == 3: talk("Sir, you can stop my execution by saying Cyber Exit. Otherwise I'm gonna do it by myself for the next " "time!") elif emptyCount == 4: talk("I think you don't want to tell something. But I give you one more chance") global isRunning isRunning = False command = take_command() if command != '': if "cyber" in command: print("Cyber got command") emptyCount = 0 command = commandCutter(command, "cyber") print(f"Command => {command}") if "time" in command: time = datetime.datetime.now().strftime("%I:%M %p") talk(f"Sir, current time is {time} now") print("Executed process => telling about current time") print(f"Current time is {time}") elif "play" in command: song = commandCutter(command, "play") talk(f"I'm opening {song} for you boss. Enjoy!") print(f"Executed process => playing {song} music on youtube ...") pywhatkit.playonyt(song) elif "search for" and "on google" in command: searchingStuff = commandCutter(command, "search for") searchingStuff = commandCutter(searchingStuff, "on google") talk(f"I'm looking for {searchingStuff} on google") print(f"Executed process => searching for {searchingStuff} on google ...") pywhatkit.search(searchingStuff) elif "search for" and "on wikipedia" in command: searchingStuff = commandCutter(command, "search for") searchingStuff = commandCutter(searchingStuff, "on wikipedia") talk(f"I'm looking for {searchingStuff} on wikipedia") print(f"Executed process => searching for {searchingStuff} on wikipedia ...") info = wiki.summary(searchingStuff, 2) print(f"Info : {info}") talk( f"Here is the info about {searchingStuff} that I found for you : {info}. That's the brief info about " f"your searching") elif "exit" in command: isRunning = False else: talk("Please sir repeat again. I can't understand") else: emptyCount += 1
def index(): user_input = request.args.get('user_input') user_input = user_input.lower() print(user_input) if "search youtube" in user_input: user_input = user_input.replace('search youtube', '') pywhatkit.playonyt(user_input) return jsonify( {'user_input': str("searched youtube" + str(user_input))}) elif "search" in user_input: user_input = user_input.replace('search', '') pywhatkit.search(user_input) return jsonify({'user_input': str("searched" + str(user_input))}) else: return jsonify({'user_input': str(chat_API.brain(user_input))})
def run(): rec = listen() if 'busca' in rec: # esto es para cuando le decimos una palabra en espesifico el programa nos ejecutara ;ago en esepecificp search = rec.replace( 'busca', '') # aca hacemos lo mismo que con el nombrey borramos talk('buscando' + search ) # le indicamos que diga reproducinedo + lo quue hallamos dicho pywhatkit.search(search) if 'hora' in rec: hora = datetime.datetime.now().strftime('%I:%M %p') talk('son las :' + hora) elif 'que es' in rec: orden = rec.replace('busca', '') info = wikipedia.summary(orden, 1) talk(info)
def search_on_google(data): words = data.split(' ') extra_words = [ 'search', 'in', 'on', 'for', 'about', 'related', 'to', 'krna', 'kro', 'google', 'ke', 'bare', 'mai', 'main', 'per', 'pr' ] if 'in google' in data or 'on google' in data or 'google pr' in data or 'google mai' in data: for item in extra_words: try: # print(item) words.remove(item) except: continue kit.search(words) return f'searching on google about {words}'