forked from neelkapadia/WolfPlanner
-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy pathbot.js
44 lines (32 loc) · 1.25 KB
/
bot.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
require('dotenv').config();
// var env = require('node-env-file');
// env(__dirname + '/.env');
// if (!process.env.clientId || !process.env.clientSecret || !process.env.PORT) {
// console.log('Error: Specify clientId clientSecret and PORT in environment');
// usage_tip();
// process.exit(1);
// }
var Botkit = require('botkit');
var debug = require('debug')('botkit:main');
var mongoStorage = require('botkit-storage-mongo')({
mongoUri: process.env.MONGO_CONNECTION,
tables: ['student']
});
var bot_options = {
clientId: process.env.clientId,
clientSecret: process.env.clientSecret,
// debug: true,
scopes: ['bot'],
storage: mongoStorage
};
//bot_options.json_file_store = __dirname + '/.data/db/';
var controller = Botkit.slackbot(bot_options);
controller.startTicking();
var webserver = require(__dirname + '/components/express_webserver.js')(controller);
require(__dirname + '/components/user_registration.js')(controller);
require(__dirname + '/components/onboarding.js')(controller);
var normalizedPath = require("path").join(__dirname, "controllers");
require("./controllers/main.js")(controller)
// require("fs").readdirSync(normalizedPath).forEach(function(file) {
// require("./controllers/" + file)(controller);
// });