Fix plural bug + change ternaries to ifs
This commit is contained in:
parent
891edff394
commit
92787eb2d1
1 changed files with 13 additions and 2 deletions
|
@ -4,8 +4,19 @@ module.exports = function ({presenceText, presenceType, client}) {
|
||||||
const {globalPrefix} = require ('../data/config.json')
|
const {globalPrefix} = require ('../data/config.json')
|
||||||
let guildCount = getGuildCount(client)
|
let guildCount = getGuildCount(client)
|
||||||
let uptime = parseMS(client.uptime);
|
let uptime = parseMS(client.uptime);
|
||||||
let uptimeSingularOrPlural = uptime.hours > 1 || uptime.minutes > 1 ? "s" : "";
|
|
||||||
let uptimeFormat = uptime.hours >= 1 || uptime.days >= 1 ? uptime.days * 24 + uptime.hours + ` hour${uptimeSingularOrPlural}`: uptime.minutes + ` minute${uptimeSingularOrPlural}`;
|
let uptimeFormat = "";
|
||||||
|
let uptimeSingularOrPlural;
|
||||||
|
if(uptime.hours >= 1 || uptime.days >= 1){
|
||||||
|
uptimeSingularOrPlural = uptime.hours > 1 ? "s" : "";
|
||||||
|
uptimeFormat = uptime.days * 24 + uptime.hours + ` hour${uptimeSingularOrPlural}`
|
||||||
|
}else if(uptime.minutes > 1){
|
||||||
|
uptimeSingularOrPlural = uptime.minutes > 1 ? "s" : "";
|
||||||
|
uptimeFormat = uptime.minutes + ` minute${uptimeSingularOrPlural}`;
|
||||||
|
}else{
|
||||||
|
uptimeFormat = `less than a minute`
|
||||||
|
}
|
||||||
|
|
||||||
let regex = [/\${guilds}/g,/\${prefix}/g,/\${uptime}/g];
|
let regex = [/\${guilds}/g,/\${prefix}/g,/\${uptime}/g];
|
||||||
let replaceValue = [guildCount, globalPrefix, uptimeFormat];
|
let replaceValue = [guildCount, globalPrefix, uptimeFormat];
|
||||||
for(let i = 0; i < regex.length; i++){
|
for(let i = 0; i < regex.length; i++){
|
||||||
|
|
Loading…
Add table
Reference in a new issue