Merged allowed fonts, added comic sans to font list

This commit is contained in:
Essem 2022-07-26 01:27:02 -05:00
parent 3670a3858e
commit 6a409283af
No known key found for this signature in database
GPG key ID: 7D497397CC3A2A8C
6 changed files with 11 additions and 13 deletions

View file

@ -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=&
############

View file

@ -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;

View file

@ -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;

View file

@ -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("&", "&amp;").replaceAll(">", "&gt;").replaceAll("<", "&lt;").replaceAll("\"", "&quot;").replaceAll("'", "&apos;").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;

View file

@ -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("&", "&amp;").replaceAll(">", "&gt;").replaceAll("<", "&lt;").replaceAll("\"", "&quot;").replaceAll("'", "&apos;").replaceAll("\\n", "\n"),
bottom: bottomText ? (this.options.case ? bottomText : bottomText.toUpperCase()).replaceAll("&", "&amp;").replaceAll(">", "&gt;").replaceAll("<", "&lt;").replaceAll("\"", "&quot;").replaceAll("'", "&apos;").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;

View file

@ -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("&", "&amp;").replaceAll(">", "&gt;").replaceAll("<", "&lt;").replaceAll("\"", "&quot;").replaceAll("'", "&apos;").replaceAll("\\n", "\n"),
bottom: bottomText ? bottomText.replaceAll("&", "&amp;").replaceAll(">", "&gt;").replaceAll("<", "&lt;").replaceAll("\"", "&quot;").replaceAll("'", "&apos;").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;