コード例 #1
0
ファイル: main.py プロジェクト: geek-samim/jarvisAI
def run_jarvis():
    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')
        print(time)
        talk('Current time is' + time)
    elif 'search' in command:
        person = command.replace('search', '')
        info = wikipedia.summary(person, 1)
        print(info)
        talk(info)
    elif 'joke' in command:
        talk(pyjokes.get_joke())
    elif 'date' in command:
        date = datetime.date.today().strftime('%B %d, %Y')
        print(date)
        talk('The Date is' + date)
    elif 'day' in command:
        day = datetime.date.today().strftime("%A")
        print(day)
        talk('Today is' + day)
    else:
        talk('Sorry, please say it again')
コード例 #2
0
ファイル: main.py プロジェクト: DIPONGKARGHOSE/Alexa
def playing():
    comm = take_command()
    print(comm)
    if 'play' in comm:
        music = comm.replace('play', '')
        talk('playing' + music)
        print(music)
        pywhatkit.playonyt(music)
    elif 'time' in comm:
        time = datetime.datetime.now().strftime('%I:%M %p')
        print(time)
        talk('current time is:' + time)
    elif 'date' in comm:
        time = datetime.datetime.now().strftime('%B:%A:%Y')
        time1 = datetime.datetime.now().strftime('%m:%d:%Y')
        talk('current DATE  is:' + time + time1)

    elif 'who is' in comm:
        man = comm.replace('who is', '')
        info = wikipedia.summary(man, 10)
        talk(info)
    elif 'joke' in comm:
        talk(pyjokes.get_joke())
    else:
        print('please say again')
コード例 #3
0
def rodai():
    comando = tomar_comando()
    print(comando)
    if 'toque' in comando:
        musica = comando.replace('toque', '')
        falar('Tocando ' + musica)
        pywhatkit.playonyt(musica)
    elif 'horas' in comando:
        hora = datetime.datetime.now().strftime('%H:%M')
        falar('Agora no horário de Brasília ' + hora)
    elif 'data' in comando:
        dia = datetime.datetime.now().strftime('%d do %m de %Y')
        falar("Hoje é: " + dia)
    elif 'pesquise' in comando:
        coisa = comando.replace('pesquise','')
        info = wikipedia.summary(coisa, 2)
        falar(info)
    elif 'temperatura' in comando:
        api = 'f454b6de88f24007ba428341f2f82711'
        url = 'HIDDEN'
        #cidade = input('Nome da Cidade:')
        json_data = requests.get(url).json()
        humidade = json_data["main"]['humidity']
        temp = json_data["main"]['temp']
        sensacao = json_data["main"]['feels_like']
        tempo = ('Agora em São Paulo,  a temperatura é de {}°, com sensação térmica de {}. Já a humidade está em {}%.'.format(temp, sensacao, humidade))
        falar(tempo)
    else:
        falar('Não entendi. Por favor, diga novamente o que deseja.')
コード例 #4
0
ファイル: Alexa App.py プロジェクト: pik1989/Alexa
def run_alexa():
    command = user_commands()
    if 'play' in command:
        song = command.replace('play', '')
        #print('New Command is' +command)
        #print('The bot is telling us: Playing' +command)
        engine_talk('Playing' + song)
        pywhatkit.playonyt(song)
    elif 'time' in command:
        time = datetime.datetime.now().strftime('%I:%M %p')
        engine_talk('The current time is' + time)
    elif 'who is' in command:
        name = command.replace('who is', '')
        info = wikipedia.summary(name, 1)
        print(info)
        engine_talk(info)
    elif 'joke' in command:
        engine_talk(pyjokes.get_joke())
    elif 'weather' in command:
        engine_talk('Please tell the name of the city')
        city = user_commands()
        #weather_api = weather('Hong Kong')
        weather_api = weather(city)
        engine_talk(weather_api + 'degree fahreneit')
    elif 'stop' in command:
        sys.exit()
    else:
        engine_talk('I could not hear you properly')
コード例 #5
0
def run_alexa():
    command = user_commands()
    if 'play' in command:
        song = command.replace('play', '')
        engine_talk('Playing....' + song)
        print("Playing....")
        pywhatkit.playonyt(song)
    elif 'time' in command:
        time = datetime.datetime.now().strftime('%I:%M %p')
        print(time)

        engine_talk('Current Time is' + time)
    elif 'joke' in command:
        get_j = pyjokes.get_joke()
        print(get_j)
        engine_talk(get_j)
    elif 'who is' in command:
        person = command.replace('who the heck is', '')
        info = wikipedia.summary(person, 1)
        print(info)
        engine_talk(info)
    elif 'stop' in command:
        sys.exit()
    else:
        engine_talk("I didn't hear you properly")
        print("I didn't hear you properly")
コード例 #6
0
def play_song():
    global recognizer, audio, message

    talk("What do you want to play?")

    done = False

    while not done:
        try:

            with sr.Microphone() as mic:

                recognizer.adjust_for_ambient_noise(mic, duration=0.2)
                audio = recognizer.listen(mic)

                filename = recognizer.recognize_google(audio)
                filename = filename.lower()

                pywhatkit.playonyt(filename)
                #
                talk("I opened {filename} for you Kelly")
                #
                done = True

        except sr.UnknownValueError:
            recognizer = sr.Recognizer()
            talk("I did not understand you! Please try again!")
コード例 #7
0
ファイル: main.py プロジェクト: Anuj-29/grab-the-code
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('%H:%M')
        print(time)
        talk('Current time is ' + time)
    elif 'who is' in command:
        person = command.replace('who is', '')
        info = wikipedia.summary(person, 1)  # To give only 1 line informartion
        print(info)
        talk(info)
    elif 'date' in command:
        talk('sorry, I have a headache')
    elif 'are you single' in command:
        talk('Haha, Sorry I am in a relationship with Anuj')
    elif 'joke' in command:
        p = pyjokes.get_joke()
        print(p)
        talk(pyjokes.get_joke())
    elif command:
        person = command.replace('who is', '')
        info = wikipedia.summary(person, 1)  # To give only 1 line informartion
        print(info)
        talk(info)
    else:
        talk('Please say the command again.')
コード例 #8
0
def run_alexa():
    global input_command
    input_command = user_input()
    print(input_command)
    understand = False

    if 'play' in input_command:
        song = input_command.replace('play', '')
        speak('playing' + song)
        pywhatkit.playonyt(song)
        understand = True
        sleep(4)
    elif 'time' in input_command:
        time = datetime.datetime.now().strftime('%I:%M %p')
        speak(time)
        understand = True
    elif 'joke' in input_command:
        speak(pyjokes.get_joke())
        understand = True
    elif 'bye' in input_command:
        speak('See you later!')
        understand = True

    for term in words_for_wiki:
        if term in input_command and understand == False:
            search_term = input_command.replace(term, ' ')
            info = wikipedia.summary(search_term, 1)
            speak(info)
            understand = True

    if understand == False:
        speak('I could not understand what you said.')
        run_alexa()
    elif 'goodbye' not in input_command:
        run_alexa()
コード例 #9
0
ファイル: AI_pbl.py プロジェクト: krishnumkhodke/PBL
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()
コード例 #10
0
ファイル: alexa.py プロジェクト: Omkar281100/alexa
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')
        print(time)
        talk('Current time is '+ time)



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



    elif 'date' in command:
        talk('ok i would love to go with you baby')
    elif'are you single'in command:
        talk('I am in a relationship with google')
    elif'joke' in command:
        talk(pyjokes.get_joke())
コード例 #11
0
ファイル: main.py プロジェクト: Vicky1251991/Python-Projects
def run_alexa():
    command = take_command()
    print(command)
    if 'play' in command:
        input = command.replace('play', '')
        talk('playing' + input)
        pywhatkit.playonyt(input)
    elif 'time' in command:
        time = datetime.datetime.now().strftime('%I:%M:%S %p')
        print(time)
        talk('Current time is' + time)
    elif 'date' in command:
        date = datetime.datetime.now().strftime('%d/%m/%Y')
        print(date)
        talk('Current date is' + date)
    elif 'who is' in command:
        person = command.replace('who is', '')
        info = wikipedia.summary(person, 3)
        print(info)
        talk(info)
    elif 'joke' in command:
        info = pyjokes.get_joke()
        print(info)
        talk(info)
    else:
        print('Please say the command again.')
        talk('Please say the command again.')
コード例 #12
0
def assistant():
    talk(
        "Hi there Hemant,Welcome to your own virtual assistant.. How May i help you today?"
    )
    command = listen_user()

    if command == None:
        talk("please say something")

    elif "play" in command:
        command = command.replace("play", "")
        talk("Playing" + command)
        pywhatkit.playonyt(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 is", "")
        info = wikipedia.summary(person, 1)
        talk(info)

    elif "joke" in command:
        talk(pyjokes.get_joke())

    elif "send" and "email" in command:
        email_automate.get_email_info()

    else:
        talk("Please say from one of the commands")
コード例 #13
0
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")
コード例 #14
0
def Execution():
    #Note:the code below the lines from 60 to 81 can be edited. In case you want to make your own skill and the other part of the code should not be edited
    command = listentouser().lower()
    if 'wikipedia' in command:
        command = command.replace('wikipedia', '')
        results = wikipedia.summary(command)
        print("Saaketh Said:", command)
        print(results)
        speak(results)
    elif 'play' in command:
        print("Saaketh Said:", command)
        print("Hover Said: Playing", command)
        command = command.replace('play', '')
        speak("playing" + command)
        pywhatkit.playonyt(command)
    elif 'open' and 'on brave' in command:
        bravepath = "C://Program Files//BraveSoftware//Application//brave.exe"
        web.get(bravepath).open('https://google.com')
    elif 'shutdown' in command:
        a = int(input("after how much time:"))
        pywhatkit.shutdown(time=a)
        if 'cancel shutdown' in command:
            pywhatkit.cancelShutdown()
    elif 'i donot need anything' in command or 'bye' in command:
        sys.exit()
    else:
        speak('I donot know that')
コード例 #15
0
def listen():
    command = get_command()
    if 'time' in command:
        time = datetime.datetime.now().strftime('%H:%M')
        print(time)
        talk('Current time is ' + time)
    elif 'play' in command:
        song = command.replace('play ', '')
        talk('playing' + song)
        print(f'playing {song}')
        pywhatkit.playonyt(song)
    elif 'joke' in command:
        talk(pyjokes.get_joke())
    elif 'find' in command:
        what = command.replace('find ', '')
        try:
            information = wikipedia.summary(what, 1)
        except:
            information = 'Didn\'t find ' + what + ' in wikipedia!'
        print(information)
        talk(information)
    elif command == 'Error':
        talk('I hear only silence!')
    else:
        talk('I can\'t do it yet!')
コード例 #16
0
def running_casa():
    data = take_data()
    if 'play' in data:
        #in case song being searched up has the word play
        song = data.replace('play', '')
        talk('playing' + song)
        pywhatkit.playonyt(song)

    elif 'what time is it' in data:
        print(time.ctime())
        talk(time.ctime())

    elif 'search' in data:
        command = data.replace('search', '')
        info = wikipedia.summary(command, 1)
        print(info)
        talk(info)

    elif 'joke' in data:
        print(pyjokes.get_joke())
        talk(pyjokes.get_joke())

    elif 'weather' in data:
        api_key = "Your_API_key"
        weather_url = "http://api.openweathermap.org/data/2.5/weather?"
        data = data.split(" ")
        location = str(data[5])
        url = weather_url + "appid=" + api_key + "&q=" + location
        js = requests.get(url).json()
コード例 #17
0
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.')
コード例 #18
0
ファイル: sunnyvoice.py プロジェクト: Sunil990/Sunilk
def run_sunny():
    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:%S %p')
        print(time)
        talk('current time is' + time)
    elif 'who the heck is' in command:
        person = command.replace('who the heck is', '')
        info = wikipedia.summary(person, 2)
        print(info)
        talk(info)
    elif 'date' in command:
        talk('sure darling, let us go')
    elif 'are you single' in command:
        talk('sorry, i am in a relationship with my man sunil')
    elif 'joke' in command:
        talk(pyjokes.get_joke())
    elif 'how are you' in command:
        talk('i am good, thank you, what about you')
    else:
        talk('please say it 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('%H:%M')
        talk('Current time is ' + time)
        print('Current time is ' + time)
    elif 'who is' in command:
        person = command.replace('who is ', '')
        info = wikipedia.summary(person, 1)
        talk(info)
    elif 'thanks' in command:
        talk('You are welcome')
    elif 'joke' in command:
        joke = pyjokes.get_joke()
        print(joke)
        talk(joke)
    elif 'bye' in command:
        talk('Bye Durga')
    else:
        talk('Please say the command again')
コード例 #20
0
def run_lucy():
    command = take_command()
    print(command)
    if 'play' in command:
        song = command.replace('play', '')
        talk('Ok wait a minute!' + song)
        pywhatkit.playonyt(song)

    elif 'time' in command:
        time = datatime.datatime.now().strftime('%H:%M:%S %p')
        print("samayam: " + time)
        talk("samayam: " + time)

    elif 'what is ' in command:
        person = command.replace("what is  ", '')
        info = wikipedia.summary(person, 2)
        print(info)
        talk(info)

    elif 'joke' in command:
        talk(pyjokes.get_joke())
        print(pyjokes.get_joke())

    elif 'single' in command:
        talk("Sorry! I'm in a relationship with WIFI  ")

    elif 'i love you' in command:
        talk("I Love You too.!")
    else:
        talk("Please say the command again.!")
コード例 #21
0
def ytube_search(request):
    if request.method == 'GET':
        return render(request, 'home/ytube_search.html')
    elif request.method == 'POST':
        data = request.POST.get('record')
        r = sr.Recognizer()
        with sr.Microphone() as source:
            voice_data = r.record(source, duration=5)
            try:
                voice_query = r.recognize_google(voice_data)
                kit.playonyt(voice_query)
                context = {
                    'response':
                    'Your search results will be opened in a new tab!!..',
                }
                return render(request, 'home/ytube_search.html', context)
            except sr.UnknownValueError:
                voice_query = "Could not understand audio"
                context = {
                    'response': voice_query,
                }
                return render(request, 'home/ytube_search.html', context)
            except sr.RequestError as e:
                voice_query = "Could not request results; {0}".format(e)
                context = {
                    'response': voice_query,
                }
                return render(request, 'home/ytube_search.html', context)
コード例 #22
0
ファイル: hero.py プロジェクト: Strata-Tech/AI
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')
コード例 #23
0
ファイル: main.py プロジェクト: TheLogicalNights/myAlexa
def run_alexa():
    command = take_command()
    print(command)
    if 'play' in command:
        song = command.replace('play', '')
        talk('playing the ' + 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 is' in command:
        person = command.replace('who is', '')
        info = wikipedia.summary(person, 2)
        print(info)
        talk(info)
    elif 'who the heck is' in command:
        person = command.replace('who the heck is', '')
        info = wikipedia.summary(person, 1)
        print(info)
        talk(info)
    elif 'are you single' in command:
        talk('I am in a relationship with wifi')
    elif 'joke' in command:
        talk(pyjokes.get_joke())
    elif 'good bye' in command:
        talk('good bye')
        exit(0)
    else:
        talk('Please say the command again.')
コード例 #24
0
def run_macAi():
    command = take_command()
    print(command)
    if 'play' in command:
        song = command.replace('play', '')
        speak('playing ' + song)
        pywhatkit.playonyt(song)
    elif 'time' in command:
        speak("the time is")
        time()
    elif 'who is' in command:
        person = command.replace('who is', '')
        info = wikipedia.summary(person, 1)
        speak(info)
    elif 'date' in command:
        speak("the date is")
        date()
    elif 'are you single' in command:
        speak('I am in a relationship with wi-fi') 
    elif 'who are you' in command:
        speak('I am mac, a courtesy of Meshack')
    elif 'siri' in command:
        speak('yeah; Only that our relationship is professional')
    elif 'cortana' in command:
        speak('i have only heard of her in halo')
    
    elif 'where can i hide a dead body' in command:
        speak("i'll call nine one one")
    elif 'joke' in command:
        speak(pyjokes.get_joke())
    else:
        speak('I cant get you well. Please repeat.')
コード例 #25
0
ファイル: main.py プロジェクト: Iain05/Adam
def run_ai():
    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')
        print(time)
        time = time.replace(':', '')
        talk('the time is' + time)
        print(time)

    elif 'how are' in command:
        talk(database.response_howareyou[random.randrange(0, len(database.response_howareyou))])
    elif 'good morning' in command:
        morning()
    elif 'date' or 'day' in command:
        date()

    elif 'thank you' in command:
        talk("you're welcome sir")

    else:
        talk('try again.')
コード例 #26
0
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")
コード例 #27
0
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('again?')
        talk('Current time is ' + time)
        seconds = time.time()

    elif 'who the heck is' in command:
        person = command.replace('who the heck is ', ' ')
        info = wikipedia.summary(person, 1)
        print(time)
        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())
    elif 'my car' in command:
        talk(pyjokes, getjokes())
    elif 'who is my star' in command:
        talk('your special girlfriend')
    elif 'open my camera' in command:
        talk('i don\'\t know how to do that')
        talk('im sorry')
        print("sorry")
    else:
        talk('Please say the command again.')
コード例 #28
0
ファイル: Asistant.py プロジェクト: anthuand/AsistenteVirtual
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)
コード例 #29
0
def run_alexa():
    command = take_command()
    if 'play' in command:
        song = command.replace('play','')
        print('Now playing'+ song)
        talk('Playing'+ song)
        pywhatkit.playonyt(song)
    elif 'time' in command:
        time = datetime.datetime.now().strftime('%I:%M %p')
        time2 = datetime.datetime.now().strftime('%I%M %p')
        print(time)
        talk("The time is:"+ time2)
    elif 'tell me about' in command:
        finder = command.replace('tell me about','')
        info = wikipedia.summary(finder,1)
        print(info)
        talk(info)
    elif 'joke' in command:
        temp = pyjokes.get_joke()
        print(temp)
        talk(temp)
    elif 'hello' or 'hi' in command:
        print("Hi there!")
        talk("Hi there!")
    else:
        print("Sorry, I didn't quite catch that!")
        talk("Sorry, I didn't quite catch that!")
コード例 #30
0
ファイル: main.py プロジェクト: Dip1059/python
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)