-
Notifications
You must be signed in to change notification settings - Fork 2
/
text.py
48 lines (34 loc) · 1.2 KB
/
text.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
def get_response(msg):
# print("yo")
msg = msg.lower()
if 'reminder' in msg:
l = []
num = 0
for i in range(len(msg)):
if msg[i] >= '0' and msg[i]<='9':
num = num*10+(int(msg[i]))
else:
if num:
l.append(num)
num=0
if num:
l.append(num)
return l
if 'hi' in msg or 'hello' in msg:
out = 'Hello ! I am ContestBot'
return [out]
elif 'bye' in msg or 'tata' in msg:
out = 'Goodbye ! See you soon!'
return [out]
# elif 'show' in msg and 'contests' in msg:
# out = 'Select Platforms:\n'+ str(1) + ' Codeforces\n' + str(2) + ' Codechef\n' + str(3) + ' HackerEarth'
# return [out]
out = [{ 'platform': [] }]
if 'codeforces' in msg or 'cf' in msg or 'all' in msg:
out[0]['platform'].append('codeforces')
if 'hackerearth' in msg or 'he' in msg or 'all' in msg:
out[0]['platform'].append('hackerearth')
if 'codechef' in msg or 'cc' in msg or 'all' in msg:
out[0]['platform'].append('codechef')
return out
# get_response("set reminder for 2,3,25")