diff options
Diffstat (limited to 'server/src/commands/admin')
-rw-r--r-- | server/src/commands/admin/addmod.js | 14 | ||||
-rw-r--r-- | server/src/commands/admin/listusers.js | 2 | ||||
-rw-r--r-- | server/src/commands/admin/reload.js | 6 | ||||
-rw-r--r-- | server/src/commands/admin/saveconfig.js | 2 | ||||
-rw-r--r-- | server/src/commands/admin/shout.js | 2 |
5 files changed, 15 insertions, 11 deletions
diff --git a/server/src/commands/admin/addmod.js b/server/src/commands/admin/addmod.js index dba5aba..e9dde2c 100644 --- a/server/src/commands/admin/addmod.js +++ b/server/src/commands/admin/addmod.js @@ -1,5 +1,5 @@ /* - + Description: Adds the target trip to the mod list then elevates the uType */ 'use strict'; @@ -16,14 +16,16 @@ exports.run = async (core, server, socket, data) => { core.config.mods.push(mod); // purposely not using `config.set()` to avoid auto-save - for (let client of server.clients) { - if (typeof client.trip !== 'undefined' && client.trip === data.trip) { - client.uType = 'mod'; + let newMod = server.findSockets({ trip: data.trip }); + + if (newMod.length !== 0) { + for (let i = 0, l = newMod.length; i < l; i++) { + newMod[i].uType = 'mod'; - server.reply({ + server.send({ cmd: 'info', text: 'You are now a mod.' - }, client); + }, newMod[i]); } } diff --git a/server/src/commands/admin/listusers.js b/server/src/commands/admin/listusers.js index 1ddb16b..226b000 100644 --- a/server/src/commands/admin/listusers.js +++ b/server/src/commands/admin/listusers.js @@ -1,5 +1,5 @@ /* - + Description: Outputs all current channels and their user nicks */ 'use strict'; diff --git a/server/src/commands/admin/reload.js b/server/src/commands/admin/reload.js index 88e40c7..387ae97 100644 --- a/server/src/commands/admin/reload.js +++ b/server/src/commands/admin/reload.js @@ -1,5 +1,5 @@ /* - + Description: Clears and resets the command modules, outputting any errors */ 'use strict'; @@ -14,7 +14,9 @@ exports.run = async (core, server, socket, data) => { loadResult += core.commands.loadCommands(); if (loadResult == '') { - loadResult = 'Commands reloaded without errors!'; + loadResult = `Loaded ${core.commands._commands.length} commands, 0 errors`; + } else { + loadResult = `Loaded ${core.commands._commands.length} commands, error(s): ${loadResult}`; } server.reply({ diff --git a/server/src/commands/admin/saveconfig.js b/server/src/commands/admin/saveconfig.js index 4c6dff8..0c4e0c9 100644 --- a/server/src/commands/admin/saveconfig.js +++ b/server/src/commands/admin/saveconfig.js @@ -1,5 +1,5 @@ /* - + Description: Writes any changes to the config to the disk */ 'use strict'; diff --git a/server/src/commands/admin/shout.js b/server/src/commands/admin/shout.js index c3cfded..736134a 100644 --- a/server/src/commands/admin/shout.js +++ b/server/src/commands/admin/shout.js @@ -1,5 +1,5 @@ /* - + Description: Emmits a server-wide message as `info` */ 'use strict'; |