Fix issue with invites made by embed API

This commit is contained in:
Christopher Cookman 2024-06-25 16:13:44 -06:00
parent 9685d75ad4
commit 24ce1d2e96
Signed by: ChrisChrome
GPG key ID: A023A26E42C33A42

View file

@ -106,7 +106,6 @@ client.on('inviteCreate', (invite) => { //if someone creates an invite while bot
return;
}
if (!row) return;
console.log(row)
if(!row.log_create) return;
client.channels.fetch(row.channel).then(channel => {
if (!channel) return; // They probably set perms wrong
@ -130,7 +129,7 @@ client.on('inviteCreate', (invite) => { //if someone creates an invite while bot
},
{
name: "Inviter",
value: `${(invite.inviter.id == client.user.id) ? "Custom Invite URL (Through Bot/Embed)" : `${invite.inviter} (${invite.inviter.displayName})`}`
value: `${invite.inviter?.id ?`${invite.inviter} (${invite.inviter.displayName})` : "Custom Invite URL (Through Bot/Embed)"}`
}
]
}]
@ -166,7 +165,7 @@ client.on('guildMemberAdd', async (member) => { // We're just gonna always send
},
{
name: "Invite",
value: `Inviter: ${(invite.inviter.id == client.user.id) ? "Custom Invite URL (Through Bot/Embed)" : `${invite.inviter} (${invite.inviter.displayName})`}\nCode: ${invite.code}\nUses: ${invite.uses}/${invite.maxUses ||"∞"}\nExpires: ${invite.expiresAt <= 0 ? "Never" : `<t:${Math.floor(new Date(invite.expiresAt) / 1000)}:R>`}\nCreated at: <t:${Math.floor(new Date(invite.createdAt) / 1000)}>`
value: `Inviter: ${invite.inviter?.id ? `${invite.inviter} (${invite.inviter.displayName})` : "Custom Invite URL (Through Bot/Embed)"}\nCode: ${invite.code}\nUses: ${invite.uses}/${invite.maxUses ||"∞"}\nExpires: ${invite.expiresAt <= 0 ? "Never" : `<t:${Math.floor(new Date(invite.expiresAt) / 1000)}:R>`}\nCreated at: <t:${Math.floor(new Date(invite.createdAt) / 1000)}>`
},
{
name: "Guild",
@ -253,7 +252,6 @@ client.on('interactionCreate', async interaction => {
}
log_create = interaction.options.getBoolean('log_create');
if (log_create == null) log_create = true;
console.log(log_create)
const channel = interaction.options.getChannel('channel').id;
db.run(`INSERT OR REPLACE INTO guilds (id, channel, log_create) VALUES (?, ?, ?)`, [interaction.guild.id.toString(), channel.toString(), log_create], (err) => {
if (err) {