mirror of
https://github.com/arthur-pbty/xiao.git
synced 2026-06-10 19:04:42 +02:00
Make parse-time look nicer
This commit is contained in:
@@ -1,5 +1,6 @@
|
||||
const Command = require('../../structures/Command');
|
||||
const moment = require('moment');
|
||||
require('moment-duration-format');
|
||||
|
||||
module.exports = class ParseTimeCommand extends Command {
|
||||
constructor(client) {
|
||||
@@ -20,8 +21,8 @@ module.exports = class ParseTimeCommand extends Command {
|
||||
}
|
||||
|
||||
run(msg, { time }) {
|
||||
const timeMs = time.startDate.getTime() - Date.now();
|
||||
const display = moment().add(timeMs, 'ms').fromNow();
|
||||
const time = moment.duration(Date.now() - time.startDate.getTime());
|
||||
const display = time.format('Y [years,] M [months,] d [days,] h [hours,] m [minutes and] s [seconds]');
|
||||
return msg.say(`This time duration parses as **${display}**.`);
|
||||
}
|
||||
};
|
||||
|
||||
+1
-1
@@ -1,6 +1,6 @@
|
||||
{
|
||||
"name": "xiao",
|
||||
"version": "121.2.0",
|
||||
"version": "121.2.1",
|
||||
"description": "Your personal server companion.",
|
||||
"main": "Xiao.js",
|
||||
"scripts": {
|
||||
|
||||
Reference in New Issue
Block a user