Use Sherlock to parse times

This commit is contained in:
Dragon Fire
2020-11-13 16:52:12 -05:00
parent f9aea25916
commit d56bc13649
3 changed files with 26 additions and 6 deletions
+18
View File
@@ -0,0 +1,18 @@
const { ArgumentType } = require('discord.js-commando');
const sherlock = require('sherlockjs');
module.exports = class SherlockType extends ArgumentType {
constructor(client) {
super(client, 'sherlock');
}
validate(value) {
const time = sherlock.parse(value);
if (!time.startDate) return `Please provide a valid starting time.`;
return true;
}
parse(value) {
return sherlock.parse(value);
}
};