InviteCreate not working fully

The InviteCreate event only fired when the invite is created withing a channel, and not within the guild itself
8 Replies
d.js docs
d.js docs3y ago
• What's your exact discord.js npm list discord.js and node node -v version? • Post the full error stack trace, not just the top part! • Show your code! • Explain what exactly your issue is. • Not a discord.js issue? Check out #useful-servers.
treble/luna
treble/lunaOP3y ago
Node v18.8.0, djs v 14.0.3
treble/luna
treble/lunaOP3y ago
this works
treble/luna
treble/lunaOP3y ago
but this doesnt it doesnt even fire the InviteCreate event i have the intents enabled yes it has admin perms
treble/luna
treble/lunaOP3y ago
yes lemme try in another guild just to be sure I found the culprit, when making an invite, it takes the top channel, which was a forum channel in this case and that seems to have broken it since it works fine when i deleted the forum channel its weird because it definetly is a new invite code chances could be that i dont have the guild and invite cached but i always use fetch() thats what i was wondering too so i have no clue why it does that i can try to remove all my invites and retry again deleted all my invites and retried, still nothing with forum channel i'll get my code
module.exports = {
name: "inviteCreate",
async execute(invite){

addInvite(invite);
const eb = new EmbedBuilder();
eb.setColor('Blue')
eb.setTitle('Invite created')
const {channel, inviter, code, expiresTimestamp, maxAge, maxUses} = invite;
eb.addFields([{
name: "User",
value: `${inviter}`
},{
name: "Code",
value: `[${code}](https://discord.gg/${code})`
},{
name: "Data",
value: `Channel: ${channel}\nExpires : ${maxAge === 0 ? "Never": `<t:${expiresTimestamp.toString().slice(0, -3)}> (<t:${expiresTimestamp.toString().slice(0, -3)}:R> )`}\nMax uses: ${maxUses === 0 ? "Unlimited": maxUses}`
}])
const c = await invite.guild.channels.fetch("1020287116439199824")
c.send({embeds: [eb]})
}
}
module.exports = {
name: "inviteCreate",
async execute(invite){

addInvite(invite);
const eb = new EmbedBuilder();
eb.setColor('Blue')
eb.setTitle('Invite created')
const {channel, inviter, code, expiresTimestamp, maxAge, maxUses} = invite;
eb.addFields([{
name: "User",
value: `${inviter}`
},{
name: "Code",
value: `[${code}](https://discord.gg/${code})`
},{
name: "Data",
value: `Channel: ${channel}\nExpires : ${maxAge === 0 ? "Never": `<t:${expiresTimestamp.toString().slice(0, -3)}> (<t:${expiresTimestamp.toString().slice(0, -3)}:R> )`}\nMax uses: ${maxUses === 0 ? "Unlimited": maxUses}`
}])
const c = await invite.guild.channels.fetch("1020287116439199824")
c.send({embeds: [eb]})
}
}
the const c = await invite.guild.channels.fetch("1020287116439199824") cant be causing it because i just get no event at all i tried logging the invite or event name method to add an invite to my database but it works fine the empty space after execute() used to be console.log(invite) sorry if my explanation is kinda unclear, i'm pretty bad at explaining stuff like this ah that would indeed explain it alright thanks!
Want results from more Discord servers?
Add your server