diff --git a/README.md b/README.md index 6ca924b2..7f4d657f 100644 --- a/README.md +++ b/README.md @@ -148,6 +148,7 @@ Xiao has nearly 200 helpful commands to power up your Discord server! - `bulbapedia` Searches Bulbapedia for your query. - `define` Defines a word. - `discrim` Searches for other users with a certain discriminator. +- `flickr` Searches Flickr for your query. - `giphy` Searches Giphy for your query. - `github` Searches GitHub for information on a repository. - `itunes` Searches iTunes for your query. diff --git a/commands/random/days-until.js b/commands/random/days-until.js new file mode 100644 index 00000000..aad6d1e3 --- /dev/null +++ b/commands/random/days-until.js @@ -0,0 +1,33 @@ +const Command = require('../../structures/Command'); + +module.exports = class DaysUntilCommand extends Command { + constructor(client) { + super(client, { + name: 'days-until', + aliases: ['days-until-christmas'], + group: 'random', + memberName: 'days-until', + description: 'Get how many days until a certain date this year.', + args: [ + { + key: 'date', + prompt: 'What date do you want events for? Month/Day format.', + type: 'string', + default: ['12', '25'], + parse: date => date.split('/') + } + ] + }); + } + + run(msg, { date }) { + const month = parseInt(date[0], 10); + const day = parseInt(date[1], 10); + const now = new Date(); + let year = now.getMonth() + 1 <= month ? now.getFullYear() : now.getFullYear() + 1; + if (month === now.getMonth() + 1 && now.getDate() >= day) ++year; + const future = new Date(`${month}/${day}/${year}`); + const time = Math.round((future - now) / (1000 * 60 * 60 * 24)) + 1; + return msg.say(`There are ${time || 'N/A'} days until ${future.toDateString()}!`); + } +}; diff --git a/package.json b/package.json index d39e1e77..ddb04442 100644 --- a/package.json +++ b/package.json @@ -1,6 +1,6 @@ { "name": "xiaobot", - "version": "41.3.0", + "version": "41.4.0", "description": "Your personal server companion.", "main": "Shard.js", "scripts": {