Добавлены методы для работы с настройками авто-модерации, включая получение и установку значений, а также переключение состояний авто-публикации и авто-отклонения. Обновлены соответствующие репозитории и обработчики для интеграции новых функций в админ-панели.
Some checks are pending
CI pipeline / Test & Code Quality (push) Waiting to run
Some checks are pending
CI pipeline / Test & Code Quality (push) Waiting to run
This commit is contained in:
@@ -46,11 +46,64 @@ def get_reply_keyboard_admin():
|
||||
types.KeyboardButton(text="Разбан (список)"),
|
||||
types.KeyboardButton(text="📊 ML Статистика"),
|
||||
)
|
||||
builder.row(types.KeyboardButton(text="⚙️ Авто-модерация"))
|
||||
builder.row(types.KeyboardButton(text="Вернуться в бота"))
|
||||
markup = builder.as_markup(resize_keyboard=True, one_time_keyboard=True)
|
||||
return markup
|
||||
|
||||
|
||||
def get_auto_moderation_keyboard(settings: dict) -> types.InlineKeyboardMarkup:
|
||||
"""
|
||||
Создает inline клавиатуру для управления авто-модерацией.
|
||||
|
||||
Args:
|
||||
settings: Словарь с текущими настройками авто-модерации
|
||||
|
||||
Returns:
|
||||
InlineKeyboardMarkup с кнопками управления
|
||||
"""
|
||||
builder = InlineKeyboardBuilder()
|
||||
|
||||
auto_publish = settings.get("auto_publish_enabled", False)
|
||||
auto_decline = settings.get("auto_decline_enabled", False)
|
||||
publish_threshold = settings.get("auto_publish_threshold", 0.8)
|
||||
decline_threshold = settings.get("auto_decline_threshold", 0.4)
|
||||
|
||||
publish_status = "✅" if auto_publish else "❌"
|
||||
decline_status = "✅" if auto_decline else "❌"
|
||||
|
||||
builder.row(
|
||||
types.InlineKeyboardButton(
|
||||
text=f"{publish_status} Авто-публикация (≥{publish_threshold})",
|
||||
callback_data="auto_mod_toggle_publish",
|
||||
)
|
||||
)
|
||||
builder.row(
|
||||
types.InlineKeyboardButton(
|
||||
text=f"{decline_status} Авто-отклонение (≤{decline_threshold})",
|
||||
callback_data="auto_mod_toggle_decline",
|
||||
)
|
||||
)
|
||||
builder.row(
|
||||
types.InlineKeyboardButton(
|
||||
text="📈 Изменить порог публикации",
|
||||
callback_data="auto_mod_threshold_publish",
|
||||
),
|
||||
types.InlineKeyboardButton(
|
||||
text="📉 Изменить порог отклонения",
|
||||
callback_data="auto_mod_threshold_decline",
|
||||
),
|
||||
)
|
||||
builder.row(
|
||||
types.InlineKeyboardButton(
|
||||
text="🔄 Обновить",
|
||||
callback_data="auto_mod_refresh",
|
||||
)
|
||||
)
|
||||
|
||||
return builder.as_markup()
|
||||
|
||||
|
||||
@track_time("create_keyboard_with_pagination", "keyboard_service")
|
||||
@track_errors("keyboard_service", "create_keyboard_with_pagination")
|
||||
def create_keyboard_with_pagination(
|
||||
|
||||
Reference in New Issue
Block a user