Lambros
Lambros
DIAdiscord.js - Imagine an app
Created by Lambros on 10/30/2024 in #djs-questions
Track invite origin
Hello developers! I am trying to set up a tracker for different invite sources for my bot but I keep getting a Missing permissions error. The invite URL works fine for every use case. What kind of permission do I need to be able to fetch commands. Current intents: GatewayIntentBits.Guilds, GatewayIntentBits.GuildInvites
const invites = await guild.invites.fetch(); // This is where it fails

let inviteSource = "unknown";
invites.forEach((invite) => {
if (invite.url.includes("source=game")) {
inviteSource = "in-game directory";
} else if (invite.url.includes("source=app")) {
inviteSource = "Bot";
} else if (invite.url.includes("source=topgg")) {
inviteSource = "top.gg";
}
});
const invites = await guild.invites.fetch(); // This is where it fails

let inviteSource = "unknown";
invites.forEach((invite) => {
if (invite.url.includes("source=game")) {
inviteSource = "in-game directory";
} else if (invite.url.includes("source=app")) {
inviteSource = "Bot";
} else if (invite.url.includes("source=topgg")) {
inviteSource = "top.gg";
}
});
19 replies