diff --git a/README.md b/README.md index da310e2c..76abc039 100644 --- a/README.md +++ b/README.md @@ -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. diff --git a/commands/events/days-since.js b/commands/events/days-since.js new file mode 100644 index 00000000..03db60df --- /dev/null +++ b/commands/events/days-since.js @@ -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}!`); + } +}; diff --git a/package.json b/package.json index 53377374..7480b2ba 100644 --- a/package.json +++ b/package.json @@ -1,6 +1,6 @@ { "name": "xiao", - "version": "119.21.0", + "version": "119.22.0", "description": "Your personal server companion.", "main": "Xiao.js", "scripts": {