Bot become a Community Guard & Post send manager
added: dictionary support for censore message/user management with dict triggers
This commit is contained in:
@@ -6,6 +6,7 @@ def kb_next_text(draft_id: int):
|
||||
)
|
||||
|
||||
def kb_confirm(draft_id: int):
|
||||
# Кнопка «Отправить» ведёт к мультивыбору чатов
|
||||
return InlineKeyboardMarkup(
|
||||
[
|
||||
[
|
||||
@@ -15,7 +16,21 @@ def kb_confirm(draft_id: int):
|
||||
]
|
||||
)
|
||||
|
||||
def kb_multiselect(draft_id: int, chats: list[tuple[str, int]], selected: set[int]):
|
||||
rows = []
|
||||
for title, chat_id in chats:
|
||||
mark = "✅ " if chat_id in selected else "▫️ "
|
||||
rows.append([InlineKeyboardButton(f"{mark}{title}", callback_data=f"tgl:{draft_id}:{chat_id}")])
|
||||
|
||||
rows.append([
|
||||
InlineKeyboardButton("Выбрать все", callback_data=f"selall:{draft_id}"),
|
||||
InlineKeyboardButton("Сбросить", callback_data=f"clear:{draft_id}"),
|
||||
])
|
||||
rows.append([
|
||||
InlineKeyboardButton("Отправить выбранные", callback_data=f"sendmulti:{draft_id}"),
|
||||
InlineKeyboardButton("Отменить", callback_data=f"draft_cancel:{draft_id}"),
|
||||
])
|
||||
return InlineKeyboardMarkup(rows)
|
||||
|
||||
def kb_choose_chat(draft_id: int, chats: list[tuple[str, int]]):
|
||||
# chats: list of (title, chat_id)
|
||||
rows = [[InlineKeyboardButton(title, callback_data=f"send:{draft_id}:{chat_id}")] for title, chat_id in chats]
|
||||
return InlineKeyboardMarkup(rows) if rows else None
|
||||
return kb_multiselect(draft_id, chats, selected=set())
|
||||
Reference in New Issue
Block a user