I am trying to fetch a guild using its ID which the bot is in, but it doesn't seem to work. Whenever I run this, it outputs a collection of every guild the client is in.
e is read from a JSON file, the id property is a direct copy from the server.
client.guilds.fetch(e.id).then((guild) => {
// logs every available guild instead of the one where id is e.id
console.log(guild)
})
Here are my intents and partials
const client = new Discord.Client({
intents: [
Intents.FLAGS.GUILDS,
Intents.FLAGS.GUILD_MESSAGES,
Intents.FLAGS.DIRECT_MESSAGES,
Intents.FLAGS.GUILD_MESSAGE_REACTIONS,
Intents.FLAGS.DIRECT_MESSAGE_REACTIONS
],
partials: ['MESSAGE', 'CHANNEL', 'REACTION'],
});