Fix !jumbo crash when passing an invalid emoji
This commit is contained in:
parent
e0844c3300
commit
5ab6c6a72b
1 changed files with 7 additions and 1 deletions
|
@ -1,9 +1,10 @@
|
||||||
import { utilityCmd } from "../types";
|
import { utilityCmd } from "../types";
|
||||||
import { commandTypeHelpers as ct } from "../../../commandTypes";
|
import { commandTypeHelpers as ct } from "../../../commandTypes";
|
||||||
import { downloadFile, SECONDS } from "../../../utils";
|
import { downloadFile, isEmoji, SECONDS } from "../../../utils";
|
||||||
import fs from "fs";
|
import fs from "fs";
|
||||||
import sharp from "sharp";
|
import sharp from "sharp";
|
||||||
import twemoji from "twemoji";
|
import twemoji from "twemoji";
|
||||||
|
import { sendErrorMessage } from "../../../pluginUtils";
|
||||||
|
|
||||||
const fsp = fs.promises;
|
const fsp = fs.promises;
|
||||||
|
|
||||||
|
@ -41,6 +42,11 @@ export const JumboCmd = utilityCmd({
|
||||||
let extention = ".png";
|
let extention = ".png";
|
||||||
let file;
|
let file;
|
||||||
|
|
||||||
|
if (!isEmoji(args.emoji)) {
|
||||||
|
sendErrorMessage(pluginData, msg.channel, "Invalid emoji");
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
if (results) {
|
if (results) {
|
||||||
let url = "https://cdn.discordapp.com/emojis/";
|
let url = "https://cdn.discordapp.com/emojis/";
|
||||||
if (results[1] === "<a:") {
|
if (results[1] === "<a:") {
|
||||||
|
|
Loading…
Add table
Reference in a new issue