bot works as echo (adding templates s functional)

tpl_list dont
This commit is contained in:
2025-08-19 05:13:16 +09:00
parent a8d860ed87
commit 18a92ca526
7 changed files with 274 additions and 47 deletions

View File

@@ -12,7 +12,10 @@ from .handlers.templates import (
handle_template_name,
handle_template_text,
handle_template_keyboard,
list_templates
list_templates,
handle_template_selection,
handle_template_vars,
handle_preview_confirmation
)
from .handlers.posts import (
newpost,
@@ -41,7 +44,10 @@ def register_handlers(app: Application) -> None:
# Шаблоны
template_handler = ConversationHandler(
entry_points=[CommandHandler("newtemplate", start_template_creation)],
entry_points=[
CommandHandler("newtemplate", start_template_creation),
CommandHandler("tpl_list", list_templates)
],
states={
BotStates.TPL_TYPE: [
CallbackQueryHandler(handle_template_type)
@@ -54,6 +60,15 @@ def register_handlers(app: Application) -> None:
],
BotStates.TPL_NEW_KB: [
MessageHandler(filters.TEXT & ~filters.COMMAND, handle_template_keyboard)
],
BotStates.SELECT_TEMPLATE: [
CallbackQueryHandler(handle_template_selection, pattern=r"^template:")
],
BotStates.TEMPLATE_VARS: [
MessageHandler(filters.TEXT & ~filters.COMMAND, handle_template_vars)
],
BotStates.PREVIEW_CONFIRM: [
CallbackQueryHandler(handle_preview_confirmation, pattern=r"^preview:")
]
},
fallbacks=[CommandHandler("cancel", cancel)]