discordjs / guide

The official guide for discord.js, created and maintained by core members of its community.
https://discordjs.guide
MIT License
1.57k stars 2.3k forks source link

Guild #1401

Closed xaezor closed 1 year ago

xaezor commented 1 year ago

Part of the guide or code sample the question is about

const client = new Client({ intents: [GatewayIntentBits.Guilds] });

Question

Do I have to add server ID? (in place of Guilds)

almostSouji commented 1 year ago

That is a very broad question with not a whole lot of an explanation as to what you are trying to achieve. If you want to retrieve information about a guild or limit certain aspects of your bot to a specific guild you would need to use some method to discern between guilds. In the code snippet you provide, the GatewayIntentBits.Guilds allows your bot to receive events for guilds (https://discordjs.guide/popular-topics/intents.html#gateway-intents, https://discord.com/developers/docs/topics/gateway#list-of-intents) in the first place.