2525import winshell as winshell # pip install winshell
2626from geopy .geocoders import Nominatim # pip install geopy and pip install geocoder
2727from geopy import distance
28+ import turtle # pip install turtle
29+ import random # pip install random
30+ import snake_game # user-defined
2831
2932engine = pyttsx3 .init ()
3033
@@ -71,8 +74,8 @@ def get_command():
7174 return query
7275
7376
74- if _name_ == '_main_' :
75-
77+ if __name__ == '_main_' :
78+
7679 wish_user ()
7780
7881 while True :
@@ -113,22 +116,22 @@ def get_command():
113116
114117 elif 'open visual studio code' in query :
115118 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" )
117120
118121 elif 'open eclipse' in query :
119122 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" )
121124
122125 elif 'open notepad' in query :
123126 os .startfile ("C:\\ Users\\ 91954\\ AppData\\ Roaming\\ Microsoft\\ Windows\\ "
124- "Start Menu\\ Programs\\ Accessories\\ Notepad" )
127+ "Start Menu\\ Programs\\ Accessories\\ Notepad" )
125128
126129 elif 'open pycharm' in query :
127130 os .startfile ("C:\\ Program Files\\ JetBrains\\ PyCharm Community Edition 2020.1.1\\ bin\\ pycharm64.exe" )
128131
129132 elif 'open code blocks' in query :
130133 os .startfile ("C:\\ Users\\ 91954\\ AppData\\ Roaming\\ Microsoft\\ Windows\\ Start Menu\\ "
131- "Programs\\ CodeBlocks\\ CodeBlocks" )
134+ "Programs\\ CodeBlocks\\ CodeBlocks" )
132135
133136 elif 'open mozilla firefox' in query :
134137 os .startfile ("C:\\ Program Files\\ Mozilla Firefox\\ firefox.exe" )
@@ -144,21 +147,21 @@ def get_command():
144147
145148 elif 'who are you' in query :
146149 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." )
148151
149152 elif 'what you want to do' in query :
150153 fun_talk ("I want to help people to do certain tasks on their single voice commands." )
151154
152155 elif 'alexa' in query :
153156 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." )
155158
156159 elif 'google assistant' in query :
157160 fun_talk ("He was my classmate, too intelligent guy. We both are best friends." )
158161
159162 elif 'siri' in query :
160163 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." )
162165
163166 elif 'cortana' in query :
164167 fun_talk ("I thought you'd never ask. So I've never thought about it." )
@@ -318,13 +321,13 @@ def get_mail_info():
318321 val_cur = float (get_command ())
319322 # print(val_cur)
320323 print (cur .convert (src_cur , dest_cur , val_cur ))
321-
324+
322325 except Exception as e :
323326 print ("Couldn't get what you have said, Can you say it again??" )
324327
325328 elif 'covid-19' in query or 'corona' in query :
326329 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?' )
328331 c_query = get_command ()
329332 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 :
330333 def world_cases ():
@@ -664,7 +667,7 @@ def send_whtmsg():
664667 fun_talk (data [0 ].summary )
665668 except Exception as e :
666669 fun_talk ('Sorry, I am unable to find the answer for your query.' )
667-
670+
668671 elif 'news' in query or 'news headlines' in query :
669672 url = "https://news.google.com/news/rss"
670673 client = urlopen (url )
@@ -683,3 +686,11 @@ def send_whtmsg():
683686
684687 except Exception as e :
685688 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