Started commandLoader.js
This commit is contained in:
@@ -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;
|
||||
}
|
||||
}
|
||||
|
||||
4
src/commandLoader.js
Normal file
4
src/commandLoader.js
Normal file
@@ -0,0 +1,4 @@
|
||||
const fs = require('fs');
|
||||
const commandH = require('./commandHandler');
|
||||
|
||||
fs.readdirSync();
|
||||
Reference in New Issue
Block a user