Skip to content

Commit 0b7de5a

Browse files
authored
Update Voice.py
1 parent 59a7f42 commit 0b7de5a

1 file changed

Lines changed: 12 additions & 96 deletions

File tree

Voice.py

Lines changed: 12 additions & 96 deletions
Original file line numberDiff line numberDiff line change
@@ -20,7 +20,6 @@
2020
import wmi
2121
import os
2222
from pathlib import Path
23-
from twilio.rest import Client
2423
from clint.textui import progress
2524
from selenium import webdriver
2625
from ecapture import ecapture as ec
@@ -213,8 +212,8 @@ def sendEmail(to, content):
213212
server = smtplib.SMTP('smtp.gmail.com', 587)
214213
server.ehlo()
215214
server.starttls()
216-
server.login('g.a.u.r.a.v.k.u.m.a.r.i.s.g.r.e.a.t@gmail.com', 'Gaurav123@')
217-
server.sendmail('g.a.u.r.a.v.k.u.m.a.r.i.s.g.r.e.a.t@gmail.com', to, content)
215+
server.login('youremail@email.com', 'your-password')
216+
server.sendmail('youremail@email.com', to, content)
218217
server.close()
219218

220219

@@ -290,7 +289,7 @@ def sendEmail(to, content):
290289
webbrowser.open("stackoverflow.com")
291290

292291
elif "send a whatsaap message" in query or "send a WhatsApp message" in query:
293-
driver = webdriver.Chrome('C:\\Users\\GAURAV\\Downloads\\chromedriver_win32 (1)\\chromedriver.exe')
292+
driver = webdriver.Chrome('Web Driver Location')
294293
driver.get('https://web.whatsapp.com/')
295294
speak("Scan QR code before proceding")
296295
tim=10
@@ -307,7 +306,7 @@ def sendEmail(to, content):
307306
msg_box.send_keys(msg)
308307
button = driver.find_element_by_class_name('_3M-N-')
309308
button.click()
310-
309+
311310
elif "stackoverflow " in query:
312311
speak("Stackoverflow khola ja rha h")
313312
webbrowser.open("stackoverflow.com")
@@ -342,17 +341,6 @@ def sendEmail(to, content):
342341
print(e)
343342
speak("I am not able to send this email")
344343

345-
elif "gaurav ko mail " in query:
346-
try:
347-
speak("Mai kiya sandesh likhyu")
348-
content = takeCommandcontent()
349-
to = "gauravkumarjha27@gmail.com"
350-
sendEmail(to, content)
351-
speak("Sandesh bhja geya")
352-
except Exception as e:
353-
print(e)
354-
speak("Sandesh bhjna mai kuch rukawtai aa rhi h")
355-
356344
elif 'send a mail' in query or "mail bhjey" in query:
357345
try:
358346
speak("Mai kiya sandesh likhyu")
@@ -380,11 +368,6 @@ def sendEmail(to, content):
380368
query=query.replace("change my name to","")
381369
assname=query
382370

383-
elif "mera naam Badle" in query:
384-
speak("Mai apko kiya bula sakta hu , Sir")
385-
assname = takeCommand()
386-
speak("Sukriya, Apka naam saflta purwak badl geya hai")
387-
388371
elif "change name" in query:
389372
speak("What would you like to call me ,Sir ")
390373
assname = takeCommand()
@@ -395,34 +378,19 @@ def sendEmail(to, content):
395378
speak(assname)
396379
print("My friends call me",assname)
397380

398-
elif "tumhara naam kya hai" in query or "naam kiya hn" in query:
399-
speak("mery dost mujhy")
400-
speak(assname)
401-
speak("keh kr bulatai hai")
402-
print("Mery dost mujhy"+assname+"kehty hn")
403-
404381
elif 'exit' in query:
405382
speak("Thanks for giving me your time")
406383
exit()
407384

408-
elif "band" in query or "ruko" in query:
409-
speak("Apky samay kai liya sukriyea")
410-
exit()
411-
412385
elif "who made you" in query or "who created you" in query:
413386
speak("I have been created by Gaurav.")
414387

415-
elif "Tumhen kisne banaya hai" in query:
416-
speak("mujhy Gaurav Kumar dura bniyea geya h")
417388

418389
elif 'joke' in query:
419390
speak(pyjokes.get_joke())
420-
421-
elif "chutkula" in query or "mazak" in query:
422-
speak(pyjokes.get_joke)
423391

424392
elif "calculate" in query:
425-
app_id = "WTHP37-K6P2X72X3E"
393+
app_id = "Wolframe Alpha API"
426394
client = wolframalpha.Client(app_id)
427395
indx = query.lower().split().index('calculate')
428396
query = query.split()[indx + 1:]
@@ -442,11 +410,6 @@ def sendEmail(to, content):
442410
elif "why you came to world" in query:
443411
speak("Thanks to Gaurav. further It's a secret")
444412

445-
elif 'power point presentation' in query:
446-
speak("opening Power Point presentation")
447-
power= r"C:\\Users\\GAURAV\\Desktop\\Minor Project\\Presentation\\Voice Assistant.pptx"
448-
os.startfile(power)
449-
450413
elif 'is love' in query:
451414
speak("It is 7th sense that destroy all other senses")
452415

@@ -466,7 +429,7 @@ def sendEmail(to, content):
466429

467430
elif 'google news' in query:
468431
try:
469-
jsonObj = urlopen('''https://newsapi.org/v2/top-headlines?sources=google-news-in&apiKey=5c06fed7ad3f4c78bb4c3a44255788cd''')
432+
jsonObj = urlopen('''https://newsapi.org/v2/top-headlines?sources=google-news-in&apiKey=Google news API key''')
470433
data = json.load(jsonObj)
471434
i = 1
472435
speak('')
@@ -481,7 +444,7 @@ def sendEmail(to, content):
481444

482445
elif "bbc news" in query:
483446
try:
484-
main_url = " https://newsapi.org/v1/articles?source=bbc-news&sortBy=top&apiKey=5c06fed7ad3f4c78bb4c3a44255788cd"
447+
main_url = " https://newsapi.org/v1/articles?source=bbc-news&sortBy=top&apiKey=BBC News API key"
485448
open_bbc_page = requests.get(main_url).json()
486449
article = open_bbc_page["articles"]
487450
results = []
@@ -494,7 +457,7 @@ def sendEmail(to, content):
494457

495458
elif 'news' in query: #samachar
496459
try:
497-
jsonObj = urlopen('''https://newsapi.org/v1/articles?source=the-times-of-india&sortBy=top&apiKey=5eeb7514007b4690b7195b4d197a75d4''')
460+
jsonObj = urlopen('''https://newsapi.org/v1/articles?source=the-times-of-india&sortBy=top&apiKey=Time of INDIA API key''')
498461
data = json.load(jsonObj)
499462
i = 1
500463
speak('here are some top news from the times of india')
@@ -514,31 +477,17 @@ def sendEmail(to, content):
514477
elif 'shutdown system' in query:
515478
speak("Hold On a Sec! Your system is on its way to shut down")
516479
subprocess.call('shutdown /p /f')
517-
518-
elif "shutdown Pranali" in query:
519-
subprocess.call('shutdown /p /f')
520-
480+
521481
elif 'empty recycle bin' in query:
522482
winshell.recycle_bin().empty(confirm=False, show_progress=False, sound=True)
523483
speak("Recycle Bin Recycled")
524484

525-
elif 'recycle bin Khali Karen' in query:
526-
winshell.recycle_bin().empty(confirm=False, show_progress=False, sound=True)
527-
speak("reesaayakal bin punarnaveeneekaran")
528-
529-
530485
elif "don't listen" in query or "stop listening" in query:
531486
speak("for how much time you want to stop jarvis from listening commands")
532487
a=int(takeCommand())
533488
time.sleep(a)
534489
print(a)
535490

536-
elif "suno nahin" in query or "sunana band karo" in query:
537-
speak("aap jaarvis ko sunane ke aadeshon ko kitane samay ke lie rokana chaahate hain")
538-
a=int(takeCommand())
539-
time.sleep(a)
540-
print(a)
541-
542491
elif "where is" in query:
543492
query=query.replace("where is","")
544493
location = query
@@ -609,7 +558,7 @@ def sendEmail(to, content):
609558
speak(assname)
610559

611560
elif "weather" in query:
612-
api_key = "139ff8e5644894750d3293adb1372433"
561+
api_key = "Open weather map API key"
613562

614563
base_url = "http://api.openweathermap.org/data/2.5/weather?"
615564
speak(" City name ")
@@ -629,40 +578,7 @@ def sendEmail(to, content):
629578
else:
630579
speak(" City Not Found ")
631580

632-
elif "mausam" in query:
633-
api_key = "139ff8e5644894750d3293adb1372433"
634-
base_url = "http://api.openweathermap.org/data/2.5/weather?"
635-
speak("shahar ka naam")
636-
print("shahar ka naam")
637-
city_name=takeCommand()
638-
complete_url = base_url + "appid=" + api_key + "&q=" + city_name
639-
response = requests.get(complete_url)
640-
x = response.json()
641-
if x["cod"] != "404":
642-
y = x["main"]
643-
current_temperature = y["temp"]
644-
current_pressure = y["pressure"]
645-
current_humidiy = y["humidity"]
646-
z = x["weather"]
647-
weather_description = z[0]["description"]
648-
print("taapamaan (kelvin ikaee mein) = " +str(current_temperature)+"\n vaayumandaleey dabaav (hp ikaee mein) = "+str(current_pressure) +"\n aardrata (pratishat mein) = " +str(current_humidiy) +"\n varnan = " +str(weather_description))
649-
else:
650-
speak("sitee nahin milee")
651-
652-
elif "send message " in query:
653-
account_sid = 'AC4b9309a38f9db652d6d6da100cae22b3'
654-
auth_token = 'c4dd02d5bb8093122e04b10b98244ec0'
655-
client = Client(account_sid, auth_token)
656-
message = client.messages \
657-
.create(
658-
body=takeCommand(),
659-
from_='+15084553394',
660-
to='+919873784911'
661-
)
662-
663-
print(message.sid)
664-
665-
elif "wikipedia" in query:
581+
elif "wikipedia" in query:
666582
webbrowser.open("wikipedia.com")
667583

668584
elif "will you be my gf" in query or "will you be my bf" in query: #most asked question from google Assistant
@@ -675,7 +591,7 @@ def sendEmail(to, content):
675591
speak("It's hard to understand")
676592

677593
elif "what is" in query or "who is" in query:
678-
client= wolframalpha.Client("WTHP37-K6P2X72X3E")
594+
client= wolframalpha.Client("WOlframe Alpha API key")
679595
res = client.query(query)
680596
try:
681597
print(next(res.results).text)

0 commit comments

Comments
 (0)