繁体   English   中英

如何使 Telegram BOT 回复特定消息?

[英]How to make Telegram BOT reply to a specific message?

我想让我的 BOT 回复这样的特定消息:

在此处输入图像描述

我正在使用带有要回复的消息 ID 的“reply_to_msg_id”,但它不起作用。

任何人都可以帮助我吗?

提前致谢,

贾科莫

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})

})

使用 replay_to_message_id

您需要使用reply_to_message_id不是reply_to_msg_id

来源:电报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
  });
})

暂无
暂无

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM