Advertisement
Guest User

Untitled

a guest
Jul 19th, 2019
127
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. if (command == 'art' || command == 'artwork' || command == 'fanart' || command == 'fanartwork') {
  2.         if (args[0] == 'submit') {
  3.             var attachmentimg = (msg.attachments.array().length < 1 === false) ? msg.attachments.array() : args[1];
  4.             if ((attachmentimg !== args[1]) ? attachmentimg[0].filesize < 10000000 : true == true) {
  5.                 var __aurl = /https:\/\/cdn\.discordapp\.com\/attachments\/[\s\S]*?\//;
  6.                 var ____i = attachmentimg[0].url;
  7.                 var ___y = `${____i}`.replace(__aurl, "")
  8.                 var ___Y = `${___y}`.replace('/', '--');
  9.                 var _fImg = (attachmentimg !== args[1]) ? `./imgcache/${___Y}` : args[1];
  10.                 var fanartcomment = (_fImg == args[1]) ? args.slice(2, 540).join(' ') : args.slice(1, 540).join(' ');
  11.             } else var fanartcomment = (attachmentimg == args[1]) ? args.slice(2, 540).join(' ') : args.slice(1, 540).join(' ');
  12.             setTimeout(function () {
  13.                 bot.guilds.get('601902117468504088').channels.get('601902220191072277').send(`Cached image: \`${___Y}\``, {
  14.                     file: _fImg
  15.                 }).then(m => {
  16.                     ogmsg = msg.attachments.array()
  17.                     if (ogmsg[0].filesize < 10000000) {
  18.                         __img = m.attachments.array();
  19.                     } else __img = msg.attachments.array();
  20.  
  21.                     var fileExtArrayImg = ['.jpg', '.jpeg', '.png', '.bmp', '.gif', '.webp', '.jif'];
  22.                     var fExtArrayMov = ['.mov', '.mp4', '.avi', '.webm', '.wmv'];
  23.  
  24.                     for (i = 0; i < fileExtArrayImg.length; i++) {
  25.                         for (_i = 0; _i < fExtArrayMov.length; _i++) {
  26.                             if (`${__img[0].url}`.toLowerCase().includes(fileExtArrayImg[i])) { //image
  27.                                 let emb_fanart_submit = new Discord.RichEmbed()
  28.                                     .setAuthor('New fan-art submitted', (!msg.author.avatarURL) ? msg.author.defaultAvatarURL : msg.author.avatarURL, __img[0].url)
  29.                                     .setImage(__img[0].url)
  30.                                     .setDescription(`Submitted by <@${msg.author.id}>.`)
  31.                                     .addField('Comment', (fanartcomment.length < 1 === false) ? fanartcomment : '`No comment.`', false)
  32.                                     .setFooter('If you want to submit your own image, go to the fan-art F.A.Q channel.')
  33.  
  34.                                 bot.channels.get('564945014308995102').send(RichEmbed = emb_fanart_submit);
  35.                                 break;
  36.                             }
  37.  
  38.                             if (`${__img[0].url}`.toLowerCase().includes(fExtArrayMov[i])) {
  39.                                 bot.channels.get('564945014308995102').send(`**New fan-art submitted**\nSubmitted by <@${msg.author.id}>.\n\n**Comment**\n${fanartcomment}\n\n**Video:** ${__img[0].url}`);
  40.                                 break;
  41.                             } else return;
  42.                         }
  43.                     }
  44.                 }).catch(err => console.log(err))
  45.             }, 2200)
  46.         }
  47.     }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement