From 1fcb230963fc2179924257118dcc4049979dd3b4 Mon Sep 17 00:00:00 2001 From: ahoZiorce Date: Sun, 1 Jul 2018 19:03:43 +0200 Subject: [PATCH] Started commandLoader.js --- src/commandHandler.js | 4 ++-- src/commandLoader.js | 4 ++++ 2 files changed, 6 insertions(+), 2 deletions(-) create mode 100644 src/commandLoader.js diff --git a/src/commandHandler.js b/src/commandHandler.js index 06b43a7..558221e 100644 --- a/src/commandHandler.js +++ b/src/commandHandler.js @@ -4,12 +4,12 @@ exports.endpoint = function endpoint (match, handler) { commands[match] = handler; }; -exports.apply = function apply (command) { +exports.apply = function apply (command, context) { let keys = Object.keys(commands); for (let i = 0; i < keys.length; i++) { let match = command.match(keys[i]); if (match) { - commands[keys[i]](match); + commands[keys[i]](match, context); return true; } } diff --git a/src/commandLoader.js b/src/commandLoader.js new file mode 100644 index 0000000..04ea4b0 --- /dev/null +++ b/src/commandLoader.js @@ -0,0 +1,4 @@ +const fs = require('fs'); +const commandH = require('./commandHandler'); + +fs.readdirSync(); \ No newline at end of file