diff --git a/package.json b/package.json index 037aa74..e1511db 100644 --- a/package.json +++ b/package.json @@ -10,6 +10,7 @@ "express": "^4.15.4", "github": "^9.2.0", "irc": "^0.5.2", + "path": "^0.12.7", "readline": "^1.3.0" }, "devDependencies": { diff --git a/src/bot.js b/src/bot.js index 45ad843..cda327f 100644 --- a/src/bot.js +++ b/src/bot.js @@ -9,6 +9,7 @@ const state = { offsetTime: 1000 }; +const path = require('path'); const greetBehavior = require('./behaviors/greet'); const helpBehavior = require('./behaviors/help').helpBehavior; const ftoBehavior = require('./behaviors/fto')(state); @@ -16,7 +17,8 @@ const heatBehavior = require('./behaviors/heat'); const unresponsiveBehavior = require('./behaviors/unresponsive')(state); // Read file synchronously because we'd need this object in later steps anyway. -const config = JSON.parse(fs.readFileSync('../config.json', 'utf8')); +const configFile = path.join(__dirname, '../', 'config.json'); +const config = JSON.parse(fs.readFileSync(configFile, 'utf8')); let client; if (process.env.TEST) {