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
import{Scenes}from'telegraf';constcontactDataWizard=newScenes.WizardScene('CONTACT_DATA_WIZARD_SCENE_ID',// first argument is Scene_ID, same as for BaseScene(ctx)=>{ctx.reply('What is your name?');ctx.wizard.state.contactData={};returnctx.wizard.next();},(ctx)=>{// validation exampleif(ctx.message.text.length<2){ctx.reply('Please enter name for real');return;}ctx.wizard.state.contactData.fio=ctx.message.text;ctx.reply('Enter your e-mail');returnctx.wizard.next();},async(ctx)=>{ctx.wizard.state.contactData.email=ctx.message.text;ctx.reply('Thank you for your replies, we'llcontactyoursoon');awaitmySendContactDataMomentBeforeErase(ctx.wizard.state.contactData);returnctx.scene.leave();},);
What i think is need
import{Scenes}from'telegraf';constscenarioTypeScene=newScenes.BaseScene('SCENARIO_TYPE_SCENE_ID');scenarioTypeScene.enter((ctx)=>{ctx.session.myData={};ctx.reply('What is your drug?',Markup.inlineKeyboard([Markup.callbackButton('Movie',MOVIE_ACTION),Markup.callbackButton('Theater',THEATER_ACTION),]).extra());});scenarioTypeScene.action(THEATER_ACTION,(ctx)=>{ctx.reply('You choose theater');ctx.session.myData.preferenceType='Theater';returnctx.scene.enter('SOME_OTHER_SCENE_ID');// switch to some other scene});scenarioTypeScene.action(MOVIE_ACTION,(ctx)=>{ctx.reply('You choose movie, your loss');ctx.session.myData.preferenceType='Movie';returnctx.scene.leave();// exit global namespace});scenarioTypeScene.leave((ctx)=>{ctx.reply('Thank you for your time!');});
The text was updated successfully, but these errors were encountered:
For example i will use
telegraphjs
What we have
What i think is need
The text was updated successfully, but these errors were encountered: