Fix !jumbo crash when passing an invalid emoji

This commit is contained in:
Dragory 2020-07-30 17:16:44 +03:00
parent e0844c3300
commit 5ab6c6a72b
No known key found for this signature in database
GPG key ID: 5F387BA66DF8AAC1

View file

@ -1,9 +1,10 @@
import { utilityCmd } from "../types";
import { commandTypeHelpers as ct } from "../../../commandTypes";
import { downloadFile, SECONDS } from "../../../utils";
import { downloadFile, isEmoji, SECONDS } from "../../../utils";
import fs from "fs";
import sharp from "sharp";
import twemoji from "twemoji";
import { sendErrorMessage } from "../../../pluginUtils";
const fsp = fs.promises;
@ -41,6 +42,11 @@ export const JumboCmd = utilityCmd({
let extention = ".png";
let file;
if (!isEmoji(args.emoji)) {
sendErrorMessage(pluginData, msg.channel, "Invalid emoji");
return;
}
if (results) {
let url = "https://cdn.discordapp.com/emojis/";
if (results[1] === "<a:") {