gpt4 book ai didi

javascript - 如何使 Telegram 机器人内联键盘私有(private)化? Node JS

转载 作者:行者123 更新时间:2023-11-29 22:54:21 31 4
gpt4 key购买 nike

// command for starting request with a simple anti-spam shiet
bot.command('movie', (ctx) => {
let stopSpam = findUserData(ctx);
if (stopSpam) {
ctx.reply(spammerMsg)
} else {
userData.push({id: ctx.message.from.id, msgId: ctx.message.message_id});
ctx.reply('Género',genreMenu);
}
});

// So the issue is right here.
//Right now I'm checking if the user has already used the comand 'movie'.
//If so, he could use its buttons. But he could use the buttons from another user too...
bot.action(/.+/,(ctx) => {
let allowed = findUserCallbackData(ctx);
if (allowed) {
ctx.editMessageReplyMarkup((m) => m.inlineKeyboard([]));
allowed.queryGenre = ctx.update.callback_query.data;
ctx.reply('Época', timeMenu)
.then(() => {
ctx.deleteMessage(ctx.update.callback_query.message.message_id)
})
.catch(e => {
console.log(e)
})
} else {
console.log('noppe')
}
});

findUserData = (ctx) => {
let findCmdUser = userData.find(user => user.id === ctx.message.from.id)
return findCmdUser
}

findUserCallbackData = (ctx) => {
let findUser = userData.find(user => user.id === ctx.update.callback_query.from.id)
return findUser
}

我在电影电报组中,我正在使用内联键盘作为数据提供者制作电影推荐机器人。

问题是内联键盘不仅对每个组成员可见,而且可以交互

所以我的问题是,我能否以某种方式防止这种情况发生?我能否使插入正确命令的用户只能访问(并且如果可能的话)内联键盘?

抱歉我的英语很基础,谢谢你的时间。

最佳答案

内联键盘直接附加到消息中,因此无法仅对某些参与者可见。

关于javascript - 如何使 Telegram 机器人内联键盘私有(private)化? Node JS,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/56905619/

31 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com