Last active
February 1, 2018 04:00
-
-
Save ginnyfahs/f6a2cd565261e7f412a53957de940a79 to your computer and use it in GitHub Desktop.
Draft of Eats Alexa Script
This file contains 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
'use strict'; | |
const Alexa = require('alexa-sdk'); | |
const APP_ID = 'amzn1.ask.skill.1d801d3b-5ade-4725-b91f-a98c61d99466'; // TODO replace with your app ID (OPTIONAL). | |
let speechOutput; | |
let reprompt; | |
const welcomeOutput = "Welcome to Uber Eats! Let’s get rolling on a new order. You can choose from any of your past three orders. Would you like to order from Italian Homemade Company, Pancho Villa Taqueria, or Little Kite?" | |
const welcomeReprompt = "Say order from Italian Homemade Company or Pancho Villa Taqueria or Little Kite" | |
const tripIntro = [ | |
"This sounds like a cool trip. ", | |
"This will be fun. ", | |
"Oh, I like this trip. " | |
]; | |
const handlers = { | |
'LaunchRequest': function () { | |
// this.emit('GetFact'); | |
this.response.speak(welcomeOutput).listen(welcomeReprompt); | |
this.emit(':responseReady'); | |
}, | |
// 'GetNewFactIntent': function () { | |
// this.emit('GetFact'); | |
// }, | |
'ChooseRestaurant': function () { | |
// this.emit('GetFact'); | |
this.response.speak('thanks'); | |
// this.response.speak('thanks, ordering from ' + this.event.request.intent.slots.restaurant.value); | |
this.emit(':responseReady'); | |
}, | |
// 'GetFact': function () { | |
// // // Get a random space fact from the space facts list | |
// // // Use this.t() to get corresponding language data | |
// // const factArr = this.t('FACTS'); | |
// // const factIndex = Math.floor(Math.random() * factArr.length); | |
// // const randomFact = factArr[factIndex]; | |
// // // Create speech output | |
// // const speechOutput = this.t('GET_FACT_MESSAGE') + randomFact; | |
// // this.emit(':tellWithCard', speechOutput, this.t('SKILL_NAME'), randomFact); | |
// // this.emit(':ask', speechOutput, reprompt) | |
// }, | |
'AMAZON.HelpIntent': function () { | |
const speechOutput = this.t('HELP_MESSAGE'); | |
const reprompt = this.t('HELP_MESSAGE'); | |
this.emit(':ask', speechOutput, reprompt); | |
}, | |
'AMAZON.CancelIntent': function () { | |
this.emit(':tell', this.t('STOP_MESSAGE')); | |
}, | |
'AMAZON.StopIntent': function () { | |
this.emit(':tell', this.t('STOP_MESSAGE')); | |
}, | |
}; | |
exports.handler = function (event, context) { | |
const alexa = Alexa.handler(event, context); | |
alexa.APP_ID = APP_ID; | |
// To enable string internationalization (i18n) features, set a resources object. | |
alexa.registerHandlers(handlers); | |
alexa.execute(); | |
}; |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment