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:
parent
be2e2ec595
commit
2a4a021860
1 changed files with 27 additions and 7 deletions
|
@ -1,10 +1,30 @@
|
||||||
const prettyMS = require('pretty-ms')
|
const parseMS = require('parse-ms')
|
||||||
|
|
||||||
module.exports = {
|
module.exports = {
|
||||||
name: 'uptime',
|
name: 'uptime',
|
||||||
description: 'Returns how long discord bot has been running',
|
description: 'Returns uptime',
|
||||||
execute(message, client) {
|
execute(message, client) {
|
||||||
message.channel.send(`${prettyMS(client.uptime, {verbose: true})}`)
|
|
||||||
|
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)
|
||||||
|
}
|
||||||
};
|
};
|
Loading…
Add table
Reference in a new issue