forked from hacker-alliance/UCFParkingAgent
-
Notifications
You must be signed in to change notification settings - Fork 0
/
index.js
66 lines (52 loc) · 1.45 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
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
const express = require('express');
const {
dialogflow,
Suggestions,
BasicCard,
Button,
SimpleResponse,
Image,
Table,
} = require('actions-on-google');
const bodyParser = require("body-parser");
const converter = require("number-to-words");
const format = require("string-template");
const moment = require("moment");
const helper = require("./lib/helper");
const lib = {
dialogflow,
Suggestions,
BasicCard,
Button,
SimpleResponse,
Image,
Table,
bodyParser,
converter,
format,
helper,
moment,
}
//intents
const welcome = require("./intents/WelcomeIntent");
const spotsLeft = require("./intents/SpotsLeftIntent");
const spotsTaken = require("./intents/SpotsTakenIntent");
const garagePredict = require("./intents/GaragePredictionIntent");
const garageStatus = require("./intents/GarageStatusIntent");
const app = dialogflow();
const restService = express();
restService.use(
bodyParser.urlencoded({
extended: true
})
);
restService.use(bodyParser.json());
app.intent('Default Welcome Intent', conv => welcome(conv,lib));
app.intent('Spots Left Intent', conv => spotsLeft(conv,lib));
app.intent('Spots Taken Intent', conv => spotsTaken(conv,lib));
app.intent('Garage Prediction Intent',conv=>garagePredict(conv,lib));
app.intent("Garage Status Intent",conv=>garageStatus(conv,lib));
restService.post("/garage", app);
restService.listen(process.env.PORT || 8080, function() {
console.log("Server up and listening v3.1");
});