我有一個技能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