mirror of
https://github.com/arthur-pbty/xiao.git
synced 2026-06-08 23:32:12 +02:00
Days Since Command
This commit is contained in:
@@ -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.
|
||||
|
||||
@@ -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
@@ -1,6 +1,6 @@
|
||||
{
|
||||
"name": "xiao",
|
||||
"version": "119.21.0",
|
||||
"version": "119.22.0",
|
||||
"description": "Your personal server companion.",
|
||||
"main": "Xiao.js",
|
||||
"scripts": {
|
||||
|
||||
Reference in New Issue
Block a user