V
V
Vladislav Babinov2019-10-11 18:43:51
Node.js
Vladislav Babinov, 2019-10-11 18:43:51

How to make multiple categories in Telegram bot, (node-telegram-bot-api)?

I'm creating a bot, rummaged through a bunch of sites, I didn't find anything sensible, mb you tell me.
The script should be like this:
Catalog(button) -> Enter product number -> Payment
How to make the processing so that when a person enters the product number, the payment is made only if he is in the product catalog. I use node-telegram-bot-api

bot.onText(/Посмотреть каталог/g, (msg) => {
        bot.sendMessage(msg['chat']['id'], catalog)
        bot.onText(/\d/, (msg)=> sendPaynament)
    });

But the second onText method works everywhere, moreover, when a person clicks on "View catalog" several times, the second onText method fires not once, but several times.
How to avoid this, is there any utility for working with several categories?

Answer the question

In order to leave comments, you need to log in

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question