GPQBot
1from pybotx import (
2Bot,
3BubbleMarkup,
4ChatCreatedEvent,
5HandlerCollector,
6IncomingMessage,
7)
8
9from app.resources import strings
10
11
12collector = HandlerCollector()
13
14@collector.default_message_handler
15async def default_message_handler(
16message: IncomingMessage,
17bot: Bot,
18) -> None:
19
20bubbles = BubbleMarkup()
21bubbles.add_button(command="/menu", label="Главное меню")
22
23await bot.send_message(body=strings.DEFAULT_MESSAGE, bubbles=bubbles)
24
25
26@collector.chat_created
27async def chat_created_handler(event: ChatCreatedEvent, bot: Bot) -> None:
28
29answer_body = strings.CHAT_CREATED_TEMPLATE.format(
30bot_project_name=strings.BOT_DISPLAY_NAME
31)
32bubbles = BubbleMarkup()
33bubbles.add_button(command="/menu", label="Главное меню")
34
35await bot.send_message(answer_body, bubbles=bubbles)
36
37
38@collector.command("/menu")
39async def menu_handler(message: IncomingMessage, bot: Bot) -> None:
40
41bubbles = BubbleMarkup()
42bubbles.add_button(command="/news", label="Новости дирекции качества")
43bubbles.add_button(command="/fidback", label="Статистика КН и АИК")
44bubbles.add_button(command="/kpi", label="Оставить обратную связь")
45
46await bot.send_message(body=strings.MAIN_MENU, bubbles=bubbles)
47
48