25
25
import winshell as winshell # pip install winshell
26
26
from geopy .geocoders import Nominatim # pip install geopy and pip install geocoder
27
27
from geopy import distance
28
+ import turtle # pip install turtle
29
+ import random # pip install random
30
+ import snake_game # user-defined
28
31
29
32
engine = pyttsx3 .init ()
30
33
@@ -71,8 +74,8 @@ def get_command():
71
74
return query
72
75
73
76
74
- if _name_ == '_main_' :
75
-
77
+ if __name__ == '_main_' :
78
+
76
79
wish_user ()
77
80
78
81
while True :
@@ -113,22 +116,22 @@ def get_command():
113
116
114
117
elif 'open visual studio code' in query :
115
118
os .startfile ("C:\\ Users\\ 91954\\ AppData\\ Roaming\\ Microsoft\\ Windows\\ Start Menu\\ "
116
- "Programs\\ Visual Studio Code\\ Visual Studio Code" )
119
+ "Programs\\ Visual Studio Code\\ Visual Studio Code" )
117
120
118
121
elif 'open eclipse' in query :
119
122
os .startfile ("C:\\ Users\\ 91954\\ AppData\\ Roaming\\ Microsoft\\ Windows\\ Start Menu\\ "
120
- "Programs\\ Eclipse\\ Eclipse IDE for Java Developers - 2020-06" )
123
+ "Programs\\ Eclipse\\ Eclipse IDE for Java Developers - 2020-06" )
121
124
122
125
elif 'open notepad' in query :
123
126
os .startfile ("C:\\ Users\\ 91954\\ AppData\\ Roaming\\ Microsoft\\ Windows\\ "
124
- "Start Menu\\ Programs\\ Accessories\\ Notepad" )
127
+ "Start Menu\\ Programs\\ Accessories\\ Notepad" )
125
128
126
129
elif 'open pycharm' in query :
127
130
os .startfile ("C:\\ Program Files\\ JetBrains\\ PyCharm Community Edition 2020.1.1\\ bin\\ pycharm64.exe" )
128
131
129
132
elif 'open code blocks' in query :
130
133
os .startfile ("C:\\ Users\\ 91954\\ AppData\\ Roaming\\ Microsoft\\ Windows\\ Start Menu\\ "
131
- "Programs\\ CodeBlocks\\ CodeBlocks" )
134
+ "Programs\\ CodeBlocks\\ CodeBlocks" )
132
135
133
136
elif 'open mozilla firefox' in query :
134
137
os .startfile ("C:\\ Program Files\\ Mozilla Firefox\\ firefox.exe" )
@@ -144,21 +147,21 @@ def get_command():
144
147
145
148
elif 'who are you' in query :
146
149
fun_talk ("I am P.A. (Python Assistant), developed by Rishabh Ranjan, Himanshi, "
147
- "Rachit Dwivedi and Umesh Singh as a project in their college." )
150
+ "Rachit Dwivedi and Umesh Singh as a project in their college." )
148
151
149
152
elif 'what you want to do' in query :
150
153
fun_talk ("I want to help people to do certain tasks on their single voice commands." )
151
154
152
155
elif 'alexa' in query :
153
156
fun_talk ("I don't know Alexa, but I've heard of Alexa. If you have Alexa, "
154
- "I may have just triggered Alexa. If so, sorry Alexa." )
157
+ "I may have just triggered Alexa. If so, sorry Alexa." )
155
158
156
159
elif 'google assistant' in query :
157
160
fun_talk ("He was my classmate, too intelligent guy. We both are best friends." )
158
161
159
162
elif 'siri' in query :
160
163
fun_talk ("Siri, She's a competing virtual assistant on a competitor's phone. "
161
- "Not that I'm competitive or anything." )
164
+ "Not that I'm competitive or anything." )
162
165
163
166
elif 'cortana' in query :
164
167
fun_talk ("I thought you'd never ask. So I've never thought about it." )
@@ -318,13 +321,13 @@ def get_mail_info():
318
321
val_cur = float (get_command ())
319
322
# print(val_cur)
320
323
print (cur .convert (src_cur , dest_cur , val_cur ))
321
-
324
+
322
325
except Exception as e :
323
326
print ("Couldn't get what you have said, Can you say it again??" )
324
327
325
328
elif 'covid-19' in query or 'corona' in query :
326
329
fun_talk ('For which region u want to see the Covid-19 cases. '
327
- 'Overall cases in the world or any specific country?' )
330
+ 'Overall cases in the world or any specific country?' )
328
331
c_query = get_command ()
329
332
if 'overall' in c_query or 'over all' in c_query or 'world' in c_query or 'total' in c_query or 'worldwide' in c_query :
330
333
def world_cases ():
@@ -664,7 +667,7 @@ def send_whtmsg():
664
667
fun_talk (data [0 ].summary )
665
668
except Exception as e :
666
669
fun_talk ('Sorry, I am unable to find the answer for your query.' )
667
-
670
+
668
671
elif 'news' in query or 'news headlines' in query :
669
672
url = "https://news.google.com/news/rss"
670
673
client = urlopen (url )
@@ -683,3 +686,11 @@ def send_whtmsg():
683
686
684
687
except Exception as e :
685
688
pass
689
+
690
+ elif 'snake game' in query :
691
+ try :
692
+ print ("Starting the game!" )
693
+ fun_talk ("Starting the game!" )
694
+ snake_game .game ()
695
+ except Exception as e :
696
+ pass
0 commit comments