I would like to make my BOT reply to a specific message like this:
I am using the "reply_to_msg_id" with the ID of the message to replies to, but it doesn't work.
Anyone can help me?
Thanks in advance,
Giao
I would like to make my BOT reply to a specific message like this:
I am using the "reply_to_msg_id" with the ID of the message to replies to, but it doesn't work.
Anyone can help me?
Thanks in advance,
Giao
Share Improve this question edited Mar 25, 2020 at 17:39 Nitin Bisht 5,3615 gold badges16 silver badges26 bronze badges asked Mar 25, 2020 at 15:30 JackPoletsJackPolets 111 gold badge1 silver badge2 bronze badges 3- What does it say when you send the request with reply_to_msg_id? It should return an error if it doesn't work. – Ali Padida Commented Mar 25, 2020 at 20:45
- Hi, no it doesn't. – JackPolets Commented Mar 26, 2020 at 16:38
- Then use another API for your bot development, it should always return a response for you to find out about the error. – Ali Padida Commented Mar 26, 2020 at 16:49
2 Answers
Reset to default 2You need to use reply_to_message_id
and NOT reply_to_msg_id
.
Source: Telegram sendMessage API
bot.on('message', (msg) => {
const { message_id: originalMessageId, from: { username }, chat: { id: chatId } } = msg;
bot.sendMessage(chatId, `wele ${username}`, {
reply_to_message_id: originalMessageId
});
})
bot.onText(/\/start/, (msg, match)=> {
var text = "hi user wele to bot"
bot.sendMessage(msg.chat.id,text,{reply_to_message_id: msg.message_id})
})
use replay_to_message_id