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
| /* eslint-disable func-names */ | |
| /* eslint-disable no-console */ | |
| const Alexa = require('ask-sdk'); | |
| const GetNewFactHandler = { | |
| canHandle(handlerInput) { | |
| const request = handlerInput.requestEnvelope.request; | |
| return request.type === 'LaunchRequest' | |
| || (request.type === 'IntentRequest' |
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
| { | |
| "interactionModel": { | |
| "languageModel": { | |
| "invocationName": "curiosidades espaciales", | |
| "intents": [ | |
| { | |
| "name": "AMAZON.CancelIntent", | |
| "samples": [] | |
| }, | |
| { |
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
| /* eslint-disable func-names */ | |
| /* eslint-disable no-console */ | |
| const Alexa = require('ask-sdk'); | |
| const GetNewFactHandler = { | |
| canHandle(handlerInput) { | |
| const request = handlerInput.requestEnvelope.request; | |
| return request.type === 'LaunchRequest' | |
| || (request.type === 'IntentRequest' |
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
| { | |
| "interactionModel": { | |
| "languageModel": { | |
| "invocationName": "curiosidades espaciales", | |
| "intents": [ | |
| { | |
| "name": "AMAZON.CancelIntent", | |
| "samples": [] | |
| }, | |
| { |
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
| /* eslint-disable func-names */ | |
| /* eslint-disable no-console */ | |
| const Alexa = require('ask-sdk'); | |
| const ESLaunchRequestHandler = { | |
| canHandle(handlerInput) { | |
| const request = handlerInput.requestEnvelope.request; | |
| return (request.type === 'LaunchRequest' | |
| && request.locale === `es-MX` ); |
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 upsInterceptor={ | |
| async process(handlerInput){ | |
| let { requestEnvelope, serviceClientFactory, attributesManager} = handlerInput; | |
| let {deviceId} = requestEnvelope.context.System.device; | |
| const upsServiceClient = serviceClientFactory.getUpsServiceClient(); | |
| const usertimeZone = await upsServiceClient.getSystemTimeZone(deviceId); | |
| const requestAttributes = attributesManager.getRequestAttributes(); | |
| requestAttributes.timeZone = usertimeZone; | |
| attributesManager.setRequestAttributes(requestAttributes); | |
| console.log(JSON.stringify(attributesManager.getRequestAttributes())); |
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
| async function httpRequestPromise(options) { | |
| //log the options in case we need to debug | |
| console.log(`~~~~~~~~~~~~~~~${JSON.stringify(options)}~~~~~~~~~~~~~`); | |
| // return new pending promise | |
| return new Promise((resolve, reject) => { | |
| const request = http.request(options, (response) => { | |
| // reject the promise if the HTTP status isn't `Successful 2xx` | |
| if (response.statusCode < 200 || response.statusCode > 299) { | |
| reject(new Error('Failed to load page, status code: ' + response.statusCode)); | |
| } |
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
| skillBuilder.addRequestHandlers( | |
| GetNewFactHandler, | |
| HelpHandler, | |
| ExitHandler, | |
| SessionEndedRequestHandler |
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
| return handlerInput.responseBuilder | |
| .speak(speechOutput) | |
| .withSimpleCard(SKILL_NAME, randomFact) | |
| .reprompt(‘Would you like another fact?’) | |
| .getResponse(); |
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
| handle(handlerInput) { | |
| const factArr = data; | |
| const factIndex = Math.floor(Math.random() * factArr.length); | |
| const randomFact = factArr[factIndex]; | |
| const speechOutput = GET_FACT_MESSAGE + randomFact; |