Days Since Command

This commit is contained in:
Dragon Fire
2020-09-02 18:29:58 -04:00
parent b439ec09b7
commit 1cc940a290
3 changed files with 45 additions and 2 deletions
+2 -1
View File
@@ -255,7 +255,7 @@ in the appropriate channel's topic to use it.
## Commands
Total: 538
Total: 539
### Utility:
@@ -431,6 +431,7 @@ Total: 538
* **anime-airing:** Responds with a list of the anime that air today.
* **apod:** Responds with today's Astronomy Picture of the Day.
* **calendar:** Responds with today's holidays.
* **days-since:** Responds with how many days there have been since a certain date.
* **days-until:** Responds with how many days there are until a certain date.
* **doomsday-clock:** Responds with the current time of the Doomsday Clock.
* **friday-the-13th:** Determines if today is Friday the 13th.
+42
View File
@@ -0,0 +1,42 @@
const Command = require('../../structures/Command');
const moment = require('moment');
require('moment-duration-format');
module.exports = class DaysSinceCommand extends Command {
constructor(client) {
super(client, {
name: 'days-since',
group: 'events',
memberName: 'days-since',
description: 'Responds with how many days there have been since a certain date.',
args: [
{
key: 'month',
prompt: 'What month would you like to get the days since?',
type: 'month'
},
{
key: 'day',
prompt: 'What day would you like to get the days since?',
type: 'integer',
min: 1,
max: 31
},
{
key: 'year',
prompt: 'What year would you like to get the days since?',
type: 'integer',
min: 1
}
]
});
}
run(msg, { month, day, year }) {
const now = new Date();
const past = new Date(`${month}/${day}/${year}`);
const pastFormat = moment.utc(past).format('dddd, MMMM Do, YYYY');
const time = moment.duration(now - past);
return msg.say(`There have been ${time.format('M [months and] d [days]')} since ${pastFormat}!`);
}
};
+1 -1
View File
@@ -1,6 +1,6 @@
{
"name": "xiao",
"version": "119.21.0",
"version": "119.22.0",
"description": "Your personal server companion.",
"main": "Xiao.js",
"scripts": {