diff options
Diffstat (limited to 'server/src/commands/admin/addmod.js')
-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]); } } |