From 39ec02d3c4cb5f5980b172d30404210de2479f0f Mon Sep 17 00:00:00 2001 From: marzavec Date: Tue, 13 Mar 2018 22:26:53 -0700 Subject: Streamlined modules, server tweaks, better feedback --- server/src/commands/core/stats.js | 26 +++----------------------- 1 file changed, 3 insertions(+), 23 deletions(-) (limited to 'server/src/commands/core/stats.js') diff --git a/server/src/commands/core/stats.js b/server/src/commands/core/stats.js index ba28319..a1abddb 100644 --- a/server/src/commands/core/stats.js +++ b/server/src/commands/core/stats.js @@ -1,22 +1,9 @@ /* - + Description: Legacy stats output, kept for compatibility, outputs user and channel count */ 'use strict'; -const stripIndents = require('common-tags').stripIndents; - -const formatTime = (time) => { - let seconds = time[0] + time[1] / 1e9; - - let minutes = Math.floor(seconds / 60); - seconds = seconds % 60; - - let hours = Math.floor(minutes / 60); - minutes = minutes % 60; - return `${hours.toFixed(0)}h ${minutes.toFixed(0)}m ${seconds.toFixed(0)}s`; -}; - exports.run = async (core, server, socket, data) => { let ips = {}; let channels = {}; @@ -35,14 +22,7 @@ exports.run = async (core, server, socket, data) => { server.reply({ 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)} - stats-requested: ${(core.managers.stats.get('stats-requested') || 0)} - server-uptime: ${formatTime(process.hrtime(core.managers.stats.get('start-time')))}` + text: `${uniqueClientCount} unique IPs in ${uniqueChannels} channels` }, socket); core.managers.stats.increment('stats-requested'); @@ -50,5 +30,5 @@ exports.run = async (core, server, socket, data) => { exports.info = { name: 'stats', - description: 'Sends back current server stats to the calling client' + description: 'Sends back legacy server stats to the calling client' }; -- cgit v1.2.1