mirror of
https://github.com/arthur-pbty/xiao.git
synced 2026-06-08 07:11:49 +02:00
New duration
This commit is contained in:
@@ -38,7 +38,7 @@ module.exports = class ApplesToApplesCommand extends Command {
|
||||
return msg.say('Game could not be started...');
|
||||
}
|
||||
const players = await this.generatePlayers(awaitedPlayers);
|
||||
let czars = Array.from(players.values());
|
||||
const czars = Array.from(players.values());
|
||||
let winner = null;
|
||||
while (!winner) {
|
||||
const czar = czars[0];
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
const { Command } = require('discord.js-commando');
|
||||
const { MessageEmbed } = require('discord.js');
|
||||
const snekfetch = require('snekfetch');
|
||||
const { shorten, duration } = require('../../util/Util');
|
||||
const { shorten } = require('../../util/Util');
|
||||
|
||||
module.exports = class VocaloidCommand extends Command {
|
||||
constructor(client) {
|
||||
@@ -36,7 +36,6 @@ module.exports = class VocaloidCommand extends Command {
|
||||
});
|
||||
if (!body.items.length) return msg.say('Could not find any results.');
|
||||
const data = body.items[0];
|
||||
const { minutes, seconds } = duration(data.lengthSeconds * 1000);
|
||||
const embed = new MessageEmbed()
|
||||
.setColor(0x86D2D0)
|
||||
.setAuthor('VocaDB', 'https://i.imgur.com/6QwraDT.jpg')
|
||||
@@ -47,9 +46,7 @@ module.exports = class VocaloidCommand extends Command {
|
||||
.addField('❯ Artist',
|
||||
data.artistString)
|
||||
.addField('❯ Publish Date',
|
||||
new Date(data.publishDate).toDateString(), true)
|
||||
.addField('❯ Length',
|
||||
`${minutes}:${seconds}`, true);
|
||||
new Date(data.publishDate).toDateString(), true);
|
||||
return msg.embed(embed);
|
||||
} catch (err) {
|
||||
return msg.reply(`Oh no, an error occurred: \`${err.message}\`. Try again later!`);
|
||||
|
||||
@@ -31,7 +31,7 @@ module.exports = class InfoCommand extends Command {
|
||||
.addField('❯ Memory Usage',
|
||||
`${Math.round(process.memoryUsage().heapUsed / 1024 / 1024)}MB`, true)
|
||||
.addField('❯ Uptime',
|
||||
duration(this.client.uptime).format(), true)
|
||||
duration(this.client.uptime), true)
|
||||
.addField('❯ Version',
|
||||
`v${version}`, true)
|
||||
.addField('❯ Node Version',
|
||||
|
||||
@@ -13,6 +13,6 @@ module.exports = class UptimeCommand extends Command {
|
||||
}
|
||||
|
||||
run(msg) {
|
||||
return msg.say(duration(this.client.uptime).format());
|
||||
return msg.say(duration(this.client.uptime));
|
||||
}
|
||||
};
|
||||
|
||||
+2
-1
@@ -59,7 +59,8 @@
|
||||
"id-length": "off",
|
||||
"no-await-in-loop": "off",
|
||||
"no-console": "off",
|
||||
"no-process-env": "off"
|
||||
"no-process-env": "off",
|
||||
"prefer-const": "error"
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
+4
-9
@@ -32,15 +32,10 @@ class Util {
|
||||
}
|
||||
|
||||
static duration(ms) {
|
||||
const sec = Math.floor((ms / 1000) % 60);
|
||||
const min = Math.floor((ms / (1000 * 60)) % 60);
|
||||
const hrs = Math.floor(ms / (1000 * 60 * 60));
|
||||
return {
|
||||
hours: hrs,
|
||||
minutes: min,
|
||||
seconds: sec,
|
||||
format: () => `${hrs < 10 ? `0${hrs}` : hrs}:${min < 10 ? `0${min}` : min}:${sec < 10 ? `0${sec}` : sec}`
|
||||
};
|
||||
const sec = Math.floor((ms / 1000) % 60).toString();
|
||||
const min = Math.floor((ms / (1000 * 60)) % 60).toString();
|
||||
const hrs = Math.floor(ms / (1000 * 60 * 60)).toString();
|
||||
return `${hrs.padStart(2, '0')}:${min.padStart(2, '0')}:${sec.padStart(2, '0')}`;
|
||||
}
|
||||
|
||||
static randomRange(min, max) {
|
||||
|
||||
Reference in New Issue
Block a user