From e35fff59ba30e78046c9212e74fce9aef56c6e93 Mon Sep 17 00:00:00 2001 From: marzavec Date: Mon, 4 Jun 2018 00:07:24 -0700 Subject: cleaned up and commented modules --- server/src/commands/admin/reload.js | 9 +++++++-- 1 file changed, 7 insertions(+), 2 deletions(-) (limited to 'server/src/commands/admin/reload.js') diff --git a/server/src/commands/admin/reload.js b/server/src/commands/admin/reload.js index e2cfbe6..7a0ffdc 100644 --- a/server/src/commands/admin/reload.js +++ b/server/src/commands/admin/reload.js @@ -3,25 +3,31 @@ */ exports.run = async (core, server, socket, data) => { + // increase rate limit chance and ignore if not admin if (socket.uType != 'admin') { - // ignore if not admin + server._police.frisk(socket.remoteAddress, 20); + return; } + // do command reloads and store results let loadResult = core.managers.dynamicImports.reloadDirCache('src/commands'); loadResult += core.commands.loadCommands(); + // build reply based on reload results if (loadResult == '') { loadResult = `Loaded ${core.commands._commands.length} commands, 0 errors`; } else { loadResult = `Loaded ${core.commands._commands.length} commands, error(s): ${loadResult}`; } + // reply with results server.reply({ cmd: 'info', text: loadResult }, socket); + // notify mods of reload #transparency server.broadcast({ cmd: 'info', text: loadResult @@ -32,4 +38,3 @@ exports.info = { name: 'reload', description: '(Re)loads any new commands into memory, outputs errors if any' }; - -- cgit v1.2.1