电报机器人:editmessagereplymarkup方法不工作
我已经使用node.js和node-telegram-bot-api模块开发了一个电报机器人,该模块向用户发送消息和直列键盘,我正在尝试的是在用户单击按钮后实现此目的键盘必须消失。我正在使用 editmessagereplymarkup
,但它给出了上述错误
代码的一部分:
bot.on('callback_query', function onCallbackQuery(example) {
const action = example.data
const msg_id = example.message.from.id
const chat_id = example.from.id
//console.log(example.from.id)
if (action == 'FM') {
bot.editMessageReplyMarkup({
reply_markup: {
inline_keyboard: [
[
],
]
}
}, {
chat_id: chat_id,
message_id: msg_id
});
}
});
错误:
Unhandled rejection Error: ETELEGRAM: 400 Bad Request: message to edit not found
我也尝试了以下解决方案,但它没有工作
bot.on('callback_query', function onCallbackQuery(example) {
const action = example.data
const msg_id = example.message.from.id
const chat_id = example.from.id
console.log(example.from.id)
if (action == 'FM') {
console.log(action)
console.log("FM")
console.log(msg_id)
// console.log(example.message.message_id)
bot.editMessageReplyMarkup({
chat_id: chat_id,
message_id: msg_id,
reply_markup: JSON.stringify({
keyboard: []
})
}
);
}
});
错误:
Unhandled rejection Error: ETELEGRAM: 400 Bad Request: message identifier is not specified
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(2)
您指的是错误的msg_id。
应该
执行
console.log(示例)
以清楚地了解响应You're referring to wrong msg_id.
It should be
execute
console.log(example)
to get a clear idea of the response使用此订单参数
bot.telegram.editmessagereplymarkup(chatid,messageId,newmarkup);
Use this order parameters
bot.telegram.editMessageReplyMarkup(chatId, messageId, newMarkup);