我目前有一个电报机器人,可为我的组织用户提供常见问题解答 但我需要对此加以限制,以便只有支付指导费用的某些人才能使用该产品
反正我可以要求人们输入存储信息的用户ID号 因此,如果代码列表中没有该机器人,则无法访问该机器人
我的机器人当前是使用nodejs语言(基于this repo)编写的。
[
{
"triggers": [
"hello",
"hi"
],
"replies": [
{
"reply": "Hi Im your Personal Lion Bot \r\n\r\nWhat do you want to focus on today\r\n\r\n>Trading Help\r\n\r\n>Business Help\r\n\r\n>Mindset\r\n\r\n>Schedule\r\n\r\n>Just Started\r\n\r\n>Help",
"type": "text"
}
]
},
{
"triggers": [
"trading",
"Trading"
],
"replies": [
{
"reply": "Ok you want to focus on trading\r\n\r\nHeres is what I can show you\r\n\r\n>Our Schedule\r\n\r\n>A Trading Gameplan\r\n\r\n>Trade Ideas\r\n\r\n>Trading Products",
"type": "text"
}
]
}
]
答案 0 :(得分:0)
您需要知道付费用户的ID,然后仅在msg.from.id
在允许的用户列表中时回答他们的消息。
类似的东西:
function check_if_allowed(id) {
...
}
bot.on('message', (msg) => {
if (check_if_allowed(msg.from.id)) {
...
}
})
要找到他们的ID,取决于您在组织中的注册方式。
如果需要进一步的帮助,请添加更多详细信息和代码