support multiple images

This commit is contained in:
derpystuff 2024-01-14 17:42:44 +01:00
parent 10106fe095
commit eb944dd1d3

View file

@ -50,7 +50,33 @@ module.exports = {
await editOrReply(context, createEmbed("ai", context, "Generating Image...")) await editOrReply(context, createEmbed("ai", context, "Generating Image..."))
let res = await aiWallpaper(context, args.text, args.style.toLowerCase()); let res = await aiWallpaper(context, args.text, args.style.toLowerCase());
let imgName = `lcwp.${Date.now().toString(36)}.jpeg`;
// Construct Embeds
let files = [];
let embeds = res.response.body.images.map((i)=>{
let imgName = `lcwp.${Date.now().toString(36)}.jpeg`;
files.push({
filename: imgName,
value: Buffer.from(i, 'base64')
})
return createEmbed("defaultNoFooter", context, {
url: "https://bignutty.gitlab.io",
author: {
iconUrl: STATIC_ICONS.ai_image,
name: stringwrap(args.text, 50, false),
},
image: {
url: `attachment://${imgName}`
},
footer: {
text: `Generative AI is experimental • Use AI Images responsibly.`
}
})
});
return editOrReply(context, {embeds, files})
return editOrReply(context, { return editOrReply(context, {
embeds:[createEmbed("defaultNoFooter", context, { embeds:[createEmbed("defaultNoFooter", context, {