Added context navigation logic

This commit is contained in:
Kirill 2025-11-28 12:57:07 +03:00
parent a8dd448c95
commit b368ecc43b
2 changed files with 21 additions and 0 deletions

View file

@ -136,3 +136,13 @@ std::pair<HandlerResult, UserContext> BotHandlers::newStateNavigation(const TgBo
return {result, newCtx};
}
}
void BotHandlers::pushState(UserContext& ctx, UserState newState, int64_t payload) {
ctx.history.push_back({newState, payload});
}
bool BotHandlers::popState(UserContext& ctx) {
if (ctx.history.size() <= 1) return false; // нельзя выйти из MAIN_MENU
ctx.history.pop_back();
return true;
}