aboutsummaryrefslogtreecommitdiffstats
path: root/server/src/commands/admin/reload.js
diff options
context:
space:
mode:
Diffstat (limited to 'server/src/commands/admin/reload.js')
-rw-r--r--server/src/commands/admin/reload.js21
1 files changed, 11 insertions, 10 deletions
diff --git a/server/src/commands/admin/reload.js b/server/src/commands/admin/reload.js
index 588d1c5..206e2ca 100644
--- a/server/src/commands/admin/reload.js
+++ b/server/src/commands/admin/reload.js
@@ -3,10 +3,10 @@
*/
// module main
-exports.run = async (core, server, socket, data) => {
+export async function run(core, server, socket, data) {
// increase rate limit chance and ignore if not admin
- if (socket.uType != 'admin') {
- return server.police.frisk(socket.remoteAddress, 20);
+ if (socket.uType !== 'admin') {
+ return server.police.frisk(socket.address, 20);
}
// do command reload and store results
@@ -17,7 +17,7 @@ exports.run = async (core, server, socket, data) => {
server.loadHooks();
// build reply based on reload results
- if (loadResult == '') {
+ if (loadResult === '') {
loadResult = `Reloaded ${core.commands.commands.length} commands, 0 errors`;
} else {
loadResult = `Reloaded ${core.commands.commands.length} commands, error(s):
@@ -31,20 +31,21 @@ exports.run = async (core, server, socket, data) => {
// reply with results
server.reply({
cmd: 'info',
- text: loadResult
+ text: loadResult,
}, socket);
// notify mods of reload #transparency
server.broadcast({
cmd: 'info',
- text: loadResult
+ text: loadResult,
}, { uType: 'mod' });
-};
-// module meta
-exports.info = {
+ return true;
+}
+
+export const info = {
name: 'reload',
description: '(Re)loads any new commands into memory, outputs errors if any',
usage: `
- API: { cmd: 'reload', reason: '<optional reason append>' }`
+ API: { cmd: 'reload', reason: '<optional reason append>' }`,
};