116 строки
2.4 KiB
Python
116 строки
2.4 KiB
Python
from aiogram import Bot, Dispatcher
|
|
from aiogram.contrib.fsm_storage.memory import MemoryStorage
|
|
|
|
import config
|
|
from fsm import FSM
|
|
import handlers
|
|
import messages
|
|
|
|
|
|
bot = Bot(
|
|
token=config.Bot.token,
|
|
)
|
|
|
|
storage = MemoryStorage()
|
|
|
|
dispatcher = Dispatcher(
|
|
bot=bot,
|
|
storage=storage,
|
|
)
|
|
|
|
dispatcher.register_message_handler(
|
|
callback=messages.start,
|
|
commands=['start'],
|
|
state='*',
|
|
)
|
|
|
|
dispatcher.register_message_handler(
|
|
callback=handlers.start,
|
|
state=FSM.start,
|
|
)
|
|
|
|
dispatcher.register_message_handler(
|
|
callback=handlers.select_category,
|
|
state=FSM.select_category,
|
|
)
|
|
|
|
dispatcher.register_message_handler(
|
|
callback=handlers.select_subcategory,
|
|
state=FSM.select_subcategory,
|
|
)
|
|
|
|
dispatcher.register_message_handler(
|
|
callback=handlers.select_date,
|
|
state=FSM.select_date,
|
|
)
|
|
|
|
dispatcher.register_message_handler(
|
|
callback=handlers.select_time_range,
|
|
state=FSM.select_time_range,
|
|
)
|
|
|
|
dispatcher.register_message_handler(
|
|
callback=handlers.input_email_address,
|
|
state=FSM.input_email_address,
|
|
)
|
|
|
|
dispatcher.register_message_handler(
|
|
callback=handlers.input_phone_number,
|
|
state=FSM.input_phone_number,
|
|
)
|
|
|
|
dispatcher.register_message_handler(
|
|
callback=handlers.input_comment,
|
|
state=FSM.input_comment,
|
|
)
|
|
|
|
dispatcher.register_message_handler(
|
|
callback=handlers.confirm_order,
|
|
state=FSM.confirm_order,
|
|
)
|
|
|
|
dispatcher.register_message_handler(
|
|
callback=handlers.success_sign_up,
|
|
state=FSM.success_sign_up,
|
|
)
|
|
|
|
dispatcher.register_message_handler(
|
|
callback=handlers.select_order,
|
|
state=FSM.select_order,
|
|
)
|
|
|
|
dispatcher.register_message_handler(
|
|
callback=handlers.no_orders,
|
|
state=FSM.no_orders,
|
|
)
|
|
|
|
dispatcher.register_message_handler(
|
|
callback=handlers.select_operation,
|
|
state=FSM.select_operation,
|
|
)
|
|
|
|
dispatcher.register_message_handler(
|
|
callback=handlers.reschedule_order_select_date,
|
|
state=FSM.reschedule_order_select_date,
|
|
)
|
|
|
|
dispatcher.register_message_handler(
|
|
callback=handlers.reschedule_order_select_time_range,
|
|
state=FSM.reschedule_order_select_time_range,
|
|
)
|
|
|
|
dispatcher.register_message_handler(
|
|
callback=handlers.success_reschedule_order,
|
|
state=FSM.success_reschedule_order,
|
|
)
|
|
|
|
dispatcher.register_message_handler(
|
|
callback=handlers.cancel_order,
|
|
state=FSM.cancel_order,
|
|
)
|
|
|
|
dispatcher.register_message_handler(
|
|
callback=handlers.success_cancel_order,
|
|
state=FSM.success_cancel_order,
|
|
)
|