Added context navigation logic
This commit is contained in:
parent
a8dd448c95
commit
b368ecc43b
2 changed files with 21 additions and 0 deletions
|
|
@ -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;
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue