File tree Expand file tree Collapse file tree 2 files changed +14
-5
lines changed Expand file tree Collapse file tree 2 files changed +14
-5
lines changed Original file line number Diff line number Diff line change @@ -64,16 +64,24 @@ if (!process.env.clientId || !process.env.clientSecret || !process.env.PORT) {
6464var Botkit = require ( 'botkit' ) ;
6565var debug = require ( 'debug' ) ( 'botkit:main' ) ;
6666
67- // Create the Botkit controller, which controls all instances of the bot.
68- var controller = Botkit . slackbot ( {
67+ var bot_options = {
6968 clientId : process . env . clientId ,
7069 clientSecret : process . env . clientSecret ,
7170 // debug: true,
7271 scopes : [ 'bot' ] ,
7372 studio_token : process . env . studio_token ,
74- studio_command_uri : process . env . studio_command_uri ,
75- json_file_store : __dirname + '/.db/' // store user data in a simple JSON format
76- } ) ;
73+ studio_command_uri : process . env . studio_command_uri
74+ } ;
75+
76+ if ( process . env . MONGO_URI ) {
77+ var mongoStorage = require ( 'botkit-storage-mongo' ) ( { mongoUri : process . env . MONGO_URI } ) ;
78+ bot_options . storage = mongoStorage ;
79+ } else {
80+ bot_options . json_file_store = __dirname + '/.data/db/' ; // store user data in a simple JSON format
81+ }
82+
83+ // Create the Botkit controller, which controls all instances of the bot.
84+ var controller = Botkit . slackbot ( bot_options ) ;
7785
7886controller . startTicking ( ) ;
7987
Original file line number Diff line number Diff line change 99 "dependencies" : {
1010 "body-parser" : " ^1.15.2" ,
1111 "botkit" : " ^0.5" ,
12+ "botkit-storage-mongo" : " ^1.0.6" ,
1213 "dashbot" : " 0.7.4" ,
1314 "debug" : " ^2.3.3" ,
1415 "express" : " ^4.14.0" ,
You can’t perform that action at this time.
0 commit comments