Change uptime to show hours if it exceeds an hour

This commit is contained in:
SileNce5k 2022-04-28 02:03:02 +02:00
parent 118e27ea5c
commit 8093998cda
No known key found for this signature in database
GPG key ID: C507260E7F2583AD

View file

@ -4,7 +4,8 @@ module.exports = function ({presenceText, presenceType, client}) {
const {globalPrefix} = require ('../data/config.json')
let guildCount = getGuildCount(client)
let uptime = parseMS(client.uptime);
let uptimeInMinutes = uptime.days * 24 * 60 + uptime.hours * 60 + uptime.minutes;
let uptimeSingularOrPlural = uptime.hours > 1 || uptime.minutes > 1 ? "s" : "";
let uptimeInMinutes = uptime.hours >= 1 || uptime.days >= 1 ? uptime.days * 24 + uptime.hours + ` hour${uptimeSingularOrPlural}`: uptime.minutes + ` minute${uptimeSingularOrPlural}`;
let regex = [/\${guilds}/g,/\${prefix}/g,/\${uptime}/g];
let replaceValue = [guildCount, globalPrefix, uptimeInMinutes];
for(let i = 0; i < regex.length; i++){