2017-11-08 21 views
0

複数のカスタムスキルインテントがあります。すべてのカスタムインテントのイベントを取り消して処理したいどのようにしてキャンセルが呼び出されているのかを知ることができます。Alexa Node JS複数イベントのキャンセルイベントを処理する方法

const Alexa = require('alexa-sdk'); 
exports.handler = (event, context) => { 
    const alexa = Alexa.handler(event, context); 
    var APP_ID = "amzn1.ask.skill.[ssdad-5c61-4d4e-b2bf-7eea8a491816]"; 
    alexa.APP_ID = APP_ID; 
    alexa.registerHandlers(handlers); 
    alexa.execute(); 
}; 
const handlers = { 
    'ConfirmChangeEvent': function() { 
    this.emit(':ask', "Do u want commit for change? "); 
    }, 
    'ConfirmLastAction': function() { 
    this.emit(':ask', "Do u want confirm for last Action?"); 
    }, 

    'LaunchRequest': function() { 
    this.emit(':tell', "Hi Damodar, I'm Dialogue manager"); 
    }, 
    'Amazon.CancelIntent' : function() { 
    // i want handle cancel on both intents here ConfirmLastAction and Conf irmChangeEvent 

    //if ConfirmChangeEvent should give output like "Okay cancelling changeEvent " 

    // ConfirmChangeEvent should give output like "Okay cancelling the Last Action " 

    } 

    'Unhandled': function() { 
    this.emit(':tell', "I'm not able to respond at this time"); 
    } 
}; 

はどのように我々はあなたが状態管理を使用する必要があるノードJSアレクサ

+0

「すべてのカスタムインテントのイベントをキャンセルする」とはどういう意味ですか?すべてを保持するセッションは1つだけです。あなたがそれをキャンセルすると、それは全体としてキャンセルされます –

答えて

0

でこれを扱うことができます。ここには、ドキュメントへのリンクhttps://github.com/alexa/alexa-skills-kit-sdk-for-nodejs#making-skill-state-management-simpler

状態ハンドラを使用すると、ユーザーの現在の状態に応じて異なるキャンセル応答を行うことができます。

+0

大変ありがとうございます@ Steve Tingiris – Dev

+0

は以下の問題 – Dev

+0

を解決するのに役立ちますhttps://stackoverflow.com/questions/47194136/alexa-not-responding-for-when- i-created-skill-from-skill-buidler – Dev

関連する問題