перед лимитом, добавление подсказок
This commit is contained in:
parent
c783fcb92b
commit
61562da3e4
3 changed files with 70 additions and 0 deletions
|
|
@ -96,6 +96,7 @@ async def on_bot_started(event: BotStarted, context: BaseContext) -> None:
|
||||||
|
|
||||||
@router.message_created(Command("start"))
|
@router.message_created(Command("start"))
|
||||||
async def on_start_command(event: MessageCreated, context: BaseContext) -> None:
|
async def on_start_command(event: MessageCreated, context: BaseContext) -> None:
|
||||||
|
"""commands_info: Главное меню"""
|
||||||
chat_id, user_id = event.get_ids()
|
chat_id, user_id = event.get_ids()
|
||||||
if user_id is None or chat_id is None:
|
if user_id is None or chat_id is None:
|
||||||
return
|
return
|
||||||
|
|
@ -237,3 +238,72 @@ async def on_contact_shared(
|
||||||
text=menu_text,
|
text=menu_text,
|
||||||
attachments=[main_menu_kb()],
|
attachments=[main_menu_kb()],
|
||||||
)
|
)
|
||||||
|
|
||||||
|
|
||||||
|
# ── /menu ─────────────────────────────────────────────────────────────────────
|
||||||
|
|
||||||
|
@router.message_created(Command("menu"))
|
||||||
|
async def on_menu_command(event: MessageCreated, context: BaseContext) -> None:
|
||||||
|
"""commands_info: Показать меню"""
|
||||||
|
chat_id, user_id = event.get_ids()
|
||||||
|
if user_id is None or chat_id is None:
|
||||||
|
return
|
||||||
|
|
||||||
|
bot_user = await get_bot_user_by_max_id(user_id)
|
||||||
|
if not bot_user or not bot_user["is_authorized"]:
|
||||||
|
return
|
||||||
|
|
||||||
|
from bot.handlers.create_ticket import cleanup_ticket_flow
|
||||||
|
await cleanup_ticket_flow(event.bot, context)
|
||||||
|
await context.set_state(None)
|
||||||
|
|
||||||
|
from bot.handlers.menu import build_main_menu_text
|
||||||
|
await bot_send(
|
||||||
|
event.bot,
|
||||||
|
chat_id=chat_id,
|
||||||
|
user_id=user_id,
|
||||||
|
text=await build_main_menu_text(bot_user),
|
||||||
|
attachments=[main_menu_kb()],
|
||||||
|
)
|
||||||
|
|
||||||
|
|
||||||
|
# ── /cancel ───────────────────────────────────────────────────────────────────
|
||||||
|
|
||||||
|
@router.message_created(Command("cancel"))
|
||||||
|
async def on_cancel_command(event: MessageCreated, context: BaseContext) -> None:
|
||||||
|
"""commands_info: Отменить текущее действие"""
|
||||||
|
chat_id, user_id = event.get_ids()
|
||||||
|
if user_id is None or chat_id is None:
|
||||||
|
return
|
||||||
|
|
||||||
|
bot_user = await get_bot_user_by_max_id(user_id)
|
||||||
|
if not bot_user or not bot_user["is_authorized"]:
|
||||||
|
return
|
||||||
|
|
||||||
|
from bot.handlers.create_ticket import cleanup_ticket_flow
|
||||||
|
from bot.states import CommentStates, TicketStates
|
||||||
|
|
||||||
|
state = await context.get_state()
|
||||||
|
active_states = [
|
||||||
|
TicketStates.waiting_description,
|
||||||
|
TicketStates.collecting_attachments,
|
||||||
|
TicketStates.confirming,
|
||||||
|
CommentStates.waiting_text,
|
||||||
|
]
|
||||||
|
|
||||||
|
if state in active_states:
|
||||||
|
await cleanup_ticket_flow(event.bot, context)
|
||||||
|
cancel_text = "❌ Действие отменено.\n\n"
|
||||||
|
else:
|
||||||
|
cancel_text = ""
|
||||||
|
|
||||||
|
await context.set_state(None)
|
||||||
|
|
||||||
|
from bot.handlers.menu import build_main_menu_text
|
||||||
|
await bot_send(
|
||||||
|
event.bot,
|
||||||
|
chat_id=chat_id,
|
||||||
|
user_id=user_id,
|
||||||
|
text=cancel_text + await build_main_menu_text(bot_user),
|
||||||
|
attachments=[main_menu_kb()],
|
||||||
|
)
|
||||||
|
|
|
||||||
Binary file not shown.
Binary file not shown.
Loading…
Add table
Reference in a new issue