Allow bmp and jfif images

This commit is contained in:
Dragon Fire
2020-06-15 16:05:01 -04:00
parent 032271e538
commit 8e9f7a49f9
2 changed files with 3 additions and 3 deletions
+1 -1
View File
@@ -1,6 +1,6 @@
{ {
"name": "xiao", "name": "xiao",
"version": "116.29.0", "version": "116.29.1",
"description": "Your personal server companion.", "description": "Your personal server companion.",
"main": "Xiao.js", "main": "Xiao.js",
"scripts": { "scripts": {
+2 -2
View File
@@ -1,5 +1,5 @@
const { ArgumentType } = require('discord.js-commando'); const { ArgumentType } = require('discord.js-commando');
const fileTypeRe = /\.(jpe?g|png|gif)$/i; const fileTypeRe = /\.(jpe?g|png|gif|jfif|bmp)$/i;
const request = require('node-superfetch'); const request = require('node-superfetch');
module.exports = class ImageArgumentType extends ArgumentType { module.exports = class ImageArgumentType extends ArgumentType {
@@ -12,7 +12,7 @@ module.exports = class ImageArgumentType extends ArgumentType {
if (attachment) { if (attachment) {
if (!attachment.height || !attachment.width) return false; if (!attachment.height || !attachment.width) return false;
if (attachment.size > 8e+6) return 'Please provide an image under 8 MB.'; if (attachment.size > 8e+6) return 'Please provide an image under 8 MB.';
if (!fileTypeRe.test(attachment.name)) return 'Please only send PNG, JPG, or GIF format images.'; if (!fileTypeRe.test(attachment.name)) return 'Please only send PNG, JPG, BMP, or GIF format images.';
return true; return true;
} }
if (fileTypeRe.test(value.toLowerCase())) { if (fileTypeRe.test(value.toLowerCase())) {