From 1eb33a8e37afecfe35afde635c6c68436011d58f Mon Sep 17 00:00:00 2001 From: Sam Roquitte Date: Wed, 19 Dec 2018 10:41:13 -0500 Subject: [PATCH] Move configuration to config.js --- config.js | 5 +++++ scripts/hubot-agenda.js | 10 ++++------ 2 files changed, 9 insertions(+), 6 deletions(-) create mode 100644 config.js diff --git a/config.js b/config.js new file mode 100644 index 0000000..8d30722 --- /dev/null +++ b/config.js @@ -0,0 +1,5 @@ +module.exports = { + // Notified on bot start. Can be users or channels (make sure to use @|#) + NOTIFY_GROUPS: ['@sam'], + SCHEDULE: true +} diff --git a/scripts/hubot-agenda.js b/scripts/hubot-agenda.js index a4c8c58..064f340 100644 --- a/scripts/hubot-agenda.js +++ b/scripts/hubot-agenda.js @@ -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 @@ -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"); @@ -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!')); }); }