Parse Time Command

This commit is contained in:
Dragon Fire
2020-11-24 17:14:21 -05:00
parent 103a66b2e0
commit 2bc6c46678
2 changed files with 29 additions and 1 deletions
+2 -1
View File
@@ -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.
+27
View File
@@ -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}**.`);
}
};