Advertisement
Guest User

Untitled

a guest
Oct 20th, 2019
75
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. if(msg.author.bot) return;
  2.  
  3.     if(msg.channel.name == "screenshots"){
  4.  
  5.         //replace ID with ID for gallery text channel.
  6.         const chl = msg.client.channels.find('id', '634920329491251200');
  7.  
  8.         //for attachments
  9.         if(msg.attachments.size > 0){
  10.             let attachmentsArray = msg.attachments.array();
  11.  
  12.             msg.channel.send("attachment");
  13.             for(let i=0; i<attachmentsArray.length; i++){
  14.                 let fileName = attachmentsArray[i].filename;
  15.                 let fileFormat = fileName.substring(fileName.lastIndexOf('.') + 1, fileName.length);
  16.                 if(fileFormat == "png" || fileFormat == "jpg"){
  17.                     chl.send("", {files: [attachmentsArray[i].url]});
  18.                 }
  19.             }
  20.         }
  21.  
  22.         //for embeds
  23.         if(msg.embeds.length > 0){
  24.             let embedsArray = msg.embeds;
  25.  
  26.             msg.channel.send("embed");
  27.             for(let i=0; i<embedsArray.length; i++){
  28.                 if(embedsArray[i].type == "image"){
  29.                     chl.send("", {files: [embedsArray[i].url]});
  30.                 }
  31.             }
  32.         }
  33.     }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement