Compare commits

..

2 commits

Author SHA1 Message Date
murm
c11fa40dfc update tip 2023-03-16 20:40:15 -04:00
murm
972e1a5bab fix image detection to not accept ANY mimetype 2023-03-16 20:39:10 -04:00
2 changed files with 5 additions and 2 deletions

View file

@ -40,7 +40,7 @@ class ImageCommand extends Command {
if (selection) selectedImages.delete(this.author); if (selection) selectedImages.delete(this.author);
if (image === undefined) { if (image === undefined) {
runningCommands.delete(this.author); runningCommands.delete(this.author);
return `${this.constructor.noImage} (Tip: try right-clicking/holding on a message and press Apps -> Select Image, then try again.)`; return `${this.constructor.noImage} (Tip: try running your command while replying to an image (or link to an image))`;
} else if (image.type === "large") { } else if (image.type === "large") {
runningCommands.delete(this.author); runningCommands.delete(this.author);
return "That image is too large (>= 25MB)! Try using a smaller image."; return "That image is too large (>= 25MB)! Try using a smaller image.";

View file

@ -142,7 +142,10 @@ const checkImages = async (message, extraReturnTypes, video, sticker) => {
url = url.replace(/.*\n\n/g, "") url = url.replace(/.*\n\n/g, "")
if (isValidUrl(url)){ if (isValidUrl(url)){
const mimetype = await getType(url, extraReturnTypes) const mimetype = await getType(url, extraReturnTypes)
type = {name: "image", path: url, url: url, type: mimetype} // console.log(mimetype)
if (mimetype && imageFormats.includes(mimetype)) {
type = {name: "image", path: url, url: url, type: mimetype}
}
} }
} }