question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

[QUESTION] Wizard call from bot.hears

See original GitHub issue

How do I call wizard from bot.hears('foo',....) ?

Issue Analytics

  • State:closed
  • Created 5 years ago
  • Comments:5

github_iconTop GitHub Comments

5reactions
Otto-AAcommented, May 22, 2018

Maybe the problem is that you deleted lines 43 and 45?

Following code works fine for me:

const superWizard = new WizardScene('super-wizard',
  (ctx) => {
    ctx.reply('Step 1', Markup.inlineKeyboard([
      Markup.urlButton('❤️', 'http://telegraf.js.org'),
      Markup.callbackButton('➡️ Next', 'next')
    ]).extra())
    return ctx.wizard.next()
  },
  (ctx) => {
    ctx.reply('Step 2')
    return ctx.wizard.next()
  },
  (ctx) => {
    ctx.reply('Done')
    return ctx.wizard.next()
  }
)

const stage = new Stage([superWizard])
bot.use(session())
bot.use(stage.middleware())
bot.hears('foo', Stage.enter('super-wizard'));
0reactions
Otto-AAcommented, May 23, 2018

You’re welcome 😃

If you have no more questions regarding this issue, feel free to close it

Read more comments on GitHub >

github_iconTop Results From Across the Web

Node.js Bot.hears() Method - GeeksforGeeks
Step 1: First, get the GET BOT_TOKEN from BOTFATHER in the telegram. · Step 2: Type /start and then click on /newbot as...
Read more >
How can I get more documentation on Scenes, Stages and stuff?
Hi all, I was checking out the docs and noticed that it doesn't say a lot about Scenes and Stages. Where can I...
Read more >
node.js - Unable to enter telegraf scene using Stage.enter and ...
I would like to have several wizards in my bot. How can I enter to another scene? I am using the below code...
Read more >
Telegraf VS Node-Telegram-Bot-API - DEV Community ‍ ‍
hears is just a function which reacts on user's message. And to launch our bot we use bot.launch() It would seem that it...
Read more >
Create a Question and Answer Bot with Amazon Lex and ...
Create and administer your questions and answers using the Q and A Bot Content Designer UI. End users ask questions using the Amazon...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found