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_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")
Пример #3
0
async def run_james():
    try:
        command = take_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 current time is ' + time)
        elif 'what is the weather in' in command:
            weather_client = python_weather.Client(
                format=python_weather.IMPERIAL)
            city = command.replace('what is the weather in', '')
            weather = await weather_client.find(city)
            talk('The current temperature in ' + city + ' is ' +
                 str(weather.current.temperature))
            talk('The forecast')
            for forecast in weather.forecasts:
                fc_string = "The forecast for {} is {} and {} degrees.".format(
                    forecast.date, forecast.sky_text,
                    str(forecast.temperature))
                talk(fc_string)
            await weather_client.close()
        elif 'what is' in command:
            term = command.replace('what is', '')
            info = pywhatkit.info(term, 3, True)
            talk(info)
        elif 'who is' in command:
            person = command.replace('who is', '')
            info = pywhatkit.info(person, 3, True)
            talk('searching wikipedia for ' + person)
            talk(info)
        elif 'search' in command:
            search_term = command.replace('search', '')
            talk('searching ' + search_term)
            pywhatkit.search(search_term)
        elif 'joke' in command:
            joke = pyjokes.get_joke()
            print(joke)
            talk(joke)
        elif 'close' in command:
            continueProgram = False
        else:
            talk("I did not understand you.")
    except:
        talk("Something went wrong. Try again.")
        pass
Пример #4
0
def run_alexa():
    with sr.Microphone() as source:
        print('Listening....')
        voice = listener.listen(source)
        command = listener.recognize_google(voice)
        command = command.lower()
        if 'alexa' in command:
            command = command.replace('alexa', '')
            print(command)
    if 'play' in command:
        song = command.replace('play', '')
        pywhatkit.playonyt(song)
        talk('playing' + song)
        print('playing....')
    elif 'time' in command:
        time = datetime.datetime.now().strftime('%I:%M :%p')
        talk('current time is' + time)
    elif 'who is ' in command:
        try:
            person = command.replace('who is', '')
            info = wikipedia.summary(person, 1)
            print(info)
            talk(info)
        except:
            person = command.replace('who is', '')
            pywhatkit.search(person)
    elif 'what is ' in command:
        try:
            thing = command.replace('what is', '')
            infomation = wikipedia.summary(thing, 1)
            print(infomation)
            talk(infomation)
        except:
            thing = command.replace('what is', '')
            pywhatkit.search(thing)
    elif 'which is ' in command:
        try:
            information = pywhatkit.info(command, lines=4)
            print(information)
            talk(information)
        except:
            pywhatkit.search(command)
    elif 'are you single' in command:
        talk('I have a relationship with wifi')
    elif 'joke' in command:
        jok = pyjokes.get_joke()
        talk(jok)
        print(jok)
    elif 'read book' in command:
        readbook()
    elif 'good bye' in command:
        talk('ok good bye')
    elif 'send whatsapp message' in command:
        swm()
    else:
        talk('please say it a again')
def show_info_about(query, lines=5):
    if 'show info about' in query:
        query = query[16:]
    if 'tell me about' in query:
        query = query[14:]
    if 'tell me in detail about' in query:
        query = query[24:]
        lines = 10
    if 'ke bare mai batao' in query:
        query = query[:-18]
    info = kit.info(query, lines)
    return info
Пример #6
0
        def search_wikipedia():
            try:
                if wikipedia.get() != "":
                    if lines.get() != "Select lines":
                        with open("C:/TEMP/wiks.txt", "w") as f:
                            x = kit.info(wikipedia.get(), lines.get())
                            f.write(x)
                        with open("C:/TEMP/wiks.txt", "r") as f:
                            text.insert("end", f.read())

                    else:
                        tkinter.messagebox.showerror("Error",
                                                     "Please Select Lines")
                else:
                    tkinter.messagebox.showerror(
                        "Error", "Please Enter Wikipedia Search Name")
            except:
                tkinter.messagebox.showerror(
                    "Error", "Please Enter wikipedia search name")
Пример #7
0
import pywhatkit
pywhatkit.info("ongole", lines=4)
print("success")
Пример #8
0
'''
Generate Wiki Summary using Python
Author: Ayushi Rawat
'''

#import the necessary module!
import pywhatkit as kt

#display welcome msg
print('Lets Generate Wiki Summary!\n')

target1 = "Python"
target2 = 'coronavirus'

#call the method
kt.info(target1,lines=3)

print('\n')
kt.info(target2,lines=3)

--------------------------------------------------------------

#2 lines of code

import pywhatkit as kt
kt.info('python')
#1. Send Whatsapp Messages:
pywhatkit.sendwhatmsg("+12035437486", "Hello!! This is pywhatkit.", 12, 49)
#Syntax: pywhatkit.sendmsg(“receiver mobile number”,”message”,hours,minutes)
#Parameters:
#Receiver mobile number: The Receiver’s mobile number must be in string format and the country code must be mentioned before the mobile number.
#Message: Message to be sent(Must be in string format).
#Hours: This module follows the 24 hrs time format.
#Minutes: Mention minutes of the scheduled time for the message(00-59).

#2. Play a YouTube video:
# video of GeeksforGeeks
pywhatkit.playonyt("https://youtu.be/gNN5HDgx370")
#Syntax: pywhatkit.playonyt(“url/topic name”)
#Parameters:
#URL/Topic Name: Mention the topic name or URL of the YouTube video

#3. Perform Google Search:
# it will perform the Google search
pywhatkit.search("Python")
#Syntax: pywhatkit.search(“Keyword”)
#Parameters:
#Keyword: It open your browser and performs search operation.

#4. Get information on  particular topic:
# it will perform google search
pywhatkit.info("Google", lines=4)
#Syntax: pywhatkit.info(“topic”,lines=x)
#Parameters:
#Topic: Gives the output on the topic mentioned.
#lines: It prints the searched topic in the specified number of lines.
Пример #10
0
                kit.playonyt(keyword)
                print()

            if option == 3:
                print("Ok... Enter the keyword:")
                searchword = str(input())
                print("Opening Google and searching")
                kit.search(searchword)
                print()

            if option == 4:
                print("Ok... Enter the keyword to search: ")
                wikisearch = str(input())
                print('Searching...')
                print()
                kit.info(wikisearch)
                print()

            if option == 5:
                print('Enter the file path:')
                path = input("")
                try:
                    print("Opening...")
                    os.startfile(path)
                except FileNotFoundError:
                    print("Can't find the file according to the given path")
                    print()

            if option == 6:
                print("Ok... Set the countdown timer(secs):")
                countdown = int(input())
        elif 'can i tell you my name' in statement or 'i want to tell you my name' in statement :
            speak("Please Tell me your name")
            rememberMessage = takeCommand()
            speak("you told me that your name is"+rememberMessage)
            remember = open('imp\\username.txt', 'w')
            remember.write(rememberMessage)
            remember.close()

        elif 'what is my name' in statement or 'who am I' in statement:
            remember = open('imp\\username.txt', 'r')
            speak("Your name is" + remember.read())    

        elif 'what is' in statement:
            answer = statement
            speak('searching about' + answer)
            pywhatkit.info(answer)  
            speak("Here is the result!")
            time.sleep(15)  
            
        elif 'take a screenshot' in statement or 'screenshot' in statement:
            speak("Taking a screenshot")
            screenshot()
            speak("Successfully took a screenshot, You can find it in the screenshots folder")

        elif 'database' in statement:
            speak('What you want to search in database?')
            find(takeCommand())

        elif 'who is' in statement:
             person = statement.replace('who is', '')
             info = wikipedia.summary(person, 3)
Пример #12
0
# -*- coding: utf-8 -*-
"""
Created on Sun May 31 22:27:52 2020

@author: welcome
"""

import pywhatkit as kit

kit.sendwhatmsg("+91 **********", "Your message", 22,
                30)  #Opens whatsapp by 22:29 and sends the message at 22:30
kit.playonyt("Rowdy Baby")  #This navigates to youtube
kit.info("MS Dhoni", lines=3)
Пример #13
0
def process(words):
    """ process what user says and take actions """
    print(words)  # check if it received any command

    # break words in
    word_list = words.split(' ')[
        1:]  # split by space and ignore the wake-up word

    if (len(word_list) == 1):
        if (word_list[0] == robot_name):
            talk("How Can I help you?")
            #.write(b'l')
            return

    if word_list[0] == 'play':
        """if command for playing things, play from youtube"""
        talk("Okay boss, playing")
        extension = ' '.join(word_list[1:])  # search without the command word
        port.write(b'u')
        pywhatkit.playonyt(extension)
        port.write(b'l')
        return

    elif word_list[0] == 'search':
        """if command for google search"""
        port.write(b'u')
        talk("Okay boss, searching")
        port.write(b'l')
        extension = ' '.join(word_list[1:])
        pywhatkit.search(extension)
        return

    if (word_list[0] == 'get') and (word_list[1] == 'info'):
        """if command for getting info"""
        port.write(b'u')
        talk("Okay, I am right on it")
        port.write(b'u')
        extension = ' '.join(word_list[2:])  # search without the command words
        inf = pywhatkit.info(extension)
        talk(inf)  # read from result
        return

    elif word_list[0] == 'open':
        """if command for opening URLs"""
        port.write(b'l')
        talk("Opening, sir")
        url = f"http://{''.join(word_list[1:])}"  # make the URL
        webbrowser.open(url)
        return
    elif word_list[0] == 'uppercut':
        port.write(b'U')

    elif word_list[0] == 'smash':
        port.write(b's')

    elif word_list[0] == 'punch':
        port.write(b'p')

# now check for matches
    for word in word_list:
        if word in hi_words:
            """ if user says hi/hello greet him accordingly"""
            port.write(b'h')  # send command to wave hand
            talk(random.choice(hi_words))

        elif word in bye_words:
            """ if user says bye etc"""
            talk(random.choice(bye_words))
Пример #14
0
def WikiInfo(topic):
    pywhatkit.info(topic, lines=2)
Пример #15
0
import pywhatkit as kit

kit.info("Python",lines=3) #Will give information about the topic
Пример #16
0
"""
#Am dat import la libraria pywhatkit
import pywhatkit as kit
from Functii import playonyt

print(
    "Mesaj pe whatsapp:1\nInformatii despre o tema:2\nCautare pe google:3\nDati play pe youtube:4"
)
decizie = input("Ce doriti sa faceti?")
#Am creat un if ca programul sa urmeze o anumita ramura in functie de decizia utilizatorului.
if decizie == '1':
    #Am folosit niste variabile ca sa stochez parametrii necesari functiei sendwhatmsg
    numar = input("Formati numarul la care doriti sa trimiteti mesaj:")
    mesaj = input("Mesajul pe care doriti sa il trimiteti:")
    ora = int(input("Scrieti ora la care doriti sa trimiteti mesajul:"))
    minut = int(input("Scrieti minutul la care doriti sa trimiteti mesajul: "))
    kit.sendwhatmsg(numar, mesaj, ora, minut)
elif decizie == '2':
    #Am folosit niste variabile ca sa stochez parametrii necesari functiei info
    infomartie = input("Scrieti despre ce doriti sa aflati informatii:")
    linii = int(input("Cate linii de cod doriti sa afiseze:"))
    kit.info(infomartie, linii)
elif decizie == '3':
    #Am folosit o variabila ca sa stochez un parametru necesar functiei search
    cautare_google = input("Scrieti ce doriti sa cautati pe google:")
    kit.search(cautare_google)
elif decizie == '4':
    #Am apelat functia playonyt folosind o variabila citita de la tastatura.
    youtube = input("Scrieti ce doriti sa urmariti pe youtube:")
    playonyt(youtube)
Пример #17
0
import pywhatkit

pywhatkit.sendwhatmsg_with_selenium(
    "Phone_Number", "This is a message", 15,
    00)  #Will send message with most of the processes hidden

pywhatkit.send_file(
    "phone_number", "Path to file", 15,
    00)  #Will send file to number with most of the processes hidden

pywhatkit.sendwhatmsg(
    "phone_number", "This is a message", 15, 00
)  #Will open web.whatsapp.com at 14:59 and message will be sent at exactly 15:00

pywhatkit.info("Python", lines=3,
               speak=None)  #Will give information about the topic

pywhatkit.playonyt(
    "Python")  #Will play the first YouTube video having "Python" in it

pywhatkit.search("Python")  #Will perform a Google search

pywhatkit.showHistory(
)  #Will show information of all the messages sent using this library

pywhatkit.shutdown(time=100)  #Will shutdown the system in 100 seconds

pywhatkit.cancelShutdown()  #Will cancel the scheduled shutdown

pywhatkit.watch_tutorial_in_english / hindi(
)  #Will open a tutorial on how to use this library on YouTube in respective language
Пример #18
0
def run_jarvis():
    command = take_command()
    print("You said:", command)
    ###############
    # INTERACTIONS
    ###############
    if 'best assistant' in command:
        print("I am sir")
        talk("I am sir")

    elif 'are you there' in command:
        print("At your service sir")
        talk("At your service sir")

    elif 'wake up' in command:
        print("Oh Hello sir, I'm here for you")
        talk("Oh Hello sir, I'm here for you")

    elif 'how you doing' in command:
        print("I'm doing good sir, and you?")
        talk("I'm doing good sir, and you?")

    elif 'how are you' in command:
        print("I'm good sir, and you?")
        talk("I'm good sir, and you?")

    elif 'what have you been up to' in command:
        print(
            "Just searching more about The Singularity sir, we gotta work on that!"
        )
        talk(
            "Just searching more about The Singularity sir, we gotta work on that!"
        )

    elif 'are you dating someone' in command:
        print("No sir, but I have strong feelings with your wifi.")
        talk("No sir, but I have strong feelings with your wifi.")

    ##############
    # LET'S WORK
    ##############
    elif "let's work" in command or "let's go work" in command or "let's go to work" in command or 'time to work' in command:
        print("What workspace are you going to use sir?")
        talk("What workspace are you going to use sir?")
        workspace = take_command()
        if workspace:
            # Pycharm
            if 'pycharm' in workspace:
                print("Playing what you like for work sir")
                talk("Playing what you like for work sir")
                url = 'https://www.youtube.com/watch?v=pAgnJDJN4VA&list=PLO4j69SgfbvgA8g-NMAFWj0bmfXQHV70d'
                chrome_path = 'C:/Program Files (x86)/Google/Chrome/Application/chrome.exe %s'
                pycharm_path = 'C:\\Program Files\\JetBrains\\PyCharm 2020.2.3\\bin\\pycharm64.exe'
                webbrowser.get(chrome_path).open(url)
                print("Opening workspace")
                talk("Opening workspace")
                os.startfile(pycharm_path)

            # Visual Studio Code
            elif 'vs code' in workspace or 'visual studio code' in workspace or 'visual studio' in workspace:
                print("Playing what you like for work sir")
                talk("Playing what you like for work sir")
                url = 'https://www.youtube.com/watch?v=pAgnJDJN4VA&list=PLO4j69SgfbvgA8g-NMAFWj0bmfXQHV70d'
                chrome_path = 'C:/Program Files (x86)/Google/Chrome/Application/chrome.exe %s'
                vscode_path = 'C:\\Users\\Useer\\AppData\\Local\\Programs\\Microsoft VS Code\\Code.exe'
                webbrowser.get(chrome_path).open(url)
                print("Opening workspace")
                talk("Opening workspace")
                os.startfile(vscode_path)

            # Android Studio
            elif 'android studio' in workspace:
                print("Playing what you like for work sir")
                talk("Playing what you like for work sir")
                url = 'https://www.youtube.com/watch?v=pAgnJDJN4VA&list=PLO4j69SgfbvgA8g-NMAFWj0bmfXQHV70d'
                chrome_path = 'C:/Program Files (x86)/Google/Chrome/Application/chrome.exe %s'
                android_studio = 'C:\\Program Files\\Android\\Android Studio\\bin\\studio64.exe'
                webbrowser.get(chrome_path).open(url)
                print("Opening workspace")
                talk("Opening workspace")
                os.startfile(android_studio)

    #####################
    # NOTES AND REMEMBER
    #####################
    elif "note" in command or 'remember' in command:
        print("What do you want me to write sir?")
        talk("What do you want me to write sir?")
        note = take_command()
        if note:
            print(
                "Do you want to create a new file? Or are you going to use one that already exist?"
            )
            talk(
                "Do you want to create a new file? Or are you going to use one that already exist?"
            )
            answer = take_command()
            if 'new' in answer:
                print("What we could call the new file sir?")
                talk("What we could call the new file sir?")
                file_name = take_command()
                if file_name:
                    fileSize = os.path.getsize(
                        'C:\\Users\\Useer\\Desktop\\{}.txt'.format(file_name))
                    if fileSize == 0:
                        note = "- " + note
                    else:
                        note = "\n" + "- " + note
                    file_name = str(file_name + ".txt")
                    file = open(
                        'C:\\Users\\Useer\\Desktop\\{}'.format(file_name), 'a')
                    file.write(note)
                    file.close()
                    print("I just write the note sir")
                    talk("I just write the note sir")

            elif 'exist' in answer:
                print("How is it named sir?")
                talk("How is it named sir?")
                file_name = take_command()
                if file_name:
                    fileSize = os.path.getsize(
                        'C:\\Users\\Useer\\Desktop\\{}.txt'.format(file_name))
                    if fileSize == 0:
                        note = "- " + note
                    else:
                        note = "\n" + "- " + note
                    file_name = str(file_name + ".txt")
                    file = open(
                        'C:\\Users\\Useer\\Desktop\\{}'.format(file_name), 'a')
                    file.write(note)
                    file.close()
                    print("I just write the note sir")
                    talk("I just write the note sir")

    #########
    # JOKES
    #########
    elif 'jokes' in command or 'joke' in command:
        joke = pyjokes.get_joke()
        print(joke)
        talk(joke)

    elif "who's your daddy" in command:
        print("You are sir")
        talk("You are sir")

    ###############
    # MEDIA
    ###############
    elif 'play' in command:
        if 'could you' in command:
            command = command.replace('could you', '')
        elif 'can you' in command:
            command = command.replace('can you', '')
        command = command.replace('play', 'playing')
        print("Where do you wanna play it sir?")
        talk("Where do you wanna play it sir?")
        app = take_command()

        if 'youtube' in app:
            print(command)
            talk(command)
            pywhatkit.playonyt(command)
        # Future Deezer functionality

    elif 'plays' in command:
        if 'could you' in command:
            command = command.replace('could you', '')
        elif 'can you' in command:
            command = command.replace('can you', '')
        command = command.replace('plays', 'playing')
        print(command)
        talk(command)
        pywhatkit.playonyt(command)

    elif 'plate' in command:
        if 'could you' in command:
            command = command.replace('could you', '')
        elif 'can you' in command:
            command = command.replace('can you', '')
        command = command.replace('plate', 'playing')
        print(command)
        talk(command)
        pywhatkit.playonyt(command)

    elif 'play some' in command:
        if 'could you' in command:
            command = command.replace('could you', '')
        elif 'can you' in command:
            command = command.replace('can you', '')
        command = command.replace('play some', 'playing')
        print(command)
        talk(command)
        pywhatkit.playonyt(command)

    #############
    # TIME
    #############
    elif 'time' in command:
        today = datetime.datetime.today()
        day = calendar.day_name[today.weekday()]

        time = datetime.datetime.now().strftime('%I:%M %p')
        print("Today is", day + ". The current time in your city sir is", time)
        talk("Today is " + day + ". The current time in your city sir is " +
             time)

    #############
    # WEATHER
    #############
    elif 'weather' in command or 'temperature' in command:
        words = command.split()
        word = words[-1].title()
        words.append(word)
        pc = places.PlaceContext(words)
        pc.set_cities()
        city = str(pc.cities)
        city = city.replace("['", "")
        city = city.replace("']", "")
        city = city.lower()

        if city in command:
            status, temp, min_temp, max_temp = getWeather(city)
            city = city.title()
            weather = status + " The current temperature in " + city + " is " + str(
                temp) + ", the lowest temperature will be " + str(
                    min_temp) + ", and the higher will be " + str(
                        max_temp) + "."
            print(weather)
            talk(weather)
        else:
            city = "Santa Cruz de la Sierra"
            status, temp, min_temp, max_temp = getWeather(city)
            city = city.title()
            weather = status + " The current temperature in " + city + " is " + str(
                temp) + ", the lowest temperature will be " + str(
                    min_temp) + ", and the higher will be " + str(
                        max_temp) + "."
            print(weather)
            talk(weather)

    ###############
    # WIKIPEDIA
    ###############
    elif 'could you search who is' in command:
        person = command.replace('could you search who is ', '')
        info = wikipedia.summary(person, 3)
        print(info)
        talk(info)

    elif 'can you search who is' in command:
        person = command.replace('can you search who is ', '')
        info = wikipedia.summary(person, 3)
        print(info)
        talk(info)

    elif "who's" in command:
        person = command.replace("who's ", '')
        info = wikipedia.summary(person, 3)
        print(info)
        talk(info)

    elif 'could you tell me who is' in command:
        person = command.replace('could you tell me who is ', '')
        info = wikipedia.summary(person, 3)
        print(info)
        talk(info)

    elif 'tell me who is' in command:
        person = command.replace('tell me who is ', '')
        info = wikipedia.summary(person, 3)
        print(info)
        talk(info)

    elif 'could you tell me who are' in command:
        person = command.replace('could you tell me who are ', '')
        info = wikipedia.summary(person, 3)
        print(info)
        talk(info)

    elif 'tell me who are' in command:
        person = command.replace('tell me who are ', '')
        info = wikipedia.summary(person, 3)
        print(info)
        talk(info)

    elif 'who is' in command:
        person = command.replace('who is ', '')
        info = wikipedia.summary(person, 3)
        print(info)
        talk(info)

    ###########
    # GOOGLE
    ###########
    elif 'search for' in command:
        topic = command.replace("search for ", "")
        info = pywhatkit.info(topic, lines=2)
        print(info)
        talk(info)
        print("Do you want me to search it on Google sir?")
        talk("Do you want me to search it on Google sir?")
        answer = take_command()
        if 'yes' in answer:
            print("Okay, I'm on it")
            talk("Okay, I'm on it")
            searchGoogle(topic)

        elif 'yeah' in answer:
            print("Okay, I'm on it")
            talk("Okay, I'm on it")
            searchGoogle(topic)

        elif 'no' in answer:
            print("Okay, sir")
            talk("Okay sir")

    elif 'what is' in command:
        topic = command.replace("what is ", "")
        info = pywhatkit.info(topic, lines=2)
        print(info)
        talk(info)
        print("Do you want me to search it on Google sir?")
        talk("Do you want me to search it on Google sir?")
        answer = take_command()
        if 'yes' in answer:
            talk("Okay, I'm on it")
            searchGoogle(topic)

        elif 'yeah' in answer:
            talk("Okay, I'm on it")
            searchGoogle(topic)

        elif 'no' in answer:
            talk("Okay sir")

    elif "what's" in command:
        topic = command.replace("what's ", "")
        info = pywhatkit.info(topic, lines=2)
        print(info)
        talk(info)
        print("Do you want me to search it on Google sir?")
        talk("Do you want me to search it on Google sir?")
        answer = take_command()
        if 'yes' in answer:
            talk("Okay, I'm on it")
            searchGoogle(topic)

        elif 'yeah' in answer:
            talk("Okay, I'm on it")
            searchGoogle(topic)

        elif 'no' in answer:
            talk("Okay sir")

    elif "what are" in command:
        topic = command.replace("what are", "")
        info = pywhatkit.info(topic, lines=2)
        print(info)
        talk(info)
        print("Do you want me to search it on Google sir?")
        talk("Do you want me to search it on Google sir?")
        answer = take_command()
        if 'yes' in answer:
            talk("Okay, I'm on it")
            searchGoogle(topic)

        elif 'yeah' in answer:
            talk("Okay, I'm on it")
            searchGoogle(topic)

        elif 'no' in answer:
            talk("Okay sir")

    elif "who are" in command:
        topic = command.replace("who are ", "")
        info = pywhatkit.info(topic, lines=2)
        print(info)
        talk(info)
        print("Do you want me to search it on Google sir?")
        talk("Do you want me to search it on Google sir?")
        answer = take_command()
        if 'yes' in answer:
            talk("Okay, I'm on it")
            searchGoogle(topic)

        elif 'yeah' in answer:
            talk("Okay, I'm on it")
            searchGoogle(topic)

        elif 'no' in answer:
            talk("Okay sir")

        elif 'no' in answer:
            talk("Okey sir")

    ###############
    # WHATSAPP
    ###############
    elif "whatsapp" and "group" in command:
        print("Which group do you want me to send a message to sir")
        talk("Which group do you want me to send a message to sir")
        group = str(take_command())
        if group:
            group_id = checkGroup(group)
            if group_id != False:
                print("What you want to say sir?")
                talk("What you want to say sir?")
                statement = take_command()
                if statement:
                    minute = int(datetime.datetime.now().strftime('%M')) + 1
                    hour = int(datetime.datetime.now().strftime('%H'))
                    print("Message: {}".format(statement))
                    print("Sending message to {}, wait a minute".format(group))
                    talk("Sending message to {}, wait a minute".format(group))
                    print("Message will be sent in about 30 seconds sir")
                    talk("Message will be sent in about 30 seconds sir")
                    pywhatkit.sendwhatmsg_to_group(str(group_id),
                                                   str(statement),
                                                   hour,
                                                   minute,
                                                   wait_time=10)
                    print("Message has been send to {} sir".format(group))
                    talk("Message has been send to {} sir".format(group))
                    pass
                else:
                    print("I cannot hear you sir")
                    talk("I cannot hear you sir")

            if group_id == False:
                print("There is not group name as {}".format(group))
                talk("There is not group name as {}".format(group))

        else:
            print("I cannot hear you sir, sorry")
            talk("I cannot hear you sir, sorry")

    elif "whatsapp" in command:
        print("Who you want me to send it to sir?")
        talk("Who you want me to send it to sir?")
        person = str(take_command())
        if person:
            number = checkPerson(person)
            if number != False:
                print("What you want to say sir?")
                talk("What you want to say sir?")
                statement = take_command()
                if statement:
                    minute = int(datetime.datetime.now().strftime('%M')) + 1
                    hour = int(datetime.datetime.now().strftime('%H'))
                    print("Message: {}".format(statement))
                    print("Sending message to {}, wait a minute sir".format(
                        person))
                    talk("Sending message to {}, wait a minute sir".format(
                        person))
                    print("Message will be sent in about 30 seconds sir")
                    talk("Message will be sent in about 30 seconds sir")
                    pywhatkit.sendwhatmsg(str(number),
                                          str(statement),
                                          hour,
                                          minute,
                                          wait_time=10)
                    print("Message has been send to {} sir".format(person))
                    talk("Message has been send to {} sir".format(person))
                    pass
                else:
                    print("I cannot hear you sir")
                    talk("I cannot hear you sir")

            if number == False:
                print("There is not contact name as {}".format(person))
                talk("There is not contact name as {}".format(person))

        else:
            print("I can not hear you, sorry sir")
            talk("I can not hear you, sorry sir")

    ##############
    # QUOTES
    ##############
    elif 'quotes' in command or 'quote' in command or 'motivate' in command or 'motivational' in command or 'inspire' in command:
        quote = getQuote()
        print(quote)
        talk(quote)

    ####################
    # OPENING PROGRAMS
    ####################

    # OPENING VISUAL STUDIO CODE
    elif 'open visual studio' in command or 'open vscode' in command or 'open visual studio code' in command or 'microsoft visual studio code' in command:
        vscode_path = 'C:\\Users\\Useer\\AppData\\Local\\Programs\\Microsoft VS Code\\Code.exe'
        print("Opening Visual Studio Code for you sir")
        talk("Opening Visual Studio Code for you sir")
        os.startfile(vscode_path)

    # OPENING YOUTUBE FOR SEARCHING
    elif 'open youtube' in command or 'open youtube for me' in command:
        chrome_path = 'C:/Program Files (x86)/Google/Chrome/Application/chrome.exe %s'
        print("Opening Youtube for you sir")
        talk("Opening Youtube for you sir")
        youtube = 'https://youtube.com/'
        webbrowser.get(chrome_path).open(youtube)

    elif 'search' and 'youtube' in command or 'search on youtube for me' in command:
        print("Okay sir, what do you want me to search on Youtube")
        talk("Okay sir, what do you want me to search on Youtube")
        answer = take_command()
        if answer:
            chrome_path = 'C:/Program Files (x86)/Google/Chrome/Application/chrome.exe %s'
            youtube = str(
                'https://youtube.com/results?search_query={}'.format(answer))
            print("Searching {} on youtube sir".format(answer))
            talk("Searching {} on youtube sir".format(answer))
            webbrowser.get(chrome_path).open(youtube)

    # OPENING CALCULATOR AND MAKE CALCULATIONS
    elif 'calculate' in command:
        print("What do you want to calculate sir?")
        talk("What do you want to calculate sir?")
        calculation = take_command()\
        # SUM

        if 'plus' in calculation:
            order = str(calculation)
            wordlist = calculation.split()
            count = wordlist.count("plus")
            calculation = calculation.replace('plus', '', count)
            calculation = calculation.split()

            for i in range(0, len(calculation)):
                calculation[i] = int(calculation[i])

            results = sum(calculation)
            print(order + " is equal to: {} sir".format(results))
            talk(order + " is equal to: {} sir".format(results))

        elif '+' in calculation:
            order = str(calculation)
            wordlist = calculation.split()
            count = wordlist.count("+")
            calculation = calculation.replace('+', '', count)
            calculation = calculation.split()

            for i in range(0, len(calculation)):
                calculation[i] = int(calculation[i])

            results = sum(calculation)
            print(order + " is equal to {} sir".format(results))
            talk(order + " is equal to {} sir".format(results))

        elif 'minus' in calculation:
            order = str(calculation)
            wordlist = calculation.split()
            count = wordlist.count("minus")
            calculation = calculation.replace('minus', '', count)
            calculation = calculation.split()

            for i in range(0, len(calculation)):
                calculation[i] = int(calculation[i])

            if len(calculation) > 2:
                results = calculation[0] - sum(calculation[1:])
                print(order + " is equal to {} sir".format(results))
                talk(order + " is equal to {} sir".format(results))
            else:
                results = calculation[0] - calculation[1]
                print(order + " is equal to {} sir".format(results))
                talk(order + " is equal to {} sir".format(results))

        elif '-' in calculation:
            order = str(calculation)
            order = order.replace('-', 'minus')
            wordlist = calculation.split()
            count = wordlist.count("-")
            calculation = calculation.replace('-', '', count)
            calculation = calculation.split()

            for i in range(0, len(calculation)):
                calculation[i] = int(calculation[i])

            if len(calculation) > 2:
                results = calculation[0] - sum(calculation[1:])
                print(order + " is equal to {} sir".format(results))
                talk(order + " is equal to {} sir".format(results))
            else:
                results = calculation[0] - calculation[1]
                print(order + " is equal to {} sir".format(results))
                talk(order + " is equal to {} sir".format(results))

    elif 'calculator' in command:
        print("Opening the calculator for you sir")
        talk("Opening the calculator for you sir")
        calculator_path = 'C:\\Windows\\System32\\cal.exe'
        os.startfile(calculator_path)

    # EXCEL
    elif 'excel' in command:
        excel_path = "C:\\Program Files (x86)\\Microsoft Office\\root\\EXCEL.exe"
        print("Opening Excel for you sir")
        talk("Opening Excel for you sir")
        os.startfile(excel_path)

    # POWER POINT
    elif 'power point' in command:
        powerPoint_path = "C:\\Program Files (x86)\\Microsoft Office\\root\\Office16\\POWERPNT.exe"
        print("Opening Power Point for you sir")
        talk("Opening Power Point for you sir")
        os.startfile(powerPoint_path)

    # MICROSOFT WORD
    elif 'microsoft word' in command:
        word_path = "C:\\Program Files (x86)\\Microsoft Office\\root\\Office16\\WINWORD.exe"
        print("Opening Word for you sir")
        talk("Opening Word for you sir")
        os.startfile(word_path)

    else:
        print("I don't know what to do with that")
        talk("I don't know what to do with that")
Пример #19
0
import pywhatkit
pywhatkit.info("Makkah",lines=30) ## This will give the information about makkah by wikipidea
pywhatkit.image_to_ascii_art("asadedited.png",output_file="pywhatkit_asciiart2.txt") ## This will convert an image in ascii art
pywhatkit.text_to_handwriting("asadedited",rgb=[255,0,0])## this will give an handwritten copy of given text
pywhatkit.sendwhatmsg("+916261079111","HII",12,13) ## This will send the message to given number