我有一个技能SkillIntent
,当你问它一个特定的游戏问题,它回答该技能的描述。完美的工作 - 然而,我现在要做的是,如果有不同的询问,那么回复世卫组织就有这个技能。不同的调用与一个Alexa技巧
下面是我的工作代码:
'use strict';
var AlexaSkill = require('./AlexaSkill'),
descriptions = require('./descriptions');
var APP_ID = undefined;
var ZombicideSkills = function() {
AlexaSkill.call(this, APP_ID);
};
// Extend AlexaSkill
ZombicideSkills.prototype = Object.create(AlexaSkill.prototype);
ZombicideSkills.prototype.constructor = ZombicideSkills;
ZombicideSkills.prototype.eventHandlers.onLaunch = function (launchRequest, session, response) {
var speechText = "You can ask a question like, what does this skill do? ... Now, what can I help you with.";
var repromptText = "For instructions on what you can say, please say help me.";
response.ask(speechText, repromptText);
};
ZombicideSkills.prototype.intentHandlers = {
"SkillIntent": function (intent, session, response) {
var skillSlot = intent.slots.Skill,
skillName;
if (skillSlot && skillSlot.value){
skillName = skillSlot.value.toLowerCase();
}
var cardTitle = "Description for " + skillName,
description = descriptions[skillName],
speechOutput,
repromptOutput;
if (description) {
speechOutput = {
speech: description,
type: AlexaSkill.speechOutputType.PLAIN_TEXT
};
response.tellWithCard(speechOutput, cardTitle, description);
} else {
var speech;
if (skillName) {
speech = "I'm sorry, I don't know if I know " + skillName + ". What else can I help with?";
} else {
speech = "I'm sorry, I currently do not know that skill. What else can I help with?";
}
speechOutput = {
speech: speech,
type: AlexaSkill.speechOutputType.PLAIN_TEXT
};
repromptOutput = {
speech: "What else can I help with?",
type: AlexaSkill.speechOutputType.PLAIN_TEXT
};
response.ask(speechOutput, repromptOutput);
}
},
"AMAZON.StopIntent": function (intent, session, response) {
var speechOutput = "Goodbye";
response.tell(speechOutput);
},
"AMAZON.CancelIntent": function (intent, session, response) {
var speechOutput = "Goodbye";
response.tell(speechOutput);
},
"AMAZON.HelpIntent": function (intent, session, response) {
var speechText = "You can ask questions such as, what does this skill do, or, you can say exit... Now, what can I help you with?";
var repromptText = "You can say things like, what does this skill do, or you can say exit... Now, what can I help you with?";
var speechOutput = {
speech: speechText,
type: AlexaSkill.speechOutputType.PLAIN_TEXT
};
var repromptOutput = {
speech: repromptText,
type: AlexaSkill.speechOutputType.PLAIN_TEXT
};
response.ask(speechOutput, repromptOutput);
}
};
exports.handler = function (event, context) {
var zombicide = new ZombicideSkills();
zombicide.execute(event, context);
};
它仿照非常相似的是,MC助手的。我是否会实现一个名为'ActorIntent'的附加intent处理程序,然后在Utterences中指定ActorIntent what {actors} have the {skill} skill?
我一直在玩这个想法,只需'上传并查看端点是否可达'。
如果我必须具备两个不同的技能,这会很烦人,但我不确定吗?这只是我的代码库的一个问题,我应该可以去创建一个没有问题的ActorIntent
?
感激 - 我不知道,如果我的次要目的是打破了功能,或别的东西。谢谢。 – DNorthrup