More slash command work
This commit is contained in:
parent
77913618d6
commit
c821d91254
26 changed files with 188 additions and 62 deletions
|
@ -7,16 +7,17 @@ class FlagCommand extends ImageCommand {
|
|||
flagPath = "";
|
||||
|
||||
async criteria() {
|
||||
if (!this.args[0].match(emojiRegex)) return false;
|
||||
const flag = emoji.unemojify(this.args[0]).replaceAll(":", "").replace("flag-", "");
|
||||
const text = this.type === "classic" ? this.args[0] : this.options.text;
|
||||
if (!text.match(emojiRegex)) return false;
|
||||
const flag = emoji.unemojify(text).replaceAll(":", "").replace("flag-", "");
|
||||
let path = `./assets/images/region-flags/png/${flag.toUpperCase()}.png`;
|
||||
if (flag === "pirate_flag") path = "./assets/images/pirateflag.png";
|
||||
if (flag === "rainbow-flag") path = "./assets/images/rainbowflag.png";
|
||||
if (flag === "checkered_flag") path = "./assets/images/checkeredflag.png";
|
||||
if (flag === "transgender_flag") path = "./assets/images/transflag.png";
|
||||
if (this.args[0] === "🏴") path = "./assets/images/region-flags/png/GB-SCT.png";
|
||||
if (this.args[0] === "🏴") path = "./assets/images/region-flags/png/GB-WLS.png";
|
||||
if (this.args[0] === "🏴") path = "./assets/images/region-flags/png/GB-ENG.png";
|
||||
if (text === "🏴") path = "./assets/images/region-flags/png/GB-SCT.png";
|
||||
if (text === "🏴") path = "./assets/images/region-flags/png/GB-WLS.png";
|
||||
if (text === "🏴") path = "./assets/images/region-flags/png/GB-ENG.png";
|
||||
try {
|
||||
await fs.promises.access(path);
|
||||
this.flagPath = path;
|
||||
|
|
|
@ -1,8 +1,18 @@
|
|||
import ImageCommand from "../../classes/imageCommand.js";
|
||||
|
||||
class FreezeCommand extends ImageCommand {
|
||||
constructor(client, cluster, worker, ipc, options) {
|
||||
super(client, cluster, worker, ipc, options);
|
||||
this.flags.push({
|
||||
name: "endframe",
|
||||
type: 4,
|
||||
description: "Set the end frame (default: last frame)",
|
||||
min_value: 0
|
||||
});
|
||||
}
|
||||
|
||||
params() {
|
||||
const frameCount = parseInt(this.args[0]);
|
||||
const frameCount = parseInt(this.type === "classic" ? this.args[0] : this.options.endframe);
|
||||
return {
|
||||
loop: false,
|
||||
frame: isNaN(frameCount) ? -1 : frameCount
|
||||
|
|
|
@ -1,8 +1,19 @@
|
|||
import ImageCommand from "../../classes/imageCommand.js";
|
||||
|
||||
class JPEGCommand extends ImageCommand {
|
||||
constructor(client, cluster, worker, ipc, options) {
|
||||
super(client, cluster, worker, ipc, options);
|
||||
this.flags.push({
|
||||
name: "quality",
|
||||
type: 4,
|
||||
description: "Set the JPEG quality (default: 1)",
|
||||
min_value: 1,
|
||||
max_value: 100
|
||||
});
|
||||
}
|
||||
|
||||
params() {
|
||||
const quality = parseInt(this.args[0]);
|
||||
const quality = parseInt(this.type === "classic" ? this.args[0] : this.options.quality);
|
||||
return {
|
||||
quality: isNaN(quality) ? 1 : Math.max(1, Math.min(quality, 100))
|
||||
};
|
||||
|
|
|
@ -19,8 +19,8 @@ class MotivateCommand extends ImageCommand {
|
|||
}
|
||||
|
||||
params(url) {
|
||||
const newArgs = this.args.filter(item => !item.includes(url));
|
||||
const [topText, bottomText] = newArgs.join(" ").split(/(?<!\\),/).map(elem => elem.trim());
|
||||
const newArgs = this.type === "classic" ? this.args.filter(item => !item.includes(url)).join(" ") : this.options.text;
|
||||
const [topText, bottomText] = newArgs.split(/(?<!\\),/).map(elem => elem.trim());
|
||||
return {
|
||||
top: topText.replaceAll("&", "\\&").replaceAll(">", "\\>").replaceAll("<", "\\<").replaceAll("\"", "\\"").replaceAll("'", "\\'").replaceAll("%", "\\%"),
|
||||
bottom: bottomText ? bottomText.replaceAll("&", "\\&").replaceAll(">", "\\>").replaceAll("<", "\\<").replaceAll("\"", "\\"").replaceAll("'", "\\'").replaceAll("%", "\\%") : "",
|
||||
|
|
|
@ -3,9 +3,10 @@ import { random } from "../../utils/misc.js";
|
|||
const names = ["esmBot", "me_irl", "dankmemes", "hmmm", "gaming", "wholesome", "chonkers", "memes", "funny", "pcmasterrace", "thomastheplankengine"];
|
||||
|
||||
class RedditCommand extends ImageCommand {
|
||||
params() {
|
||||
params(url) {
|
||||
const newArgs = this.type === "classic" ? this.args.filter(item => !item.includes(url)).join(" ") : this.options.text;
|
||||
return {
|
||||
caption: this.args.length === 0 ? random(names) : this.args.join(" ").replaceAll("\n", "").replaceAll(" ", "")
|
||||
caption: newArgs && newArgs.trim() ? newArgs.replaceAll("\n", "").replaceAll(" ", "") : random(names)
|
||||
};
|
||||
}
|
||||
|
||||
|
|
|
@ -1,8 +1,18 @@
|
|||
import ImageCommand from "../../classes/imageCommand.js";
|
||||
|
||||
class SlowCommand extends ImageCommand {
|
||||
constructor(client, cluster, worker, ipc, options) {
|
||||
super(client, cluster, worker, ipc, options);
|
||||
this.flags.push({
|
||||
name: "multiplier",
|
||||
type: 4,
|
||||
description: "Set the speed multiplier (default: 2)",
|
||||
min_value: 1
|
||||
});
|
||||
}
|
||||
|
||||
params() {
|
||||
const speed = parseInt(this.args[0]);
|
||||
const speed = parseInt(this.type === "classic" ? this.args[0] : this.options.multiplier);
|
||||
return {
|
||||
slow: true,
|
||||
speed: isNaN(speed) ? 2 : speed
|
||||
|
|
|
@ -13,10 +13,10 @@ class SnapchatCommand extends ImageCommand {
|
|||
}
|
||||
|
||||
params(url) {
|
||||
const newArgs = this.args.filter(item => !item.includes(url));
|
||||
const newArgs = this.type === "classic" ? this.args.filter(item => !item.includes(url)).join(" ") : this.options.text;
|
||||
const position = parseFloat(this.specialArgs.position);
|
||||
return {
|
||||
caption: newArgs.join(" ").replaceAll("&", "\\&").replaceAll(">", "\\>").replaceAll("<", "\\<").replaceAll("\"", "\\"").replaceAll("'", "\\'").replaceAll("%", "\\%"),
|
||||
caption: newArgs.replaceAll("&", "\\&").replaceAll(">", "\\>").replaceAll("<", "\\<").replaceAll("\"", "\\"").replaceAll("'", "\\'").replaceAll("%", "\\%"),
|
||||
pos: isNaN(position) ? 0.5 : position
|
||||
};
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue