This repository was archived by the owner on Oct 20, 2025. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathFridaytext.py
More file actions
218 lines (167 loc) · 6.32 KB
/
Fridaytext.py
File metadata and controls
218 lines (167 loc) · 6.32 KB
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
import pyttsx3
import webbrowser
import smtplib,ssl
import random
import speech_recognition as sr
from time import ctime
import wikipedia
import datetime
import wolframalpha
import os
import sys
from playsound import playsound
import pyautogui # pip install pyautogui
import psutil # pip install psutil
import pyjokes
engine = pyttsx3.init()
client = wolframalpha.Client(' 2RX228-KWEXT6PLTT')
voices = engine.getProperty('voices')
engine.setProperty('voice', voices[len(voices)-1].id)
def speak(audio):
print("Friday:" + audio)
engine.say(audio)
engine.runAndWait()
def greetme():
print('Friday : Hello' + ' Arnav')
print('Friday : Type your command')
greetme()
def greetme2():
speak("Anything else??")
def say(audio):
engine.say(audio)
engine.runAndWait()
def time():
Time = datetime.datetime.now().strftime("%I:%M:%S")
speak("the current time is")
speak(Time)
def date():
year = int(datetime.datetime.now().year)
month = int(datetime.datetime.now().month)
date = int(datetime.datetime.now().day)
speak("the current date is")
speak(date)
speak(month)
speak(year)
def screenshot():
img = pyautogui.screenshot()
img.save("E:/Screenshots")
def cpu():
usage = str(psutil.cpu_percent())
speak('CPU is at'+ usage)
battery = psutil.sensors_battery()
speak("Battery is at")
speak(battery.percent )
def jokes():
speak(pyjokes.get_joke())
def myCommand():
query = str(input("Type Here : "))
return query
def sendEmail():
speak("Please enter the following credentials")
sender_email = "thefridayassistant@gmail.com"
rec_email = input(str("Email:"))
password = 'uwantit??'
message1 = str(input("Enter Your Message here :"))
message = ('I am friday here is your email: ' + ' Hello ,' + rec_email + message1 )
server = smtplib.SMTP('smtp.gmail.com', 587)
server.starttls()
server.login(sender_email, password)
speak('I logged in !')
server.sendmail(sender_email, rec_email, message)
print('email sent sucessfully to ' + rec_email)
def intro():
stMsgs = ['Did i forget to introduce myself?I am friday, your personal assistant', 'I am fine!', 'Nice!', 'I am nice and full of energy']
speak(random.choice(stMsgs))
if __name__ == '__main__':
while True:
query = myCommand()
query = query.lower()
if 'open youtube' in query:
webbrowser.open('www.youtube.com')
sys.exit()
elif 'open google' in query:
webbrowser.open('www.google.co.in')
sys.exit()
elif 'say this' in query:
speak("what should i say?")
this = myCommand
speak(this)
elif 'open gmail' in query:
webbrowser.open('mail.google.com')
sys.exit()
elif "what\'s up" in query or 'how are you' in query:
stMsgs = ['Just doing my thing!', 'I am fine!', 'Nice!', 'I am nice and full of energy']
speak(random.choice(stMsgs))
elif 'email' in query:
try:
sendEmail()
say("email was sent sucessfully")
except:
speak('the mail could not b sent due to some problems')
elif 'search google' in query:
print("What should i search ?")
chromepath = 'C:/Program Files/Google/Chrome/Application/chrome.exe %s'
search = myCommand()
webbrowser.get(chromepath).open_new_tab('https://www.google.com/search?q=' + search)
elif 'email me' in query:
try:
sendEmail()
speak("email was sent sucessfully")
except:
speak('the mail could not b sent due to some problems')
elif 'email my father' in query:
try:
sendEmail()
speak("email was sent sucessfully")
except:
speak('the mail could not b sent due to some problems')
elif 'email to' in query:
try:
sendEmail()
speak("email was sent sucessfully")
except:
speak('the mail could not b sent due to some problems')
elif 'nothing' in query or 'abort' in query or 'stop' or 'get the hell out of here' or 'no thanks' in query:
playsound('bye bye.mp3')
sys.exit()
elif "you are mad " in query:
speak ('sorry boss will not do it again,perhaps never')
elif "what is the time" in query:
speak("the time is:")
speak(ctime())
elif 'hello' in query:
speak('Hello boss')
elif 'bye' in query:
speak('Bye Arnav, have a good day.')
sys.exit()
elif 'play music' in query:
speak('Here is your music! Enjoy!')
webbrowser.open('https://music.amazon.in/my/playlists/Fav/73669e57-3261-4f56-a694-d9e513124650')
sys.exit()
elif "where is" in query:
data = query.split(" ")
location = data[2]
speak("Hold on boss, I will show you where " + location + " is.")
url = 'https://www.google.nl/maps/place/' + location + "/&"
webbrowser.open(url)
sys.exit()
elif "who are you" in query:
speak(intro)
else:
query = query
speak('Searching...')
try:
try:
res = client.query(query)
results = next(res.results).text
speak('WOLFRAM-ALPHA says - ')
speak('Got it.')
speak(results)
except:
results = wikipedia.summary(query, sentences=2)
speak('Got it.')
speak('WIKIPEDIA says - ')
speak(results)
except:
webbrowser.open('www.google.com')
speak('Any thing else?' + 'Arnav')