aboutsummaryrefslogtreecommitdiffstats
path: root/server/src/commands/admin/saveconfig.js
diff options
context:
space:
mode:
Diffstat (limited to 'server/src/commands/admin/saveconfig.js')
-rw-r--r--server/src/commands/admin/saveconfig.js23
1 files changed, 12 insertions, 11 deletions
diff --git a/server/src/commands/admin/saveconfig.js b/server/src/commands/admin/saveconfig.js
index 65fff0e..6c713b4 100644
--- a/server/src/commands/admin/saveconfig.js
+++ b/server/src/commands/admin/saveconfig.js
@@ -3,37 +3,38 @@
*/
// module main
-exports.run = async (core, server, socket, data) => {
+export async function run(core, server, socket) {
// 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);
}
// attempt save, notify of failure
if (!core.configManager.save()) {
return server.reply({
cmd: 'warn',
- text: 'Failed to save config, check logs.'
- }, client);
+ text: 'Failed to save config, check logs.',
+ }, socket);
}
// return success message
server.reply({
cmd: 'info',
- text: 'Config saved!'
+ text: 'Config saved!',
}, socket);
// notify mods #transparency
server.broadcast({
cmd: 'info',
- text: 'Config saved!'
+ text: 'Config saved!',
}, { uType: 'mod' });
-};
-// module meta
-exports.info = {
+ return true;
+}
+
+export const info = {
name: 'saveconfig',
description: 'Writes the current config to disk',
usage: `
- API: { cmd: 'saveconfig' }`
+ API: { cmd: 'saveconfig' }`,
};