-
Notifications
You must be signed in to change notification settings - Fork 9
/
alexaLambda2.js
28 lines (25 loc) · 1.06 KB
/
alexaLambda2.js
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
const alexa = require('alexa-sdk');
const handlers = {
'LaunchRequest': function () {
this.emit(':tell', "Welcome to your cookbook, ask me some questions and I'll try to answer!");
},
'FavoriteIceCream': function () {
this.emit(':tell', "I love all types of ice cream, but rocky road is my favorite!");
},
'KitchenFacts': function () {
const facts = [
'Pringles once had a lawsuit trying to prove that they weren’t really potato chips.',
'Ripe cranberries will bounce like rubber balls.',
'An average ear of corn has an even number of rows, usually 16.',
'Apples belong to the rose family, as do pears and plums.',
'One of the most popular pizza toppings in Brazil is green peas.'
];
const factNumber = Math.floor(Math.random() * facts.length);
this.emit(':tell', facts[factNumber]);
}
};
exports.handler = (event, context) => {
const handler = alexa.handler(event, context);
handler.registerHandlers(handlers);
handler.execute();
};