This commit is contained in:
Christopher Cookman 2024-04-15 00:44:25 -06:00
parent 36a7194b49
commit 832514ca90
Signed by: ChrisChrome
GPG key ID: A023A26E42C33A42

View file

@ -382,13 +382,11 @@ client.on('inviteCreate', (invite) => { //if someone creates an invite while bot
}); });
client.on('guildMemberAdd', async (member) => { // We're just gonna always send invite logs, even if we're not monitoring them client.on('guildMemberAdd', async (member) => { // We're just gonna always send invite logs, even if we're not monitoring them
isInv = false invites = 0;
const channel = client.channels.cache.get(config.discord.invitelog) const channel = client.channels.cache.get(config.discord.invitelog)
let guild = member.guild let guild = member.guild
member.guild.invites.fetch().then(async guildInvites => { //get all guild invites member.guild.invites.fetch().then(async guildInvites => { //get all guild invites
await (async () => {
guildInvites.forEach(invite => { //basically a for loop over the invites guildInvites.forEach(invite => { //basically a for loop over the invites
if (invite.uses != client.invites[invite.code]) { //if it doesn't match what we stored: if (invite.uses != client.invites[invite.code]) { //if it doesn't match what we stored:
channel.send({ channel.send({
embeds: [{ embeds: [{
@ -415,11 +413,9 @@ client.on('guildMemberAdd', async (member) => { // We're just gonna always send
}] }]
}); });
client.invites[invite.code] = invite.uses client.invites[invite.code] = invite.uses
isInv = true invites++
} } else if (invites == guildInvites.toJSON().length()) {
}) // Assume its a custom link lol
})();
if (isInv) return;
channel.send({ channel.send({
embeds: [{ embeds: [{
color: 0x00ff00, color: 0x00ff00,
@ -440,6 +436,8 @@ client.on('guildMemberAdd', async (member) => { // We're just gonna always send
] ]
}] }]
}); });
}
})
}) })
if (defcon <= 3) { if (defcon <= 3) {