You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
I'm using state machine for telegram bot, when webhook received message from telegram i get user state from store (redis), next creating state machine:
//example of user state from store
fsmState = {state: 'initial', data: {}}
const fsm = new StateMachine({
data: fsmState.data,
init: fsmState.state,
transitions: [
//some transitions
],
methods: {
onAfterTransition: async lifecycle => {
if (fsmState.state !== lifecycle.to) {
fsmState = await this.setUserFsmState(userId, {...fsmState, state: lifecycle.to});
}
},
//some other transitions and state lifecycle methods
},
});
next i'm parsing telegram message based on user state and wanna make some transition: fsm[camelCase(transition)]();
but received pending transition error, because of promised onAfterTransition.
How can i wait while StateMachine is ready to make transition? Now i'm using awfull code:
I'm using state machine for telegram bot, when webhook received message from telegram i get user state from store (redis), next creating state machine:
next i'm parsing telegram message based on user state and wanna make some transition:
fsm[camelCase(transition)]();
but received pending transition error, because of promised onAfterTransition.
How can i wait while StateMachine is ready to make transition? Now i'm using awfull code:
The text was updated successfully, but these errors were encountered: