ShopBot/handlers/operator/start.py
2022-06-16 00:32:17 +03:00

25 lines
1.1 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, is_operator=True)
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, is_operator=True)
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)