-
Notifications
You must be signed in to change notification settings - Fork 0
/
index.js
40 lines (37 loc) · 1.03 KB
/
index.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
29
30
31
32
33
34
35
36
37
38
39
40
"use strict";
const Alexa = require("alexa-sdk");
const AWS = require("aws-sdk");
const dialogues = require("dialogues/main");
// Intents
const whatHappenedIntent = require("intents/whatHappenedIntent");
exports.handler = function(event, context, callback) {
var alexa = Alexa.handler(event, context);
alexa.appId = process.env.APP_ID;
alexa.registerHandlers(handlers);
alexa.execute();
};
var handlers = {
LaunchRequest: function() {
this.emit("AMAZON.HelpIntent");
},
"AMAZON.HelpIntent": function() {
this.emit(":ask", dialogues.HELP_REPROMPT);
},
"AMAZON.StopIntent": function() {
this.emit(":tell", dialogues.BYE_BYE);
},
"AMAZON.CancelIntent": function() {
this.emit(":tell", dialogues.BYE_BYE);
},
Unhandled: function() {
console.log(`unhandled`);
this.emit(":ask", dialogues.REPROMPT);
},
"AMAZON.YesIntent": function() {
this.emit("WhatHappenedIntent");
},
"AMAZON.NoIntent": function() {
this.emit(":tell", dialogues.BYEBYE);
},
WhatHappenedIntent: whatHappenedIntent
};