Advertisement
ninja-gen

Untitled

Nov 18th, 2019
137
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. this.message = message => {
  2.         const split = message.cleanContent.split(" "),
  3.               command = split[0];
  4.  
  5.         if (message.channel.type == "dm") return;
  6.  
  7.         if (command == "-gen") {
  8.             if(message.author.id === "11"){
  9.                 return message.author.send("You have been banned from using VocGen. Pm gz#8851 with why you want to be unbanned.");
  10.             }
  11.             message.delete().catch(err => undefined);
  12.             if (!split[1]) return post(message, "You must provide a category!");
  13.             const category = database.get(split[1].toLowerCase(), true);
  14.             if (!category) return post(message, "Category Does Not Exist");
  15.             if (category.data.length == 0) return post(message, "Category Empty");
  16.  
  17.             const cdi = handler.cooldown.findIndex(x => x.id == message.author.id);
  18.             if (cdi != -1) return post(message, `Please wait **${Math.abs(Math.floor(60 - ((new Date().getTime() - handler.cooldown[cdi].time.getTime()) / 1000)))}s** before using that again!`);
  19.            
  20.             const new_index = handler.cooldown.push({id: message.author.id, time: new Date()});
  21.             const to_splice = handler.cooldown[new_index];
  22.  
  23.             setTimeout(() => handler.cooldown.splice(handler.cooldown.indexOf(to_splice), 1), 60000);
  24.  
  25.             const data = database.pull(split[1].toLowerCase());
  26.             database.save();
  27.            
  28.             post(message, "Generating...");
  29.  
  30.             clicksify(data).then(response => {
  31.                 response = JSON.parse(response);
  32.                 if (response.status != 'success') return post(message, "There was an issue grabbing the account...");
  33.                 const embed = generate(message, `Your ${category.name} account data is available [**HERE**](${data})`);
  34.                 message.member.send(embed).then(linked => {
  35.       const message = message.channel.send;
  36.  
  37.         message.channel.send(`Your ${category.name} account data is available [**HERE**](${linked.url})`)
  38. .then(msg =>
  39. msg.delete(30000)
  40. })
  41.  
  42.                     console.log(`${message.author.tag} has generated an account with the category ${category.name}`);
  43.                     const log = new Discord.RichEmbed();
  44.                     log.setFooter(message.author.tag, message.author.avatarURL || message.author.defaultAvatarURL);
  45.                     log.setTitle("Account Generated");
  46.                     log.addField("Category", category.name[0].toUpperCase() + category.name.substring(1), true);
  47.                     log.addField("Server", message.member.guild.name, true);
  48.                     log.setColor("#36393F");
  49.                     const log_channel = client.channels.get('588585916642099210');
  50.                     if (log_channel) log_channel.send(log);
  51.                 }).catch(() => undefined);
  52.             });
  53.         };
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement