-
Notifications
You must be signed in to change notification settings - Fork 0
/
bot.py
127 lines (124 loc) · 4.95 KB
/
bot.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
import datetime
import random
import webbrowser
from ROCK_PAPER_SCISSORS import rock_paper_scissors
import covid_checker
from TIC_TAC_TOE import tic_tac_toe_gui
def greeting():
responses = [
"Welcome, I am a personal chatbot. I can take care of you :). Your name please : ",
"Hey hello! I am your personal bot who helps you to do your things. May I know your name? : "
]
print(random.choice(responses))
def guess_age():
try:
rem3 = int(input("Enter remainder of dividing your age by 3 : "))
rem5 = int(input("Enter remainder of dividing your age by 5 : "))
rem7 = int(input("Enter remainder of dividing your age by 7 : "))
except:
print("Please enter a valid input")
print("----------------------------------------------------------------------------------------------------")
return None
return (rem3 * 70 + rem5 * 21 + rem7 * 15) % 105
def wish(name):
time_now = datetime.datetime.now().hour
if time_now < 12:
print("Well! nice to meet you " + name + ", Good morning.")
elif time_now > 12 and time_now < 17:
print("Well! nice to meet you " + name + ", Good afternoon.")
elif time_now > 18 and time_now <22:
print("Well! nice to meet you " + name + ", Good evening.")
else:
print("Oh! I think it's time for bed " + name + ".")
def check():
print("I can make you more comfortable :)")
print("How are feeling now?")
print("1. I'm feeling good and let's have some fun!!")
print("2. I'm Not Feeling well :( Can you help me?")
print("3. I want to watch movies and webseries")
print("4. I want to buy some things")
print("5. End my session")
try:
return int(input("How are you feeling now: "))
except Exception:
print("Enter a valid choice")
def bot():
greeting()
name = input()
wish(name)
choice = check()
while choice != 5:
if choice == 1:
print("Why don't we play some exciting games :)")
print("Avialable Games")
print("1. Tic Tac Toe")
print("2. Rock Paper Scissors")
print("3. Why don't we have some Excitement!!!*Let me Guess your Age*")
try:
game = int(input("Choose A Game : "))
except:
print("Invalid Input")
continue
if game == 1:
tic_tac_toe_gui.ttt()
elif game == 2:
rock_paper_scissors.rps()
elif game == 3:
age = guess_age()
print("I did it ! Your Age is ",age)
else:
print("Invalid Input :( ")
elif choice == 2:
print("1 : I am Physically Not well, Can you help me")
print("2 : I am Mentally Disturbed, Can you help me")
try:
game = int(input("Choose your choice: "))
except:
print("Invalid Input")
continue
if game == 1:
print("Oh!, I am worried about you")
print("Trending Health Assessment tests....")
print("1 : Covid-19 Health Assessment Test")
print("2 : Health Condition Checker using Symptoms")
try:
choose = int(input("Choose your Choice : "))
except:
print("Invalid Input")
continue
if choose == 1:
covid_checker.check_me()
elif choose == 2:
print("Redirecting you.......")
webbrowser.open("https://www.mayoclinic.org/symptom-checker/select-symptom/itt-20009075", new = 1)
else:
print("Sorry! I didn't get that")
elif game == 2:
print("Please Make your choice")
print("1 : I want to take a Meditation class and stress relief exercises")
print("2 : I want to listen Music, It makes me more confortable")
try:
claim = int(input("Choose your Choice : "))
except:
print("Invalid Input")
continue
if claim == 1:
print("Redirecting you.......")
webbrowser.open("https://www.happify.com/", new = 1)
elif claim == 2:
print("Redirecting you.......")
webbrowser.open("https://www.spotify.com/in/", new = 1)
else:
print("Sorry! I didn't get that")
elif choice == 3:
print("Redirecting you.......")
webbrowser.open("https://www.netflix.com/in/", new = 1)
elif choice == 4:
print("Redirecting you.......")
webbrowser.open("https://www.amazon.in/", new = 1)
else:
print("Sorry! I didn't get that")
choice = check()
if choice == 3:
print("Good bye "+name+" Take care :-)" )
bot()