ShopBot/handlers/operator/start.py

25 lines
1.1 KiB
Python
Raw Normal View History

2022-06-05 15:07:48 +03:00
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))
2022-06-16 00:32:17 +03:00
@dp.message_handler(lambda x: x.text == messages.leave_work, is_operator=True)
2022-06-05 15:07:48 +03:00
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)
2022-06-16 00:32:17 +03:00
@dp.message_handler(lambda x: x.text == messages.on_work, is_operator=True)
2022-06-05 15:07:48 +03:00
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)