Ledger Nano X - The secure hardware wallet
SHARE
TWEET

server security

a guest Mar 31st, 2020 86 Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. const Discord = require('discord.js');
  2. const client = new Discord.Client();
  3.  
  4. var config = {
  5.   events: [
  6.     {type: "CHANNEL_CREATE", logType: "CHANNEL_CREATE", limit: 4 , delay: 5000},
  7.     {type: "CHANNEL_DELETE", logType: "CHANNEL_DELETE", limit: 4, delay: 5000},
  8.     {type: "GUILD_MEMBER_REMOVE", logType: "MEMBER_KICK", limit: 4, delay: 5000},
  9.     {type: "GUILD_BAN_ADD", logType: "MEMBER_BAN_ADD", limit: 4, delay: 5000},
  10.     {type: "GUILD_ROLE_CREATE", logType: "ROLE_CREATE", limit: 5, delay: 5000},
  11.     {type: "GUILD_ROLE_DELETE", logType: "ROLE_DELETE", limit: 4, delay: 5000},
  12.   ]
  13. }
  14. client.on("error", (e) => console.error(e));
  15. client.on("raw", (packet)=> {
  16.   let {t, d} = packet, type = t, {guild_id} = data = d || {};
  17.   if (type === "READY") {
  18.     client.startedTimestamp = new Date().getTime();
  19.     client.captures = [];
  20.   }
  21.   let event = config.events.find(anEvent => anEvent.type === type);
  22.   if (!event) return;
  23.   let guild = client.guilds.get(guild_id);
  24.   if (!guild) return;
  25.   guild.fetchAuditLogs({limit : 1, type: event.logType})
  26.     .then(eventAudit => {
  27.       let eventLog = eventAudit.entries.first();
  28.       if (!eventLog) return;
  29.       let executor = eventLog.executor;
  30.       guild.fetchAuditLogs({type: event.logType, user: executor})
  31.         .then((userAudit, index) => {
  32.           let uses = 0;
  33.           userAudit.entries.map(entry => {
  34.             if (entry.createdTimestamp > client.startedTimestamp && !client.captures.includes(index)) uses += 1;
  35.           });
  36.           setTimeout(() => {
  37.             client.captures[index] = index
  38.           }, event.delay || 2000)
  39.           if (uses >= event.limit) {
  40.             client.emit("reachLimit", {
  41.               user: userAudit.entries.first().executor,
  42.               member: guild.members.get(executor.id),
  43.               guild: guild,
  44.               type: event.type,
  45.             })
  46.           }
  47.         }).catch(console.error)
  48.     }).catch(console.error)
  49. });
  50. client.on("reachLimit", (limit)=> {
  51.   let log = limit.guild.channels.find( channel => channel.name === "security-log");
  52.   log.send(limit.user.username+"\**@everyone سيرفر بيتهكر ! ** ");
  53.   limit.guild.owner.send(limit.user.username+"\**@everyone سيرفرك بيتهكر ! ** ")
  54.   limit.member.roles.map(role => {
  55.     limit.member.removeRole(role.id)
  56.     .catch(log.send)
  57.   });
  58. });
RAW Paste Data
We use cookies for various purposes including analytics. By continuing to use Pastebin, you agree to our use of cookies as described in the Cookies Policy. OK, I Understand
Top