E
E
Evgeniy V.2020-05-28 09:25:54
Node.js
Evgeniy V., 2020-05-28 09:25:54

How do telegram bot constructors work?

How do constructors work? It turns out that they select data, let's say one entry point, get the id of the bot, and process it, but how to make a constructor so that the user can add some reactions and actions?

Answer the question

In order to leave comments, you need to log in

1 answer(s)
C
casoer, 2020-05-28
@casoer

In bot.on('message') you run message.text through an array that has a regex and a handler. You do regex.test(message.string) if true then you throw the whole message object into the handler.

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question