Added font flag to caption

This commit is contained in:
Essem 2021-08-06 22:27:50 -05:00
parent f7923c19cb
commit e44f5ba59d
No known key found for this signature in database
GPG key ID: 7D497397CC3A2A8C
3 changed files with 11 additions and 4 deletions

View file

@ -1,4 +1,5 @@
const ImageCommand = require("../../classes/imageCommand.js");
const allowedFonts = ["futura", "impact", "helvetica", "arial", "roboto", "noto"];
class CaptionCommand extends ImageCommand {
params(url) {
@ -6,7 +7,8 @@ class CaptionCommand extends ImageCommand {
let newCaption = newArgs.join(" ").replaceAll("&", "\\&amp;").replaceAll(">", "\\&gt;").replaceAll("<", "\\&lt;").replaceAll("\"", "\\&quot;").replaceAll("'", "\\&apos;").replaceAll("%", "\\%");
if (process.env.NODE_ENV === "development" && newCaption.toLowerCase() === "get real" && !this.specialArgs.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
caption: newCaption,
font: this.specialArgs.font && allowedFonts.includes(this.specialArgs.font.toLowerCase()) ? this.specialArgs.font.toLowerCase() : "futura"
};
}
@ -16,6 +18,10 @@ class CaptionCommand extends ImageCommand {
static flags = [{
name: "noEgg",
description: "Disable... something. Not saying what it is though."
}, {
name: "font",
type: allowedFonts.join("|"),
description: "Specify the font you want to use (default: `futura`)"
}];
static requiresText = true;