aboutsummaryrefslogtreecommitdiffstats
path: root/server/src/managers/commands.js
diff options
context:
space:
mode:
Diffstat (limited to 'server/src/managers/commands.js')
-rw-r--r--server/src/managers/commands.js14
1 files changed, 12 insertions, 2 deletions
diff --git a/server/src/managers/commands.js b/server/src/managers/commands.js
index fd743fb..a5ef464 100644
--- a/server/src/managers/commands.js
+++ b/server/src/managers/commands.js
@@ -71,8 +71,9 @@ class CommandManager {
command.info.category = category;
- if (this._categories.indexOf(category) === -1)
+ if (this._categories.indexOf(category) === -1) {
this._categories.push(category);
+ }
}
if (typeof command.init === 'function') {
@@ -114,7 +115,7 @@ class CommandManager {
/**
* Pulls all command names from a passed `category`
*
- * @param {String} category reference to the newly loaded object
+ * @param {String} category [Optional] filter return results by this category
*/
all (category) {
return !category ? this._commands : this._commands.filter(c => c.info.category.toLowerCase() === category.toLowerCase());
@@ -149,6 +150,15 @@ class CommandManager {
}
/**
+ * Runs `initHooks` function on any modules that utilize the event
+ *
+ * @param {Object} server main server object
+ */
+ initCommandHooks (server) {
+ this._commands.filter(c => typeof c.initHooks !== 'undefined').forEach(c => c.initHooks(server));
+ }
+
+ /**
* Finds and executes the requested command, or fails with semi-intelligent error
*
* @param {Object} server main server reference