最新消息:雨落星辰是一个专注网站SEO优化、网站SEO诊断、搜索引擎研究、网络营销推广、网站策划运营及站长类的自媒体原创博客

javascript - How to make Telegram BOT reply to a specific message? - Stack Overflow

programmeradmin2浏览0评论

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
Add a ment  | 

2 Answers 2

Reset to default 2

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, `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

发布评论

评论列表(0)

  1. 暂无评论