Fixed durations
This commit is contained in:
parent
dea160c73b
commit
f2ace6ee52
6 changed files with 54 additions and 31 deletions
|
@ -1,13 +1,11 @@
|
|||
const { version } = require("../../package.json");
|
||||
const day = require("dayjs");
|
||||
day.extend(require("dayjs/plugin/duration"));
|
||||
const os = require("os");
|
||||
const Command = require("../../classes/command.js");
|
||||
|
||||
class StatsCommand extends Command {
|
||||
async run() {
|
||||
const duration = day.duration(this.client.uptime).format(" D [days], H [hrs], m [mins], s [secs]");
|
||||
const uptime = day.duration(process.uptime(), "seconds").format(" D [days], H [hrs], m [mins], s [secs]");
|
||||
const uptime = process.uptime();
|
||||
const connUptime = this.client.uptime;
|
||||
const owner = await this.ipc.fetchUser(process.env.OWNER);
|
||||
const stats = await this.ipc.getStats();
|
||||
return {
|
||||
|
@ -34,11 +32,11 @@ class StatsCommand extends Command {
|
|||
},
|
||||
{
|
||||
"name": "Bot Uptime",
|
||||
"value": uptime
|
||||
"value": `${Math.trunc(uptime / 86400000)} days, ${Math.trunc(uptime / 3600000) % 24} hrs, ${Math.trunc(uptime / 60000) % 60} mins, ${Math.trunc(uptime / 1000) % 60} secs`
|
||||
},
|
||||
{
|
||||
"name": "Connection Uptime",
|
||||
"value": duration
|
||||
"value": `${Math.trunc(connUptime / 86400000)} days, ${Math.trunc(connUptime / 3600000) % 24} hrs, ${Math.trunc(connUptime / 60000) % 60} mins, ${Math.trunc(connUptime / 1000) % 60} secs`
|
||||
},
|
||||
{
|
||||
"name": "Host",
|
||||
|
|
|
@ -1,7 +1,5 @@
|
|||
const fetch = require("node-fetch");
|
||||
const day = require("dayjs");
|
||||
const duration = require("dayjs/plugin/duration");
|
||||
day.extend(duration);
|
||||
const format = require("format-duration");
|
||||
const MusicCommand = require("../../classes/musicCommand.js");
|
||||
|
||||
class NowPlayingCommand extends MusicCommand {
|
||||
|
@ -36,7 +34,7 @@ class NowPlayingCommand extends MusicCommand {
|
|||
},
|
||||
{
|
||||
"name": `${"▬".repeat(parts)}🔘${"▬".repeat(10 - parts)}`,
|
||||
"value": `${day.duration(player.state.position).format("m:ss", { trim: false })}/${track.isStream ? "∞" : day.duration(track.length).format("m:ss", { trim: false })}`
|
||||
"value": `${format(player.state.position)}/${track.isStream ? "∞" : format(track.length)}`
|
||||
}]
|
||||
}
|
||||
};
|
||||
|
|
|
@ -1,8 +1,6 @@
|
|||
const soundPlayer = require("../../utils/soundplayer.js");
|
||||
const fetch = require("node-fetch");
|
||||
const day = require("dayjs");
|
||||
const duration = require("dayjs/plugin/duration");
|
||||
day.extend(duration);
|
||||
const format = require("format-duration");
|
||||
const paginator = require("../../utils/pagination/pagination.js");
|
||||
const MusicCommand = require("../../classes/musicCommand.js");
|
||||
|
||||
|
@ -21,7 +19,7 @@ class QueueCommand extends MusicCommand {
|
|||
const trackList = [];
|
||||
const firstTrack = tracks.shift();
|
||||
for (const [i, track] of tracks.entries()) {
|
||||
trackList.push(`${i + 1}. ${track.info.author} - **${track.info.title}** (${track.info.isStream ? "∞" : day.duration(track.info.length).format("m:ss", { trim: false })})`);
|
||||
trackList.push(`${i + 1}. ${track.info.author} - **${track.info.title}** (${track.info.isStream ? "∞" : format(track.info.length)})`);
|
||||
}
|
||||
const pageSize = 5;
|
||||
const embeds = [];
|
||||
|
@ -42,7 +40,7 @@ class QueueCommand extends MusicCommand {
|
|||
},
|
||||
"fields": [{
|
||||
"name": "🎶 Now Playing",
|
||||
"value": `${firstTrack.info.author} - **${firstTrack.info.title}** (${firstTrack.info.isStream ? "∞" : day.duration(firstTrack.info.length).format("m:ss", { trim: false })})`
|
||||
"value": `${firstTrack.info.author} - **${firstTrack.info.title}** (${firstTrack.info.isStream ? "∞" : format(firstTrack.info.length)})`
|
||||
}, {
|
||||
"name": "🔁 Looping?",
|
||||
"value": player.loop ? "Yes" : "No"
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue