-
Notifications
You must be signed in to change notification settings - Fork 0
/
voice_assistent.py
800 lines (666 loc) · 24.2 KB
/
voice_assistent.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
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
587
588
589
590
591
592
593
594
595
596
597
598
599
600
601
602
603
604
605
606
607
608
609
610
611
612
613
614
615
616
617
618
619
620
621
622
623
624
625
626
627
628
629
630
631
632
633
634
635
636
637
638
639
640
641
642
643
644
645
646
647
648
649
650
651
652
653
654
655
656
657
658
659
660
661
662
663
664
665
666
667
668
669
670
671
672
673
674
675
676
677
678
679
680
681
682
683
684
685
686
687
688
689
690
691
692
693
694
695
696
697
698
699
700
701
702
703
704
705
706
707
708
709
710
711
712
713
714
715
716
717
718
719
720
721
722
723
724
725
726
727
728
729
730
731
732
733
734
735
736
737
738
739
740
741
742
743
744
745
746
747
748
749
750
751
752
753
754
755
756
757
758
759
760
761
762
763
764
765
766
767
768
769
770
771
772
773
774
775
776
777
778
779
780
781
782
783
784
785
786
787
788
789
790
791
792
793
794
795
796
797
798
799
800
import subprocess
import wolframalpha
import pyttsx3
import tkinter
import json
import random
import operator
import speech_recognition as sr
import turtle
import datetime
import wikipedia
import webbrowser
import os
import winshell
import pyjokes
import feedparser
import smtplib
import instaloader
import ctypes
import time
import requests
import shutil
from tkinter import *
import numpy as np
from sketchpy import canvas
from sketchpy import library as lib
from turtle import *
from twilio.rest import Client
from clint.textui import progress
from ecapture import ecapture as ec
from bs4 import BeautifulSoup
import win32com.client as wincl
from urllib.request import urlopen
engine = pyttsx3.init('sapi5')
voices = engine.getProperty('voices')
engine.setProperty('voice', voices[1].id)
def speak(audio):
engine.say(audio)
engine.runAndWait()
def wishMe():
hour = int(datetime.datetime.now().hour)
if hour>= 0 and hour<12:
speak("Good Morning Sir !")
elif hour>= 12 and hour<18:
speak("Good Afternoon Sir !")
else:
speak("Good Evening Sir !")
assname ="simple ai bot"
speak("I am your Assistant")
speak(assname)
def username():
speak("What should i call you sir")
uname = takeCommand()
speak("Welcome Mister")
speak(uname)
columns = shutil.get_terminal_size().columns
print("#####################".center(columns))
print("Welcome Mr.", uname.center(columns))
print("#####################".center(columns))
speak("How can i Help you, Sir")
def takeCommand():
r = sr.Recognizer()
with sr.Microphone() as source:
print("Listening...")
r.pause_threshold = 1
audio = r.listen(source)
try:
print("Recognizing...")
query = r.recognize_google(audio, language ='en-in')
print(f"User said: {query}\n")
except Exception as e:
print(e)
print("Unable to Recognize your voice.")
return "None"
return query
def sendEmail(to, content):
server = smtplib.SMTP('smtp.gmail.com', 587)
server.ehlo()
server.starttls()
# Enable low security in gmail
server.login('your email id', 'your email password')
server.sendmail('your email id', to, content)
server.close()
if __name__ == '__main__':
clear = lambda: os.system('cls')
# This Function will clean any
# command before execution of this python file
clear()
wishMe()
username()
while True:
query = takeCommand().lower()
# All the commands said by user will be
# stored here in 'query' and will be
# converted to lower case for easily
# recognition of command
if 'wikipedia' in query:
speak('Searching Wikipedia...')
query = query.replace("wikipedia", "")
results = wikipedia.summary(query, sentences = 3)
speak("According to Wikipedia")
print(results)
speak(results)
elif 'open youtube' in query:
speak("Here you go to Youtube\n")
webbrowser.open("youtube.com")
elif 'open google' in query:
speak("Here you go to Google\n")
webbrowser.open("google.com")
elif 'open stackoverflow' in query:
speak("Here you go to Stack Over flow Happy coding")
webbrowser.open("stackoverflow.com")
elif 'today time' in query or 'what is the time now' in query:
strTime = datetime.datetime.now().strftime("%H:%M:%S")
speak(f"Sir, the time is {strTime}")
elif 'open opera' in query:
codePath = r"C:\\Users\\GAURAV\\AppData\\Local\\Programs\\Opera\\launcher.exe"
os.startfile(codePath)
elif 'email to kannan' in query:
try:
speak("What should I say?")
content = takeCommand()
to = "Receiver email address"
sendEmail(to, content)
speak("Email has been sent !")
except Exception as e:
print(e)
speak("I am not able to send this email")
elif 'send a mail' in query:
try:
speak("What should I say?")
content = takeCommand()
speak("whome should i send")
to = input()
sendEmail(to, content)
speak("Email has been sent !")
except Exception as e:
print(e)
speak("I am not able to send this email")
elif 'how are you' in query:
speak("I am fine, Thank you")
speak("How are you, Sir")
elif 'fine' in query or "good" in query:
speak("It's good to know that your fine")
elif "change my name to" in query:
query = query.replace("change my name to", "")
assname = query
elif "change name" in query:
speak("What would you like to call me, Sir ")
assname = takeCommand()
speak("Thanks for naming me")
elif "what's your name" in query or "What is your name" in query:
speak("My friends call me")
speak(assname)
print("My friends call me", assname)
elif 'exit' in query:
speak("Thanks for giving me your time")
exit()
elif "who made you" in query or "who created you" in query:
speak("I have been created by MR KANNAN.")
elif 'tell me an joke' in query:
speak(pyjokes.get_joke())
elif "calculate" in query:
app_id = "Wolframalpha api id"
client = wolframalpha.Client(app_id)
indx = query.lower().split().index('calculate')
query = query.split()[indx + 1:]
res = client.query(' '.join(query))
answer = next(res.results).text
print("The answer is " + answer)
speak("The answer is " + answer)
elif 'instagram details' in query:
ig=instaloader.Instaloader()
speak("tell the user name of that insta id")
usrname=input('enter user name\n')
profile=instaloader.Profile.from_username(ig.context, usrname)
speak("Username is ")
speak(profile.username)
speak("Number of Posts Uploaded are")
speak(profile.mediacount)
speak(" he or she is having ")
speak(profile.followers)
speak(' followers')
speak(" he or she is following ")
speak(profile.followees)
speak('people')
speak("he or she Bio is ")
speak(profile.biography)
elif 'search' in query or 'play' in query:
query = query.replace("search", "")
query = query.replace("play", "")
webbrowser.open(query)
elif "who i am" in query:
speak("If you talk then definitely your human.")
elif "why you came to world" in query:
speak("Thanks to KANNAN. further It's a secret")
elif 'open power point presentation' in query:
speak("opening Power Point presentation")
power = r"C:\\Users\\GAURAV\\Desktop\\Minor Project\\Presentation\\Voice Assistant.pptx"
os.startfile(power)
elif 'what is love' in query:
speak("It is 7th sense that destroy all other senses")
elif "who are you" in query:
speak("I am your virtual assistant created by KANNAN")
elif 'reason for you' in query:
speak("I was created as a Minor project by Mister KANNAN ")
elif 'open bluestack' in query:
appli = r"C:\\ProgramData\\BlueStacks\\Client\\Bluestacks.exe"
os.startfile(appli)
elif 'news' in query:
try:
jsonObj = urlopen('''https://newsapi.org / v1 / articles?source = the-times-of-india&sortBy = top&apiKey =\\times of India Api key\\''')
data = json.load(jsonObj)
i = 1
speak('here are some top news from the times of india')
print('''=============== TIMES OF INDIA ============'''+ '\n')
for item in data['articles']:
print(str(i) + '. ' + item['title'] + '\n')
print(item['description'] + '\n')
speak(str(i) + '. ' + item['title'] + '\n')
i += 1
except Exception as e:
print(str(e))
elif 'lock window' in query:
speak("locking the device")
ctypes.windll.user32.LockWorkStation()
elif 'shutdown system' in query:
speak("Hold On a Sec ! Your system is on its way to shut down")
subprocess.call('shutdown / p /f')
elif 'empty recycle bin' in query:
winshell.recycle_bin().empty(confirm = False, show_progress = False, sound = True)
speak("Recycle Bin Recycled")
elif "don't listen" in query or "stop listening" in query:
speak("for how much time you want to stop jarvis from listening commands")
a = int(takeCommand())
time.sleep(a)
print(a)
elif "where is" in query:
query = query.replace("where is", "")
location = query
speak("User asked to Locate")
speak(location)
webbrowser.open("https://www.google.nl / maps / place/" + location + "")
elif "camera" in query or "take a photo" in query:
ec.capture(0, "Jarvis Camera ", "img.jpg")
elif "restart the system" in query:
subprocess.call(["shutdown", "/r"])
elif "hibernate" in query or "sleep" in query:
speak("Hibernating")
subprocess.call("shutdown / h")
elif "log off" in query or "sign out" in query:
speak("Make sure all the application are closed before sign-out")
time.sleep(5)
subprocess.call(["shutdown", "/l"])
elif "write a note" in query:
speak("What should i write, sir")
note = takeCommand()
file = open('jarvis.txt', 'w')
speak("Sir, Should i include date and time")
snfm = takeCommand()
if 'yes' in snfm or 'sure' in snfm:
strTime = datetime.datetime.now().strftime("% H:% M:% S")
file.write(strTime)
file.write(" :- ")
file.write(note)
else:
file.write(note)
elif "show note" in query:
speak("Showing Notes")
file = open("jarvis.txt", "r")
print(file.read())
speak(file.read(6))
elif 'counting number' in query:
speak("tell me the number when i want to stop ")
num=int(takeCommand())
for i in range(1,num+1):
speak(i)
elif "calculator" in query:
speak("choose any one the option below:\n")
print("1.Addition:\n 2.subtraction:\n 3.multiplication:\n 4.division:\n")
n=takeCommand()
if (n=='addition') or (n=='one') or (n==1):
speak("give me two number of input")
speak("tell me the first value ")
A=int(takeCommand())
speak("tell me the seconde value")
B=int(takeCommand())
add=A+B
print("the addition of first and seconde value is :",add)
speak("the addition of first and seconde value is :")
speak(add)
elif (n=='subtraction') or (n==2) or (n=='two'):
speak("give me two number of input")
speak("tell me the first value ")
A=int(takeCommand())
speak("tell me the seconde value")
B=int(takeCommand())
sub=A-B
print("the subtraction of first and seconde value is :",sub)
speak("the subtraction of first and seconde value is ")
speak(sub)
elif (n=='multiplication') or (n==3) or (n=='three'):
speak("give me two number of input")
speak("tell me the first value ")
A=int(takeCommand())
speak("tell me the seconde value")
B=int(takeCommand())
mul=A*B
print("the multiplication of first and seconde value is :",mul)
speak("the multiplication of first and seconde value is ")
speak(mul)
elif (n=='division') or (n==4) or (n=='four'):
speak("give me two number of input")
speak("tell me the first value ")
A=int(takeCommand())
speak("tell me the seconde value")
B=int(takeCommand())
div=A/B
print("the division of first and seconde value is :",div)
speak("the division of first and seconde value is")
speak(div)
else:
speak("are you kidding me")
speak("please give input present in list")
elif 'draw national flag' in query:
#screen for output
screen = turtle.Screen()
# Defining a turtle Instance
t = turtle.Turtle()
t.speed(2)
# initially penup()
t.penup()
t.goto(-400, 250)
t.pendown()
# Orange Rectangle
#white rectangle
t.color("orange")
t.begin_fill()
t.forward(800)
t.right(90)
t.forward(167)
t.right(90)
t.forward(800)
t.end_fill()
t.left(90)
t.forward(167)
# Green Rectangle
t.color("green")
t.begin_fill()
t.forward(167)
t.left(90)
t.forward(800)
t.left(90)
t.forward(167)
t.end_fill()
# Big Blue Circle
t.penup()
t.goto(70, 0)
t.pendown()
t.color("navy")
t.begin_fill()
t.circle(70)
t.end_fill()
# Big White Circle
t.penup()
t.goto(60, 0)
t.pendown()
t.color("white")
t.begin_fill()
t.circle(60)
t.end_fill()
# Mini Blue Circles
t.penup()
t.goto(-57, -8)
t.pendown()
t.color("navy")
for i in range(24):
t.begin_fill()
t.circle(3)
t.end_fill()
t.penup()
t.forward(15)
t.right(15)
t.pendown()
# Small Blue Circle
t.penup()
t.goto(20, 0)
t.pendown()
t.begin_fill()
t.circle(20)
t.end_fill()
# Spokes
t.penup()
t.goto(0, 0)
t.pendown()
t.pensize(2)
for i in range(24):
t.forward(60)
t.backward(60)
t.left(15)
#to hold the
#output window
turtle.done()
elif 'draw abdul kalam sir ' in query or 'draw apj adul kalam sir' in query or "abdul kalam" in query or 'draw abdul kalam' in query:
obj= lib.apj()
obj.pen.speed(2)
obj.draw()
elif 'draw iron man' in query or 'draw tony stark' in query or 'iorn man' in query:
obj1=lib.rdj()
obj1.pen.speed(2)
obj1.draw()
elif 'draw me' in query or 'draw kannan' in query:
obj2=canvas.sketch_from_image('C:\\Users\\kanna\\OneDrive\\Pictures\\Screenshot_20221223_141632.jpg')
obj2.draw(threshold=127)
elif 'picture of my sketch' in query:
obj3 =canvas.sketch_from_svg("C:\\Users\\kanna\\Downloads\\Screenshot_20221223_141632.svg",scale =250)
obj3.draw()
elif 'picture of my gang' in query:
obj4=canvas.sketch_from_image("C:\\Users\\kanna\\OneDrive\\Pictures\\Screenshot_20230112_175240.jpg")
obj4.draw(threshold=127)
elif 'draw my dog' in query:
obj5=canvas.sketch_from_image("C:\\Users\\kanna\\OneDrive\\Pictures\\IMG_20221113_124805_407.jpg")
obj5.draw(threshold=127)
elif 'draw vijay' in query or 'vijay' in query:
obj6=lib.vijay()
obj6.draw()
elif 'play game' in query or 'tik tac tio' in query or 'tik tac tio' in query or 'game' in query:
size_of_board = 600
symbol_size = (size_of_board / 3 - size_of_board / 8) / 2
symbol_thickness = 50
symbol_X_color = '#EE4035'
symbol_O_color = '#0492CF'
Green_color = '#7BC043'
class Tic_Tac_Toe():
# ------------------------------------------------------------------
# Initialization Functions:
# ------------------------------------------------------------------
def __init__(self):
self.window = Tk()
self.window.title('Tic-Tac-Toe')
self.canvas = Canvas(self.window, width=size_of_board, height=size_of_board)
self.canvas.pack()
# Input from user in form of clicks
self.window.bind('<Button-1>', self.click)
self.initialize_board()
self.player_X_turns = True
self.board_status = np.zeros(shape=(3, 3))
self.player_X_starts = True
self.reset_board = False
self.gameover = False
self.tie = False
self.X_wins = False
self.O_wins = False
self.X_score = 0
self.O_score = 0
self.tie_score = 0
def mainloop(self):
self.window.mainloop()
def initialize_board(self):
for i in range(2):
self.canvas.create_line((i + 1) * size_of_board / 3, 0, (i + 1) * size_of_board / 3, size_of_board)
for i in range(2):
self.canvas.create_line(0, (i + 1) * size_of_board / 3, size_of_board, (i + 1) * size_of_board / 3)
def play_again(self):
self.initialize_board()
self.player_X_starts = not self.player_X_starts
self.player_X_turns = self.player_X_starts
self.board_status = np.zeros(shape=(3, 3))
# ------------------------------------------------------------------
# Drawing Functions:
# The modules required to draw required game based object on canvas
# ------------------------------------------------------------------
def draw_O(self, logical_position):
logical_position = np.array(logical_position)
# logical_position = grid value on the board
# grid_position = actual pixel values of the center of the grid
grid_position = self.convert_logical_to_grid_position(logical_position)
self.canvas.create_oval(grid_position[0] - symbol_size, grid_position[1] - symbol_size,
grid_position[0] + symbol_size, grid_position[1] + symbol_size, width=symbol_thickness,
outline=symbol_O_color)
def draw_X(self, logical_position):
grid_position = self.convert_logical_to_grid_position(logical_position)
self.canvas.create_line(grid_position[0] - symbol_size, grid_position[1] - symbol_size,
grid_position[0] + symbol_size, grid_position[1] + symbol_size, width=symbol_thickness,
fill=symbol_X_color)
self.canvas.create_line(grid_position[0] - symbol_size, grid_position[1] + symbol_size,
grid_position[0] + symbol_size, grid_position[1] - symbol_size, width=symbol_thickness,
fill=symbol_X_color)
def display_gameover(self):
if self.X_wins:
self.X_score += 1
text = 'Winner: Player 1 (X)'
color = symbol_X_color
elif self.O_wins:
self.O_score += 1
text = 'Winner: Player 2 (O)'
color = symbol_O_color
else:
self.tie_score += 1
text = 'Its a tie'
color = 'gray'
self.canvas.delete("all")
self.canvas.create_text(size_of_board / 2, size_of_board / 3, font="cmr 60 bold", fill=color, text=text)
score_text = 'Scores \n'
self.canvas.create_text(size_of_board / 2, 5 * size_of_board / 8, font="cmr 40 bold", fill=Green_color,
text=score_text)
score_text = 'Player 1 (X) : ' + str(self.X_score) + '\n'
score_text += 'Player 2 (O): ' + str(self.O_score) + '\n'
score_text += 'Tie : ' + str(self.tie_score)
self.canvas.create_text(size_of_board / 2, 3 * size_of_board / 4, font="cmr 30 bold", fill=Green_color,
text=score_text)
self.reset_board = True
score_text = 'Click to play again \n'
self.canvas.create_text(size_of_board / 2, 15 * size_of_board / 16, font="cmr 20 bold", fill="gray",
text=score_text)
# ------------------------------------------------------------------
# Logical Functions:
# The modules required to carry out game logic
# ------------------------------------------------------------------
def convert_logical_to_grid_position(self, logical_position):
logical_position = np.array(logical_position, dtype=int)
return (size_of_board / 3) * logical_position + size_of_board / 6
def convert_grid_to_logical_position(self, grid_position):
grid_position = np.array(grid_position)
return np.array(grid_position // (size_of_board / 3), dtype=int)
def is_grid_occupied(self, logical_position):
if self.board_status[logical_position[0]][logical_position[1]] == 0:
return False
else:
return True
def is_winner(self, player):
player = -1 if player == 'X' else 1
# Three in a row
for i in range(3):
if self.board_status[i][0] == self.board_status[i][1] == self.board_status[i][2] == player:
return True
if self.board_status[0][i] == self.board_status[1][i] == self.board_status[2][i] == player:
return True
# Diagonals
if self.board_status[0][0] == self.board_status[1][1] == self.board_status[2][2] == player:
return True
if self.board_status[0][2] == self.board_status[1][1] == self.board_status[2][0] == player:
return True
return False
def is_tie(self):
r, c = np.where(self.board_status == 0)
tie = False
if len(r) == 0:
tie = True
return tie
def is_gameover(self):
# Either someone wins or all grid occupied
self.X_wins = self.is_winner('X')
if not self.X_wins:
self.O_wins = self.is_winner('O')
if not self.O_wins:
self.tie = self.is_tie()
gameover = self.X_wins or self.O_wins or self.tie
if self.X_wins:
print('X wins')
if self.O_wins:
print('O wins')
if self.tie:
print('Its a tie')
return gameover
def click(self, event):
grid_position = [event.x, event.y]
logical_position = self.convert_grid_to_logical_position(grid_position)
if not self.reset_board:
if self.player_X_turns:
if not self.is_grid_occupied(logical_position):
self.draw_X(logical_position)
self.board_status[logical_position[0]][logical_position[1]] = -1
self.player_X_turns = not self.player_X_turns
else:
if not self.is_grid_occupied(logical_position):
self.draw_O(logical_position)
self.board_status[logical_position[0]][logical_position[1]] = 1
self.player_X_turns = not self.player_X_turns
# Check if game is concluded
if self.is_gameover():
self.display_gameover()
# print('Done')
else: # Play Again
self.canvas.delete("all")
self.play_again()
self.reset_board = False
game_instance = Tic_Tac_Toe()
game_instance.mainloop()
elif "update assistant" in query:
speak("After downloading file please replace this file with the downloaded one")
url = '# url after uploading file'
r = requests.get(url, stream = True)
with open("Voice.py", "wb") as Pypdf:
total_length = int(r.headers.get('content-length'))
for ch in progress.bar(r.iter_content(chunk_size = 2391975),
expected_size =(total_length / 1024) + 1):
if ch:
Pypdf.write(ch)
# NPPR9-FWDCX-D2C8J-H872K-2YT43
elif "jarvis" in query:
wishMe()
speak("Jarvis 1 point o in your service Mister")
speak(assname)
elif "weather" in query:
# Google Open weather website
# to get API of Open weather
api_key = "Api key"
base_url = "http://api.openweathermap.org / data / 2.5 / weather?"
speak(" City name ")
print("City name : ")
city_name = takeCommand()
complete_url = base_url + "appid =" + api_key + "&q =" + city_name
response = requests.get(complete_url)
x = response.json()
if x["code"] != "404":
y = x["main"]
current_temperature = y["temp"]
current_pressure = y["pressure"]
current_humidiy = y["humidity"]
z = x["weather"]
weather_description = z[0]["description"]
print(" Temperature (in kelvin unit) = " +str(current_temperature)+"\n atmospheric pressure (in hPa unit) ="+str(current_pressure) +"\n humidity (in percentage) = " +str(current_humidiy) +"\n description = " +str(weather_description))
else:
speak(" City Not Found ")
elif "send message " in query:
# You need to create an account on Twilio to use this service
account_sid = 'Account Sid key'
auth_token = 'Auth token'
client = Client(account_sid, auth_token)
message = client.messages \
.create(
body = takeCommand(),
from_='Sender No',
to ='Receiver No'
)
print(message.sid)
elif "wikipedia" in query:
webbrowser.open("wikipedia.com")
elif "tell about you" in query or "self introduction" in query:
speak("The primary purpose of developing voice recognition software is to make everyday life easier in business and private life. Voice assistants can perform many tasks for your business while you are occupied with something else. In addition, they can replace a human being in completing specific tasks, such as: answering questions, making calls, creating to-do lists, and much more. They, therefore, allow you to save time and help you multitask. ")
elif "Good Morning " in query or "Good afternoon" in query or "Good evening" in query:
speak("A warm" +query)
speak("How are you Mister")
speak(username)
# most asked question from google Assistant
elif "will you be my gf" in query or "will you be my bf" in query:
speak("I'm not sure about, may be you should give me some time")
elif "how are you" in query:
speak("I'm fine, about you")
elif "i love you" in query:
speak("I love you too")
speak(username)
elif "what is" in query or "who is" in query:
# Use the same API key
# that we have generated earlier
client = wolframalpha.Client("API_ID")
res = client.query(query)
try:
print (next(res.results).text)
speak (next(res.results).text)
except StopIteration:
print ("No results")
# elif "" in query:
# Command go here
# For adding more commands