Advertisement
Guest User

Untitled

a guest
Jun 24th, 2018
69
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.36 KB | None | 0 0
  1. var dat = JSON.parse("{}");
  2. function forEachObject(obj, func) {
  3. Object.keys(obj).forEach(function (key) { func(key, obj[key]) })
  4. }
  5. client.on("ready", () => {
  6. var guild;
  7. while (!guild)
  8. guild = client.guilds.find("name", "اسم سرفرك هنا")
  9. guild.fetchInvites().then((data) => {
  10. data.forEach((Invite, key, map) => {
  11. var Inv = Invite.code;
  12. dat[Inv] = Invite.uses;
  13. })
  14. })
  15. })
  16. client.on("guildMemberAdd", (member) => {
  17. let channel = member.guild.channels.find('name', 'اسم روم اللي برسل فيها');
  18. if (!channel) {
  19. console.log("!channel fails");
  20. return;
  21. }
  22. if (member.id == client.user.id) {
  23. return;
  24. }
  25. console.log('made it till here!');
  26. var guild;
  27. while (!guild)
  28. guild = client.guilds.find("name", "اسم سرفرك هنا")
  29. guild.fetchInvites().then((data) => {
  30. data.forEach((Invite, key, map) => {
  31. var Inv = Invite.code;
  32. if (dat[Inv])
  33. if (dat[Inv] < Invite.uses) {
  34. console.log(3);
  35. console.log(`${member} joined over ${Invite.inviter}'s invite ${Invite.code}`)
  36. channel.send(` ♥ **تم دعوته من قبل ${Invite.inviter} ♥ `)
  37. }
  38. dat[Inv] = Invite.uses;
  39. })
  40. })
  41. });
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement