Refactor uptime command

Use parse-ms instead of pretty-ms.
It wasn't possible to make it return what I wanted it to return.
Was easier to just do that manually.
This commit is contained in:
SileNce5k 2021-03-09 02:24:51 +01:00
parent be2e2ec595
commit 2a4a021860
No known key found for this signature in database
GPG key ID: C507260E7F2583AD

View file

@ -1,10 +1,30 @@
const prettyMS = require('pretty-ms')
const parseMS = require('parse-ms')
module.exports = {
name: 'uptime',
description: 'Returns how long discord bot has been running',
execute(message, client) {
message.channel.send(`${prettyMS(client.uptime, {verbose: true})}`)
name: 'uptime',
description: 'Returns uptime',
execute(message, client) {
}
let days = "";
let hours = "";
let minutes = "";
let seconds = "";
let milliseconds = "";
let uptime = parseMS(client.uptime)
if (uptime.days != 0)
days = `${uptime.days} days, `
if (uptime.hours != 0)
hours = `${uptime.hours} hours, `
if (uptime.minutes != 0)
minutes = `${uptime.minutes} minutes, `
if (uptime.seconds != 0)
seconds = `${uptime.seconds} seconds, and `
if (uptime.milliseconds != 0)
milliseconds = `${uptime.milliseconds} milliseconds`
let fullUptime = `This bot has an uptime of ${days}${hours}${minutes}${seconds}${milliseconds}`
message.channel.send(fullUptime)
}
};