From 9d7ba365c83ac826bb01b47b8c7a21012fd89adb Mon Sep 17 00:00:00 2001 From: Essem Date: Wed, 8 Jun 2022 12:17:57 -0500 Subject: [PATCH] Fix delay bug on jpeg/deepfry, remove mc/blurple --- commands/fun/mc.js | 21 --------------------- commands/image-editing/blurple.js | 28 ---------------------------- natives/colors.cc | 4 +--- natives/deepfry.cc | 2 +- natives/jpeg.cc | 2 +- 5 files changed, 3 insertions(+), 54 deletions(-) delete mode 100644 commands/fun/mc.js delete mode 100644 commands/image-editing/blurple.js diff --git a/commands/fun/mc.js b/commands/fun/mc.js deleted file mode 100644 index 6e97c12..0000000 --- a/commands/fun/mc.js +++ /dev/null @@ -1,21 +0,0 @@ -import fetch from "node-fetch"; -import Command from "../../classes/command.js"; - -class MCCommand extends Command { - async run() { - if (this.args.length === 0) return "You need to provide some text to generate a Minecraft achievement!"; - await this.acknowledge(); - const request = await fetch(`https://www.minecraftskinstealer.com/achievement/a.php?i=13&h=Achievement+get%21&t=${encodeURIComponent(this.args.join("+"))}`); - return { - file: Buffer.from(await request.arrayBuffer()), - name: "mc.png" - }; - } - - static description = "Generates a Minecraft achievement image"; - static aliases = ["ach", "achievement", "minecraft"]; - static arguments = ["[text]"]; - static slashAllowed = false; -} - -export default MCCommand; \ No newline at end of file diff --git a/commands/image-editing/blurple.js b/commands/image-editing/blurple.js deleted file mode 100644 index e4b39dc..0000000 --- a/commands/image-editing/blurple.js +++ /dev/null @@ -1,28 +0,0 @@ -import ImageCommand from "../../classes/imageCommand.js"; - -class BlurpleCommand extends ImageCommand { - params() { - return { - old: !!this.specialArgs.old, - color: "blurple" - }; - } - - static description = "Turns an image blurple"; - - static init() { - super.init(); - this.flags.push({ - name: "old", - description: "Use the old blurple color", - type: 5 - }); - return this; - } - - static noImage = "You need to provide an image/GIF to make blurple!"; - static command = "colors"; - static aliases = ["blurp"]; -} - -export default BlurpleCommand; diff --git a/natives/colors.cc b/natives/colors.cc index 3ed02c1..f22c4ba 100644 --- a/natives/colors.cc +++ b/natives/colors.cc @@ -26,9 +26,7 @@ Napi::Value Colors(const Napi::CallbackInfo &info) { VImage out; - if (color == "blurple") { - out = in; - } else if (color == "grayscale") { + if (color == "grayscale") { out = in.colourspace(VIPS_INTERPRETATION_B_W); } else if (color == "sepia") { out = in.flatten().recomb(sepia); diff --git a/natives/deepfry.cc b/natives/deepfry.cc index 02d22c7..f59fe23 100644 --- a/natives/deepfry.cc +++ b/natives/deepfry.cc @@ -32,7 +32,7 @@ Napi::Value Deepfry(const Napi::CallbackInfo &info) { VImage::option()->set("Q", 1)->set("strip", true)); VImage final = VImage::new_from_buffer(jpgBuf, jpgLength, ""); final.set(VIPS_META_PAGE_HEIGHT, page_height); - final.set("delay", fried.get_array_int("delay")); + if (type == "gif") final.set("delay", fried.get_array_int("delay")); void *buf; size_t length; diff --git a/natives/jpeg.cc b/natives/jpeg.cc index fb5dde6..512baf2 100644 --- a/natives/jpeg.cc +++ b/natives/jpeg.cc @@ -35,7 +35,7 @@ Napi::Value Jpeg(const Napi::CallbackInfo &info) { VImage::option()->set("Q", quality)->set("strip", true)); VImage final = VImage::new_from_buffer(jpgBuf, jpgLength, ""); final.set(VIPS_META_PAGE_HEIGHT, page_height); - final.set("delay", in.get_array_int("delay")); + if (type == "gif") final.set("delay", in.get_array_int("delay")); void *buf; size_t length;