Condensed some commands, fixed a bug with motivate, updated packages
This commit is contained in:
		
							parent
							
								
									c4c01d8620
								
							
						
					
					
						commit
						1da0d24602
					
				
					 8 changed files with 161 additions and 104 deletions
				
			
		| 
						 | 
				
			
			@ -11,8 +11,8 @@ exports.run = async (message, args) => {
 | 
			
		|||
  const size = await gm(image.path).sizePromise();
 | 
			
		||||
  const output = await gm().out("-size", `${size.width}x`).background("white").fill("black").font("./assets/caption.otf", size.width / 10).gravity("Center").out(`caption:${args.join(" ")}`).bufferPromise("png");
 | 
			
		||||
  const size2 = await gm(output).sizePromise();
 | 
			
		||||
  const output2 = await gm(output).gravity("Center").trim().out("+repage").extent(size.width, size2.height + (size.width / 10)).streamPromise();
 | 
			
		||||
  const outputFinal = await gm(output2).out("-alpha", "set").background("none").out("(").out(image.path).out("-coalesce").out(")").colorspace("sRGB").out("-set", "page", "%[fx:u.w]x%[fx:u.h+v.h]+%[fx:t?(u.w-v.w)/2:0]+%[fx:t?u.h:0]").out("-coalesce").out("null:").out("-insert", 1).out("-layers", "composite").bufferPromise(image.type);
 | 
			
		||||
  //const output2 = await gm(output).gravity("Center").trim().out("+repage").extent(size.width, size2.height + (size.width / 10)).streamPromise();
 | 
			
		||||
  const outputFinal = await gm(output).in("(").gravity("Center").trim().out("+repage").extent(size.width, size2.height + (size.width / 10)).out(")").background("white").out("-alpha", "set").out("(").out(image.path).out("-coalesce").out(")").colorspace("sRGB").out("-set", "page", "%[fx:u.w]x%[fx:u.h+v.h]+%[fx:t?(u.w-v.w)/2:0]+%[fx:t?u.h:0]").out("-coalesce").out("null:").out("-insert", 1).out("-layers", "composite").bufferPromise(image.type);
 | 
			
		||||
  await processMessage.delete();
 | 
			
		||||
  //return upload(message, outputFinal, `caption.${image.type}`);
 | 
			
		||||
  return message.channel.createMessage("", {
 | 
			
		||||
| 
						 | 
				
			
			
 | 
			
		|||
| 
						 | 
				
			
			@ -7,10 +7,8 @@ exports.run = async (message) => {
 | 
			
		|||
  const image = await require("../utils/imagedetect.js")(message);
 | 
			
		||||
  if (image === undefined) return `${message.author.mention}, you need to provide an image to mirror!`;
 | 
			
		||||
  const data = `/tmp/${Math.random().toString(36).substring(2, 15)}.miff`;
 | 
			
		||||
  const data2 = `/tmp/${Math.random().toString(36).substring(2, 15)}.miff`;
 | 
			
		||||
  await gm(image.path).coalesce().gravity("West").crop("50%", 0).out("+repage").writePromise(data2);
 | 
			
		||||
  await gm(data2).flop().writePromise(data);
 | 
			
		||||
  const buffer = await gm(data2).extent("%[fx:u.w*2]", "%[fx:u.h]").out("null:").out(data).gravity("East").out("-layers", "Composite").bufferPromise(image.type);
 | 
			
		||||
  await gm(image.path).coalesce().gravity("West").crop("50%", 0).out("+repage").writePromise(data);
 | 
			
		||||
  const buffer = await gm(data).extent("%[fx:u.w*2]", "%[fx:u.h]").out("null:").out("(").out(data).flop().out(")").gravity("East").out("-layers", "Composite").bufferPromise(image.type);
 | 
			
		||||
  return message.channel.createMessage("", {
 | 
			
		||||
    file: buffer,
 | 
			
		||||
    name: `haah.${image.type}`
 | 
			
		||||
| 
						 | 
				
			
			
 | 
			
		|||
| 
						 | 
				
			
			@ -7,12 +7,10 @@ exports.run = async (message) => {
 | 
			
		|||
  const image = await require("../utils/imagedetect.js")(message);
 | 
			
		||||
  if (image === undefined) return `${message.author.mention}, you need to provide an image to mirror!`;
 | 
			
		||||
  const data = `/tmp/${Math.random().toString(36).substring(2, 15)}.miff`;
 | 
			
		||||
  const data2 = `/tmp/${Math.random().toString(36).substring(2, 15)}.miff`;
 | 
			
		||||
  const size = await gm(image.path).sizePromise();
 | 
			
		||||
  await gm(image.path).coalesce().gravity("South").crop(0, "50%").out("+repage").writePromise(data2);
 | 
			
		||||
  await gm(data2).flip().writePromise(data);
 | 
			
		||||
  await gm(image.path).coalesce().gravity("South").crop(0, "50%").out("+repage").writePromise(data);
 | 
			
		||||
  // const buffer = await gm(data2).extent("%[fx:u.w]", "%[fx:u.h*2]").out("null:").out(data).gravity("North").out("-layers", "Composite").bufferPromise(image.type);
 | 
			
		||||
  const buffer = await gm(data2).extent(size.width, size.height).out("null:").out(data).geometry(`+0+${size.height / 2}`).out("-layers", "Composite").bufferPromise(image.type);
 | 
			
		||||
  const buffer = await gm(data).extent(size.width, size.height).out("null:").out("(").out(data).flip().out(")").geometry(`+0+${size.height / 2}`).out("-layers", "Composite").bufferPromise(image.type);
 | 
			
		||||
  return message.channel.createMessage("", {
 | 
			
		||||
    file: buffer,
 | 
			
		||||
    name: `hooh.${image.type}`
 | 
			
		||||
| 
						 | 
				
			
			
 | 
			
		|||
| 
						 | 
				
			
			@ -7,9 +7,7 @@ exports.run = async (message) => {
 | 
			
		|||
  if (image === undefined) return `${message.author.mention}, you need to provide an image to add some magik!`;
 | 
			
		||||
  if (image.type === "gif") return `${message.author.mention}, this command doesn't work with GIFs!`;
 | 
			
		||||
  const processMessage = await message.channel.createMessage("<a:processing:479351417102925854> Processing... This might take a while");
 | 
			
		||||
  const stream = await gm(image.path).coalesce().resize(600, 600).streamPromise("miff");
 | 
			
		||||
  const stream2 = await gm(stream).out("-liquid-rescale", "300x300").streamPromise();
 | 
			
		||||
  const resultBuffer = await gm(stream2).out("-liquid-rescale", "800x800").bufferPromise(image.type);
 | 
			
		||||
  const resultBuffer = await gm(image.path).in("(").in("(").coalesce().resize(600, 600).out(")").out("-liquid-rescale", "300x300").out(")").out("-liquid-rescale", "800x800").bufferPromise(image.type);
 | 
			
		||||
  await processMessage.delete();
 | 
			
		||||
  return message.channel.createMessage("", {
 | 
			
		||||
    file: resultBuffer,
 | 
			
		||||
| 
						 | 
				
			
			
 | 
			
		|||
| 
						 | 
				
			
			@ -16,12 +16,12 @@ exports.run = async (message, args) => {
 | 
			
		|||
  const size2 = await gm(file).sizePromise();
 | 
			
		||||
  await gm().background("black").out("-size", "600").fill("white").font("Times").pointSize(56).gravity("Center").out(`pango:${topText.replace(/&/g, "\\&").replace(/>/g, "\\>").replace(/</g, "\\<").replace(/"/g, "\\"").replace(/'/g, "\\'")}`).gravity("South").out("-splice", bottomText ? "0x0" : "0x20").writePromise(text);
 | 
			
		||||
  const size3 = await gm(text).sizePromise();
 | 
			
		||||
  const command2 = gm(file).gravity("North").coalesce().background("black").extent(600, size2.height + size3.height).out("null:", "(", text, "-set", "page", `+0+${size2.height}`, ")", "-layers", "composite", "-layers", "optimize");
 | 
			
		||||
  const command2 = gm(file).gravity("North").coalesce().extent(600, size2.height + size3.height).out("null:", "(", text, "-set", "page", `+0+${size2.height}`, ")", "-layers", "composite", "-layers", "optimize");
 | 
			
		||||
  let resultBuffer;
 | 
			
		||||
  if (bottomText) {
 | 
			
		||||
    await gm().background("black").out("-size", "600").fill("white").font("Times").pointSize(28).gravity("Center").out(`pango:${bottomText.replace(/&/g, "\\&").replace(/>/g, "\\>").replace(/</g, "\\<").replace(/"/g, "\\"").replace(/'/g, "\\'")}`).gravity("South").out("-splice", "0x20").writePromise(text2);
 | 
			
		||||
    const size4 = await gm(text2).sizePromise();
 | 
			
		||||
    resultBuffer = await gm(await command2.bufferPromise(image.type)).gravity("North").coalesce().background("black").extent(600, size2.height + size3.height + size4.height).out("null:", "(", text2, "-set", "page", `+0+${size2.height + size3.height}`, ")", "-layers", "composite", "-layers", "optimize").bufferPromise(image.type);
 | 
			
		||||
    resultBuffer = await gm(await command2.bufferPromise(image.type)).gravity("North").coalesce().extent(600, size2.height + size3.height + size4.height).out("null:", "(", text2, "-set", "page", `+0+${size2.height + size3.height}`, ")", "-layers", "composite", "-layers", "optimize").bufferPromise(image.type);
 | 
			
		||||
  } else {
 | 
			
		||||
    resultBuffer = await command2.bufferPromise(image.type);
 | 
			
		||||
  }
 | 
			
		||||
| 
						 | 
				
			
			
 | 
			
		|||
		Loading…
	
	Add table
		Add a link
		
	
		Reference in a new issue