Fix issue with invites made by embed API
This commit is contained in:
parent
9685d75ad4
commit
24ce1d2e96
6
index.js
6
index.js
|
@ -106,7 +106,6 @@ client.on('inviteCreate', (invite) => { //if someone creates an invite while bot
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
if (!row) return;
|
if (!row) return;
|
||||||
console.log(row)
|
|
||||||
if(!row.log_create) return;
|
if(!row.log_create) return;
|
||||||
client.channels.fetch(row.channel).then(channel => {
|
client.channels.fetch(row.channel).then(channel => {
|
||||||
if (!channel) return; // They probably set perms wrong
|
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",
|
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",
|
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",
|
name: "Guild",
|
||||||
|
@ -253,7 +252,6 @@ client.on('interactionCreate', async interaction => {
|
||||||
}
|
}
|
||||||
log_create = interaction.options.getBoolean('log_create');
|
log_create = interaction.options.getBoolean('log_create');
|
||||||
if (log_create == null) log_create = true;
|
if (log_create == null) log_create = true;
|
||||||
console.log(log_create)
|
|
||||||
const channel = interaction.options.getChannel('channel').id;
|
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) => {
|
db.run(`INSERT OR REPLACE INTO guilds (id, channel, log_create) VALUES (?, ?, ?)`, [interaction.guild.id.toString(), channel.toString(), log_create], (err) => {
|
||||||
if (err) {
|
if (err) {
|
||||||
|
|
Loading…
Reference in a new issue