-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathbot.py
610 lines (518 loc) · 23.8 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
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
587
588
589
590
591
592
593
594
595
596
597
598
599
600
601
602
603
604
605
606
607
608
609
610
import os, time
import pandas as pd
import logging, requests, re
import inline_district_keyboard as idk
from cowin_api import CoWinAPI
from datetime import datetime, date, timedelta
from telegram import Sticker, BotCommand, Bot, InlineKeyboardMarkup, InlineKeyboardButton
from telegram.ext import Updater, CommandHandler, CallbackQueryHandler
from telegram.ext import MessageHandler, Filters, CallbackContext
# REGEX
AGE_BUTTON_REGEX = r'^age: (?P<age_mg>\d+)'
CMD_BUTTON_REGEX = r'^cmd: (?P<cmd_mg>.+)'
STATES_LIST_BUTTON_REGEX = r'^option_selected:'
# Global variables
AGE = 45
ID = ""
USERNAME = ""
FIRSTNAME = ""
LASTNAME = ""
STATE = ""
STATEID = ""
DISTRICT = ""
DISTRICTID = ""
PINCODE = ""
CHATID = ""
DAYS = 0
NOTIFICATION = True
TIMEOUT = 10
# Generating logs
logging.basicConfig(format='%(asctime)s - %(name)s - %(levelname)s - %(message)s',
level=logging.INFO)
URL = 'https://selfregistration.cowin.gov.in/'
logger = logging.getLogger(__name__)
TOKEN = "YOUR_TOKEN_HERE"
# Function for start command
def start(update, context):
author = update.message.from_user.first_name
reply = """ Hello *{}*! ✋
I am *Cowin* help bot. 🤖
I will assist you in finding *vaccination slot*.
💉💉💉💉💉💉💉💉💉
It is now easy to *search* 🔍 and setup *alerts* 🔔.
*/help* see all commands
""".format(author)
update.message.reply_text(reply, parse_mode="markdown")
# Updating basic details whenever a new user starts the bot
global FIRSTNAME
global LASTNAME
global ID
global USERNAME
global CHATID
FIRSTNAME = update.message.from_user.first_name
LASTNAME = update.message.from_user.last_name
ID = update.message.from_user.id
USERNAME = update.message.from_user.username
CHATID = update.message.chat_id
# Function for help command
def help(update, context):
text = f'''👨🚀 *HELP* 👨🚀
It is our help section.
This bot🤖 work on simple *commands*.
To run any command put "/" then type your command.👨💻
Below is a list of all commands you can use.
*Commands* -
1. */start:* to start the bot.
2. */state:* to add your state.
3. */pincode:* to add pincode of your region.
- *Format:* /pincode [YOUR_PINCODE]
4. */age:* to update your age preference.
5. */help:* to see help menu.
6. */about:* to view developer's details.
7. */slot_today:* to check slot today in your region.
8. */slot_tomorrow:* to check slot tomorrow in your region.
*Steps* -
1. Start your bot using /start.
2. Add State or Pincode using /state or /pincode.
3. Find available slots using */slot_today* or */slot_tomorrow*.
❗️ NOTE ❗️- To update your age preference use /age.
'''
update.message.reply_text(text, parse_mode="markdown")
# Function for echoing text and responding to wrong commands entered by user
def echo_text(update, context):
text = update.message.text
if text[0] == '/':
text = f'''You have entered an wrong command👨💻.
❌❌❌❌❌❌❌❌❌❌❌
Please re-enter your command.
'''
update.message.reply_text(text)
return
output = f''''I am an echo-bot. 🤖
📱I Will repeat whatever you say.📱
Echo: '''+ text
update.message.reply_text(output, parse_mode="markdown")
# Function district to update district details of user
def district(update, context, STATE_ID, STATE):
STATE_ID = int(STATE_ID)
text = f'''👾 *Select District* 👾
👇👇👇👇👇👇👇👇👇
'''
# Selection keyboard based on user's STATE ID
if STATE_ID == 1:
update.effective_chat.send_message(text, reply_markup=idk.get_district_1(), parse_mode="markdown")
elif STATE_ID == 2:
update.effective_chat.send_message(text, reply_markup=idk.get_district_2(), parse_mode="markdown")
elif STATE_ID == 3:
update.effective_chat.send_message(text, reply_markup=idk.get_district_3(), parse_mode="markdown")
elif STATE_ID == 4:
update.effective_chat.send_message(text, reply_markup=idk.get_district_4(), parse_mode="markdown")
elif STATE_ID == 5:
update.effective_chat.send_message(text, reply_markup=idk.get_district_5(), parse_mode="markdown")
elif STATE_ID == 6:
update.effective_chat.send_message(text, reply_markup=idk.get_district_6(), parse_mode="markdown")
elif STATE_ID == 7:
update.effective_chat.send_message(text, reply_markup=idk.get_district_7(), parse_mode="markdown")
elif STATE_ID == 8:
update.effective_chat.send_message(text, reply_markup=idk.get_district_8(), parse_mode="markdown")
elif STATE_ID == 9:
update.effective_chat.send_message(text, reply_markup=idk.get_district_9(), parse_mode="markdown")
elif STATE_ID == 10:
update.effective_chat.send_message(text, reply_markup=idk.get_district_10(), parse_mode="markdown")
elif STATE_ID == 11:
update.effective_chat.send_message(text, reply_markup=idk.get_district_11(), parse_mode="markdown")
elif STATE_ID == 12:
update.effective_chat.send_message(text, reply_markup=idk.get_district_12(), parse_mode="markdown")
elif STATE_ID == 13:
update.effective_chat.send_message(text, reply_markup=idk.get_district_13(), parse_mode="markdown")
elif STATE_ID == 14:
update.effective_chat.send_message(text, reply_markup=idk.get_district_14(), parse_mode="markdown")
elif STATE_ID == 15:
update.effective_chat.send_message(text, reply_markup=idk.get_district_15(), parse_mode="markdown")
elif STATE_ID == 16:
update.effective_chat.send_message(text, reply_markup=idk.get_district_16(), parse_mode="markdown")
elif STATE_ID == 17:
update.effective_chat.send_message(text, reply_markup=idk.get_district_17(), parse_mode="markdown")
elif STATE_ID == 18:
update.effective_chat.send_message(text, reply_markup=idk.get_district_18(), parse_mode="markdown")
elif STATE_ID == 19:
update.effective_chat.send_message(text, reply_markup=idk.get_district_19(), parse_mode="markdown")
elif STATE_ID == 20:
update.effective_chat.send_message(text, reply_markup=idk.get_district_20(), parse_mode="markdown")
elif STATE_ID == 21:
update.effective_chat.send_message(text, reply_markup=idk.get_district_21(), parse_mode="markdown")
elif STATE_ID == 22:
update.effective_chat.send_message(text, reply_markup=idk.get_district_22(), parse_mode="markdown")
elif STATE_ID == 23:
update.effective_chat.send_message(text, reply_markup=idk.get_district_23(), parse_mode="markdown")
elif STATE_ID == 24:
update.effective_chat.send_message(text, reply_markup=idk.get_district_24(), parse_mode="markdown")
elif STATE_ID == 25:
update.effective_chat.send_message(text, reply_markup=idk.get_district_25(), parse_mode="markdown")
elif STATE_ID == 26:
update.effective_chat.send_message(text, reply_markup=idk.get_district_26(), parse_mode="markdown")
elif STATE_ID == 27:
update.effective_chat.send_message(text, reply_markup=idk.get_district_27(), parse_mode="markdown")
elif STATE_ID == 28:
update.effective_chat.send_message(text, reply_markup=idk.get_district_28(), parse_mode="markdown")
elif STATE_ID == 29:
update.effective_chat.send_message(text, reply_markup=idk.get_district_29(), parse_mode="markdown")
elif STATE_ID == 30:
update.effective_chat.send_message(text, reply_markup=idk.get_district_30(), parse_mode="markdown")
elif STATE_ID == 31:
update.effective_chat.send_message(text, reply_markup=idk.get_district_31(), parse_mode="markdown")
elif STATE_ID == 32:
update.effective_chat.send_message(text, reply_markup=idk.get_district_32(), parse_mode="markdown")
elif STATE_ID == 33:
update.effective_chat.send_message(text, reply_markup=idk.get_district_33(), parse_mode="markdown")
elif STATE_ID == 34:
update.effective_chat.send_message(text, reply_markup=idk.get_district_34(), parse_mode="markdown")
elif STATE_ID == 35:
update.effective_chat.send_message(text, reply_markup=idk.get_district_35(), parse_mode="markdown")
elif STATE_ID == 36:
update.effective_chat.send_message(text, reply_markup=idk.get_district_36(), parse_mode="markdown")
elif STATE_ID == 37:
update.effective_chat.send_message(text, reply_markup=idk.get_district_37(), parse_mode="markdown")
#
# Keyboard for all states
def get_states_kb() -> InlineKeyboardMarkup:
keyboard = [
[
InlineKeyboardButton("Andaman and Nicobar Islands", callback_data='option_selected:Andaman and Nicobar Islands:1'),
InlineKeyboardButton("Andhra Pradesh", callback_data='option_selected:Andhra Pradesh:2'),
],
[
InlineKeyboardButton("Arunachal Pradesh", callback_data='option_selected:Andhra Pradesh:3'),
InlineKeyboardButton("Assam", callback_data='option_selected:Assam:4'),
],
[
InlineKeyboardButton("Bihar", callback_data='option_selected:Bihar:5'),
InlineKeyboardButton("Chandigarh", callback_data='option_selected:Chandigarh:6'),
],
[
InlineKeyboardButton("Chhattisgarh", callback_data='option_selected:Chhattisgarh:7'),
InlineKeyboardButton("Dadra and Nagar Haveli", callback_data='option_selected:Dadra and Nagar Haveli:8'),
],
[
InlineKeyboardButton("Daman and Diu", callback_data='option_selected:Daman and Diu:37'),
InlineKeyboardButton("Delhi", callback_data='option_selected:Delhi:9'),
],
[
InlineKeyboardButton("Goa", callback_data='option_selected:Goa:10'),
InlineKeyboardButton("Gujarat", callback_data='option_selected:Gujarat:11'),
],
[
InlineKeyboardButton("Haryana", callback_data='option_selected:Haryana:12'),
InlineKeyboardButton("Himachal Pradesh", callback_data='option_selected:Himachal Pradesh:13'),
],
[
InlineKeyboardButton("Jammu and Kashmir", callback_data='option_selected:Jammu and Kashmir:14'),
InlineKeyboardButton("Jharkhand", callback_data='option_selected:Jharkhand:15'),
],
[
InlineKeyboardButton("Karnataka", callback_data='option_selected:Karnataka:16'),
InlineKeyboardButton("Kerala", callback_data='option_selected:Kerala:17'),
],
[
InlineKeyboardButton("Ladakh", callback_data='option_selected:Ladakh:18'),
InlineKeyboardButton("Lakshadweep", callback_data='option_selected:Lakshadweep:19'),
],
[
InlineKeyboardButton("Madhya Pradesh", callback_data='option_selected:Madhya Pradesh:20'),
InlineKeyboardButton("Maharashtra", callback_data='option_selected:Maharashtra:21'),
],
[
InlineKeyboardButton("Manipur", callback_data='option_selected:Manipur:22'),
InlineKeyboardButton("Meghalaya", callback_data='option_selected:Meghalaya:23'),
],
[
InlineKeyboardButton("Mizoram", callback_data='option_selected:Mizoram:24'),
InlineKeyboardButton("Nagaland", callback_data='option_selected:Nagaland:25'),
],
[
InlineKeyboardButton("Odisha", callback_data='option_selected:Odisha:26'),
InlineKeyboardButton("Puducherry", callback_data='option_selected:Puducherry:27'),
],
[
InlineKeyboardButton("Punjab", callback_data='option_selected:Punjab:28'),
InlineKeyboardButton("Rajasthan", callback_data='option_selected:Rajasthan:29'),
],
[
InlineKeyboardButton("Sikkim", callback_data='option_selected:Sikkim:30'),
InlineKeyboardButton("Tamil Nadu", callback_data='option_selected:Tamil Nadu:31'),
],
[
InlineKeyboardButton("Telangana", callback_data='option_selected:Telangana:32'),
InlineKeyboardButton("Tripura", callback_data='option_selected:Tripura:33'),
],
[
InlineKeyboardButton("Uttar Pradesh", callback_data='option_selected:Uttar Pradesh:34'),
InlineKeyboardButton("Uttarakhand", callback_data='option_selected:Uttarakhand:35'),
],
[
InlineKeyboardButton("West Bengal", callback_data='option_selected:West Bengal:36'),
]
]
return InlineKeyboardMarkup(keyboard)
# Function state list for user to select one state
def states_list(update, context):
global PINCODE
PINCODE = ""
text = f'''👾 *Select State* 👾
👇👇👇👇👇👇👇👇👇
'''
update.effective_chat.send_message(text, reply_markup=get_states_kb(), parse_mode="markdown")
return
# Callback function of state
def states_list_callback(update, context):
query = update.callback_query
query.answer()
text = query.data
global STATE
global STATEID
if text[-2] == ':':
STATE = text[16:-2]
STATEID = text[-1:]
else:
STATE = text[16:-3]
STATEID = text[-2:]
text = f''' *Selected State*
✔️✔️✔️✔️✔️✔️✔️✔️
> Successful: 👍🏻
> STATE: {STATE}
> STATE ID: {STATEID}
✔️✔️✔️✔️✔️✔️✔️✔️
'''
query.edit_message_text(text, parse_mode="markdown")
district(update, context, STATEID, STATE)
# Function to echo sticker as a response to user sticker
def echo_sticker(update, context):
text = update.message.text
update.message.reply_sticker(sticker=update.message.sticker.file_id)
# Error fucntion for logging error
def error(update, context):
logger.warning('Update "%s" caused "%s"', update, context.error)
# Age keyboard
def get_age_kb() -> InlineKeyboardMarkup:
keyboard = [
[
InlineKeyboardButton("18+", callback_data='age: 1'),
InlineKeyboardButton("45+", callback_data='age: 2'),
]
]
return InlineKeyboardMarkup(keyboard)
# Function for handling age command
def age_command(update, context):
text = f'''👾 *Select Age* 👾
👇👇👇👇👇👇👇👇👇
'''
update.effective_chat.send_message(text, reply_markup=get_age_kb(), parse_mode="markdown")
return
# Age callback function to handle users preference for age group
def age_callback(update, context):
query = update.callback_query
query.answer()
global AGE
if query.data == 'age: 1':
AGE = 18
elif query.data == 'age: 2':
AGE = 45
text = f''' *Selected Age*
✔️✔️✔️✔️✔️✔️✔️✔️
> Successful: 👍🏻
> New Age: {AGE}
✔️✔️✔️✔️✔️✔️✔️✔️
'''
query.edit_message_text(text, parse_mode="markdown")
# About section with information of developer
def about(update, context):
text = f'''👨💻 *About Section* 👨💻
*Hello*, I am Dhruv Saini, the *developer* of this bot.
In the beginning,
I had an objective to help people find vaccination slot.
And this is my solution for the problem.
*My profiles*
LinkedIN - https://www.linkedin.com/in/dhruv73
GitHub - https://github.com/DS-73
'''
update.message.reply_text(text, parse_mode="markdown")
# Button to handle in-general callbacks form inline keyboards
def button(update, context):
query = update.callback_query
query.answer()
global DISTRICT
global DISTRICTID
text = query.data
if text[-2] == '-':
DISTRICT = text[:-2]
DISTRICTID = text[-1:]
elif text[-3] == '-':
DISTRICT = text[:-3]
DISTRICTID = text[-2:]
elif text[-4] == '-':
DISTRICT = text[:-4]
DISTRICTID = text[-3:]
else:
DISTRICT = text[:-5]
DISTRICTID = text[-4:]
text = f''' *Selected District*
✔️✔️✔️✔️✔️✔️✔️✔️
> Successful: 👍🏻
> DISTRICT: {DISTRICT}
> DISTRICT ID: {DISTRICTID}
✔️✔️✔️✔️✔️✔️✔️✔️
'''
query.edit_message_text(text)
age_command(update, context)
# Function to handle pincode command
def pincode_command(update, context):
text = update.message.text
global PINCODE
PINCODE = text[9:]
PINCODE = PINCODE.strip()
# Resetting District to avoid searching acccording to districts
global DISTRICTID
DISTRICTID = ""
text = ""
# Validating Pincode entered by user
try:
pin = int(PINCODE)
validate_pin = lambda pin: len(pin) in (6) and pin.isdigit()
if not validate_pin:
raise Exception
except:
text = f'''👾 *INVALID PINCODE* 👾
Please enter a *valid* pincode using /pincode command.👨💻
❗️ Format ❗️ - /pincode [YOUR_PINCODE]
'''
update.effective_chat.send_message(text, parse_mode="markdown")
return
# Incase of valid pincode
text = f'''👾 *Pincode Updates* 👾
👇👇👇👇👇👇👇👇👇
Pincode: {PINCODE}
'''
update.effective_chat.send_message(text, parse_mode="markdown")
age_command(update, context)
return
# Function to check from slot today
def get_slot_today(update, context):
# CoWIN Official website url
URL = 'https://selfregistration.cowin.gov.in/'
# Returing back if required details are not found
if len(DISTRICTID) == 0 and len(PINCODE) == 0:
text = f"NOT ENOUGH DETAILS!!!!"
update.message.reply_text(text)
else:
# Using CoWIN API to search for a slot
cowin = CoWinAPI()
today = date.today()
DATE = today.strftime("%d-%m-%Y")
if len(DISTRICTID) > 0:
available_centers = cowin.get_availability_by_district(DISTRICTID, DATE, AGE)
elif len(PINCODE) > 0:
available_centers = cowin.get_availability_by_pincode(PINCODE, DATE, AGE)
# Update flag False in case of no vaccination slot
UPDATE = False
# Replying user with deatils of vaccination center with available slots
if len(available_centers["centers"]) > 0:
URL = 'https://selfregistration.cowin.gov.in/'
for x in available_centers["centers"]:
center_name = x["name"]
center_address = x["address"]
center_district = x["district_name"]
center_pincode = x["pincode"]
center_fee = x["fee_type"]
for items in x["sessions"]:
if items["available_capacity_dose1"]>0 and items["available_capacity_dose2"]>0:
VACCINE = items['vaccine']
DOSE1 = items["available_capacity_dose1"]
DOSE2 = items["available_capacity_dose2"]
MIN_AGE_LIMIT = items["min_age_limit"]
text = f"Name: {center_name}\nDistrict: {center_district}\nAddress: {center_address}\nPincode:{center_pincode}\n\nFees: {center_fee}\nVaccine: {VACCINE}\nDate: {DATE}\nDose1: {DOSE1}\nDose2: {DOSE2}\nAge Limit: {MIN_AGE_LIMIT}\n{URL}"
update.message.reply_text(text)
UPDATE = True
# Replying with no slot in case of slot unavailablility of slot
if not UPDATE:
text = f"No Slot Available on {DATE} in your region.\n\nFor more information \n{URL}"
update.message.reply_text(text)
# Function to check from slot tomorrow
def get_slot_tomorrow(update, context):
# CoWIN Official website url
URL = 'https://selfregistration.cowin.gov.in/'
# Returing back if required details are not found
if len(DISTRICTID) == 0 and len(PINCODE) == 0:
text = f"NOT ENOUGH DETAILS!!!! {DISTRICTID}:{PINCODE}"
update.message.reply_text(text)
else:
# Using CoWIN API to search for a slot
cowin = CoWinAPI()
today = date.today() + timedelta(1)
DATE = today.strftime("%d-%m-%Y")
if len(DISTRICTID) > 0:
available_centers = cowin.get_availability_by_district(DISTRICTID, DATE, AGE)
elif len(PINCODE) > 0:
available_centers = cowin.get_availability_by_pincode(PINCODE, DATE, AGE)
# Update flag False in case of no vaccination slot
UPDATE = False
# Replying user with deatils of vaccination center with available slots
if len(available_centers["centers"]) > 0:
URL = 'https://selfregistration.cowin.gov.in/'
for x in available_centers["centers"]:
center_name = x["name"]
center_address = x["address"]
center_district = x["district_name"]
center_pincode = x["pincode"]
center_fee = x["fee_type"]
for items in x["sessions"]:
vaccines = []
if items["available_capacity_dose1"]>0 and items["available_capacity_dose2"]>0:
if items['vaccine'] not in vaccines:
vaccines.append(items['vaccine'])
DOSE1 = items["available_capacity_dose1"]
DOSE2 = items["available_capacity_dose2"]
MIN_AGE_LIMIT = items["min_age_limit"]
VACCINE = vaccines[0]
text = f"Name: {center_name}\nDistrict: {center_district}\nAddress: {center_address}\nPincode:{center_pincode}\n\nFees: {center_fee}\nVaccine: {VACCINE}\nDate: {DATE}\nDose1: {DOSE1}\nDose2: {DOSE2}\nAge Limit: {MIN_AGE_LIMIT}\n{URL}"
update.message.reply_text(text)
UPDATE = True
# Replying with no slot in case of slot unavailablility of slot
if not UPDATE:
text = f"No Slot Available on {DATE} in your region.\n\nFor more information \n{URL}"
update.message.reply_text(text)
# Main function of our code
def main():
bot = Bot(TOKEN)
# Setting bot commands for quick access
bot.set_my_commands([
BotCommand(command='start', description='start the bot session'),
BotCommand(command='help', description='provide help in using bot'),
BotCommand(command='about', description='this is about section of developer'),
BotCommand(command='state', description='update your state and district'),
BotCommand(command='pincode', description='update pincode'),
BotCommand(command='age', description='update age preference'),
BotCommand(command='about', description='to view bot developer\'s detail'),
BotCommand(command='slot_today', description='Check slot for today in your region'),
BotCommand(command='slot_tomorrow', description='Check slot for tomorrow in your region'),
])
updater = Updater(TOKEN, use_context=True)
dispacher_obj = updater.dispatcher
# Various different handlers
dispacher_obj.add_handler(CommandHandler("start", start))
dispacher_obj.add_handler(CommandHandler("help", help))
dispacher_obj.add_handler(CommandHandler("state", states_list))
dispacher_obj.add_handler(CommandHandler("slot_today", get_slot_today))
dispacher_obj.add_handler(CommandHandler("slot_tomorrow", get_slot_tomorrow))
dispacher_obj.add_handler(CommandHandler("age", age_command))
dispacher_obj.add_handler(CommandHandler("about", about))
dispacher_obj.add_handler(CommandHandler("pincode", pincode_command))
dispacher_obj.add_handler(CallbackQueryHandler(age_callback, pattern=AGE_BUTTON_REGEX))
dispacher_obj.add_handler(CallbackQueryHandler(states_list_callback, pattern=STATES_LIST_BUTTON_REGEX))
dispacher_obj.add_handler(CallbackQueryHandler(button))
dispacher_obj.add_handler(MessageHandler(Filters.text, echo_text))
dispacher_obj.add_handler(MessageHandler(Filters.sticker, echo_sticker))
dispacher_obj.add_error_handler(error)
updater.start_polling()
updater.idle()
if __name__ == "__main__":
main()