Some tweaks

This commit is contained in:
Essem 2022-06-25 12:45:42 -05:00
parent 5072c6ea10
commit 551c7294b5
No known key found for this signature in database
GPG key ID: 7D497397CC3A2A8C
5 changed files with 15 additions and 28 deletions

View file

@ -10,7 +10,7 @@ class RawCommand extends Command {
}
static description = "Gets a direct image URL (useful for saving GIFs from sites like Tenor)";
static aliases = ["gif", "getgif", "giflink", "imglink", "getimg", "rawgif", "rawimg"];
static aliases = ["giflink", "imglink", "getimg", "rawgif", "rawimg"];
static flags = [{
name: "image",
type: 11,

View file

@ -0,0 +1,11 @@
import ImageCommand from "../../classes/imageCommand.js";
class GIFCommand extends ImageCommand {
static description = "Converts an image into a GIF";
static aliases = ["gif", "getgif", "togif", "tgif", "gifify"];
static noImage = "You need to provide an image to convert to GIF!";
static command = "togif";
}
export default GIFCommand;

View file

@ -1,11 +0,0 @@
import ImageCommand from "../../classes/imageCommand.js";
class ToGIFCommand extends ImageCommand {
static description = "Turns an image into a gif";
static aliases = ["tgif", "gifify"];
static noImage = "You need to provide an image to turn into a GIF!";
static command = "togif";
}
export default ToGIFCommand;

View file

@ -23,24 +23,11 @@ Napi::Value ToGif(const Napi::CallbackInfo &info) {
VOption *options = VImage::option()->set("access", "sequential");
VImage in =
VImage::new_from_buffer(data.Data(), data.Length(), "",
type == "gif" ? options->set("n", -1) : options)
.colourspace(VIPS_INTERPRETATION_sRGB);
if (!in.has_alpha()) in = in.bandjoin(255);
int pageHeight = vips_image_get_page_height(in.get_image());
vector<VImage> img;
img.push_back(in);
VImage final = VImage::arrayjoin(img, VImage::option()->set("across", 1));
final.set(VIPS_META_PAGE_HEIGHT, pageHeight + in.height());
VImage::new_from_buffer(data.Data(), data.Length(), "", options);
void *buf;
size_t length;
final.write_to_buffer(
("." + type).c_str(), &buf, &length, VImage::option()->set("dither", 0));
in.write_to_buffer(".gif", &buf, &length);
vips_thread_shutdown();

View file

@ -10,7 +10,7 @@ import { log, error } from "./utils/logger.js";
// initialize command loader
import { load, update } from "./utils/handler.js";
// lavalink stuff
import { checkStatus, connect, reload, status, connected, manager } from "./utils/soundplayer.js";
import { checkStatus, connect, reload, status, connected } from "./utils/soundplayer.js";
// database stuff
import database from "./utils/database.js";
// command collections