-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathion.js
31 lines (25 loc) · 941 Bytes
/
ion.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
'use strict';
let ApiAiApp = require('actions-on-google').ApiAiApp;
exports.echoNumber = (req, res) => {
const app = new ApiAiApp({request: req, response: res});
// Create functions to handle requests here
const WELCOME_INTENT = 'input.welcome'; // the action name from the API.AI intent
//const NUMBER_INTENT = 'input.number'; // the action name from the API.AI intent
//const NUMBER_ARGUMENT = 'input.mynum'; // the action name from the API.AI intent
const TEST_INTENT = 'input.test';
function welcomeIntent (app) {
app.ask('Welcome to number echo! Say a number.');
}
// function numberIntent (app) {
// let number = app.getArgument(NUMBER_ARGUMENT);
// app.tell('You said ' + number);
// }
function testIntent(app)
{
app.tell('5 + 5 = 10');
}
}
let actionMap = new Map();
actionMap.set(WELCOME_INTENT, welcomeIntent);
actionMap.set(TEST_INTENT, testIntent);
app.handleRequest(actionMap);