mirror of
https://github.com/arthur-pbty/xiao.git
synced 2026-06-03 15:07:42 +02:00
Increase file size limit to 25MB
This commit is contained in:
+4
-4
@@ -11,17 +11,17 @@ module.exports = class ImageArgument extends Argument {
|
||||
async validate(value, msg) {
|
||||
const attachment = msg.attachments.first();
|
||||
if (attachment) {
|
||||
if (attachment.size > 8e+6) return false;
|
||||
if (!fileTypeRe.test(attachment.name)) return false;
|
||||
if (attachment.size > 8e+6) return 'Image size is above 8 MB.';
|
||||
if (!fileTypeRe.test(attachment.name)) return 'Provided attachment is not an image.';
|
||||
return true;
|
||||
}
|
||||
if (fileTypeRe.test(value.toLowerCase())) {
|
||||
if (!validURL.isWebUri(value)) return false;
|
||||
if (!validURL.isWebUri(value)) return 'Provided URL is not valid.';
|
||||
try {
|
||||
await request.get(value);
|
||||
return true;
|
||||
} catch {
|
||||
return false;
|
||||
return 'Provided URL is not valid.';
|
||||
}
|
||||
}
|
||||
return false;
|
||||
|
||||
Reference in New Issue
Block a user