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
This bug is related to Callback Query handling entering a Wizard Scene. When the bot enters a wizard scene the first update cached by the scene itself is the CB Query. So if there is a matching action there it will be executed.
Expected Behavior
The bot should handle the CB Query and forget it.
Current Behavior
The bot handles it twice.
Workaround
Change the CB to a different text.
The text was updated successfully, but these errors were encountered:
This happens because when an update enters a wizard, it calls its parent, base scene's handler. This is ostensibly to cause wizard.enter to run, but it runs any matching middleware attached directly to the wizard scene. If none is found, it drops down to wizard mode and runs the step 0.
constwizard=newWizard("wizarudo",[step0,step1]);wizard.on("callback_query",ctx=>ctx.reply("AHA, I ran first"));bot.on("callback_query",ctx=>ctx.scene.enter("wizarudo"));
WizardScene#enterMiddleware could be modified to call only WizardScene#enter and steps[0] in that order, but this would be a breaking change. I'd like more comments on this issue before I can "fix" it, and be sure nobody is relying on this behaviour.
Changing it so could also be unexpected behaviour, because when a user is in a wizard scene, any update will first run through the wizard's middleware (this is anything attached directly to the wizard) before it runs the current step. So probably a documentation issue more than a fix needed. Still, leaving this open for some time to accept comments.
Context
This bug is related to Callback Query handling entering a Wizard Scene. When the bot enters a wizard scene the first update cached by the scene itself is the CB Query. So if there is a matching action there it will be executed.
Expected Behavior
The bot should handle the CB Query and forget it.
Current Behavior
The bot handles it twice.
Workaround
Change the CB to a different text.
The text was updated successfully, but these errors were encountered: