此对话框提示用户在JavaScript对象中搜索首字母缩略词。当用户输入少于4个字符时,机器人返回:
"我不明白。请再试一次。"
当我提供4个或更多字符的首字母缩写时,对话框完美无缺。用户响应中的字符数是否有下限?
bot.dialog('AcronymDialog', [
function (session, arg) {
// Prompts user for an acronym to be searched in an object
builder.Prompts.text(session, "Please provide the Industry Acronym you wish to be translated.");
},
function(session, results) {
//If response is 4 or more characters this is executed
session.send(industryAcronyms[results.response]);
}
]);
此外,即使结果函数中的代码是session.send(" Hello,World");并且它从不搜索JS对象,响应是"我不明白。请再试一次。"