misc.generate: pretty embeds

This commit is contained in:
Cynthia Foxwell 2022-07-04 19:36:06 -06:00
parent b15bcfbdf3
commit 8f016f7361

View file

@ -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);