v1.6.0: max_bot fixes — feature keys, flush→commit, test-run, categories, broadcast page, proxy error handling, deploy scripts

This commit is contained in:
2026-05-24 07:50:38 +03:00
parent bd048ea23d
commit 493e0b37a1
127 changed files with 6082 additions and 65 deletions
+43
View File
@@ -0,0 +1,43 @@
from app.settings_cache import SettingsCache
from app.conversation import get_template_rendered
from app.keyboards.inline import build_cancel_button
from app.fsm import BotState, FSM
from app.handlers.main_menu import handle_main_menu
async def handle_out_of_hours(bot, user_data: dict, db, max_api):
max_user_id = user_data["user_id"]
await SettingsCache.refresh(db)
start = SettingsCache.get_int("work_hours_start", 9)
end = SettingsCache.get_int("work_hours_end", 18)
hours_str = SettingsCache.get_work_hours_str()
text = (
f"Сейчас мы не работаем. Наше рабочее время: Пн-Пт {hours_str} (МСК).\n\n"
f"Оставьте сообщение — мы ответим как можно быстрее."
)
buttons = [
[{"type": "message", "text": "✉️ Оставить сообщение", "payload": "leave_message"}],
[{"type": "message", "text": "📞 Заказать звонок", "payload": "callback"}],
]
await max_api.send_message_with_keyboard(max_user_id, text, buttons)
FSM.set_state(max_user_id, BotState.OUT_OF_HOURS)
async def handle_out_of_hours_callback(bot, user_data: dict, db, max_api, payload: str):
max_user_id = user_data["user_id"]
if payload == "leave_message":
FSM.set_state(max_user_id, BotState.INQUIRY_REQUEST)
from app.handlers.inquiry import handle_inquiry
await handle_inquiry(bot, user_data, db, max_api)
return
if payload == "callback":
from app.handlers.consent import handle_consent_request
FSM.set_state(max_user_id, BotState.NAME_REQUEST)
await max_api.send_message(max_user_id, "Как к вам обращаться?")
return
await handle_main_menu(bot, user_data, db, max_api)