Added more command flags, start documenting command flags, removed args argument from params function
This commit is contained in:
parent
e414d31b52
commit
d03967212e
24 changed files with 240 additions and 205 deletions
|
@ -1,9 +1,9 @@
|
|||
const ImageCommand = require("../../classes/imageCommand.js");
|
||||
|
||||
class HomebrewCommand extends ImageCommand {
|
||||
params(args) {
|
||||
params() {
|
||||
return {
|
||||
caption: args.join(" ").toLowerCase().replaceAll("\n", " ")
|
||||
caption: this.args.join(" ").toLowerCase().replaceAll("\n", " ")
|
||||
};
|
||||
}
|
||||
|
||||
|
|
|
@ -2,8 +2,8 @@ const wrap = require("../../utils/wrap.js");
|
|||
const ImageCommand = require("../../classes/imageCommand.js");
|
||||
|
||||
class RetroCommand extends ImageCommand {
|
||||
params(args) {
|
||||
let [line1, line2, line3] = args.join(" ").replaceAll("&", "\\&").replaceAll(">", "\\>").replaceAll("<", "\\<").replaceAll("\"", "\\"").replaceAll("'", "\\'").replaceAll("%", "\\%").split(",").map(elem => elem.trim());
|
||||
params() {
|
||||
let [line1, line2, line3] = this.args.join(" ").replaceAll("&", "\\&").replaceAll(">", "\\>").replaceAll("<", "\\<").replaceAll("\"", "\\"").replaceAll("'", "\\'").replaceAll("%", "\\%").split(",").map(elem => elem.trim());
|
||||
if (!line2 && line1.length > 15) {
|
||||
const [split1, split2, split3] = wrap(line1, { width: 15, indent: "" }).split("\n");
|
||||
line1 = split1;
|
||||
|
|
|
@ -2,8 +2,8 @@ const wrap = require("../../utils/wrap.js");
|
|||
const ImageCommand = require("../../classes/imageCommand.js");
|
||||
|
||||
class SonicCommand extends ImageCommand {
|
||||
params(args) {
|
||||
const cleanedMessage = args.join(" ").replaceAll("&", "\\&").replaceAll(">", "\\>").replaceAll("<", "\\<").replaceAll("\"", "\\"").replaceAll("'", "\\'").replaceAll("%", "\\%");
|
||||
params() {
|
||||
const cleanedMessage = this.args.join(" ").replaceAll("&", "\\&").replaceAll(">", "\\>").replaceAll("<", "\\<").replaceAll("\"", "\\"").replaceAll("'", "\\'").replaceAll("%", "\\%");
|
||||
return {
|
||||
text: wrap(cleanedMessage, {width: 15, indent: ""})
|
||||
};
|
||||
|
|
|
@ -1,14 +1,17 @@
|
|||
const ImageCommand = require("../../classes/imageCommand.js");
|
||||
|
||||
class BlurpleCommand extends ImageCommand {
|
||||
params(args) {
|
||||
params() {
|
||||
return {
|
||||
old: args.length !== 0 && args[0].toLowerCase() === "old" ? true : false
|
||||
old: !!this.specialArgs.old
|
||||
};
|
||||
}
|
||||
|
||||
static description = "Turns an image blurple";
|
||||
static arguments = ["{old}"];
|
||||
static flags = [{
|
||||
name: "old",
|
||||
description: "Use the old blurple color"
|
||||
}];
|
||||
|
||||
static noImage = "You need to provide an image to make blurple!";
|
||||
static command = "blurple";
|
||||
|
|
|
@ -1,8 +1,8 @@
|
|||
const ImageCommand = require("../../classes/imageCommand.js");
|
||||
|
||||
class CaptionCommand extends ImageCommand {
|
||||
params(args, url) {
|
||||
const newArgs = args.filter(item => !item.includes(url));
|
||||
params(url) {
|
||||
const newArgs = this.args.filter(item => !item.includes(url));
|
||||
let newCaption = newArgs.join(" ").replaceAll("&", "\\&").replaceAll(">", "\\>").replaceAll("<", "\\<").replaceAll("\"", "\\"").replaceAll("'", "\\'").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 {
|
||||
|
|
|
@ -2,16 +2,21 @@ const ImageCommand = require("../../classes/imageCommand.js");
|
|||
const words = ["me irl", "dank", "follow my second account @esmBot_", "2016", "meme", "wholesome", "reddit", "instagram", "twitter", "facebook", "fortnite", "minecraft", "relatable", "gold", "funny", "template", "hilarious", "memes", "deep fried", "2020", "leafy", "pewdiepie"];
|
||||
|
||||
class CaptionTwoCommand extends ImageCommand {
|
||||
params(args, url) {
|
||||
const newArgs = args.filter(item => !item.includes(url));
|
||||
params(url) {
|
||||
const newArgs = this.args.filter(item => !item.includes(url));
|
||||
return {
|
||||
caption: newArgs.length !== 0 ? newArgs.join(" ").replaceAll("&", "\\&").replaceAll(">", "\\>").replaceAll("<", "\\<").replaceAll("\"", "\\"").replaceAll("'", "\\'").replaceAll("%", "\\%") : words.sort(() => 0.5 - Math.random()).slice(0, Math.floor(Math.random() * words.length + 1)).join(" ")
|
||||
caption: newArgs.length !== 0 ? newArgs.join(" ").replaceAll("&", "\\&").replaceAll(">", "\\>").replaceAll("<", "\\<").replaceAll("\"", "\\"").replaceAll("'", "\\'").replaceAll("%", "\\%") : words.sort(() => 0.5 - Math.random()).slice(0, Math.floor(Math.random() * words.length + 1)).join(" "),
|
||||
top: !!this.specialArgs.top
|
||||
};
|
||||
}
|
||||
|
||||
static description = "Adds a me.me caption/tag list to an image/GIF";
|
||||
static aliases = ["tags2", "meirl", "memecaption", "medotmecaption"];
|
||||
static arguments = ["{text}"];
|
||||
static flags = [{
|
||||
name: "top",
|
||||
description: "Put the caption on the top of an image/GIF instead of the bottom"
|
||||
}];
|
||||
|
||||
static noText = "You need to provide some text to add a caption!";
|
||||
static noImage = "You need to provide an image to add a caption!";
|
||||
|
|
|
@ -6,9 +6,9 @@ const ImageCommand = require("../../classes/imageCommand.js");
|
|||
class FlagCommand extends ImageCommand {
|
||||
flagPath = "";
|
||||
|
||||
async criteria(args) {
|
||||
if (!args[0].match(emojiRegex)) return false;
|
||||
const flag = emoji.unemojify(args[0]).replaceAll(":", "").replace("flag-", "");
|
||||
async criteria() {
|
||||
if (!this.args[0].match(emojiRegex)) return false;
|
||||
const flag = emoji.unemojify(this.args[0]).replaceAll(":", "").replace("flag-", "");
|
||||
let path = `./assets/images/region-flags/png/${flag.toUpperCase()}.png`;
|
||||
if (flag === "🏴☠️") path = "./assets/images/pirateflag.png";
|
||||
if (flag === "rainbow-flag") path = "./assets/images/rainbowflag.png";
|
||||
|
|
|
@ -1,8 +1,8 @@
|
|||
const ImageCommand = require("../../classes/imageCommand.js");
|
||||
|
||||
class FreezeCommand extends ImageCommand {
|
||||
params(args) {
|
||||
const frameCount = parseInt(args[0]);
|
||||
params() {
|
||||
const frameCount = parseInt(this.args[0]);
|
||||
return {
|
||||
loop: false,
|
||||
frame: isNaN(frameCount) ? -1 : frameCount
|
||||
|
|
|
@ -1,8 +1,8 @@
|
|||
const ImageCommand = require("../../classes/imageCommand.js");
|
||||
|
||||
class MemeCommand extends ImageCommand {
|
||||
params(args, url) {
|
||||
const newArgs = args.filter(item => !item.includes(url));
|
||||
params(url) {
|
||||
const newArgs = this.args.filter(item => !item.includes(url));
|
||||
const [topText, bottomText] = newArgs.join(" ").split(/(?<!\\),/).map(elem => elem.trim());
|
||||
return {
|
||||
top: topText.toUpperCase().replaceAll("&", "\\&").replaceAll(">", "\\>").replaceAll("<", "\\<").replaceAll("\"", "\\"").replaceAll("'", "\\'").replaceAll("%", "\\%"),
|
||||
|
|
|
@ -1,8 +1,8 @@
|
|||
const ImageCommand = require("../../classes/imageCommand.js");
|
||||
|
||||
class MotivateCommand extends ImageCommand {
|
||||
params(args, url) {
|
||||
const newArgs = args.filter(item => !item.includes(url));
|
||||
params(url) {
|
||||
const newArgs = this.args.filter(item => !item.includes(url));
|
||||
const [topText, bottomText] = newArgs.join(" ").split(/(?<!\\),/).map(elem => elem.trim());
|
||||
return {
|
||||
top: topText.replaceAll("&", "\\&").replaceAll(">", "\\>").replaceAll("<", "\\<").replaceAll("\"", "\\"").replaceAll("'", "\\'").replaceAll("%", "\\%"),
|
||||
|
|
|
@ -3,9 +3,9 @@ const { random } = require("../../utils/misc.js");
|
|||
const names = ["esmBot", "me_irl", "dankmemes", "hmmm", "gaming", "wholesome", "chonkers", "memes", "funny", "pcmasterrace", "bellybros"];
|
||||
|
||||
class RedditCommand extends ImageCommand {
|
||||
params(args) {
|
||||
params() {
|
||||
return {
|
||||
caption: args.length === 0 ? random(names) : args.join(" ").replaceAll("\n", "").replaceAll(" ", "")
|
||||
caption: this.args.length === 0 ? random(names) : this.args.join(" ").replaceAll("\n", "").replaceAll(" ", "")
|
||||
};
|
||||
}
|
||||
|
||||
|
|
|
@ -1,7 +1,7 @@
|
|||
const ImageCommand = require("../../classes/imageCommand.js");
|
||||
|
||||
class ReverseCommand extends ImageCommand {
|
||||
params(args, url, delay) {
|
||||
params(url, delay) {
|
||||
return {
|
||||
delay: delay ? (100 / delay.split("/")[0]) * delay.split("/")[1] : 0
|
||||
};
|
||||
|
|
|
@ -1,8 +1,8 @@
|
|||
const ImageCommand = require("../../classes/imageCommand.js");
|
||||
|
||||
class SlowCommand extends ImageCommand {
|
||||
params(args) {
|
||||
const speed = parseInt(args[0]);
|
||||
params() {
|
||||
const speed = parseInt(this.args[0]);
|
||||
return {
|
||||
slow: true,
|
||||
speed: isNaN(speed) ? 2 : speed
|
||||
|
|
|
@ -1,16 +1,23 @@
|
|||
const ImageCommand = require("../../classes/imageCommand.js");
|
||||
|
||||
class SnapchatCommand extends ImageCommand {
|
||||
params(args, url) {
|
||||
const newArgs = args.filter(item => !item.includes(url));
|
||||
params(url) {
|
||||
const newArgs = this.args.filter(item => !item.includes(url));
|
||||
const position = parseFloat(this.specialArgs.position);
|
||||
return {
|
||||
caption: newArgs.join(" ").replaceAll("&", "\\&").replaceAll(">", "\\>").replaceAll("<", "\\<").replaceAll("\"", "\\"").replaceAll("'", "\\'").replaceAll("%", "\\%")
|
||||
caption: newArgs.join(" ").replaceAll("&", "\\&").replaceAll(">", "\\>").replaceAll("<", "\\<").replaceAll("\"", "\\"").replaceAll("'", "\\'").replaceAll("%", "\\%"),
|
||||
pos: isNaN(position) ? 0.5 : position
|
||||
};
|
||||
}
|
||||
|
||||
static description = "Adds a Snapchat style caption to an image";
|
||||
static aliases = ["snap", "caption3"];
|
||||
static arguments = ["[text]"];
|
||||
static flags = [{
|
||||
name: "position",
|
||||
type: "number",
|
||||
description: "Set the position of the caption as a decimal (0.0 is top, 1.0 is bottom)"
|
||||
}];
|
||||
|
||||
static requiresText = true;
|
||||
static noText = "You need to provide some text to add a caption!";
|
||||
|
|
|
@ -1,7 +1,7 @@
|
|||
const ImageCommand = require("../../classes/imageCommand.js");
|
||||
|
||||
class SooSCommand extends ImageCommand {
|
||||
params(args, url, delay) {
|
||||
params(url, delay) {
|
||||
return {
|
||||
delay: delay ? (100 / delay.split("/")[0]) * delay.split("/")[1] : 0,
|
||||
soos: true
|
||||
|
|
|
@ -1,8 +1,8 @@
|
|||
const ImageCommand = require("../../classes/imageCommand.js");
|
||||
|
||||
class SpeedCommand extends ImageCommand {
|
||||
params(args) {
|
||||
const speed = parseInt(args[0]);
|
||||
params() {
|
||||
const speed = parseInt(this.args[0]);
|
||||
return {
|
||||
speed: isNaN(speed) || speed < 1 ? 2 : speed
|
||||
};
|
||||
|
|
|
@ -1,8 +1,8 @@
|
|||
const ImageCommand = require("../../classes/imageCommand.js");
|
||||
|
||||
class WhisperCommand extends ImageCommand {
|
||||
params(args, url) {
|
||||
const newArgs = args.filter(item => !item.includes(url));
|
||||
params(url) {
|
||||
const newArgs = this.args.filter(item => !item.includes(url));
|
||||
return {
|
||||
caption: newArgs.join(" ").replaceAll("&", "\\&").replaceAll(">", "\\>").replaceAll("<", "\\<").replaceAll("\"", "\\"").replaceAll("'", "\\'").replaceAll("%", "\\%")
|
||||
};
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue