title: How to log deleted images with a discord bot
body: <p>I have been spending hours trying to get this code to log deleted images but everything I have tried its been nothing but fails, it logs deleted messages but images it just ignores completely.</p>
  
  <p>Can someone please point me in the right direction on how to fix this issue, please. Any help is very much appreciated</p>
  
  <pre><code>const Discord = require('discord.js')
  module.exports = async (client, message) =&gt; {
  
      if (!message.guild) return;
      if (!message.content) return;
      const logs = message.guild.channels.find(c =&gt; c.name === '420-logs');
  
      if (!logs) {
          return console.log(`[WARN]: The Delete Logs channel does not exist in the server named '${message.guild.name}'`)
      }
  
      if (message.attachments.size &gt; 0) { // If I change this to: message.attachments.size&gt;0 &amp;&amp; message it works with deleted image &amp; text but as it is without this said line it doesn't function
  
          var Attachment = (message.attachments).array();
  
          Attachment.forEach(function(attachment) {
              const logembed = new Discord.RichEmbed()
  
                  .setAuthor(message.author.tag, message.author.displayAvatarURL)
                  .setDescription(`**Image sent by ${message.author.tag} deleted in &lt;#${message.channel.id}&gt;**`)
                  .setImage(attachment.proxyURL)
  
                  .setColor(message.guild.member(client.user).displayHexColor)
  
                  .setFooter(`Deleted Image`)
                  .setTimestamp()
  
              logs.send(logembed);
              console.log(attachment.proxyURL);
          })
      } else {
          const logembed = new Discord.RichEmbed()
              //.setTitle('Message Deleted')
              .setAuthor(message.author.tag, message.author.displayAvatarURL)
              .setDescription(`**Message sent by ${message.author.tag} deleted in &lt;#${message.channel.id}&gt;**`)
              .addField("Message Content", `${message.content}`)
  
              .setColor(message.guild.member(client.user).displayHexColor)
  
              .setFooter(`Deleted Message`)
              .setTimestamp()
  
          logs.send(logembed);
  
      }
  }
  </code></pre>