images dont appear
when i put an attachment using
AttachmentBuilderAttachmentBuilder in to the files: []files: []part of a message it appears in discord as something i have to download. im trying to embed it right into discord. code: const { SlashCommandBuilder, AttachmentBuilder } = require("discord.js");
const { OpenAI } = require("openai");
const data = new SlashCommandBuilder()
.setName("imagine")
.setDescription("Uses AI to generate images!")
.addStringOption((option) =>
option
.setName("prompt")
.setDescription("Describe what you'd like to generate...")
.setRequired(true)
);
module.exports = {
data: data,
async execute(interaction) {
let generateMessage = await interaction.reply("Generating...");
const openai = new OpenAI();
await openai.images
.generate({
prompt: interaction.options.getString("prompt"),
})
.then(async (image) => {
await generateMessage.delete();
/*
await interaction.channel.send(
`${interaction.user}! We just finished generating your image! It can be viewed at the following link: ${image.data[0].url}`
);
*/
await interaction.channel.send({
content: `${interaction.user}! We just finished generating your image!`,
files: [{ attachment: image.data[0].url }],
});
});
},
};const { SlashCommandBuilder, AttachmentBuilder } = require("discord.js");
const { OpenAI } = require("openai");
const data = new SlashCommandBuilder()
.setName("imagine")
.setDescription("Uses AI to generate images!")
.addStringOption((option) =>
option
.setName("prompt")
.setDescription("Describe what you'd like to generate...")
.setRequired(true)
);
module.exports = {
data: data,
async execute(interaction) {
let generateMessage = await interaction.reply("Generating...");
const openai = new OpenAI();
await openai.images
.generate({
prompt: interaction.options.getString("prompt"),
})
.then(async (image) => {
await generateMessage.delete();
/*
await interaction.channel.send(
`${interaction.user}! We just finished generating your image! It can be viewed at the following link: ${image.data[0].url}`
);
*/
await interaction.channel.send({
content: `${interaction.user}! We just finished generating your image!`,
files: [{ attachment: image.data[0].url }],
});
});
},
};