forked from sayar/fitcbot
-
Notifications
You must be signed in to change notification settings - Fork 0
/
app.js
47 lines (40 loc) · 1.39 KB
/
app.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
/**
* FITC Chat Bot
* Authors: Rami Sayar and Rick Mason
*
* Note: Lots of node BotBuilder samples here: https://github.com/Microsoft/BotBuilder-Samples/tree/master/Node
*/
var restify = require('restify');
var builder = require('botbuilder');
var dotenv = require('dotenv');
// Load ENV variables
dotenv.load();
/**
* Bot Setup
*/
// Setup Restify Server
var server = restify.createServer();
server.listen(process.env.port || process.env.PORT || 3978, function() {
console.log('%s listening to %s', server.name, server.url);
});
// Create chat bot
var connector = new builder.ChatConnector({
appId: process.env.MICROSOFT_APP_ID,
appPassword: process.env.MICROSOFT_APP_PASSWORD
});
var bot = new builder.UniversalBot(connector);
server.post('/api/messages', connector.listen());
var home = require('./dialogs/home');
var cats = require('./dialogs/cats');
var presentations = require('./dialogs/cats');
var findSpeaker = require('./dialogs/findSpeaker');
var currentPresentations = require('./dialogs/currentPresentations');
var nextPresentations = require('./dialogs/nextPresentations');
var faq = require('./dialogs/faq');
bot.dialog('/', home);
bot.dialog('/cats', cats);
bot.dialog('/presentations', presentations);
bot.dialog('/findSpeaker', findSpeaker);
bot.dialog('/currentPresentations', currentPresentations);
bot.dialog('/nextPresentations', nextPresentations);
bot.dialog('/faq', faq);