diff --git a/README.md b/README.md index 089b88cf..18ba2c77 100644 --- a/README.md +++ b/README.md @@ -268,7 +268,7 @@ in the appropriate channel's topic to use it. ## Commands -Total: 561 +Total: 562 ### Utility: @@ -548,6 +548,7 @@ Total: 561 * **has-transparency:** Determines if an image has transparency in it. * **image-size:** Determines the size of an image. * **ocr:** Performs Optical Character Recognition on an image. +* **parse-time:** Analyzes the time duration you provide and gives the result. * **read-qr-code:** Reads a QR Code. * **safe-url:** Determines if a URL is safe or not. * **scrabble-score:** Responds with the scrabble score of a word. diff --git a/commands/analyze/parse-time.js b/commands/analyze/parse-time.js new file mode 100644 index 00000000..dac224ed --- /dev/null +++ b/commands/analyze/parse-time.js @@ -0,0 +1,27 @@ +const Command = require('../../structures/Command'); +const moment = require('moment'); + +module.exports = class ParseTimeCommand extends Command { + constructor(client) { + super(client, { + name: 'parse-time', + aliases: ['analyze-time', 'sherlock'], + group: 'analyze', + memberName: 'parse-time', + description: 'Analyzes the time duration you provide and gives the result.', + args: [ + { + key: 'time', + prompt: 'What do you want me to analyze?', + type: 'sherlock' + } + ] + }); + } + + async run(msg, { time }) { + const timeMs = time.startDate.getTime() - Date.now(); + const display = moment().add(timeMs, 'ms').fromNow(); + return msg.say(`This time duration parses as **${display}**.`); + } +};