diff options
author | marzavec <admin@marzavec.com> | 2019-03-19 07:36:21 +0100 |
---|---|---|
committer | marzavec <admin@marzavec.com> | 2019-03-19 07:36:21 +0100 |
commit | c634e03cb553e21158fddc6d4221a54aa799de79 (patch) | |
tree | 74f303d4ab65b08c7ec316fb713146cc99024c00 /server/src/commands | |
parent | Merge pull request #56 from paulgreg/manifest (diff) | |
download | hackchat-c634e03cb553e21158fddc6d4221a54aa799de79.tar.gz hackchat-c634e03cb553e21158fddc6d4221a54aa799de79.zip |
refactoring 1 of 2
Diffstat (limited to 'server/src/commands')
-rw-r--r-- | server/src/commands/admin/addmod.js | 2 | ||||
-rw-r--r-- | server/src/commands/admin/reload.js | 2 | ||||
-rw-r--r-- | server/src/commands/admin/saveconfig.js | 2 | ||||
-rw-r--r-- | server/src/commands/core/chat.js | 2 | ||||
-rw-r--r-- | server/src/commands/core/invite.js | 2 | ||||
-rw-r--r-- | server/src/commands/core/join.js | 2 | ||||
-rw-r--r-- | server/src/commands/core/morestats.js | 16 | ||||
-rw-r--r-- | server/src/commands/core/stats.js | 2 | ||||
-rw-r--r-- | server/src/commands/mod/ban.js | 2 | ||||
-rw-r--r-- | server/src/commands/mod/kick.js | 2 | ||||
-rw-r--r-- | server/src/commands/mod/unban.js | 2 |
11 files changed, 18 insertions, 18 deletions
diff --git a/server/src/commands/admin/addmod.js b/server/src/commands/admin/addmod.js index c4fcdd5..a30b175 100644 --- a/server/src/commands/admin/addmod.js +++ b/server/src/commands/admin/addmod.js @@ -10,7 +10,7 @@ exports.run = async (core, server, socket, data) => { } // add new trip to config - core.config.mods.push({ trip: data.trip }); // purposely not using `config.set()` to avoid auto-save + core.config.mods.push({ trip: data.trip }); // find targets current connections let newMod = server.findSockets({ trip: data.trip }); diff --git a/server/src/commands/admin/reload.js b/server/src/commands/admin/reload.js index 947f9d9..27be19c 100644 --- a/server/src/commands/admin/reload.js +++ b/server/src/commands/admin/reload.js @@ -10,7 +10,7 @@ exports.run = async (core, server, socket, data) => { } // do command reload and store results - let loadResult = core.managers.dynamicImports.reloadDirCache('src/commands'); + let loadResult = core.dynamicImports.reloadDirCache('src/commands'); loadResult += core.commands.loadCommands(); // clear and rebuild all module hooks diff --git a/server/src/commands/admin/saveconfig.js b/server/src/commands/admin/saveconfig.js index b8a769b..a95a39a 100644 --- a/server/src/commands/admin/saveconfig.js +++ b/server/src/commands/admin/saveconfig.js @@ -10,7 +10,7 @@ exports.run = async (core, server, socket, data) => { } // attempt save, notify of failure - if (!core.managers.config.save()) { + if (!core.configManager.save()) { return server.reply({ cmd: 'warn', text: 'Failed to save config, check logs.' diff --git a/server/src/commands/core/chat.js b/server/src/commands/core/chat.js index 3455453..bb9584e 100644 --- a/server/src/commands/core/chat.js +++ b/server/src/commands/core/chat.js @@ -57,7 +57,7 @@ exports.run = async (core, server, socket, data) => { server.broadcast( payload, { channel: socket.channel}); // stats are fun - core.managers.stats.increment('messages-sent'); + core.stats.increment('messages-sent'); }; // module hook functions diff --git a/server/src/commands/core/invite.js b/server/src/commands/core/invite.js index 8374309..046e47a 100644 --- a/server/src/commands/core/invite.js +++ b/server/src/commands/core/invite.js @@ -59,7 +59,7 @@ exports.run = async (core, server, socket, data) => { }, socket); // stats are fun - core.managers.stats.increment('invites-sent'); + core.stats.increment('invites-sent'); }; // module meta diff --git a/server/src/commands/core/join.js b/server/src/commands/core/join.js index 8b6a971..ce900db 100644 --- a/server/src/commands/core/join.js +++ b/server/src/commands/core/join.js @@ -135,7 +135,7 @@ exports.run = async (core, server, socket, data) => { }, socket); // stats are fun - core.managers.stats.increment('users-joined'); + core.stats.increment('users-joined'); }; // module meta diff --git a/server/src/commands/core/morestats.js b/server/src/commands/core/morestats.js index 69740a9..a71729c 100644 --- a/server/src/commands/core/morestats.js +++ b/server/src/commands/core/morestats.js @@ -43,17 +43,17 @@ exports.run = async (core, server, socket, data) => { cmd: 'info', text: stripIndents`current-connections: ${uniqueClientCount} current-channels: ${uniqueChannels} - users-joined: ${(core.managers.stats.get('users-joined') || 0)} - invites-sent: ${(core.managers.stats.get('invites-sent') || 0)} - messages-sent: ${(core.managers.stats.get('messages-sent') || 0)} - users-banned: ${(core.managers.stats.get('users-banned') || 0)} - users-kicked: ${(core.managers.stats.get('users-kicked') || 0)} - stats-requested: ${(core.managers.stats.get('stats-requested') || 0)} - server-uptime: ${formatTime(process.hrtime(core.managers.stats.get('start-time')))}` + users-joined: ${(core.stats.get('users-joined') || 0)} + invites-sent: ${(core.stats.get('invites-sent') || 0)} + messages-sent: ${(core.stats.get('messages-sent') || 0)} + users-banned: ${(core.stats.get('users-banned') || 0)} + users-kicked: ${(core.stats.get('users-kicked') || 0)} + stats-requested: ${(core.stats.get('stats-requested') || 0)} + server-uptime: ${formatTime(process.hrtime(core.stats.get('start-time')))}` }, socket); // stats are fun - core.managers.stats.increment('stats-requested'); + core.stats.increment('stats-requested'); }; // module hook functions diff --git a/server/src/commands/core/stats.js b/server/src/commands/core/stats.js index b271bb1..ff4b1ef 100644 --- a/server/src/commands/core/stats.js +++ b/server/src/commands/core/stats.js @@ -27,7 +27,7 @@ exports.run = async (core, server, socket, data) => { }, socket); // stats are fun - core.managers.stats.increment('stats-requested'); + core.stats.increment('stats-requested'); }; // module meta diff --git a/server/src/commands/mod/ban.js b/server/src/commands/mod/ban.js index 8236136..93c536b 100644 --- a/server/src/commands/mod/ban.js +++ b/server/src/commands/mod/ban.js @@ -56,7 +56,7 @@ exports.run = async (core, server, socket, data) => { badClient.terminate(); // stats are fun - core.managers.stats.increment('users-banned'); + core.stats.increment('users-banned'); }; // module meta diff --git a/server/src/commands/mod/kick.js b/server/src/commands/mod/kick.js index 0e8ee0a..808defa 100644 --- a/server/src/commands/mod/kick.js +++ b/server/src/commands/mod/kick.js @@ -69,7 +69,7 @@ exports.run = async (core, server, socket, data) => { }, { channel: socket.channel, uType: 'user' }); // stats are fun - core.managers.stats.increment('users-kicked', kicked.length); + core.stats.increment('users-kicked', kicked.length); }; // module meta diff --git a/server/src/commands/mod/unban.js b/server/src/commands/mod/unban.js index 0cd8ca7..71be9bb 100644 --- a/server/src/commands/mod/unban.js +++ b/server/src/commands/mod/unban.js @@ -49,7 +49,7 @@ exports.run = async (core, server, socket, data) => { }, { uType: 'mod' }); // stats are fun - core.managers.stats.decrement('users-banned'); + core.stats.decrement('users-banned'); }; // module meta |