title: How do I edit an image inside an embed discord?
body: <p>Is it possible to change an image inside an embed? I'm trying to recreate an &quot;etch-a-sketch&quot; bot I saw on reddit and was wondering how it was done. Here's what I tried so far:
  This is inside the function that makes the image:</p>
  <pre class="lang-js prettyprint-override"><code>//code that draws the etch-a-sketch
  const etchembed = new Discord.MessageEmbed()
      .setAuthor(`${message.author.username}`, `${message.author.displayAvatarURL()}`)
      .setTitle(' Etch-A-Sketch ')
      .setColor(&quot;#f66868&quot;)
      .setFooter(`${client.user.username}`, `${client.user.displayAvatarURL()}`)
      //n is a variable that increases by 1 every time the function is run
      .attachFiles([new Discord.MessageAttachment(canvas.toBuffer(), `etch${n}.png`)])
      .setImage(`attachment://etch${n}.png`)
      .setTimestamp();
  return etchembed
  </code></pre>
  <p>In the main command file I do this after awaiting for a return from the function:</p>
  <pre><code>message.edit(newetchembed)
  </code></pre>
  <p>All this does is move the image outside of the embed. Am I doing something wrong?</p>
  <p><strong>Edit 1:</strong></p>
  <p>I tried changing message.edit(...) to message.channel.send(...) and it sends a new embed with the right image just fine. When I try to use message.edit, it just moves the image outside of the embed for some reason.</p>
  <p><strong>Edit 2:</strong></p>
  <p>I did some more testing and I'm starting to think it's just something wrong with discord or discord.js. This is due to the fact that when I log the file attachments and the image, everything works as it should:</p>
  <pre><code>embed 1: [
    MessageAttachment {
      attachment: &lt; Buffer 89 50 4e 47 0 d 0 a 1 a 0 a 00 00 00 0 d 49 48 44 52 00 00 01 94 00 00 01 2 c 08 06 00 00 00 e4 5 c 45 b8 00 00 00 06 62 4 b 47 44 00 ff 00 ff 00 ff a0 bd a7...1167 more bytes &gt; ,
      name: 'etch_1595840597644.png'
    }
  ] {
    url: 'attachment://etch_1595840597644.png'
  }
  embed 2: [
    MessageAttachment {
      attachment: &lt; Buffer 89 50 4e 47 0 d 0 a 1 a 0 a 00 00 00 0 d 49 48 44 52 00 00 01 94 00 00 01 2 c 08 06 00 00 00 e4 5 c 45 b8 00 00 00 06 62 4 b 47 44 00 ff 00 ff 00 ff a0 bd a7...1167 more bytes &gt; ,
      name: 'etch_1595840607390.png'
    }
  ] {
    url: 'attachment://etch_1595840607390.png'
  }
  </code></pre>
  <p>As you can see, the message embeds have different image attachments, so I'm not sure why it just moves the original image outside of the embed instead of attaching a new one. <a href="https://i.stack.imgur.com/95OfN.png" rel="nofollow noreferrer">This is what it looks like.</a></p>
  <p>Another thing is that it sends the right image when I send a new message instead of editing.</p>