Some tweaks
This commit is contained in:
		
							parent
							
								
									5072c6ea10
								
							
						
					
					
						commit
						551c7294b5
					
				
					 5 changed files with 15 additions and 28 deletions
				
			
		| 
						 | 
					@ -10,7 +10,7 @@ class RawCommand extends Command {
 | 
				
			||||||
  }
 | 
					  }
 | 
				
			||||||
 | 
					
 | 
				
			||||||
  static description = "Gets a direct image URL (useful for saving GIFs from sites like Tenor)";
 | 
					  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 = [{
 | 
					  static flags = [{
 | 
				
			||||||
    name: "image",
 | 
					    name: "image",
 | 
				
			||||||
    type: 11,
 | 
					    type: 11,
 | 
				
			||||||
| 
						 | 
					
 | 
				
			||||||
							
								
								
									
										11
									
								
								commands/image-editing/gif.js
									
										
									
									
									
										Normal file
									
								
							
							
						
						
									
										11
									
								
								commands/image-editing/gif.js
									
										
									
									
									
										Normal 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;
 | 
				
			||||||
| 
						 | 
					@ -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;
 | 
					 | 
				
			||||||
| 
						 | 
					@ -23,24 +23,11 @@ Napi::Value ToGif(const Napi::CallbackInfo &info) {
 | 
				
			||||||
    VOption *options = VImage::option()->set("access", "sequential");
 | 
					    VOption *options = VImage::option()->set("access", "sequential");
 | 
				
			||||||
 | 
					
 | 
				
			||||||
    VImage in =
 | 
					    VImage in =
 | 
				
			||||||
        VImage::new_from_buffer(data.Data(), data.Length(), "",
 | 
					        VImage::new_from_buffer(data.Data(), data.Length(), "", options);
 | 
				
			||||||
                                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());
 | 
					 | 
				
			||||||
 | 
					
 | 
				
			||||||
    void *buf;
 | 
					    void *buf;
 | 
				
			||||||
    size_t length;
 | 
					    size_t length;
 | 
				
			||||||
    final.write_to_buffer(
 | 
					    in.write_to_buffer(".gif", &buf, &length);
 | 
				
			||||||
        ("." + type).c_str(), &buf, &length, VImage::option()->set("dither", 0));
 | 
					 | 
				
			||||||
 | 
					
 | 
				
			||||||
    vips_thread_shutdown();
 | 
					    vips_thread_shutdown();
 | 
				
			||||||
 | 
					
 | 
				
			||||||
| 
						 | 
					
 | 
				
			||||||
							
								
								
									
										2
									
								
								shard.js
									
										
									
									
									
								
							
							
						
						
									
										2
									
								
								shard.js
									
										
									
									
									
								
							| 
						 | 
					@ -10,7 +10,7 @@ import { log, error } from "./utils/logger.js";
 | 
				
			||||||
// initialize command loader
 | 
					// initialize command loader
 | 
				
			||||||
import { load, update } from "./utils/handler.js";
 | 
					import { load, update } from "./utils/handler.js";
 | 
				
			||||||
// lavalink stuff
 | 
					// 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
 | 
					// database stuff
 | 
				
			||||||
import database from "./utils/database.js";
 | 
					import database from "./utils/database.js";
 | 
				
			||||||
// command collections
 | 
					// command collections
 | 
				
			||||||
| 
						 | 
					
 | 
				
			||||||
		Loading…
	
	Add table
		Add a link
		
	
		Reference in a new issue