SHARE
TWEET

Untitled

a guest Apr 21st, 2019 68 Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. lient.on('message', async message => {
  2.     if(message.content.startsWith(prefix + "id")) {
  3.     let mem = message.mentions.members.first() || message.member;
  4.     let auth = message.mentions.users.first() || message.author;
  5.     const imageUrlRegex = /\?size=2048$/g;
  6.     const name = mem.displayName.length > 10 ? mem.displayName.substring(0, 11) + "..." : mem.displayName;
  7.  
  8.     const { body: ava } = await get(auth.displayAvatarURL.replace(imageUrlRegex, "?size=128"));
  9.    
  10.     const img = await readFile("./id_1.png");
  11.     const millis = new Date().getTime() - auth.createdAt.getTime();
  12.     const now = new Date();
  13.     const createdAt = millis / 1000 / 60 / 60 / 24;
  14.     const millisj = new Date().getTime() - mem.joinedAt.getTime();
  15.     const joinedAt = millisj / 1000 / 60 / 60 / 24;
  16.    
  17.         if(!inv[mem.id+message.guild.id]) inv[mem.id+message.guild.id] = {
  18.             inviter: "Not stored in database",
  19.             totalSecs: 0
  20.         }
  21.  
  22.         fs.writeFile("./userD.json", JSON.stringify(inv), function(err) {
  23.             if(err) throw err;
  24.         });
  25.     // Invites
  26.     const guildInvites = await message.guild.fetchInvites();
  27.     let invites = 0;
  28.     guildInvites.forEach(i => {
  29.         if(i.inviter.id === auth.id) {
  30.             invites += i.uses;
  31.         }
  32.     }) // اصلا البوت معاه انفايتات؟؟؟؟
  33.     // Inviter
  34.    
  35.     let inviter =client.users.get(inv[mem.id+message.guild.id].inviter);
  36.    
  37.         const { body: bot } = await get(message.guild.iconURL.replace(imageUrlRegex, "?size=128"));
  38.  
  39.  
  40.     let canvas = new Canvas(417, 181)
  41.     .addImage(img, 0, 0, 417, 181)
  42.     .addRoundImage(bot, 7, 1, 29, 29, 25)
  43.     .setShadowColor("rgba(22, 22, 22, 1)") // This is a nice colour for a shadow.
  44.     .setShadowOffsetY(3) // Drop the shadow by 5 pixels.
  45.   .setShadowBlur(03) // Blur the shadow by 10.
  46.   .save()
  47.     .addRoundImage(ava, 320, 55, 78, 78, 39)
  48.     .setTextAlign("center")
  49.     .setTextFont("8pt Cairo")
  50.     .setColor((mem.highestRole.hexColor === "#000000") ? "#ffffff" : mem.highestRole.hexColor)
  51.     .addText(name, 360, 162)
  52.     .setColor("#FFFFFF")
  53.     .addText(createdAt.toFixed(), 192, 77)
  54.     .addText((joinedAt.toFixed().length >= 3) ? joinedAt.toFixed() : joinedAt.toFixed() + "D", 257.5, 77)
  55.     .addText("voc", 195, 130)
  56.     .addText("tex", 258, 130)
  57.     .addText(`${inv[mem.id+message.guild.id].totalSecs} Sec`, 205, 163)
  58.     .addText((invites === 1 || invites === 0 ) ? invites + " Member" : invites + " Members", 120, 128)
  59.     .addText((inviter) ? inviter.username : "Not stored", 110, 77)
  60.     if(inviter) {
  61.             const { body: buffer } = await get(inviter.avatarURL.replace(imageUrlRegex, "?size=128"))
  62.  
  63.         canvas.addRoundImage(buffer, 14, 59, 30, 30, 15)
  64.  
  65.     }
  66.    
  67.     //.addText("Joined at: ", 120, 100)
  68.     message.channel.send({ file: canvas.toBuffer()})
  69.     }
  70. })
  71.  
  72. client.on('voiceStateUpdate', (o, n) => {
  73.     if(n.user.bot) return;
  74.     int(o, n);
  75.    
  76. })
  77. function int(o, n) {
  78.     var inter = setInterval(() => {
  79.         if(!n.voiceChannel) return clearInterval(inter);
  80.         if(n.voiceChannel === n.guild.afkChannel) return clearInterval(inter)
  81.          fs.writeFile("./userD.json", JSON.stringify(inv), function(err) {
  82.             if(err) throw err;
  83.         });
  84.     }, 1000)
  85. }
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