-
Notifications
You must be signed in to change notification settings - Fork 0
/
responses.py
41 lines (33 loc) · 1.2 KB
/
responses.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
import constants as const
import display as dy
def sample_responses(input_text):
user_message = str(input_text).lower()
if user_message == ('/start'):
return const.welcome_message
if user_message == ('/pin'):
return const.findByPin_message
if pin_request(user_message):
text = dy.displaySessionsByPin(user_message)
if text == '':
return 'No Vaccination Slot registered under COWIN available in your district.'
else:
return text
if calendar_request(user_message):
text = dy.displayCalendarByPin(user_message)
if text == '':
return 'No Vaccination Slot registered under COWIN available in your district.'
else:
return text
return 'Request not valid. Kindly enter the request/command in the correct format.'
def pin_request(message):
request = message.split()
if len(request)<2 or request[0].lower() not in {"pin" or "Pin"}:
return False
else:
return True
def calendar_request(message):
request = message.split()
if len(request)<2 or request[0].lower() not in {"calendar" or "Calendar"}:
return False
else:
return True