diff options
author | marzavec <admin@marzavec.com> | 2018-03-14 06:26:53 +0100 |
---|---|---|
committer | marzavec <admin@marzavec.com> | 2018-03-14 06:26:53 +0100 |
commit | 39ec02d3c4cb5f5980b172d30404210de2479f0f (patch) | |
tree | b837c9cfff94c62aa3de9880e4f7d07460734984 /server/src/commands/admin/addmod.js | |
parent | stabilized modules and server cmd field (diff) | |
download | hackchat-39ec02d3c4cb5f5980b172d30404210de2479f0f.tar.gz hackchat-39ec02d3c4cb5f5980b172d30404210de2479f0f.zip |
Streamlined modules, server tweaks, better feedback
Diffstat (limited to '')
-rw-r--r-- | server/src/commands/admin/addmod.js | 14 |
1 files changed, 8 insertions, 6 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]); } } |