From 5ab6c6a72be49d2aad8c72a2c1f03c69a4458f71 Mon Sep 17 00:00:00 2001 From: Dragory <2606411+Dragory@users.noreply.github.com> Date: Thu, 30 Jul 2020 17:16:44 +0300 Subject: [PATCH] Fix !jumbo crash when passing an invalid emoji --- backend/src/plugins/Utility/commands/JumboCmd.ts | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) diff --git a/backend/src/plugins/Utility/commands/JumboCmd.ts b/backend/src/plugins/Utility/commands/JumboCmd.ts index d8596139..d31e2dcb 100644 --- a/backend/src/plugins/Utility/commands/JumboCmd.ts +++ b/backend/src/plugins/Utility/commands/JumboCmd.ts @@ -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] === "