Comparing version 1.1.4 to 1.1.5
@@ -18,17 +18,19 @@ const invites = {}; | ||
client.on('guildMemberAdd', member => { | ||
// To compare, we need to load the current invite list. | ||
member.guild.fetchInvites().then(guildInvites => { | ||
// This is the *existing* invites for the guild. | ||
const ei = invites[member.guild.id]; | ||
// Update the cached invites for the guild. | ||
invites[member.guild.id] = guildInvites; | ||
if (!ei) return; | ||
// Look through the invites, find the one for which the uses went up. | ||
const invite = guildInvites.find(i => ei.get(i.code).uses < i.uses); | ||
// This is just to simplify the message being sent below (inviter doesn't have a tag property) | ||
const inviter = client.users.cache.get(invite.inviter.id); | ||
// Get the log channel (change to your liking) | ||
client.emit("inviteJoin", member, invite, inviter) | ||
}); | ||
try { | ||
// To compare, we need to load the current invite list. | ||
member.guild.fetchInvites().then(guildInvites => { | ||
// This is the *existing* invites for the guild. | ||
const ei = invites[member.guild.id]; | ||
// Update the cached invites for the guild. | ||
invites[member.guild.id] = guildInvites; | ||
if (!ei) return; | ||
// Look through the invites, find the one for which the uses went up. | ||
const invite = guildInvites.find(i => ei.get(i.code).uses < i.uses); | ||
// This is just to simplify the message being sent below (inviter doesn't have a tag property) | ||
const inviter = client.users.cache.get(invite.inviter.id); | ||
// Get the log channel (change to your liking) | ||
client.emit("inviteJoin", member, invite, inviter) | ||
}); | ||
} catch (e) {} | ||
}); | ||
}; |
@@ -6,3 +6,3 @@ const sleep = require('./functions/sleep'), | ||
_checkUpdate = require("./functions/checkUpdates"), | ||
ButtonPaginatoir = require("./functions/button-embed-reactor") | ||
ButtonPaginator = require("./functions/button-embed-reactor") | ||
@@ -17,3 +17,3 @@ | ||
inviteLogger, | ||
ButtonPaginatoir | ||
ButtonPaginator | ||
}; |
{ | ||
"name": "ultrax", | ||
"version": "1.1.4", | ||
"version": "1.1.5", | ||
"description": "This package is used to make stuff easier by using simple functions, its not fully released yet!", | ||
@@ -5,0 +5,0 @@ "main": "index.js", |
13881
235