【发布时间】:2018-05-30 07:43:48
【问题描述】:
如果函数调用完成,则在代码的注释区域中。
newGame.call(conv);
它抛出错误:“TypeError: Cannot read property 'ask' of undefined at newGame”
如果我用下面的代码行替换注释。
它抛出错误:“错误:未设置响应。”
app.intent('newGameIntent',newGame);
这是代码。
const functions = require('firebase-functions');
process.env.DEBUG = 'actions-on-google:*';
const {dialogflow,SimpleResponse} = require('actions-on-google');
const app = dialogflow();
var welcome =(conv)=>{
if(newUser)
{
// how to trigger 'newGameIntent' here
}
else
{
// how to trigger 'LoadGameIntent' here
}
}
var newGame =(conv)=>{
conv.ask(new SimpleResponse({
speech: "Welcome to new game",
text: "Welcome to new game"
}));
}
var loadGame =(conv)=>{
conv.ask(new SimpleResponse({
speech: "Resuming the game for you",
text: "Resuming the game for you"
}));
}
app.intent('Default Welcome Intent',welcome);
app.intent('newGameIntent',newGame);
app.intent('LoadGameIntent',loadGame);
exports.MySample = functions.https.onRequest(app);
【问题讨论】:
-
嘿,你找到如何调用意图的解决方案了吗?
标签: node.js actions-on-google dialogflow-es google-home