【发布时间】:2016-11-14 04:13:15
【问题描述】:
所以我有一个我目前正在开发的 Kik 机器人,它使用键盘来建议用户可能想对机器人说的话,就像大多数 Kik 机器人一样。对于不同的用户,我希望弹出不同的选项。我创建了一个函数来检查当前用户是否曾经是那些特殊用户,如果是,则为他们显示另一个选项。我从许多测试中确认该函数返回 true,但键盘选项拒绝改变普通用户会看到的内容。这是我的代码
message.stopTyping();
if (userIsAdmin(message.from)) //This function returns the boolean true
{
message.reply(Bot.Message.text("I don't understand what you are trying to ask me. Please reply with something I can work with.").addResponseKeyboard(["Homework", "Admin Options"]))
}
else
{
message.reply(Bot.Message.text("I don't understand what you are trying to ask me. Please reply with something I can work with.").addResponseKeyboard(["Homework"])) //The bot always displays this as the keyboard, no matter if the user is an admin or not
}
break;
}
【问题讨论】:
-
您的消息是否真的被发送(= 您是否在 Kik 应用上收到消息?)。
-
@RémiVansteelandt 是的,除了建议的键盘没有改变之外,一切正常。
-
为了测试目的,我会让消息具有不同的字符串。我听起来你只是总是发送第二条消息。如果您更改消息正文,您将能够看到
标签: javascript node.js kik