Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- var dat = JSON.parse("{}");
- function forEachObject(obj, func) {
- Object.keys(obj).forEach(function (key) { func(key, obj[key]) })
- }
- client.on("ready", () => {
- var guild;
- while (!guild)
- guild = client.guilds.find("name", "اسم سرفرك هنا")
- guild.fetchInvites().then((data) => {
- data.forEach((Invite, key, map) => {
- var Inv = Invite.code;
- dat[Inv] = Invite.uses;
- })
- })
- })
- client.on("guildMemberAdd", (member) => {
- let channel = member.guild.channels.find('name', 'اسم روم اللي برسل فيها');
- if (!channel) {
- console.log("!channel fails");
- return;
- }
- if (member.id == client.user.id) {
- return;
- }
- console.log('made it till here!');
- var guild;
- while (!guild)
- guild = client.guilds.find("name", "اسم سرفرك هنا")
- guild.fetchInvites().then((data) => {
- data.forEach((Invite, key, map) => {
- var Inv = Invite.code;
- if (dat[Inv])
- if (dat[Inv] < Invite.uses) {
- console.log(3);
- console.log(`${member} joined over ${Invite.inviter}'s invite ${Invite.code}`)
- channel.send(` ♥ **تم دعوته من قبل ${Invite.inviter} ♥ `)
- }
- dat[Inv] = Invite.uses;
- })
- })
- });
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement