Replace all instances of this.specialArgs with this.options, update docs
This commit is contained in:
parent
d469d36a59
commit
df91afee1f
14 changed files with 50 additions and 32 deletions
|
@ -5,10 +5,10 @@ class CaptionCommand extends ImageCommand {
|
|||
params(url) {
|
||||
const newArgs = this.options.text ?? this.args.filter(item => !item.includes(url)).join(" ");
|
||||
let newCaption = newArgs.replaceAll("&", "&").replaceAll(">", ">").replaceAll("<", "<").replaceAll("\"", """).replaceAll("'", "'").replaceAll("\\n", "\n");
|
||||
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}`;
|
||||
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.specialArgs.font && allowedFonts.includes(this.specialArgs.font.toLowerCase()) ? this.specialArgs.font.toLowerCase() : "futura"
|
||||
font: this.options.font && allowedFonts.includes(this.options.font.toLowerCase()) ? this.options.font.toLowerCase() : "futura"
|
||||
};
|
||||
}
|
||||
|
||||
|
|
|
@ -7,8 +7,8 @@ class CaptionTwoCommand extends ImageCommand {
|
|||
const newArgs = this.options.text ?? this.args.filter(item => !item.includes(url)).join(" ");
|
||||
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.specialArgs.top,
|
||||
font: this.specialArgs.font && allowedFonts.includes(this.specialArgs.font.toLowerCase()) ? this.specialArgs.font.toLowerCase() : "helvetica"
|
||||
top: !!this.options.top,
|
||||
font: this.options.font && allowedFonts.includes(this.options.font.toLowerCase()) ? this.options.font.toLowerCase() : "helvetica"
|
||||
};
|
||||
}
|
||||
|
||||
|
|
|
@ -6,9 +6,9 @@ class MemeCommand extends ImageCommand {
|
|||
const newArgs = this.options.text ?? this.args.filter(item => !item.includes(url)).join(" ");
|
||||
const [topText, bottomText] = newArgs.split(/(?<!\\),/).map(elem => elem.trim());
|
||||
return {
|
||||
top: (this.specialArgs.case ? topText : topText.toUpperCase()).replaceAll("&", "&").replaceAll(">", ">").replaceAll("<", "<").replaceAll("\"", """).replaceAll("'", "'").replaceAll("\\n", "\n"),
|
||||
bottom: bottomText ? (this.specialArgs.case ? bottomText : bottomText.toUpperCase()).replaceAll("&", "&").replaceAll(">", ">").replaceAll("<", "<").replaceAll("\"", """).replaceAll("'", "'").replaceAll("\\n", "\n") : "",
|
||||
font: this.specialArgs.font && allowedFonts.includes(this.specialArgs.font.toLowerCase()) ? this.specialArgs.font.toLowerCase() : "impact"
|
||||
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"
|
||||
};
|
||||
}
|
||||
|
||||
|
|
|
@ -8,7 +8,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.specialArgs.font && allowedFonts.includes(this.specialArgs.font.toLowerCase()) ? this.specialArgs.font.toLowerCase() : "times"
|
||||
font: this.options.font && allowedFonts.includes(this.options.font.toLowerCase()) ? this.options.font.toLowerCase() : "times"
|
||||
};
|
||||
}
|
||||
|
||||
|
|
|
@ -3,7 +3,7 @@ import ImageCommand from "../../classes/imageCommand.js";
|
|||
class SnapchatCommand extends ImageCommand {
|
||||
params(url) {
|
||||
const newArgs = this.options.text ?? this.args.filter(item => !item.includes(url)).join(" ");
|
||||
const position = parseFloat(this.specialArgs.position);
|
||||
const position = parseFloat(this.options.position);
|
||||
return {
|
||||
caption: newArgs.replaceAll("&", "&").replaceAll(">", ">").replaceAll("<", "<").replaceAll("\"", """).replaceAll("'", "'").replaceAll("\\n", "\n"),
|
||||
pos: isNaN(position) ? 0.5 : position
|
||||
|
|
|
@ -3,12 +3,12 @@ import ImageCommand from "../../classes/imageCommand.js";
|
|||
class SpeechBubbleCommand extends ImageCommand {
|
||||
params() {
|
||||
return {
|
||||
water: this.specialArgs.alpha ? "assets/images/speech.png" : "assets/images/speechbubble.png",
|
||||
water: this.options.alpha ? "assets/images/speech.png" : "assets/images/speechbubble.png",
|
||||
gravity: "north",
|
||||
resize: true,
|
||||
yscale: 0.2,
|
||||
alpha: this.specialArgs.alpha,
|
||||
flip: this.specialArgs.flip
|
||||
alpha: this.options.alpha,
|
||||
flip: this.options.flip
|
||||
};
|
||||
}
|
||||
|
||||
|
|
|
@ -2,7 +2,7 @@ import ImageCommand from "../../classes/imageCommand.js";
|
|||
|
||||
class UncaptionCommand extends ImageCommand {
|
||||
params() {
|
||||
const tolerance = parseFloat(this.specialArgs.tolerance);
|
||||
const tolerance = parseFloat(this.options.tolerance);
|
||||
return {
|
||||
tolerance: isNaN(tolerance) ? 0.95 : tolerance
|
||||
};
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue