From 02f6fbf70153241ce45b9c880664566f2d1ede86 Mon Sep 17 00:00:00 2001 From: marzavec Date: Sat, 2 Feb 2019 13:34:06 -0800 Subject: Minor module changes Added trips to listusers output. Added 'reason' to reload broadcast. Fixed removemod bug. Added /nick hook to changenick. Added 'type' and 'from' fields to invite event. --- server/src/commands/admin/listusers.js | 5 ++++- server/src/commands/admin/reload.js | 11 ++++++++--- server/src/commands/admin/removemod.js | 8 +++++--- 3 files changed, 17 insertions(+), 7 deletions(-) (limited to 'server/src/commands/admin') diff --git a/server/src/commands/admin/listusers.js b/server/src/commands/admin/listusers.js index 85fc078..472b89d 100644 --- a/server/src/commands/admin/listusers.js +++ b/server/src/commands/admin/listusers.js @@ -20,7 +20,10 @@ exports.run = async (core, server, socket, data) => { if (typeof channels[currentUsers[i].channel] === 'undefined') { channels[currentUsers[i].channel] = []; } - channels[currentUsers[i].channel].push(currentUsers[i].nick); + + channels[currentUsers[i].channel].push( + `[${currentUsers[i].trip||'null'}]${currentUsers[i].nick}` + ); } // build output diff --git a/server/src/commands/admin/reload.js b/server/src/commands/admin/reload.js index f7f7464..f40d0b2 100644 --- a/server/src/commands/admin/reload.js +++ b/server/src/commands/admin/reload.js @@ -19,9 +19,14 @@ exports.run = async (core, server, socket, data) => { // build reply based on reload results if (loadResult == '') { - loadResult = `Loaded ${core.commands._commands.length} commands, 0 errors`; + loadResult = `Reloaded ${core.commands._commands.length} commands, 0 errors`; } else { - loadResult = `Loaded ${core.commands._commands.length} commands, error(s): ${loadResult}`; + loadResult = `Reloaded ${core.commands._commands.length} commands, error(s): + ${loadResult}`; + } + + if (typeof data.reason !== 'undefined') { + loadResult += `\nReason: ${data.reason}`; } // reply with results @@ -42,5 +47,5 @@ exports.info = { name: 'reload', description: '(Re)loads any new commands into memory, outputs errors if any', usage: ` - API: { cmd: 'reload' }` + API: { cmd: 'reload', reason: '' }` }; diff --git a/server/src/commands/admin/removemod.js b/server/src/commands/admin/removemod.js index dda822c..87f4124 100644 --- a/server/src/commands/admin/removemod.js +++ b/server/src/commands/admin/removemod.js @@ -14,8 +14,8 @@ exports.run = async (core, server, socket, data) => { // find targets current connections let targetMod = server.findSockets({ trip: data.trip }); - if (newMod.length !== 0) { - for (let i = 0, l = newMod.length; i < l; i++) { + if (targetMod.length !== 0) { + for (let i = 0, l = targetMod.length; i < l; i++) { // downgrade privilages targetMod[i].uType = 'user'; @@ -30,7 +30,9 @@ exports.run = async (core, server, socket, data) => { // return success message server.reply({ cmd: 'info', - text: `Removed mod trip: ${data.trip}, remember to run 'saveconfig' to make it permanent` + text: `Removed mod trip: ${ + data.trip + }, remember to run 'saveconfig' to make it permanent` }, socket); // notify all mods -- cgit v1.2.1