Answer the question
In order to leave comments, you need to log in
How to process incoming message in Telegram bot api?
Hello! Please tell me how to process the incoming message. I don't understand at all.
It works like this:
The bot sends me a message "Enter a stop phrase".
I send something in the message to the bot, for example "boiler".
My message is, in this case, the "boiler" must be passed to the AutoBan.add function.
module.exports = async function(bot, message, query) {
if (query.data === "wordsban") {
await message.send("Введите стоп фразу");
let stop = ЧЕМУ????
await AutoBan.add(stop);
}
}
Answer the question
In order to leave comments, you need to log in
I don't know what lib you write in, but
messages have an ID so you can check previous messages for command content.
For example,
user - /wordsban // message id 5
bot - enter the word // message id 6
user boiler // message id 7
here you check the logic, if the user entered /wordsban two IDs ago, then the content of the current message must be processed.
This is a bad mechanic, it’s easier to ask to enter a word ban according to the wordsban principle: word1 word2 and catch such messages through a regular expression and parse the string by space
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question