WizardScene: Handle question and answer in the same step
See original GitHub issueIs it possible to send the question (e.g. ‘Please enter your email adress’) and handle the answer (‘abc@gmx.com’) in the same function in a SceneWizard?
So (in simplified) code it would look kinda like this:
function setup_email_adress() {
send_message("Please enter your email adress");
on_message_receive(function(email) {
if (is_valid_email(email)) {
save_email_into_db(email)
ctx.wizard.next()
} else {
send_message("Please enter a valid email adress")
}
}
}
function setup_password() {
....
}
setup_wizard = new WizardScene('setup',
setup_email_adress,
setup_password,
...
);
I am sure, that it would be easy to do a workaround, but I wonder if there is an intended way to do this?
Issue Analytics
- State:
- Created 5 years ago
- Comments:8
Top Results From Across the Web
Telegraf.js: leave WizardScene with a button - Stack Overflow
I would put a button after a message in a WizardScene with a "Cancel" ... is undefined and go back to the previous...
Read more >Class WizardScene<C> - Telegraf
Registers middleware for handling matching callback queries. Parameters. triggers: Triggers<C>. Rest .
Read more >Telegraf VS Node-Telegram-Bot-API - DEV Community
Telegraf Scene is the same, but let's display it in code. This library has two types of scene: Base Scene and Wizard Scene....
Read more >cjd - River Thames Conditions - Environment Agency - GOV.UK
Charlie boutique hampstead, Konstanze kuss, Keytrain answers level 5 reading, ... Toilet tank float ball, Single serving question sites, Or2 program, ...
Read more >telegraf@4.11.2 - jsDocs.io
Generates middleware for handling provided update types. ... Note: The Bot API must receive an answer within 10 seconds after the ...
Read more >
Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free
Top Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
Yeah, but can this help me achieve a chat like this?
I am currently only able do get following structure (without doing something hacky like
ctx.wizard.steps[ctx.wizard.cursor](ctx);
):I am not sure if this solves my problem: If I ask multiple questions one after another and implement it in your way, I get the following chat result
ok
, but instantly trigger the next function.My current workaround is to call
ctx.wizard.next() and afterwards
ctx.wizard.stepsctx.wizard.cursor;` to first increase the cursor and then call the next function.So my current code is following (which works fine, but doesn’t seem to be right imo):