我想重播给用户一个消息,当他点击按钮,我尝试了许多解决方案,但到目前为止没有任何工作,我得到回调_查询数据后,用户点击按钮,但机器人正在重播给他IM使用telecom js库
// Add the callback query event handler
bot.on('callback_query', async (ctx) => {
const buttonPressed = ctx.callbackQuery.data;
if (buttonPressed === 'button1') {
ctx.answerCbQuery('You pressed Button 1!');
// Perform actions specific to Button 1
} else if (buttonPressed === 'button2') {
ctx.answerCbQuery('You pressed Button 2!');
// Perform actions specific to Button 2
}
});
// Your existing code
if (Object.keys(buttonReplay).length > 0) {
for (const button of buttonReplay.actionButtons) {
const inlineKeyboard = Markup.inlineKeyboard([
Markup.button.callback("button 1", "button1"),
Markup.button.callback("button 2", "button2"),
Markup.button.url("open url", "https://google.com"),
]);
await bot.telegram.sendMessage(chatId, "hi", inlineKeyboard);
}
}
字符串
1条答案
按热度按时间xfyts7mz1#
取决于telecom js版本,in V4.11 filters was introduced
尝试使用过滤器:
字符串
不过,如果输入不是动态的,也许您应该考虑使用
型