B
B
Belavor2019-09-25 12:07:41
Node.js
Belavor, 2019-09-25 12:07:41

Bot on node js?

I have

bot.onText(/\/echo (.+)/, function(msg, match) {
         const chatId = msg.chat.id;
         const resp = match[1];
         const curTime = new Date();

         bot.sendMessage(chatId,
`Дата: ${curTime}
Транспорт: ${resp}
`);

but I need such an answer but without writing /echo

Answer the question

In order to leave comments, you need to log in

1 answer(s)
S
Sunflowerz, 2019-09-25
@Sunflowerz

What is it like?
You start communication with the bot with the /start command - This is the -> regular expression. What message do you need to execute your function on? ot.onText(/\/start/, function(msg, match) {

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question