mirror of
https://github.com/arthur-pbty/xiao.git
synced 2026-06-03 15:07:42 +02:00
URL type
This commit is contained in:
@@ -0,0 +1,17 @@
|
||||
const { ArgumentType } = require('discord.js-commando');
|
||||
const { URL } = require('url');
|
||||
const validURL = require('valid-url');
|
||||
|
||||
module.exports = class UrlType extends ArgumentType {
|
||||
constructor(client) {
|
||||
super(client, 'url');
|
||||
}
|
||||
|
||||
validate(value) {
|
||||
return Boolean(validURL.isWebUri(value));
|
||||
}
|
||||
|
||||
async parse(value) {
|
||||
return new URL(value);
|
||||
}
|
||||
};
|
||||
Reference in New Issue
Block a user