diff --git a/commands/fun/homebrew.js b/commands/fun/homebrew.js index 649bb15f..fe01ad72 100644 --- a/commands/fun/homebrew.js +++ b/commands/fun/homebrew.js @@ -1,6 +1,6 @@ -import ImageCommand from "#cmd-classes/imageCommand.js"; +import MediaCommand from "#cmd-classes/mediaCommand.js"; -class HomebrewCommand extends ImageCommand { +class HomebrewCommand extends MediaCommand { /** * @param {string | undefined} url */ diff --git a/commands/fun/sonic.js b/commands/fun/sonic.js index 2024dc09..5455f30b 100644 --- a/commands/fun/sonic.js +++ b/commands/fun/sonic.js @@ -1,6 +1,6 @@ -import ImageCommand from "#cmd-classes/imageCommand.js"; +import MediaCommand from "#cmd-classes/mediaCommand.js"; -class SonicCommand extends ImageCommand { +class SonicCommand extends MediaCommand { paramsFunc() { const inputText = this.getOptionString("text") ?? this.args.join(" "); return { diff --git a/commands/general/qr/create.js b/commands/general/qr/create.js index bc0f166d..c7c6eb9d 100644 --- a/commands/general/qr/create.js +++ b/commands/general/qr/create.js @@ -1,6 +1,6 @@ -import ImageCommand from "#cmd-classes/imageCommand.js"; +import MediaCommand from "#cmd-classes/mediaCommand.js"; -class QrCreateCommand extends ImageCommand { +class QrCreateCommand extends MediaCommand { paramsFunc() { const inputText = this.getOptionString("text") ?? this.args.join(" "); return { diff --git a/commands/general/qr/read.js b/commands/general/qr/read.js index 95e0a743..22e05838 100644 --- a/commands/general/qr/read.js +++ b/commands/general/qr/read.js @@ -1,6 +1,6 @@ -import ImageCommand from "#cmd-classes/imageCommand.js"; +import MediaCommand from "#cmd-classes/mediaCommand.js"; -class QrReadCommand extends ImageCommand { +class QrReadCommand extends MediaCommand { static description = "Reads a QR code"; static aliases = ["qrread"]; diff --git a/commands/image-editing/blur.js b/commands/image-editing/blur.js index 756af6e4..8752c6bd 100644 --- a/commands/image-editing/blur.js +++ b/commands/image-editing/blur.js @@ -1,6 +1,6 @@ -import ImageCommand from "#cmd-classes/imageCommand.js"; +import MediaCommand from "#cmd-classes/mediaCommand.js"; -class BlurCommand extends ImageCommand { +class BlurCommand extends MediaCommand { params = { sharp: false, }; diff --git a/commands/image-editing/bounce.js b/commands/image-editing/bounce.js index bac40499..7e0c04ee 100644 --- a/commands/image-editing/bounce.js +++ b/commands/image-editing/bounce.js @@ -1,6 +1,6 @@ -import ImageCommand from "#cmd-classes/imageCommand.js"; +import MediaCommand from "#cmd-classes/mediaCommand.js"; -class BounceCommand extends ImageCommand { +class BounceCommand extends MediaCommand { static description = "Makes an image bounce up and down"; static aliases = ["bouncy"]; diff --git a/commands/image-editing/caption.js b/commands/image-editing/caption.js index c9582ebf..761e99fa 100644 --- a/commands/image-editing/caption.js +++ b/commands/image-editing/caption.js @@ -1,7 +1,7 @@ import { Constants } from "oceanic.js"; -import ImageCommand from "#cmd-classes/imageCommand.js"; +import MediaCommand from "#cmd-classes/mediaCommand.js"; -class CaptionCommand extends ImageCommand { +class CaptionCommand extends MediaCommand { /** * @param {string | undefined} url */ diff --git a/commands/image-editing/caption2.js b/commands/image-editing/caption2.js index 484555ce..2f7ba380 100644 --- a/commands/image-editing/caption2.js +++ b/commands/image-editing/caption2.js @@ -1,5 +1,5 @@ import { Constants } from "oceanic.js"; -import ImageCommand from "#cmd-classes/imageCommand.js"; +import MediaCommand from "#cmd-classes/mediaCommand.js"; const words = [ "me irl", "dank", @@ -25,7 +25,7 @@ const words = [ "pewdiepie", ]; -class CaptionTwoCommand extends ImageCommand { +class CaptionTwoCommand extends MediaCommand { /** * @param {string | undefined} url */ diff --git a/commands/image-editing/circle.js b/commands/image-editing/circle.js index 84da9ef7..555fcd60 100644 --- a/commands/image-editing/circle.js +++ b/commands/image-editing/circle.js @@ -1,6 +1,6 @@ -import ImageCommand from "#cmd-classes/imageCommand.js"; +import MediaCommand from "#cmd-classes/mediaCommand.js"; -class CircleCommand extends ImageCommand { +class CircleCommand extends MediaCommand { static description = "Applies a radial blur effect on an image"; static aliases = ["cblur", "radial", "radialblur"]; diff --git a/commands/image-editing/crop.js b/commands/image-editing/crop.js index f3a5e258..b2f214f2 100644 --- a/commands/image-editing/crop.js +++ b/commands/image-editing/crop.js @@ -1,6 +1,6 @@ -import ImageCommand from "#cmd-classes/imageCommand.js"; +import MediaCommand from "#cmd-classes/mediaCommand.js"; -class CropCommand extends ImageCommand { +class CropCommand extends MediaCommand { static description = "Crops an image to 1:1"; static noImage = "You need to provide an image/GIF to crop!"; diff --git a/commands/image-editing/deepfry.js b/commands/image-editing/deepfry.js index 205a57ac..3dc38ce1 100644 --- a/commands/image-editing/deepfry.js +++ b/commands/image-editing/deepfry.js @@ -1,6 +1,6 @@ -import ImageCommand from "#cmd-classes/imageCommand.js"; +import MediaCommand from "#cmd-classes/mediaCommand.js"; -class DeepfryCommand extends ImageCommand { +class DeepfryCommand extends MediaCommand { static description = "Deep-fries an image"; static aliases = ["fry", "jpeg2", "nuke", "df"]; diff --git a/commands/image-editing/explode.js b/commands/image-editing/explode.js index bcf60734..665d3aa9 100644 --- a/commands/image-editing/explode.js +++ b/commands/image-editing/explode.js @@ -1,6 +1,6 @@ -import ImageCommand from "#cmd-classes/imageCommand.js"; +import MediaCommand from "#cmd-classes/mediaCommand.js"; -class ExplodeCommand extends ImageCommand { +class ExplodeCommand extends MediaCommand { params = { mapName: "linearexplode.png", }; diff --git a/commands/image-editing/fade.js b/commands/image-editing/fade.js index 7350e6af..d6b33cf0 100644 --- a/commands/image-editing/fade.js +++ b/commands/image-editing/fade.js @@ -1,7 +1,7 @@ import { Constants } from "oceanic.js"; -import ImageCommand from "#cmd-classes/imageCommand.js"; +import MediaCommand from "#cmd-classes/mediaCommand.js"; -class FadeCommand extends ImageCommand { +class FadeCommand extends MediaCommand { paramsFunc() { const alpha = this.getOptionBoolean("alpha"); return { diff --git a/commands/image-editing/flag.js b/commands/image-editing/flag.js index 839f8d4a..12394176 100644 --- a/commands/image-editing/flag.js +++ b/commands/image-editing/flag.js @@ -1,7 +1,7 @@ import fs from "node:fs"; -import ImageCommand from "#cmd-classes/imageCommand.js"; +import MediaCommand from "#cmd-classes/mediaCommand.js"; -class FlagCommand extends ImageCommand { +class FlagCommand extends MediaCommand { flagPath = ""; async criteria() { diff --git a/commands/image-editing/flip.js b/commands/image-editing/flip.js index fe3cde30..9794dd08 100644 --- a/commands/image-editing/flip.js +++ b/commands/image-editing/flip.js @@ -1,6 +1,6 @@ -import ImageCommand from "#cmd-classes/imageCommand.js"; +import MediaCommand from "#cmd-classes/mediaCommand.js"; -class FlipCommand extends ImageCommand { +class FlipCommand extends MediaCommand { static description = "Flips an image"; static noImage = "You need to provide an image/GIF to flip!"; diff --git a/commands/image-editing/flop.js b/commands/image-editing/flop.js index 0d413f13..a468f040 100644 --- a/commands/image-editing/flop.js +++ b/commands/image-editing/flop.js @@ -1,6 +1,6 @@ -import ImageCommand from "#cmd-classes/imageCommand.js"; +import MediaCommand from "#cmd-classes/mediaCommand.js"; -class FlopCommand extends ImageCommand { +class FlopCommand extends MediaCommand { params = { flop: true, }; diff --git a/commands/image-editing/freeze.js b/commands/image-editing/freeze.js index 45a3a222..d953875e 100644 --- a/commands/image-editing/freeze.js +++ b/commands/image-editing/freeze.js @@ -1,7 +1,7 @@ import { Constants } from "oceanic.js"; -import ImageCommand from "#cmd-classes/imageCommand.js"; +import MediaCommand from "#cmd-classes/mediaCommand.js"; -class FreezeCommand extends ImageCommand { +class FreezeCommand extends MediaCommand { paramsFunc() { const frameCount = this.getOptionInteger("endframe", true) ?? Number.parseInt(this.args[0]); return { diff --git a/commands/image-editing/gamexplain.js b/commands/image-editing/gamexplain.js index 6bc3a535..f337a821 100644 --- a/commands/image-editing/gamexplain.js +++ b/commands/image-editing/gamexplain.js @@ -1,6 +1,6 @@ -import ImageCommand from "#cmd-classes/imageCommand.js"; +import MediaCommand from "#cmd-classes/mediaCommand.js"; -class GameXplainCommand extends ImageCommand { +class GameXplainCommand extends MediaCommand { static description = "Makes a GameXplain thumbnail from an image"; static aliases = ["gx"]; diff --git a/commands/image-editing/gif.js b/commands/image-editing/gif.js index e1a50433..6374bb9e 100644 --- a/commands/image-editing/gif.js +++ b/commands/image-editing/gif.js @@ -1,6 +1,6 @@ -import ImageCommand from "#cmd-classes/imageCommand.js"; +import MediaCommand from "#cmd-classes/mediaCommand.js"; -class GIFCommand extends ImageCommand { +class GIFCommand extends MediaCommand { static description = "Converts an image into a GIF"; static aliases = ["gif", "getgif", "togif", "tgif", "gifify"]; diff --git a/commands/image-editing/globe.js b/commands/image-editing/globe.js index b515a565..fcacf545 100644 --- a/commands/image-editing/globe.js +++ b/commands/image-editing/globe.js @@ -1,6 +1,6 @@ -import ImageCommand from "#cmd-classes/imageCommand.js"; +import MediaCommand from "#cmd-classes/mediaCommand.js"; -class GlobeCommand extends ImageCommand { +class GlobeCommand extends MediaCommand { static description = "Spins an image"; static aliases = ["sphere"]; diff --git a/commands/image-editing/grayscale.js b/commands/image-editing/grayscale.js index fdedffd1..e884a306 100644 --- a/commands/image-editing/grayscale.js +++ b/commands/image-editing/grayscale.js @@ -1,6 +1,6 @@ -import ImageCommand from "#cmd-classes/imageCommand.js"; +import MediaCommand from "#cmd-classes/mediaCommand.js"; -class GrayscaleCommand extends ImageCommand { +class GrayscaleCommand extends MediaCommand { params = { color: "grayscale", }; diff --git a/commands/image-editing/haah.js b/commands/image-editing/haah.js index 73ed9334..b4b39534 100644 --- a/commands/image-editing/haah.js +++ b/commands/image-editing/haah.js @@ -1,6 +1,6 @@ -import ImageCommand from "#cmd-classes/imageCommand.js"; +import MediaCommand from "#cmd-classes/mediaCommand.js"; -class HaaHCommand extends ImageCommand { +class HaaHCommand extends MediaCommand { params = { first: true, }; diff --git a/commands/image-editing/hooh.js b/commands/image-editing/hooh.js index d34b7ca5..708946bc 100644 --- a/commands/image-editing/hooh.js +++ b/commands/image-editing/hooh.js @@ -1,6 +1,6 @@ -import ImageCommand from "#cmd-classes/imageCommand.js"; +import MediaCommand from "#cmd-classes/mediaCommand.js"; -class HooHCommand extends ImageCommand { +class HooHCommand extends MediaCommand { params = { vertical: true, }; diff --git a/commands/image-editing/hue.js b/commands/image-editing/hue.js index 3d0d0ac5..a5270a98 100644 --- a/commands/image-editing/hue.js +++ b/commands/image-editing/hue.js @@ -1,7 +1,7 @@ import { Constants } from "oceanic.js"; -import ImageCommand from "#cmd-classes/imageCommand.js"; +import MediaCommand from "#cmd-classes/mediaCommand.js"; -class HueCommand extends ImageCommand { +class HueCommand extends MediaCommand { paramsFunc() { const shift = this.getOptionInteger("shift", true) ?? Number.parseInt(this.args[0]); return { diff --git a/commands/image-editing/implode.js b/commands/image-editing/implode.js index b2b0926e..e85912a0 100644 --- a/commands/image-editing/implode.js +++ b/commands/image-editing/implode.js @@ -1,6 +1,6 @@ -import ImageCommand from "#cmd-classes/imageCommand.js"; +import MediaCommand from "#cmd-classes/mediaCommand.js"; -class ImplodeCommand extends ImageCommand { +class ImplodeCommand extends MediaCommand { params = { mapName: "linearimplode.png", }; diff --git a/commands/image-editing/invert.js b/commands/image-editing/invert.js index 7396b666..fe4b6db6 100644 --- a/commands/image-editing/invert.js +++ b/commands/image-editing/invert.js @@ -1,6 +1,6 @@ -import ImageCommand from "#cmd-classes/imageCommand.js"; +import MediaCommand from "#cmd-classes/mediaCommand.js"; -class InvertCommand extends ImageCommand { +class InvertCommand extends MediaCommand { static description = "Inverts an image"; static aliases = ["inverse", "negate", "negative"]; diff --git a/commands/image-editing/jpeg.js b/commands/image-editing/jpeg.js index 1c0a92ee..90216d9f 100644 --- a/commands/image-editing/jpeg.js +++ b/commands/image-editing/jpeg.js @@ -1,7 +1,7 @@ import { Constants } from "oceanic.js"; -import ImageCommand from "#cmd-classes/imageCommand.js"; +import MediaCommand from "#cmd-classes/mediaCommand.js"; -class JPEGCommand extends ImageCommand { +class JPEGCommand extends MediaCommand { paramsFunc() { const quality = this.getOptionInteger("quality", true) ?? Number.parseInt(this.args[0]); return { diff --git a/commands/image-editing/magik.js b/commands/image-editing/magik.js index c5af9f0b..39c14ac0 100644 --- a/commands/image-editing/magik.js +++ b/commands/image-editing/magik.js @@ -1,6 +1,6 @@ -import ImageCommand from "#cmd-classes/imageCommand.js"; +import MediaCommand from "#cmd-classes/mediaCommand.js"; -class MagikCommand extends ImageCommand { +class MagikCommand extends MediaCommand { static description = "Adds a content aware scale effect to an image"; static aliases = ["imagemagic", "imagemagick", "imagemagik", "magic", "magick", "cas", "liquid"]; diff --git a/commands/image-editing/meme.js b/commands/image-editing/meme.js index 50772f89..04428ca5 100644 --- a/commands/image-editing/meme.js +++ b/commands/image-editing/meme.js @@ -1,7 +1,7 @@ import { Constants } from "oceanic.js"; -import ImageCommand from "#cmd-classes/imageCommand.js"; +import MediaCommand from "#cmd-classes/mediaCommand.js"; -class MemeCommand extends ImageCommand { +class MemeCommand extends MediaCommand { /** * @param {string | number | boolean | import("oceanic.js").User | import("oceanic.js").Attachment} text * @param {string | undefined} url diff --git a/commands/image-editing/motivate.js b/commands/image-editing/motivate.js index 2ba27e98..4edc7235 100644 --- a/commands/image-editing/motivate.js +++ b/commands/image-editing/motivate.js @@ -1,7 +1,7 @@ import { Constants } from "oceanic.js"; -import ImageCommand from "#cmd-classes/imageCommand.js"; +import MediaCommand from "#cmd-classes/mediaCommand.js"; -class MotivateCommand extends ImageCommand { +class MotivateCommand extends MediaCommand { /** * @param {string | number | boolean | import("oceanic.js").User | import("oceanic.js").Attachment} text * @param {string | undefined} url diff --git a/commands/image-editing/pixelate.js b/commands/image-editing/pixelate.js index 78d75c32..f8e83c6c 100644 --- a/commands/image-editing/pixelate.js +++ b/commands/image-editing/pixelate.js @@ -1,6 +1,6 @@ -import ImageCommand from "#cmd-classes/imageCommand.js"; +import MediaCommand from "#cmd-classes/mediaCommand.js"; -class PixelateCommand extends ImageCommand { +class PixelateCommand extends MediaCommand { static description = "Pixelates an image"; static aliases = ["pixel", "small"]; diff --git a/commands/image-editing/reddit.js b/commands/image-editing/reddit.js index 3b35ac95..5a94b1b9 100644 --- a/commands/image-editing/reddit.js +++ b/commands/image-editing/reddit.js @@ -1,8 +1,8 @@ -import ImageCommand from "#cmd-classes/imageCommand.js"; +import MediaCommand from "#cmd-classes/mediaCommand.js"; import { random } from "#utils/misc.js"; const names = ["esmBot", "me_irl", "dankmemes", "hmmm", "gaming", "wholesome", "chonkers", "memes", "funny", "lies"]; -class RedditCommand extends ImageCommand { +class RedditCommand extends MediaCommand { /** * @param {string | undefined} url */ diff --git a/commands/image-editing/reverse.js b/commands/image-editing/reverse.js index 707f57f7..e536044a 100644 --- a/commands/image-editing/reverse.js +++ b/commands/image-editing/reverse.js @@ -1,6 +1,6 @@ -import ImageCommand from "#cmd-classes/imageCommand.js"; +import MediaCommand from "#cmd-classes/mediaCommand.js"; -class ReverseCommand extends ImageCommand { +class ReverseCommand extends MediaCommand { static description = "Reverses an image sequence"; static aliases = ["backwards"]; diff --git a/commands/image-editing/scott.js b/commands/image-editing/scott.js index 143a6149..9b973337 100644 --- a/commands/image-editing/scott.js +++ b/commands/image-editing/scott.js @@ -1,6 +1,6 @@ -import ImageCommand from "#cmd-classes/imageCommand.js"; +import MediaCommand from "#cmd-classes/mediaCommand.js"; -class ScottCommand extends ImageCommand { +class ScottCommand extends MediaCommand { static description = "Makes Scott the Woz show off an image"; static aliases = ["woz", "tv", "porn"]; diff --git a/commands/image-editing/sepia.js b/commands/image-editing/sepia.js index b611f8b8..5f98ce80 100644 --- a/commands/image-editing/sepia.js +++ b/commands/image-editing/sepia.js @@ -1,6 +1,6 @@ -import ImageCommand from "#cmd-classes/imageCommand.js"; +import MediaCommand from "#cmd-classes/mediaCommand.js"; -class SepiaCommand extends ImageCommand { +class SepiaCommand extends MediaCommand { params = { color: "sepia", }; diff --git a/commands/image-editing/sharpen.js b/commands/image-editing/sharpen.js index 45208d98..2f9759dd 100644 --- a/commands/image-editing/sharpen.js +++ b/commands/image-editing/sharpen.js @@ -1,6 +1,6 @@ -import ImageCommand from "#cmd-classes/imageCommand.js"; +import MediaCommand from "#cmd-classes/mediaCommand.js"; -class SharpenCommand extends ImageCommand { +class SharpenCommand extends MediaCommand { params = { sharp: true, }; diff --git a/commands/image-editing/slide.js b/commands/image-editing/slide.js index db4a71e0..c1f159aa 100644 --- a/commands/image-editing/slide.js +++ b/commands/image-editing/slide.js @@ -1,7 +1,7 @@ import { Constants } from "oceanic.js"; -import ImageCommand from "#cmd-classes/imageCommand.js"; +import MediaCommand from "#cmd-classes/mediaCommand.js"; -class SlideCommand extends ImageCommand { +class SlideCommand extends MediaCommand { paramsFunc() { const vertical = this.getOptionBoolean("vertical"); const reverse = this.getOptionBoolean("reverse"); diff --git a/commands/image-editing/slow.js b/commands/image-editing/slow.js index 7640d911..463b2add 100644 --- a/commands/image-editing/slow.js +++ b/commands/image-editing/slow.js @@ -1,7 +1,7 @@ import { Constants } from "oceanic.js"; -import ImageCommand from "#cmd-classes/imageCommand.js"; +import MediaCommand from "#cmd-classes/mediaCommand.js"; -class SlowCommand extends ImageCommand { +class SlowCommand extends MediaCommand { paramsFunc() { const speed = this.getOptionInteger("multiplier", true) ?? Number.parseInt(this.args[0]); return { diff --git a/commands/image-editing/snapchat.js b/commands/image-editing/snapchat.js index 4988498e..ba8f30e5 100644 --- a/commands/image-editing/snapchat.js +++ b/commands/image-editing/snapchat.js @@ -1,7 +1,7 @@ import { Constants } from "oceanic.js"; -import ImageCommand from "#cmd-classes/imageCommand.js"; +import MediaCommand from "#cmd-classes/mediaCommand.js"; -class SnapchatCommand extends ImageCommand { +class SnapchatCommand extends MediaCommand { /** * @param {string | undefined} url */ diff --git a/commands/image-editing/soos.js b/commands/image-editing/soos.js index 858d9456..80cbe99d 100644 --- a/commands/image-editing/soos.js +++ b/commands/image-editing/soos.js @@ -1,6 +1,6 @@ -import ImageCommand from "#cmd-classes/imageCommand.js"; +import MediaCommand from "#cmd-classes/mediaCommand.js"; -class SooSCommand extends ImageCommand { +class SooSCommand extends MediaCommand { params = { soos: true, }; diff --git a/commands/image-editing/speechbubble.js b/commands/image-editing/speechbubble.js index e178cd60..33e7d1bc 100644 --- a/commands/image-editing/speechbubble.js +++ b/commands/image-editing/speechbubble.js @@ -1,7 +1,7 @@ import { Constants } from "oceanic.js"; -import ImageCommand from "#cmd-classes/imageCommand.js"; +import MediaCommand from "#cmd-classes/mediaCommand.js"; -class SpeechBubbleCommand extends ImageCommand { +class SpeechBubbleCommand extends MediaCommand { paramsFunc() { const parsedScale = this.getOptionNumber("scale"); const alpha = this.getOptionBoolean("alpha"); diff --git a/commands/image-editing/speed.js b/commands/image-editing/speed.js index 0159d220..8402754b 100644 --- a/commands/image-editing/speed.js +++ b/commands/image-editing/speed.js @@ -1,7 +1,7 @@ import { Constants } from "oceanic.js"; -import ImageCommand from "#cmd-classes/imageCommand.js"; +import MediaCommand from "#cmd-classes/mediaCommand.js"; -class SpeedCommand extends ImageCommand { +class SpeedCommand extends MediaCommand { paramsFunc() { const speed = this.getOptionInteger("multiplier", true) ?? Number.parseInt(this.args[0]); return { diff --git a/commands/image-editing/spin.js b/commands/image-editing/spin.js index 5dae6dd7..341bf7c6 100644 --- a/commands/image-editing/spin.js +++ b/commands/image-editing/spin.js @@ -1,6 +1,6 @@ -import ImageCommand from "#cmd-classes/imageCommand.js"; +import MediaCommand from "#cmd-classes/mediaCommand.js"; -class SpinCommand extends ImageCommand { +class SpinCommand extends MediaCommand { static description = "Spins an image"; static aliases = ["rotate"]; diff --git a/commands/image-editing/spotify.js b/commands/image-editing/spotify.js index 51717661..cdc8ca86 100644 --- a/commands/image-editing/spotify.js +++ b/commands/image-editing/spotify.js @@ -1,6 +1,6 @@ -import ImageCommand from "#cmd-classes/imageCommand.js"; +import MediaCommand from "#cmd-classes/mediaCommand.js"; -class SpotifyCommand extends ImageCommand { +class SpotifyCommand extends MediaCommand { /** * @param {string | undefined} url */ diff --git a/commands/image-editing/squish.js b/commands/image-editing/squish.js index a69b8cd1..a19f7e55 100644 --- a/commands/image-editing/squish.js +++ b/commands/image-editing/squish.js @@ -1,6 +1,6 @@ -import ImageCommand from "#cmd-classes/imageCommand.js"; +import MediaCommand from "#cmd-classes/mediaCommand.js"; -class SquishCommand extends ImageCommand { +class SquishCommand extends MediaCommand { static description = "Squishes/stretches an image"; static aliases = ["squishy", "squash"]; diff --git a/commands/image-editing/stretch.js b/commands/image-editing/stretch.js index 041e4ba1..39557ab5 100644 --- a/commands/image-editing/stretch.js +++ b/commands/image-editing/stretch.js @@ -1,6 +1,6 @@ -import ImageCommand from "#cmd-classes/imageCommand.js"; +import MediaCommand from "#cmd-classes/mediaCommand.js"; -class StretchCommand extends ImageCommand { +class StretchCommand extends MediaCommand { params = { stretch: true, }; diff --git a/commands/image-editing/swirl.js b/commands/image-editing/swirl.js index 2de337b6..65ed0459 100644 --- a/commands/image-editing/swirl.js +++ b/commands/image-editing/swirl.js @@ -1,6 +1,6 @@ -import ImageCommand from "#cmd-classes/imageCommand.js"; +import MediaCommand from "#cmd-classes/mediaCommand.js"; -class SwirlCommand extends ImageCommand { +class SwirlCommand extends MediaCommand { static description = "Swirls an image"; static aliases = ["whirlpool", "distort"]; diff --git a/commands/image-editing/tile.js b/commands/image-editing/tile.js index 7d1b480f..0393938d 100644 --- a/commands/image-editing/tile.js +++ b/commands/image-editing/tile.js @@ -1,6 +1,6 @@ -import ImageCommand from "#cmd-classes/imageCommand.js"; +import MediaCommand from "#cmd-classes/mediaCommand.js"; -class TileCommand extends ImageCommand { +class TileCommand extends MediaCommand { static description = "Creates a tile pattern from an image"; static aliases = ["wall2"]; diff --git a/commands/image-editing/uncanny.js b/commands/image-editing/uncanny.js index 557ffaa0..39fbcbdf 100644 --- a/commands/image-editing/uncanny.js +++ b/commands/image-editing/uncanny.js @@ -2,7 +2,7 @@ import { readdirSync } from "node:fs"; import { dirname, resolve } from "node:path"; import { fileURLToPath } from "node:url"; import { Constants } from "oceanic.js"; -import ImageCommand from "#cmd-classes/imageCommand.js"; +import MediaCommand from "#cmd-classes/mediaCommand.js"; import { random } from "#utils/misc.js"; const prompts = [ "you found:", @@ -26,7 +26,7 @@ const names = readdirSync(resolve(dirname(fileURLToPath(import.meta.url)), "../. return val.split(".")[0]; }); -class UncannyCommand extends ImageCommand { +class UncannyCommand extends MediaCommand { /** * @param {string | undefined} url */ diff --git a/commands/image-editing/uncaption.js b/commands/image-editing/uncaption.js index e7811837..82595b3c 100644 --- a/commands/image-editing/uncaption.js +++ b/commands/image-editing/uncaption.js @@ -1,7 +1,7 @@ import { Constants } from "oceanic.js"; -import ImageCommand from "#cmd-classes/imageCommand.js"; +import MediaCommand from "#cmd-classes/mediaCommand.js"; -class UncaptionCommand extends ImageCommand { +class UncaptionCommand extends MediaCommand { paramsFunc() { const tolerance = this.getOptionNumber("tolerance"); return { diff --git a/commands/image-editing/unfreeze.js b/commands/image-editing/unfreeze.js index 04b49360..b00d7a74 100644 --- a/commands/image-editing/unfreeze.js +++ b/commands/image-editing/unfreeze.js @@ -1,6 +1,6 @@ -import ImageCommand from "#cmd-classes/imageCommand.js"; +import MediaCommand from "#cmd-classes/mediaCommand.js"; -class UnfreezeCommand extends ImageCommand { +class UnfreezeCommand extends MediaCommand { params = { loop: true, }; diff --git a/commands/image-editing/vignette.js b/commands/image-editing/vignette.js index f07706e4..17ca42e2 100644 --- a/commands/image-editing/vignette.js +++ b/commands/image-editing/vignette.js @@ -1,6 +1,6 @@ -import ImageCommand from "#cmd-classes/imageCommand.js"; +import MediaCommand from "#cmd-classes/mediaCommand.js"; -class VignetteCommand extends ImageCommand { +class VignetteCommand extends MediaCommand { params = { water: "assets/images/vignette.png", yscale: 1.0, diff --git a/commands/image-editing/waaw.js b/commands/image-editing/waaw.js index 1ae191fb..f6e47a24 100644 --- a/commands/image-editing/waaw.js +++ b/commands/image-editing/waaw.js @@ -1,6 +1,6 @@ -import ImageCommand from "#cmd-classes/imageCommand.js"; +import MediaCommand from "#cmd-classes/mediaCommand.js"; -class WaaWCommand extends ImageCommand { +class WaaWCommand extends MediaCommand { static description = "Mirrors the right side of an image onto the left"; static aliases = ["magik3", "mirror"]; diff --git a/commands/image-editing/wall.js b/commands/image-editing/wall.js index 1ece4444..3d6e1cff 100644 --- a/commands/image-editing/wall.js +++ b/commands/image-editing/wall.js @@ -1,6 +1,6 @@ -import ImageCommand from "#cmd-classes/imageCommand.js"; +import MediaCommand from "#cmd-classes/mediaCommand.js"; -class WallCommand extends ImageCommand { +class WallCommand extends MediaCommand { static description = "Creates a wall from an image"; static noImage = "You need to provide an image/GIF to make a wall!"; diff --git a/commands/image-editing/watermark/9gag.js b/commands/image-editing/watermark/9gag.js index fb8222db..b25e635b 100644 --- a/commands/image-editing/watermark/9gag.js +++ b/commands/image-editing/watermark/9gag.js @@ -1,6 +1,6 @@ -import ImageCommand from "#cmd-classes/imageCommand.js"; +import MediaCommand from "#cmd-classes/mediaCommand.js"; -class WatermarkNineGagCommand extends ImageCommand { +class WatermarkNineGagCommand extends MediaCommand { params = { water: "assets/images/9gag.png", gravity: 6, diff --git a/commands/image-editing/watermark/avs4you.js b/commands/image-editing/watermark/avs4you.js index 1cef9591..58ed40c9 100644 --- a/commands/image-editing/watermark/avs4you.js +++ b/commands/image-editing/watermark/avs4you.js @@ -1,6 +1,6 @@ -import ImageCommand from "#cmd-classes/imageCommand.js"; +import MediaCommand from "#cmd-classes/mediaCommand.js"; -class WatermarkAVSCommand extends ImageCommand { +class WatermarkAVSCommand extends MediaCommand { params = { water: "assets/images/avs4you.png", gravity: 5, diff --git a/commands/image-editing/watermark/bandicam.js b/commands/image-editing/watermark/bandicam.js index 6d7cfefb..3cdd428f 100644 --- a/commands/image-editing/watermark/bandicam.js +++ b/commands/image-editing/watermark/bandicam.js @@ -1,6 +1,6 @@ -import ImageCommand from "#cmd-classes/imageCommand.js"; +import MediaCommand from "#cmd-classes/mediaCommand.js"; -class WatermarkBandicamCommand extends ImageCommand { +class WatermarkBandicamCommand extends MediaCommand { params = { water: "assets/images/bandicam.png", gravity: 2, diff --git a/commands/image-editing/watermark/deviantart.js b/commands/image-editing/watermark/deviantart.js index f66ad604..6f05b3e9 100644 --- a/commands/image-editing/watermark/deviantart.js +++ b/commands/image-editing/watermark/deviantart.js @@ -1,6 +1,6 @@ -import ImageCommand from "#cmd-classes/imageCommand.js"; +import MediaCommand from "#cmd-classes/mediaCommand.js"; -class WatermarkDeviantArtCommand extends ImageCommand { +class WatermarkDeviantArtCommand extends MediaCommand { params = { water: "assets/images/deviantart.png", gravity: 5, diff --git a/commands/image-editing/watermark/funky.js b/commands/image-editing/watermark/funky.js index 40b877fa..32112141 100644 --- a/commands/image-editing/watermark/funky.js +++ b/commands/image-editing/watermark/funky.js @@ -1,6 +1,6 @@ -import ImageCommand from "#cmd-classes/imageCommand.js"; +import MediaCommand from "#cmd-classes/mediaCommand.js"; -class WatermarkFunkyCommand extends ImageCommand { +class WatermarkFunkyCommand extends MediaCommand { params = { water: "assets/images/funky.png", gravity: 3, diff --git a/commands/image-editing/watermark/hypercam.js b/commands/image-editing/watermark/hypercam.js index edd2f9b7..e87123e3 100644 --- a/commands/image-editing/watermark/hypercam.js +++ b/commands/image-editing/watermark/hypercam.js @@ -1,6 +1,6 @@ -import ImageCommand from "#cmd-classes/imageCommand.js"; +import MediaCommand from "#cmd-classes/mediaCommand.js"; -class WatermarkHypercamCommand extends ImageCommand { +class WatermarkHypercamCommand extends MediaCommand { params = { water: "assets/images/hypercam.png", gravity: 1, diff --git a/commands/image-editing/watermark/ifunny.js b/commands/image-editing/watermark/ifunny.js index ba13e1a0..4a446831 100644 --- a/commands/image-editing/watermark/ifunny.js +++ b/commands/image-editing/watermark/ifunny.js @@ -1,6 +1,6 @@ -import ImageCommand from "#cmd-classes/imageCommand.js"; +import MediaCommand from "#cmd-classes/mediaCommand.js"; -class WatermarkiFunnyCommand extends ImageCommand { +class WatermarkiFunnyCommand extends MediaCommand { params = { water: "assets/images/ifunny.png", gravity: 8, diff --git a/commands/image-editing/watermark/kinemaster.js b/commands/image-editing/watermark/kinemaster.js index 4ec9950f..6d72bf4d 100644 --- a/commands/image-editing/watermark/kinemaster.js +++ b/commands/image-editing/watermark/kinemaster.js @@ -1,6 +1,6 @@ -import ImageCommand from "#cmd-classes/imageCommand.js"; +import MediaCommand from "#cmd-classes/mediaCommand.js"; -class WatermarkKineMasterCommand extends ImageCommand { +class WatermarkKineMasterCommand extends MediaCommand { params = { water: "assets/images/kinemaster.png", gravity: 3, diff --git a/commands/image-editing/watermark/memecenter.js b/commands/image-editing/watermark/memecenter.js index 60cbb583..41c3634e 100644 --- a/commands/image-editing/watermark/memecenter.js +++ b/commands/image-editing/watermark/memecenter.js @@ -1,6 +1,6 @@ -import ImageCommand from "#cmd-classes/imageCommand.js"; +import MediaCommand from "#cmd-classes/mediaCommand.js"; -class WatermarkMemeCenterCommand extends ImageCommand { +class WatermarkMemeCenterCommand extends MediaCommand { params = { water: "assets/images/memecenter.png", gravity: 9, diff --git a/commands/image-editing/watermark/powerdirector.js b/commands/image-editing/watermark/powerdirector.js index d1c2a24c..6fbca31c 100644 --- a/commands/image-editing/watermark/powerdirector.js +++ b/commands/image-editing/watermark/powerdirector.js @@ -1,6 +1,6 @@ -import ImageCommand from "#cmd-classes/imageCommand.js"; +import MediaCommand from "#cmd-classes/mediaCommand.js"; -class WatermarkPowerDirectorCommand extends ImageCommand { +class WatermarkPowerDirectorCommand extends MediaCommand { params = { water: "assets/images/powerdirector.png", gravity: 9, diff --git a/commands/image-editing/watermark/shutterstock.js b/commands/image-editing/watermark/shutterstock.js index c6cede91..2d231320 100644 --- a/commands/image-editing/watermark/shutterstock.js +++ b/commands/image-editing/watermark/shutterstock.js @@ -1,6 +1,6 @@ -import ImageCommand from "#cmd-classes/imageCommand.js"; +import MediaCommand from "#cmd-classes/mediaCommand.js"; -class WatermarkShutterstockCommand extends ImageCommand { +class WatermarkShutterstockCommand extends MediaCommand { params = { water: "assets/images/shutterstock.png", gravity: 5, diff --git a/commands/image-editing/whisper.js b/commands/image-editing/whisper.js index 3890d8fd..4b6d5290 100644 --- a/commands/image-editing/whisper.js +++ b/commands/image-editing/whisper.js @@ -1,6 +1,6 @@ -import ImageCommand from "#cmd-classes/imageCommand.js"; +import MediaCommand from "#cmd-classes/mediaCommand.js"; -class WhisperCommand extends ImageCommand { +class WhisperCommand extends MediaCommand { /** * @param {string | undefined} url */ diff --git a/commands/image-editing/wide.js b/commands/image-editing/wide.js index 6a27114a..bbd9c481 100644 --- a/commands/image-editing/wide.js +++ b/commands/image-editing/wide.js @@ -1,7 +1,7 @@ import { Constants } from "oceanic.js"; -import ImageCommand from "#cmd-classes/imageCommand.js"; +import MediaCommand from "#cmd-classes/mediaCommand.js"; -class WideCommand extends ImageCommand { +class WideCommand extends MediaCommand { paramsFunc() { const amount = this.getOptionInteger("scale"); return { diff --git a/commands/image-editing/woow.js b/commands/image-editing/woow.js index 33664fd9..cea2b13d 100644 --- a/commands/image-editing/woow.js +++ b/commands/image-editing/woow.js @@ -1,6 +1,6 @@ -import ImageCommand from "#cmd-classes/imageCommand.js"; +import MediaCommand from "#cmd-classes/mediaCommand.js"; -class WooWCommand extends ImageCommand { +class WooWCommand extends MediaCommand { params = { vertical: true, first: true, diff --git a/src/classes/imageCommand.ts b/src/classes/mediaCommand.ts similarity index 91% rename from src/classes/imageCommand.ts rename to src/classes/mediaCommand.ts index 13768b0e..b27cfaee 100644 --- a/src/classes/imageCommand.ts +++ b/src/classes/mediaCommand.ts @@ -12,12 +12,12 @@ import messages from "#config/messages.json" with { type: "json" }; import { runningCommands, selectedImages } from "#utils/collections.js"; import { getAllLocalizations } from "#utils/i18n.js"; import { runMediaJob } from "#utils/media.js"; -import imageDetect, { type ImageMeta } from "#utils/mediadetect.js"; +import mediaDetect, { type MediaMeta } from "#utils/mediadetect.js"; import { clean, isEmpty, random } from "#utils/misc.js"; import type { MediaParams } from "#utils/types.js"; import Command from "./command.ts"; -class ImageCommand extends Command { +class MediaCommand extends Command { params?: object; paramsFunc(_url?: string, _name?: string): object { @@ -48,20 +48,20 @@ class ImageCommand extends Command { // before awaiting the command result, add this command to the set of running commands runningCommands.set(this.author.id, timestamp); - const staticProps = this.constructor as typeof ImageCommand; + const staticProps = this.constructor as typeof MediaCommand; - let imageParams: MediaParams; + let mediaParams: MediaParams; let needsSpoiler = false; if (staticProps.requiresImage) { try { - let selection: ImageMeta | undefined; + let selection: MediaMeta | undefined; if (!this.getOptionAttachment("image") && !this.getOptionString("link")) { selection = selectedImages.get(this.author.id); } const image = selection ?? - (await imageDetect(this.client, this.permissions, this.message, this.interaction, true).catch((e) => { + (await mediaDetect(this.client, this.permissions, this.message, this.interaction, true).catch((e) => { if (e.name === "AbortError") { runningCommands.delete(this.author.id); return this.getString("image.timeout"); @@ -87,8 +87,9 @@ class ImageCommand extends Command { runningCommands.delete(this.author.id); return this.getString("image.badurl"); } - imageParams = { + mediaParams = { cmd: staticProps.command, + type: "image", params: { togif: !!this.getOptionBoolean("togif"), }, @@ -106,8 +107,9 @@ class ImageCommand extends Command { throw e; } } else { - imageParams = { + mediaParams = { cmd: staticProps.command, + type: "image", params: { togif: !!this.getOptionBoolean("togif"), }, @@ -125,7 +127,7 @@ class ImageCommand extends Command { staticProps.requiredParamType, staticProps.requiredParamType !== Constants.ApplicationCommandOptionTypes.STRING, ) ?? this.args.join(" ").trim(); - if (!text || (typeof text === "string" && isEmpty(text)) || !(await this.criteria(text, imageParams.url))) { + if (!text || (typeof text === "string" && isEmpty(text)) || !(await this.criteria(text, mediaParams.url))) { runningCommands.delete(this.author?.id); return ( this.getString(`commands.noParam.${this.cmdName}`, { returnNull: true }) || @@ -136,15 +138,15 @@ class ImageCommand extends Command { } if (this.params) { - Object.assign(imageParams.params, this.params); + Object.assign(mediaParams.params, this.params); } else { - Object.assign(imageParams.params, this.paramsFunc(imageParams.url, imageParams.name)); + Object.assign(mediaParams.params, this.paramsFunc(mediaParams.url, mediaParams.name)); } let status: Message | undefined; if ( - imageParams.input && - (imageParams.input.type === "image/gif" || imageParams.input.type === "image/webp") && + mediaParams.input && + (mediaParams.input.type === "image/gif" || mediaParams.input.type === "image/webp") && this.message ) { status = await this.processMessage( @@ -155,13 +157,13 @@ class ImageCommand extends Command { const ephemeral = this.getOptionBoolean("ephemeral"); if (this.interaction) { - imageParams.ephemeral = ephemeral; - imageParams.spoiler = needsSpoiler; - imageParams.token = this.interaction.token; + mediaParams.ephemeral = ephemeral; + mediaParams.spoiler = needsSpoiler; + mediaParams.token = this.interaction.token; } try { - const result = await runMediaJob(imageParams); + const result = await runMediaJob(mediaParams); const buffer = result.buffer; const type = result.type; if (type === "sent") { @@ -300,6 +302,8 @@ class ImageCommand extends Command { "ubuntu", ]; + static supportedTypes: MediaParams["type"][] = ["image"]; + static requiresImage = true; static requiresParam = false; static requiredParam = "text"; @@ -313,4 +317,4 @@ class ImageCommand extends Command { static command = ""; } -export default ImageCommand; +export default MediaCommand; diff --git a/src/events/interactionCreate.ts b/src/events/interactionCreate.ts index e398bfd0..8b871b31 100644 --- a/src/events/interactionCreate.ts +++ b/src/events/interactionCreate.ts @@ -2,7 +2,7 @@ import { Buffer } from "node:buffer"; import process from "node:process"; import type { AnyInteractionGateway } from "oceanic.js"; import Command from "#cmd-classes/command.js"; -import ImageCommand from "#cmd-classes/imageCommand.js"; +import MediaCommand from "#cmd-classes/mediaCommand.js"; import { collectors, commands, messageCommands, selectedImages, userCommands } from "#utils/collections.js"; import detectRuntime from "#utils/detectRuntime.js"; import { getString } from "#utils/i18n.js"; @@ -73,7 +73,7 @@ export default async ({ client, database }: EventParams, interaction: AnyInterac flags: commandClass.success ? 0 : 64, }); } else if (typeof result === "object") { - if (commandClass instanceof ImageCommand && result.files) { + if (commandClass instanceof MediaCommand && result.files) { const fileSize = interaction.attachmentSizeLimit; const file = result.files[0]; if (file.contents.length > fileSize) { diff --git a/src/events/messageCreate.ts b/src/events/messageCreate.ts index 979a6db7..7f5fa663 100644 --- a/src/events/messageCreate.ts +++ b/src/events/messageCreate.ts @@ -8,7 +8,7 @@ import { ThreadChannel, } from "oceanic.js"; import Command from "#cmd-classes/command.js"; -import ImageCommand from "#cmd-classes/imageCommand.js"; +import MediaCommand from "#cmd-classes/mediaCommand.js"; import { aliases, commands, disabledCache, disabledCmdCache, prefixCache } from "#utils/collections.js"; import detectRuntime from "#utils/detectRuntime.js"; import { getString } from "#utils/i18n.js"; @@ -186,7 +186,7 @@ export default async ({ client, database }: EventParams, message: Message) => { ), ); } else if (typeof result === "object") { - if (commandClass instanceof ImageCommand && result.files) { + if (commandClass instanceof MediaCommand && result.files) { let fileSize = 10485760; if (message.guild) { switch (message.guild.premiumTier) { diff --git a/src/utils/collections.ts b/src/utils/collections.ts index 338f728d..ef50259e 100644 --- a/src/utils/collections.ts +++ b/src/utils/collections.ts @@ -1,5 +1,5 @@ import type InteractionCollector from "../pagination/awaitinteractions.ts"; -import type { ImageMeta } from "./mediadetect.ts"; +import type { MediaMeta } from "./mediadetect.ts"; import type { CommandEntry, CommandInfo } from "./types.ts"; export const commands = new Map(); @@ -31,7 +31,7 @@ class TimedMap extends Map { } export const runningCommands = new TimedMap(5000); -export const selectedImages = new TimedMap(180000); +export const selectedImages = new TimedMap(180000); class Cache extends Map { maxValues: number; diff --git a/src/utils/mediadetect.ts b/src/utils/mediadetect.ts index 71cb67a7..d2e40abd 100644 --- a/src/utils/mediadetect.ts +++ b/src/utils/mediadetect.ts @@ -52,7 +52,7 @@ type TenorResponse = { }[]; }; -export type ImageMeta = { +export type MediaMeta = { path: string; type?: string; url: string; @@ -71,7 +71,7 @@ async function getImage( extraReturnTypes = false, type: string | null = null, client: Client | undefined = undefined, -): Promise { +): Promise { let imageURL: URL; try { imageURL = new URL(image); @@ -89,7 +89,7 @@ async function getImage( const fileNameSplit = imageURL.pathname.split("/"); const fileName = fileNameSplit[fileNameSplit.length - 1]; const fileNameNoExtension = fileName.slice(0, fileName.lastIndexOf(".")); - const payload: ImageMeta = { + const payload: MediaMeta = { url: image2, path: image, name: fileNameNoExtension, @@ -179,8 +179,8 @@ async function checkImages( message: Message, extraReturnTypes: boolean, video: boolean, -): Promise { - let type: ImageMeta | undefined; +): Promise { + let type: MediaMeta | undefined; // first check the embeds if (message.embeds.length !== 0) { @@ -319,7 +319,7 @@ export default async ( extraReturnTypes = false, video = false, singleMessage = false, -): Promise => { +): Promise => { // we start by determining whether or not we're dealing with an interaction or a message if (interaction) { // we can get a raw attachment or a URL in the interaction itself diff --git a/src/utils/types.ts b/src/utils/types.ts index efe9f8da..ae392607 100644 --- a/src/utils/types.ts +++ b/src/utils/types.ts @@ -62,6 +62,7 @@ export interface CommandInfo { } export interface MediaParams { + type: "image"; cmd: string; params: { [key: string]: string | number | boolean;