Mr-KayJayDee / discord-image-generation

Moved to a new repository
https://git.mrkayjaydee.xyz/Mr-KayJayDee/discord-image-generation
53 stars 13 forks source link

Is there a way to put the image on a embed? Cause it shows an error for me #15

Closed Aikoo08 closed 3 years ago

Mr-KayJayDee commented 3 years ago

Hello, to put your image into an embed you need first of all to generate the image and have it in a variable.

Then this code should work (discord.js v12)

let embed = new Discord.MessageEmbed()
    .setImage(`attachment://REPLACE_BY_IMAGE_NAME.png`).attachFiles([{ attachment: REPLACE_BY_IMAGE_VARIABLE, name: `REPLACE_BY_IMAGE_NAME.png`}]);
message.channel.send(embed);

Make sure that both names in the setImage and attachFiles are the same or it will just not work.

Feel free to ask me if you need more help on it.

Aikoo08 commented 3 years ago

Thank you