Skip to content

Commit

Permalink
Move configuration to config.js
Browse files Browse the repository at this point in the history
  • Loading branch information
samr28 committed Dec 19, 2018
1 parent 3597930 commit 1eb33a8
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 6 deletions.
5 changes: 5 additions & 0 deletions config.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
module.exports = {
// Notified on bot start. Can be users or channels (make sure to use @|#)
NOTIFY_GROUPS: ['@sam'],
SCHEDULE: true
}
10 changes: 4 additions & 6 deletions scripts/hubot-agenda.js
Original file line number Diff line number Diff line change
Expand Up @@ -24,15 +24,13 @@ const l = require('@samr28/log');
const agenda = require('./agenda');
const utils = require('./utils');
const schedule = require('./schedule');
const config = require('../config');

l.on();
l.setColors({
redis: "blue"
});
const REDIS_BRAIN_KEY = "agenda";
// Notified on bot start. Can be users or channels (make sure to use @|#)
const NOTIFY_GROUPS = ['@sam'];
const SCHEDULE = true;

// ================================================================================================
// Module exports
Expand Down Expand Up @@ -80,7 +78,7 @@ module.exports = function (robot) {
});

robot.brain.on('connected', initBrain);
NOTIFY_GROUPS.forEach(function (user) {
config.NOTIFY_GROUPS.forEach(function (user) {
robot.messageRoom(user, `Bot v${version} started @ ${startTime}`);
});
l.log(`Bot v${version} started @ ${startTime}`, "info");
Expand All @@ -94,9 +92,9 @@ module.exports = function (robot) {
l.log('NO PREV DATA', "redis");
robot.brain.set(REDIS_BRAIN_KEY, []);
}
if (SCHEDULE) {
if (config.SCHEDULE) {
if (utils.checkError(schedule.addSchedule(robot))) {
NOTIFY_GROUPS.forEach(function (user) {
config.NOTIFY_GROUPS.forEach(function (user) {
robot.messageRoom(user, new Error('Unable to set schedule at startup!'));
});
}
Expand Down

0 comments on commit 1eb33a8

Please sign in to comment.