From 02ec9079ff2fd327907efe12b7748b38877ae24b Mon Sep 17 00:00:00 2001 From: chris062689 Date: Sat, 25 Mar 2017 21:33:44 -0400 Subject: [PATCH] Only load scripts and modules that end in .js --- server.js | 10 ++++++++-- 1 file changed, 8 insertions(+), 2 deletions(-) diff --git a/server.js b/server.js index 9dcf528..472cf04 100644 --- a/server.js +++ b/server.js @@ -21,12 +21,18 @@ client.on('ready', () => { // Cache all command modules. require("fs").readdirSync('./commands/').forEach(function(file) { - cachedModules[file] = require(`./commands/${file}`); + // Load the module if it's a script. + if (path.extname(file) == '.js') { + cachedModules[file] = require(`./commands/${file}`); + } }); // Cache all triggers. require("fs").readdirSync('./triggers/').forEach(function(file) { - cachedTriggers.push(require(`./triggers/${file}`)); + // Load the trigger if it's a script. + if (path.extname(file) == '.js') { + cachedTriggers.push(require(`./triggers/${file}`)); + } }); // Initalize app channels.