Answer the question
In order to leave comments, you need to log in
Handling Telegram Bot messages?
I am trying to process a bot message like this:
bot.onText(/\/add/, async (msg) => {
bot.sendMessage(msg.chat.id, "Добавь ссылку на фото...");
let link = await getAnswer();
bot.sendMessage(msg.chat.id, link);
});
async function getAnswer() {
bot.on("message", (msg) => {
return msg.text;
});
}
Unhandled rejection Error: ETELEGRAM: 400 Bad Request: message text is empty
at C:\Users\sasha\Desktop\MelqorShopBot v2\node_modules\node-telegram-bot-api\src\telegram.js:284:15
at tryCatcher (C:\Users\sasha\Desktop\MelqorShopBot v2\node_modules\bluebird\js\release\util.js:16:23)
at Promise._settlePromiseFromHandler (C:\Users\sasha\Desktop\MelqorShopBot v2\node_modules\bluebird\js\release\promise.js:547:31)
at Promise._settlePromise (C:\Users\sasha\Desktop\MelqorShopBot v2\node_modules\bluebird\js\release\promise.js:604:18)
at Promise._settlePromise0 (C:\Users\sasha\Desktop\MelqorShopBot v2\node_modules\bluebird\js\release\promise.js:649:10)
at Promise._settlePromises (C:\Users\sasha\Desktop\MelqorShopBot v2\node_modules\bluebird\js\release\promise.js:729:18)
at _drainQueueStep (C:\Users\sasha\Desktop\MelqorShopBot v2\node_modules\bluebird\js\release\async.js:93:12)
at _drainQueue (C:\Users\sasha\Desktop\MelqorShopBot v2\node_modules\bluebird\js\release\async.js:86:9)
at Async._drainQueues (C:\Users\sasha\Desktop\MelqorShopBot v2\node_modules\bluebird\js\release\async.js:102:5)
at Immediate.Async.drainQueues [as _onImmediate] (C:\Users\sasha\Desktop\MelqorShopBot v2\node_modules\bluebird\js\release\async.js:15:14)
at processImmediate (internal/timers.js:458:21)
Answer the question
In order to leave comments, you need to log in
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question