domovoy_bot/keyboards/inline.py
Admin ba4676b0af v1.0 MVP - Инициализация проекта 🏠
 Регистрация и верификация жильцов
 Рейтинг активности (уровни)
 Детект шпионов (Score 0-100)
 Анти-мат система (3 предупреждения → бан)
 Админ-панель с рассылкой
 Учёт квартир (несколько жильцов)
 Телефоны экстренных служб и мастеров
 Еженедельный экспорт JSON
 Прокси (socks5) для обхода РКН

Бекап: backups/versions/v1.0_mvp_2026-02-26/

Co-authored-by: Qwen-Coder <qwen-coder@alibabacloud.com>
2026-02-27 10:54:16 +00:00

247 lines
8.7 KiB
Python
Raw Blame History

This file contains ambiguous Unicode characters

This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.

"""
Inline-клавиатуры
"""
from aiogram.types import InlineKeyboardMarkup, InlineKeyboardButton
from aiogram.utils.keyboard import InlineKeyboardBuilder
def get_main_menu() -> InlineKeyboardMarkup:
"""Главное меню жильца"""
builder = InlineKeyboardBuilder()
builder.row(
InlineKeyboardButton(text='📞 Экстренные телефоны', callback_data='phones'),
)
builder.row(
InlineKeyboardButton(text='👷 Мастера', callback_data='masters'),
InlineKeyboardButton(text='👮 Участковый', callback_data='police'),
)
builder.row(
InlineKeyboardButton(text='📅 График отключений', callback_data='schedule'),
InlineKeyboardButton(text='📢 Объявления', callback_data='announcements'),
)
builder.row(
InlineKeyboardButton(text='🔍 Моя квартира', callback_data='my_apartment'),
InlineKeyboardButton(text='📣 Подать объявление', callback_data='submit_ad'),
)
builder.row(
InlineKeyboardButton(text='❓ Помощь', callback_data='help'),
)
return builder.as_markup()
def get_admin_menu() -> InlineKeyboardMarkup:
"""Меню администратора"""
builder = InlineKeyboardBuilder()
builder.row(
InlineKeyboardButton(text='📊 Статистика', callback_data='admin_stats'),
InlineKeyboardButton(text='🕵️ Шпионы', callback_data='admin_spies'),
)
builder.row(
InlineKeyboardButton(text='👥 Пользователи', callback_data='admin_users'),
InlineKeyboardButton(text='⏳ Непроверенные', callback_data='admin_unverified'),
)
builder.row(
InlineKeyboardButton(text='📥 Экспорт JSON', callback_data='admin_export'),
InlineKeyboardButton(text='📤 Рассылка', callback_data='admin_broadcast'),
)
builder.row(
InlineKeyboardButton(text='🔙 В главное меню', callback_data='main_menu'),
)
return builder.as_markup()
def get_verification_menu() -> InlineKeyboardMarkup:
"""Меню верификации"""
builder = InlineKeyboardBuilder()
builder.row(
InlineKeyboardButton(text='✅ Подтвердить верификацию', callback_data='verify_approve'),
InlineKeyboardButton(text='❌ Отклонить', callback_data='verify_reject'),
)
builder.row(
InlineKeyboardButton(text='📝 Написать жильцу', callback_data='verify_message'),
)
return builder.as_markup()
def get_phones_menu() -> InlineKeyboardMarkup:
"""Меню телефонов"""
builder = InlineKeyboardBuilder()
builder.row(
InlineKeyboardButton(text='🚨 Экстренные', callback_data='phones_emergency'),
InlineKeyboardButton(text='🔧 ЖКХ', callback_data='phones_utility'),
)
builder.row(
InlineKeyboardButton(text='👮 Полиция', callback_data='phones_police'),
InlineKeyboardButton(text='👷 Мастера', callback_data='phones_masters'),
)
builder.row(
InlineKeyboardButton(text='🔙 Назад', callback_data='main_menu'),
)
return builder.as_markup()
def get_spy_detail_menu(user_id: int) -> InlineKeyboardMarkup:
"""Детали шпиона"""
builder = InlineKeyboardBuilder()
builder.row(
InlineKeyboardButton(text='⚠️ Предупредить', callback_data=f'spy_warn_{user_id}'),
InlineKeyboardButton(text='🚫 Забанить', callback_data=f'spy_ban_{user_id}'),
)
builder.row(
InlineKeyboardButton(text='📝 Профиль', callback_data=f'spy_profile_{user_id}'),
InlineKeyboardButton(text='🔙 Назад', callback_data='admin_spies'),
)
return builder.as_markup()
def get_yes_no_keyboard() -> InlineKeyboardMarkup:
"""Клавиатура Да/Нет"""
builder = InlineKeyboardBuilder()
builder.row(
InlineKeyboardButton(text='✅ Да', callback_data='yes'),
InlineKeyboardButton(text='❌ Нет', callback_data='no'),
)
return builder.as_markup()
def get_poll_keyboard(poll_id: int, options: list) -> InlineKeyboardMarkup:
"""Клавиатура для голосования"""
builder = InlineKeyboardBuilder()
# Кнопки для каждого варианта
for i, option in enumerate(options):
builder.row(
InlineKeyboardButton(
text=f"🔘 {option}",
callback_data=f'poll_vote_{poll_id}_{i}'
)
)
return builder.as_markup()
def get_poll_results_keyboard(poll_id: int) -> InlineKeyboardMarkup:
"""Клавиатура для просмотра результатов"""
builder = InlineKeyboardBuilder()
builder.row(
InlineKeyboardButton(
text='📊 Показать результаты',
callback_data=f'poll_results_{poll_id}'
)
)
return builder.as_markup()
def get_poll_close_keyboard(poll_id: int) -> InlineKeyboardMarkup:
"""Клавиатура для закрытия опроса (только админ)"""
builder = InlineKeyboardBuilder()
builder.row(
InlineKeyboardButton(
text='🔒 Закрыть опрос',
callback_data=f'poll_close_{poll_id}'
)
)
return builder.as_markup()
def get_schedule_menu() -> InlineKeyboardMarkup:
"""Меню выбора типа отключения"""
builder = InlineKeyboardBuilder()
builder.row(
InlineKeyboardButton(text='💧 Вода', callback_data='schedule_type_water'),
InlineKeyboardButton(text='⚡ Электричество', callback_data='schedule_type_electricity'),
)
builder.row(
InlineKeyboardButton(text='🔥 Отопление', callback_data='schedule_type_heating'),
InlineKeyboardButton(text='🔶 Газ', callback_data='schedule_type_gas'),
)
builder.row(
InlineKeyboardButton(text='🛗 Лифт', callback_data='schedule_type_elevator'),
InlineKeyboardButton(text='📋 Общее', callback_data='schedule_type_general'),
)
return builder.as_markup()
def get_schedule_item_menu(skip: bool = False) -> InlineKeyboardMarkup:
"""Меню для пропуска описания"""
builder = InlineKeyboardBuilder()
if skip:
builder.row(
InlineKeyboardButton(text='⏭️ Пропустить', callback_data='schedule_skip_desc'),
)
return builder.as_markup()
def get_ads_category_menu() -> InlineKeyboardMarkup:
"""Меню выбора категории объявления"""
builder = InlineKeyboardBuilder()
builder.row(
InlineKeyboardButton(text='💰 Продам', callback_data='ads_category_sell'),
InlineKeyboardButton(text='🛒 Куплю', callback_data='ads_category_buy'),
)
builder.row(
InlineKeyboardButton(text='🎁 Отдам', callback_data='ads_category_give'),
InlineKeyboardButton(text='😿 Потеряно', callback_data='ads_category_lost'),
)
builder.row(
InlineKeyboardButton(text='😺 Нашлось', callback_data='ads_category_found'),
InlineKeyboardButton(text='🔧 Услуга', callback_data='ads_category_service'),
)
return builder.as_markup()
def get_ads_item_menu() -> InlineKeyboardMarkup:
"""Меню для объявления (просмотр)"""
builder = InlineKeyboardBuilder()
builder.row(
InlineKeyboardButton(text='📞 Показать телефон', callback_data='ads_show_phone'),
)
return builder.as_markup()
def get_payment_type_menu() -> InlineKeyboardMarkup:
"""Меню выбора типа платежа"""
builder = InlineKeyboardBuilder()
builder.row(
InlineKeyboardButton(text='⚡ Электро', callback_data='payment_type_electricity'),
InlineKeyboardButton(text='💧 Вода', callback_data='payment_type_water'),
)
builder.row(
InlineKeyboardButton(text='🔥 Отопление', callback_data='payment_type_heating'),
InlineKeyboardButton(text='🔶 Газ', callback_data='payment_type_gas'),
)
builder.row(
InlineKeyboardButton(text='🏠 Жильё', callback_data='payment_type_maintenance'),
InlineKeyboardButton(text='🗑️ Мусор', callback_data='payment_type_trash'),
)
builder.row(
InlineKeyboardButton(text='📡 Интернет', callback_data='payment_type_internet'),
InlineKeyboardButton(text='📋 Другое', callback_data='payment_type_other'),
)
return builder.as_markup()