mrmBot-Matrix/commands/image-editing/whisper.js

22 lines
810 B
JavaScript
Raw Normal View History

import ImageCommand from "../../classes/imageCommand.js";
2021-07-12 21:02:00 +00:00
class WhisperCommand extends ImageCommand {
params(url) {
2022-03-31 18:47:22 +00:00
const newArgs = this.type === "classic" ? this.args.filter(item => !item.includes(url)).join(" ") : this.options.text;
2021-07-12 21:02:00 +00:00
return {
2022-03-20 04:25:59 +00:00
caption: newArgs.replaceAll("&", "&amp;").replaceAll(">", "&gt;").replaceAll("<", "&lt;").replaceAll("\"", "&quot;").replaceAll("'", "&apos;").replaceAll("\\n", "\n")
2021-07-12 21:02:00 +00:00
};
}
static description = "Adds a Whisper style caption to an image";
static aliases = ["caption4"];
static arguments = ["[text]"];
static requiresText = true;
static noText = "You need to provide some text to add a caption!";
static noImage = "You need to provide an image/GIF to add a caption!";
2021-07-12 21:02:00 +00:00
static command = "whisper";
}
export default WhisperCommand;