in src/utils/discord.ts [20:50]
export async function createResponse(
prompt: string,
imageBuffers: Buffer[],
buttonActions: Action[],
context: CustomIdContext
): Promise<BaseMessageOptions> {
const logo = await createLogo();
const composite = await createTiledComposite(imageBuffers, context.width, context.height);
const files = [
new AttachmentBuilder(logo, { name: "logo.png" }),
new AttachmentBuilder(composite, { name: "DALL-E.png" }),
];
const randomPhrase = phrases[Math.floor(Math.random() * phrases.length)];
const embed = new EmbedBuilder()
.setImage("attachment://DALL-E.png")
.setColor("#2ee66b")
.setTitle(randomPhrase)
.setDescription(prompt) // this is always the prompt, other objects read from this directly
.setFooter({
text: "Generated with DALL-E API",
iconURL: "attachment://logo.png",
});
const row = rowFromActions(buttonActions, context);
if (row) {
return { embeds: [embed], files: files, components: [row] };
} else {
return { embeds: [embed], files: files, components: [] };
}
}