-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathkeyboards.py
More file actions
52 lines (43 loc) · 1.48 KB
/
keyboards.py
File metadata and controls
52 lines (43 loc) · 1.48 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
from __future__ import annotations
from aiogram.types import (
InlineKeyboardButton,
InlineKeyboardMarkup,
KeyboardButton,
ReplyKeyboardMarkup,
)
from aiogram.utils.keyboard import InlineKeyboardBuilder
def user_menu() -> ReplyKeyboardMarkup:
return ReplyKeyboardMarkup(
keyboard=[[KeyboardButton(text="Частые вопросы"), KeyboardButton(text="Задать вопрос")]],
resize_keyboard=True,
)
def admin_menu() -> ReplyKeyboardMarkup:
return ReplyKeyboardMarkup(
keyboard=[
[
KeyboardButton(text="Добавить вопрос"),
KeyboardButton(text="Список вопросов"),
],
[KeyboardButton(text="Удалить вопрос"), KeyboardButton(text="Назад")],
],
resize_keyboard=True,
)
def build_faq_keyboard(faqs: list[tuple[int, str]]) -> InlineKeyboardMarkup:
builder = InlineKeyboardBuilder()
for faq_id, question in faqs:
builder.row(
InlineKeyboardButton(
text=question,
callback_data=f"faq:{faq_id}",
)
)
return builder.as_markup()
def build_admin_reply_keyboard(user_id: int) -> InlineKeyboardMarkup:
builder = InlineKeyboardBuilder()
builder.row(
InlineKeyboardButton(
text="Ответить пользователю",
callback_data=f"reply:{user_id}",
)
)
return builder.as_markup()