I don't know how to return to the previous menu by clicking to Back button.
bot.command('course', ctx => {
ctx.replyWithHTML('<b>Courses</b>', Markup.keyboard(
[
['Editors', 'Reviews'],
['JS']
]
).resize())
})
bot.hears('JS', ctx => {
ctx.replyWithHTML('<b>Courses</b>', Markup.keyboard(
[
['Angular', 'React'],
['Node'], ['Back'],
]
).resize())
})
I can't understand what kind of bot. function use to solve my problem.
I resolve it like this.
bot.hears(/course|Back/, ctx => { // <==== here we have regex and change command to hears
ctx.replyWithHTML('<b>Courses</b>', Markup.keyboard(
[
['Editors', 'Reviews'],
['JS']
]
).resize())
})
bot.hears('JS', ctx => {
ctx.replyWithHTML('<b>Courses</b>', Markup.keyboard(
[
['Angular', 'React'],
['Node'], ['Back'],
]
).resize())
})