0

I would like to make my BOT reply to a specific message like this:

enter image description here

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,

Giacomo

Nitin Bisht
  • 5,053
  • 4
  • 14
  • 26
JackPolets
  • 1
  • 1
  • 1

2 Answers2

0
bot.onText(/\/start/, (msg, match)=> {
var text = "hi user welcome to bot"
bot.sendMessage(msg.chat.id,text,{reply_to_message_id: msg.message_id})

})

use replay_to_message_id

Afsal Cp
  • 21
  • 1
  • 1
    OP has already mentioned that he's using `reply_to_message_id` and that it's not working. Please elaborate on why do you your solution would work. – Gangula Sep 24 '21 at 18:50
0

You 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, `welcome ${username}`, {
    reply_to_message_id: originalMessageId
  });
})
Sridhar
  • 11,466
  • 5
  • 39
  • 43