Answer the question
In order to leave comments, you need to log in
How to write the user's response to a variable (Bot telegram)?
The user sends the /Enter command, enters text in the next message, the received text is written to a variable. How to organize it on node.js?
Answer the question
In order to leave comments, you need to log in
I still do not understand what kind of library, but I think that 'Telegraf'
Here is the code:
let prev_command = ""
bot.command('test', (ctx) => {
ctx.reply("Send your text in chat.")
prev_command = "test"
});
bot.on('text', (ctx) => {
if (prev_command == "test") {
ctx.reply(`Ok, your text '${ctx.message.text}'`)
} else {
ctx.reply("Sorry, usage commands!")
}
})
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question