-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathmain.py
78 lines (63 loc) · 1.99 KB
/
main.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
import sys
from lib.sound import Sound
from data.json import read, check
# initializing things
sound = Sound()
args_length = len(sys.argv)
# print(f"args length: {args_length}")
class Talk(object):
def __init__(self):
if args_length >= 3:
self.depression = int(sys.argv[2])
else:
self.depression = 0
if args_length >= 2:
self.input = sys.argv[1]
else:
self.input = 'text'
sound.setInput(self.input)
print("input type:", self.input)
print("depression level:", self.depression)
self.checkDie()
def setInput(self, value: str):
self.input = value
sound.setInput = value
def increment(self, value=1):
self.depression += value
print("\nуровень депрессии:", self.depression)
sound.say('ай блять')
self.checkDie()
def decrement(self, value=1):
self.depression -= value
print("\nуровень депрессии:", self.depression)
sound.say('спасибо')
self.checkDie()
def reset(self):
self.depression = 0
print('reseted')
def checkDie(self):
if self.depression >= 10:
self.die()
def die(self):
sound.say('блять. заебало. всё, пока.')
sound.play("assets/gunshot.m4a")
sys.exit()
siri = Talk()
def main():
sound.say('привет, напиши или скажи мне что нибудь ')
userType = sound.listenTo()
sound.say("читаю: " + userType)
sound.say('хм..')
result = check(userType)
if result == 'bad' or result == 'Negative':
siri.increment()
elif result == 'good' or result == 'Positive':
siri.decrement()
elif result == 'good' or result == 'Neutral':
sound.say('ok..?')
elif hasattr(result, 'id'):
sound.say(result['choices'][0]['text'].strip())
else:
sound.say('чего?')
while True:
main()