-
-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy pathindex.js
38 lines (35 loc) · 948 Bytes
/
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
'use strict'
const Alexa = require('alexa-sdk')
const consts = require('./consts')
const handlers = {
'NewSession': function() {
this.emit('LaunchRequest')
}
'LaunchRequest': function() {
this.response.speak(consts.messages['launch'])
this.emit(':responseReady')
},
'AMAZON.StopIntent': function() {
this.response.speak(consts.messages['stop'])
this.emit(':responseReady')
},
'AMAZON.HelpIntent': function() {
const help_lines = consts.messages['help']
help_lines.forEach(help => {
this.response.speak(help)
})
this.emit(':responseReady')
},
'AMAZON.CancelIntent': function() {
this.response.speak(consts.messages['stop'])
this.emit(':responseReady')
},
'Unhandled': function() {
this.emit('AMAZON.HelpIntent')
}
}
exports.handler = (event, context, _callback) => {
const alexa = Alexa.handler(event, context)
alexa.registerHandlers(handlers)
alexa.execute()
}