This commit is contained in:
Christopher Cookman 2024-04-15 01:06:04 -06:00
parent ae667d18e7
commit b9fa194933
Signed by: ChrisChrome
GPG key ID: A023A26E42C33A42

View file

@ -250,9 +250,9 @@ client.on("ready", async () => {
client.invites[guildInvite.code] = guildInvite.uses client.invites[guildInvite.code] = guildInvite.uses
}) })
}) })
if(guild.vanityURLCode) { guild.fetchVanityData().then(vanityData => {
client.invites[guild.vanityURLCode] = guild.vanityURLUses client.invites[vanityData.code] = vanityData.uses
} })
}) })
const commands = [ const commands = [
@ -417,29 +417,31 @@ client.on('guildMemberAdd', async (member) => { // We're just gonna always send
}) })
}) })
// Handle vanity URLs // Handle vanity URLs
console.log(`Checking vanity: ${member.guild.vanityURLUses != client.invites[member.guild.vanityURLCode]} ${member.guild.vanityURLCode} ${member.guild.vanityURLUses}`) member.guild.fetchVanityData().then(vanityData => {
if (member.guild.vanityURLUses != client.invites[member.guild.vanityURLCode]) { // They used the vanity URL if (vanityData.uses != client.invites[vanityData.code]) { // They used the vanity URL
channel.send({ channel.send({
embeds: [{ embeds: [{
color: 0x00ff00, color: 0x00ff00,
title: "New Member", title: "New Member",
fields: [ fields: [
{ {
name: "New Member", name: "New Member",
value: `${member} (${member.user.displayName})\n\`${member.id}\`\nJoined at: <t:${new Date(member.joinedAt)/1000}>\nAccount Created: <t:${new Date(member.user.createdTimestamp)/1000}>` value: `${member} (${member.user.displayName})\n\`${member.id}\`\nJoined at: <t:${new Date(member.joinedAt)/1000}>\nAccount Created: <t:${new Date(member.user.createdTimestamp)/1000}>`
}, },
{ {
name: "Invite", name: "Invite",
value: `Vanity Code: ${member.guild.vanityURLCode}\nUses: ${member.vanityURLUses}` value: `Vanity Code: ${vanityData.code}\nUses: ${vanityData.uses}`
}, },
{ {
name: "Guild", name: "Guild",
value: `${guild.name}\n\`${guild.id}\`` value: `${guild.name}\n\`${guild.id}\``
} }
] ]
}] }]
}); });
} }
});
if (defcon <= 3) { if (defcon <= 3) {
// DM user saying Invites are disabled for security reasons, then kick them with the same reason // DM user saying Invites are disabled for security reasons, then kick them with the same reason