misc.generate: pretty embeds
This commit is contained in:
		
							parent
							
								
									b15bcfbdf3
								
							
						
					
					
						commit
						8f016f7361
					
				
					 1 changed files with 18 additions and 7 deletions
				
			
		| 
						 | 
					@ -419,16 +419,27 @@ generate.callback = async function (msg, line) {
 | 
				
			||||||
  }
 | 
					  }
 | 
				
			||||||
 | 
					
 | 
				
			||||||
  const data = await request.json();
 | 
					  const data = await request.json();
 | 
				
			||||||
  const images = data.images.map((img) => Buffer.from(img, "base64"));
 | 
					  const images = data.images
 | 
				
			||||||
 | 
					    .map((img) => Buffer.from(img, "base64"))
 | 
				
			||||||
 | 
					    .map((img, index) => ({file: img, name: `${index}.jpg`}));
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					  const title = `Responses for "${safeString(line)}"`;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					  const out = {
 | 
				
			||||||
 | 
					    embeds: [],
 | 
				
			||||||
 | 
					    file: images,
 | 
				
			||||||
 | 
					  };
 | 
				
			||||||
 | 
					
 | 
				
			||||||
  for (const index in images) {
 | 
					  for (const index in images) {
 | 
				
			||||||
    const img = images[index];
 | 
					    out.embeds.push({
 | 
				
			||||||
    await msg.channel.createMessage(
 | 
					      title,
 | 
				
			||||||
      `Response ${Number(index) + 1} for \`${safeString(line)}\`:`,
 | 
					      url: "https://www.craiyon.com",
 | 
				
			||||||
      {file: img, name: `${index}.jpg`}
 | 
					      image: {
 | 
				
			||||||
    );
 | 
					        url: `attachment://${index}.jpg`,
 | 
				
			||||||
 | 
					      },
 | 
				
			||||||
 | 
					    });
 | 
				
			||||||
  }
 | 
					  }
 | 
				
			||||||
 | 
					
 | 
				
			||||||
  return null;
 | 
					  return out;
 | 
				
			||||||
};
 | 
					};
 | 
				
			||||||
hf.registerCommand(generate);
 | 
					hf.registerCommand(generate);
 | 
				
			||||||
| 
						 | 
					
 | 
				
			||||||
		Loading…
	
	Add table
		Add a link
		
	
		Reference in a new issue