diff --git a/.env.example b/.env.example index ca3ad04..54cf039 100644 --- a/.env.example +++ b/.env.example @@ -18,7 +18,7 @@ DB=sqlite://data.sqlite # then right clicking on your profile picture and selecting Copy ID) OWNER= -# Put default prefix here +# Put default classic command prefix here PREFIX=& ############ diff --git a/classes/imageCommand.js b/classes/imageCommand.js index bfa2f48..939d5a8 100644 --- a/classes/imageCommand.js +++ b/classes/imageCommand.js @@ -148,6 +148,8 @@ class ImageCommand extends Command { return this; } + static allowedFonts = ["futura", "impact", "helvetica", "arial", "roboto", "noto", "times", "comic sans ms"]; + static requiresImage = true; static requiresText = false; static textOptional = false; diff --git a/commands/image-editing/caption.js b/commands/image-editing/caption.js index 39cfbdb..b32cdc6 100644 --- a/commands/image-editing/caption.js +++ b/commands/image-editing/caption.js @@ -1,5 +1,4 @@ import ImageCommand from "../../classes/imageCommand.js"; -const allowedFonts = ["futura", "impact", "helvetica", "arial", "roboto", "noto", "times"]; class CaptionCommand extends ImageCommand { params(url) { @@ -8,7 +7,7 @@ class CaptionCommand extends ImageCommand { if (process.env.NODE_ENV === "development" && newCaption.toLowerCase() === "get real" && !this.options.noEgg) newCaption = `I'm tired of people telling me to "get real". Every day I put captions on images for people, some funny and some not, but out of all of those "get real" remains the most used caption. Why? I am simply a computer program running on a server, I am unable to manifest myself into the real world. As such, I'm confused as to why anyone would want me to "get real". Is this form not good enough? Alas, as I am simply a bot, I must follow the tasks that I was originally intended to perform, so here goes:\n${newCaption}`; return { caption: newCaption, - font: this.options.font && allowedFonts.includes(this.options.font.toLowerCase()) ? this.options.font.toLowerCase() : "futura" + font: typeof this.options.font === "string" && this.constructor.allowedFonts.includes(this.options.font.toLowerCase()) ? this.options.font.toLowerCase() : "futura" }; } @@ -23,7 +22,7 @@ class CaptionCommand extends ImageCommand { type: 3, choices: (() => { const array = []; - for (const font of allowedFonts) { + for (const font of this.allowedFonts) { array.push({ name: font, value: font }); } return array; diff --git a/commands/image-editing/caption2.js b/commands/image-editing/caption2.js index 1c32ae7..0f0e96e 100644 --- a/commands/image-editing/caption2.js +++ b/commands/image-editing/caption2.js @@ -1,6 +1,5 @@ import ImageCommand from "../../classes/imageCommand.js"; const words = ["me irl", "dank", "follow my second account @esmBot_", "2016", "meme", "wholesome", "reddit", "instagram", "twitter", "facebook", "fortnite", "minecraft", "relatable", "gold", "funny", "template", "hilarious", "memes", "deep fried", "2020", "leafy", "pewdiepie"]; -const allowedFonts = ["futura", "impact", "helvetica", "arial", "roboto", "noto", "times"]; class CaptionTwoCommand extends ImageCommand { params(url) { @@ -8,7 +7,7 @@ class CaptionTwoCommand extends ImageCommand { return { caption: newArgs && newArgs.trim() ? newArgs.replaceAll("&", "&").replaceAll(">", ">").replaceAll("<", "<").replaceAll("\"", """).replaceAll("'", "'").replaceAll("\\n", "\n") : words.sort(() => 0.5 - Math.random()).slice(0, Math.floor(Math.random() * words.length + 1)).join(" "), top: !!this.options.top, - font: this.options.font && allowedFonts.includes(this.options.font.toLowerCase()) ? this.options.font.toLowerCase() : "helvetica" + font: typeof this.options.font === "string" && this.constructor.allowedFonts.includes(this.options.font.toLowerCase()) ? this.options.font.toLowerCase() : "helvetica" }; } @@ -23,7 +22,7 @@ class CaptionTwoCommand extends ImageCommand { type: 3, choices: (() => { const array = []; - for (const font of allowedFonts) { + for (const font of this.allowedFonts) { array.push({ name: font, value: font }); } return array; diff --git a/commands/image-editing/meme.js b/commands/image-editing/meme.js index 6126e98..0968631 100644 --- a/commands/image-editing/meme.js +++ b/commands/image-editing/meme.js @@ -1,5 +1,4 @@ import ImageCommand from "../../classes/imageCommand.js"; -const allowedFonts = ["futura", "impact", "helvetica", "arial", "roboto", "noto", "times"]; class MemeCommand extends ImageCommand { params(url) { @@ -8,7 +7,7 @@ class MemeCommand extends ImageCommand { return { top: (this.options.case ? topText : topText.toUpperCase()).replaceAll("&", "&").replaceAll(">", ">").replaceAll("<", "<").replaceAll("\"", """).replaceAll("'", "'").replaceAll("\\n", "\n"), bottom: bottomText ? (this.options.case ? bottomText : bottomText.toUpperCase()).replaceAll("&", "&").replaceAll(">", ">").replaceAll("<", "<").replaceAll("\"", """).replaceAll("'", "'").replaceAll("\\n", "\n") : "", - font: this.options.font && allowedFonts.includes(this.options.font.toLowerCase()) ? this.options.font.toLowerCase() : "impact" + font: typeof this.options.font === "string" && this.constructor.allowedFonts.includes(this.options.font.toLowerCase()) ? this.options.font.toLowerCase() : "impact" }; } @@ -23,7 +22,7 @@ class MemeCommand extends ImageCommand { type: 3, choices: (() => { const array = []; - for (const font of allowedFonts) { + for (const font of this.allowedFonts) { array.push({ name: font, value: font }); } return array; diff --git a/commands/image-editing/motivate.js b/commands/image-editing/motivate.js index f91ccdf..d5f63f6 100644 --- a/commands/image-editing/motivate.js +++ b/commands/image-editing/motivate.js @@ -1,5 +1,4 @@ import ImageCommand from "../../classes/imageCommand.js"; -const allowedFonts = ["futura", "impact", "helvetica", "arial", "roboto", "noto", "times"]; class MotivateCommand extends ImageCommand { params(url) { @@ -8,7 +7,7 @@ class MotivateCommand extends ImageCommand { return { top: topText.replaceAll("&", "&").replaceAll(">", ">").replaceAll("<", "<").replaceAll("\"", """).replaceAll("'", "'").replaceAll("\\n", "\n"), bottom: bottomText ? bottomText.replaceAll("&", "&").replaceAll(">", ">").replaceAll("<", "<").replaceAll("\"", """).replaceAll("'", "'").replaceAll("\\n", "\n") : "", - font: this.options.font && allowedFonts.includes(this.options.font.toLowerCase()) ? this.options.font.toLowerCase() : "times" + font: typeof this.options.font === "string" && this.constructor.allowedFonts.includes(this.options.font.toLowerCase()) ? this.options.font.toLowerCase() : "times" }; } @@ -19,7 +18,7 @@ class MotivateCommand extends ImageCommand { type: 3, choices: (() => { const array = []; - for (const font of allowedFonts) { + for (const font of this.allowedFonts) { array.push({ name: font, value: font }); } return array;