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

33 lines
886 B
JavaScript
Raw Normal View History

2023-03-15 14:09:09 +00:00
import ImageCommand from "../../classes/imageCommand.js";
class JPEGCommand extends ImageCommand {
2023-03-19 05:10:48 +00:00
static category = "image-editing"
2023-03-15 14:09:09 +00:00
params() {
const quality = parseInt(this.options.quality ?? this.args[0]);
return {
quality: isNaN(quality) ? 1 : Math.max(1, Math.min(quality, 100))
};
}
static init() {
super.init();
this.flags.push({
name: "quality",
type: 4,
description: "Set the JPEG quality (default: 1)",
min_value: 1,
max_value: 100
});
return this;
}
static description = "Adds JPEG compression to an image";
static aliases = ["needsmorejpeg", "jpegify", "magik2", "morejpeg", "jpg", "quality"];
static arguments = ["{quality}"];
static noImage = "You need to provide an image/GIF to add more JPEG!";
static command = "jpeg";
}
export default JPEGCommand;