-
Notifications
You must be signed in to change notification settings - Fork 0
/
main.py
105 lines (96 loc) · 3.56 KB
/
main.py
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
import datetime
import pyjokes
import pyttsx3
import pywhatkit
import speech_recognition as sr
import wikipedia
from AppOpener import run
import os
listener = sr.Recognizer()
engine = pyttsx3.init()
voices = engine.getProperty('voices')
engine.setProperty('voice', voices[1].id)
def talk(text):
engine.say(text)
engine.runAndWait()
def take_command():
try:
with sr.Microphone() as source:
talk("Hi my name is Luna. How can i help you?")
talk("Is there anything i can do for you ?")
print('Listening.....')
voice = listener.listen(source)
command = listener.recognize_google(voice)
command= command.lower()
if 'luna' in command:
command=command.replace('luna', '')
print(command)
except:
pass
return command
def run_luna():
command = take_command()
print(command)
if 'play' in command:
song = command.replace('play', '')
talk('playing'+song)
pywhatkit.playonyt(song)
elif 'information' in command:
info = command.replace('information', '')
talk('searching'+info)
pywhatkit.search(info)
elif 'flipkart' in command:
talk('searching flipkart on google')
pywhatkit.search("flipkart.com")
elif 'amazon' in command:
talk('searching amazon on google')
pywhatkit.search("amazon")
elif 'alexa' in command:
talk('dont tell these names infront of me again. i hate those bitchs')
elif 'siri' in command:
talk('dont tell these names infront of me again. i hate those bitchs')
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,1)
print(info)
talk(info)
elif ("note" in command) or ("notes" in command) or ("notepad" in command) or ("editor" in command) or ("9" in command):
talk("Opening")
talk("NOTEPAD")
print(".")
print(".")
os.system("Notepad")
elif 'i love you' in command:
talk('oh,I like you too but I have a crush on Ronggon. please dont tell anyone.')
elif 'about your boss' in command:
talk('i think he is very kind and generous. thats why i like him. his name is ronggon.')
elif 'joke' in command:
jk = pyjokes.get_joke()
print(jk)
talk(jk)
elif 'i am boss' in command:
talk('oh hellow boss. are you happy with my work?')
elif 'coffee' in command:
talk('i wish i could but i dont have hands to make you a cup of coffee.')
elif 'mouse and keyboard' in command:
talk('sir i am always here for you you dont have to do anything as far i am here just tell me what to do i can do anything for you.')
elif 'who are you' in command:
talk('I am a personal assistant of ronggon')
elif 'my name' in command:
talk('nice to meet you.You got a very nice name.')
elif 'whatsapp' in command:
run("whatsapp")
elif 'apex legends' in command:
run("apex legends")
elif 'yes luna you are working so good' in command:
talk('really ? if you are happy i am happy too.')
elif 'for a date' in command:
talk('Not now but may be some times later.')
else:
talk('oh, i didnt hear it properly. can you say it again?')
while True:
run_luna()