This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| const FactsIntentHandler = { | |
| canHandle(handlerInput) { | |
| return Alexa.getRequestType(handlerInput.requestEnvelope) === 'IntentRequest' | |
| && Alexa.getIntentName(handlerInput.requestEnvelope) === 'FactsIntent'; | |
| }, | |
| handle(handlerInput) { | |
| var random = factsList.facts[Math.floor(Math.random() * factsList.facts.length)]; //select a random fact from json file | |
| var factText = random.text; | |
| var speakOutput = "Did you know that " + factText; | |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| { | |
| "facts" :[ | |
| { | |
| "text" : "Fact1" | |
| }, | |
| { | |
| "text" : "Fact2" | |
| }, | |
| { | |
| "text" : "Fact3" |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| const HelloWorldIntentHandler = { | |
| canHandle(handlerInput) { | |
| return Alexa.getRequestType(handlerInput.requestEnvelope) === 'IntentRequest' | |
| && Alexa.getIntentName(handlerInput.requestEnvelope) === 'HelloWorldIntent'; | |
| }, | |
| handle(handlerInput) { | |
| const speakOutput = 'Hello there! If you want to hear facts regarding Windows, say Facts.'; | |
| return handlerInput.responseBuilder | |
| .speak(speakOutput) | |
| //.reprompt('add a reprompt if you want to keep the session open for the user to respond') |
NewerOlder