bugfix
This commit is contained in:
@@ -1446,16 +1446,18 @@ async def choose_template_apply(update: Update, context: CallbackContext) -> int
|
||||
"missing": list(required)
|
||||
}
|
||||
|
||||
# Если есть обязательные переменные, запрашиваем их заполнение
|
||||
if required:
|
||||
if msg and hasattr(msg, 'edit_text'):
|
||||
# Получаем первую необходимую переменную
|
||||
next_var = list(required)[0]
|
||||
await msg.edit_text(
|
||||
"Для этого шаблона требуются дополнительные параметры.\n"
|
||||
f"Для этого шаблона требуются параметры:\n"
|
||||
f"{', '.join(sorted(required))}\n\n"
|
||||
f"Пожалуйста, введите значение для параметра {next_var}:"
|
||||
)
|
||||
return PREVIEW_VARS
|
||||
|
||||
# Если переменных нет, применяем шаблон сразу
|
||||
return await _apply_template_and_confirm(update, user.id, name, {})
|
||||
|
||||
except Exception as e:
|
||||
@@ -1464,17 +1466,6 @@ async def choose_template_apply(update: Update, context: CallbackContext) -> int
|
||||
if msg and hasattr(msg, 'edit_text'):
|
||||
await msg.edit_text("Ошибка при применении шаблона")
|
||||
return ConversationHandler.END
|
||||
await update.callback_query.edit_message_text(
|
||||
"Шаблон требует переменные: " + ", ".join(sorted(required)) +
|
||||
"\nПришли значения в формате key=value (по строкам или в одну строку)."
|
||||
)
|
||||
return PREVIEW_VARS
|
||||
|
||||
return await _apply_template_and_confirm(update, uid, name, {})
|
||||
except Exception as e:
|
||||
logger.error(f"Error applying template: {e}")
|
||||
await update.callback_query.edit_message_text("Ошибка при применении шаблона")
|
||||
return ConversationHandler.END
|
||||
|
||||
async def choose_template_preview(update: Update, context: CallbackContext) -> int:
|
||||
"""Предпросмотр шаблона."""
|
||||
|
||||
Reference in New Issue
Block a user