Fix reddit slash command text input, make filename detection split on last period

This commit is contained in:
Essem 2022-07-30 20:21:06 -05:00
parent f3eea0d96a
commit b0f4c16d50
No known key found for this signature in database
GPG Key ID: 7D497397CC3A2A8C
4 changed files with 8 additions and 3 deletions

Binary file not shown.

Before

Width:  |  Height:  |  Size: 102 KiB

After

Width:  |  Height:  |  Size: 102 KiB

View File

@ -10,6 +10,8 @@ class RedditCommand extends ImageCommand {
};
}
static textOptional = true;
static description = "Adds a Reddit watermark to an image";
static arguments = ["{text}"];

View File

@ -17,7 +17,7 @@ class UncannyCommand extends ImageCommand {
return {
caption: text1?.trim() ? text1.replaceAll("&", "&amp;").replaceAll(">", "&gt;").replaceAll("<", "&lt;").replaceAll("\"", "&quot;").replaceAll("'", "&apos;").replaceAll("\\n", "\n") : random(prompts),
caption2: text2.replaceAll("&", "&amp;").replaceAll(">", "&gt;").replaceAll("<", "&lt;").replaceAll("\"", "&quot;").replaceAll("'", "&apos;").replaceAll("\\n", "\n"),
path: `./assets/images/uncanny/${typeof this.options.phase === "string" && names.includes(this.options.phase.toLowerCase()) ? this.options.phase.toLowerCase() : random(names)}.png`,
path: `./assets/images/uncanny/${typeof this.options.phase === "string" && names.includes(this.options.phase.toLowerCase()) ? this.options.phase.toLowerCase() : random(names.filter((val) => val !== "goated"))}.png`,
font: typeof this.options.font === "string" && this.constructor.allowedFonts.includes(this.options.font.toLowerCase()) ? this.options.font.toLowerCase() : "helvetica"
};
}
@ -50,6 +50,8 @@ class UncannyCommand extends ImageCommand {
return this;
}
static textOptional = true;
static description = "Makes a Mr. Incredible Becomes Uncanny image (separate left/right text with a comma)";
static aliases = ["canny", "incredible", "pain"];
static arguments = ["{left text}", "{right text}"];

View File

@ -39,11 +39,12 @@ const videoFormats = ["video/mp4", "video/webm", "video/mov"];
const getImage = async (image, image2, video, extraReturnTypes, gifv = false, type = null, link = false) => {
try {
const fileNameSplit = new URL(image).pathname.split("/");
const fileName = fileNameSplit[fileNameSplit.length - 1].split(".")[0];
const fileName = fileNameSplit[fileNameSplit.length - 1];
const fileNameNoExtension = fileName.slice(0, fileName.lastIndexOf("."));
const payload = {
url: image2,
path: image,
name: fileName
name: fileNameNoExtension
};
const host = new URL(image2).host;
if (gifv || (link && combined.includes(host))) {