From eb944dd1d38987481dec102e9218af8ce07599bc Mon Sep 17 00:00:00 2001 From: derpystuff <3515180-derpystuff@users.noreply.gitlab.com> Date: Sun, 14 Jan 2024 17:42:44 +0100 Subject: [PATCH] support multiple images --- commands/message/genai/wallpaper.js | 28 +++++++++++++++++++++++++++- 1 file changed, 27 insertions(+), 1 deletion(-) diff --git a/commands/message/genai/wallpaper.js b/commands/message/genai/wallpaper.js index e7eefc2..1164b6a 100644 --- a/commands/message/genai/wallpaper.js +++ b/commands/message/genai/wallpaper.js @@ -50,7 +50,33 @@ module.exports = { await editOrReply(context, createEmbed("ai", context, "Generating Image...")) 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, { embeds:[createEmbed("defaultNoFooter", context, {