-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathmain2.py
More file actions
91 lines (62 loc) · 2.26 KB
/
main2.py
File metadata and controls
91 lines (62 loc) · 2.26 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
import speech_recognition as sr
import pyttsx3
import datetime
import wikipedia
import webbrowser
import pywhatkit
maquina = pyttsx3.init()
vozes = maquina.getProperty('voices')
maquina.setProperty('voice', vozes[0].id)
maquina.setProperty("rate",220)
def falar(audio):
maquina.say(audio)
maquina.runAndWait()
def microfone():
r = sr.Recognizer()
with sr.Microphone() as source:
r.pause_threshold = 1
r.adjust_for_ambient_noise(source)
audio = r.listen(source)
try:
print("Reconhecendo...")
comando = r.recognize_google(audio, language='pt-BR')
print(comando)
except Exception as e:
print(e)
return "None"
return comando
def abrir_google():
google = f"https://google.com/"
falar("claro parça")
webbrowser.open(google)
def tempo():
Tempo = datetime.datetime.now().strftime("%I:%M")
falar("agora são")
falar(Tempo)
def tocar(musica):
pywhatkit.playonyt(musica)
def boas_vindas():
falar("Olá arthur. Seja bem vindo")
falar("como posso lhe ajudar?")
if __name__ == "__main__":
boas_vindas()
while True:
print("escutando...")
comando = microfone().lower()
if 'artemis' in comando and 'olá' in comando:
falar("Olá")
elif 'oi' in comando and 'artemis' in comando:
falar("Olá, tudo bem?")
elif 'e você' in comando:
falar("Que bom, fico feliz. Eu estou ótima")
elif 'como você está' in comando and 'artemis' in comando:
falar("Estou bem, obrigada")
elif 'hora' in comando and 'artemis' in comando:
tempo()
elif 'abrir google' in comando and 'artemis' in comando:
abrir_google()
elif 'artemis' in comando and 'tocar' in comando:
musica = comando.replace('artemis' and 'tocar', '')
tocar(musica)
elif 'artemis' in comando and 'ferrar' in comando:
falar("vai se ferrar você seu desgraçado")