Home > database >  Djs interaction sending attachment separately from embed
Djs interaction sending attachment separately from embed

Time:10-13

I'm trying to make my message look like this, but as a result of interaction.reply I get this instead.

Here is my code:

fs.readdir("./pics", (error, files) => {
if (error) return console.log(error)
const num = (Math.floor(Math.random() * files.length) 1).toString();

const imagembed = new Discord.MessageEmbed()
.setTitle("Some cute pic for you!")
.setColor("#980002")
.setFooter("Requested by "   interaction.member.user.tag);
interaction.reply({ embeds: [imagembed], files: [`./pics/${num}.jpg`]})
})

Any ideas how to fix it?

CodePudding user response:

Try this:

fs.readdir("./pics", (error, files) => {
  if (error) return console.log(error)
  const num = (Math.floor(Math.random() * files.length)   1).toString();

  const imagembed = new Discord.MessageEmbed()
    .setTitle("Some cute pic for you!")
    .setColor("#980002")
    .setFooter("Requested by "   interaction.member.user.tag)
    .setImage(`attachment://${num}.jpg`);
  interaction.reply({ embeds: [imagembed], files: [`./pics/${num}.jpg`] })
})
  • Related