Make log files rotate, clean up separated text input, add more uncanny images, use a more reliable method to get the instance owner username

This commit is contained in:
Essem 2022-08-03 20:54:07 -05:00
parent b0f4c16d50
commit 4265e3e914
No known key found for this signature in database
GPG key ID: 7D497397CC3A2A8C
22 changed files with 128 additions and 88 deletions

View file

@ -1,11 +1,9 @@
import ImageCommand from "../../classes/imageCommand.js";
class GrayscaleCommand extends ImageCommand {
params() {
return {
color: "grayscale"
};
}
params = {
color: "grayscale"
};
static description = "Adds a grayscale filter";

View file

@ -1,9 +1,18 @@
import ImageCommand from "../../classes/imageCommand.js";
class MemeCommand extends ImageCommand {
async criteria(text, url) {
const [topText, bottomText] = text.replaceAll(url, "").split(/(?<!\\),/).map(elem => elem.trim());
if (topText === "" && bottomText === "") {
return false;
} else {
return true;
}
}
params(url) {
const newArgs = this.options.text ?? this.args.filter(item => !item.includes(url)).join(" ");
const [topText, bottomText] = newArgs.split(/(?<!\\),/).map(elem => elem.trim());
const newArgs = this.options.text ?? this.args.join(" ");
const [topText, bottomText] = newArgs.replaceAll(url, "").split(/(?<!\\),/).map(elem => elem.trim());
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") : "",

View file

@ -1,9 +1,18 @@
import ImageCommand from "../../classes/imageCommand.js";
class MotivateCommand extends ImageCommand {
async criteria(text, url) {
const [topText, bottomText] = text.replaceAll(url, "").split(/(?<!\\),/).map(elem => elem.trim());
if (topText === "" && bottomText === "") {
return false;
} else {
return true;
}
}
params(url) {
const newArgs = this.options.text ?? this.args.filter(item => !item.includes(url)).join(" ");
const [topText, bottomText] = newArgs.split(/(?<!\\),/).map(elem => elem.trim());
const newArgs = this.options.text ?? this.args.join(" ");
const [topText, bottomText] = newArgs.replaceAll(url, "").split(/(?<!\\),/).map(elem => elem.trim());
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") : "",

View file

@ -1,11 +1,9 @@
import ImageCommand from "../../classes/imageCommand.js";
class SepiaCommand extends ImageCommand {
params() {
return {
color: "sepia"
};
}
params = {
color: "sepia"
};
static description = "Adds a sepia filter";

View file

@ -1,11 +1,9 @@
import ImageCommand from "../../classes/imageCommand.js";
class SooSCommand extends ImageCommand {
params() {
return {
soos: true
};
}
params = {
soos: true
};
static description = "\"Loops\" an image sequence by reversing it when it's finished";
static aliases = ["bounce", "boomerang"];

View file

@ -10,9 +10,9 @@ const names = readdirSync(resolve(dirname(fileURLToPath(import.meta.url)), "../.
class UncannyCommand extends ImageCommand {
params(url, name = "unknown") {
const newArgs = this.options.text ?? this.args.filter(item => !item.includes(url)).join(" ");
const newArgs = this.options.text ?? this.args.join(" ");
// eslint-disable-next-line prefer-const
let [text1, text2] = newArgs.split(/(?<!\\),/).map(elem => elem.trim());
let [text1, text2] = newArgs.replaceAll(url, "").split(/(?<!\\),/).map(elem => elem.trim());
if (!text2?.trim()) text2 = name;
return {
caption: text1?.trim() ? text1.replaceAll("&", "&amp;").replaceAll(">", "&gt;").replaceAll("<", "&lt;").replaceAll("\"", "&quot;").replaceAll("'", "&apos;").replaceAll("\\n", "\n") : random(prompts),