ShopBot/handlers/operator/start.py
2022-06-05 15:07:48 +03:00

25 lines
1.0 KiB
Python

from aiogram import types
from load import dp, bot, messages
from keyboard.default.operator.main_menu import main_menu
from keyboard.default.main_menu import back_to_main_menu
from utils.database.user import User
@dp.message_handler(lambda x: x.text == messages.operator_panel, is_operator=True)
async def cmd_menu(message: types.Message):
active = User.get_state(message.from_user.id)
await bot.send_message(message.chat.id, "Operator panel", reply_markup=main_menu(active))
@dp.message_handler(lambda x: x.text == messages.leave_work)
async def leave_work(message: types.Message):
User.set_state(message.from_user.id)
await bot.send_message(message.chat.id, "Режим тех. поддержки отключён!", reply_markup=back_to_main_menu)
@dp.message_handler(lambda x: x.text == messages.on_work)
async def on_work(message: types.Message):
User.set_state(message.from_user.id, True)
await bot.send_message(message.chat.id, "Режим тех. поддержки включён!", reply_markup=back_to_main_menu)