Free tool
Discord gateway intents calculator
Choose the events your bot needs, and get the intents value and the code to request them in discord.js or discord.py. The privileged ones are flagged, with what to switch on in the Developer Portal.
Intents value
1const { Client, GatewayIntentBits } = require('discord.js');
const client = new Client({
intents: [
GatewayIntentBits.Guilds,
],
});What intents are
When a bot connects to Discord it says which groups of events it wants to receive, and Discord sends only those. Each group is an intent. Ask for too few and your event handlers silently never fire; ask for too many and your bot spends memory and bandwidth on events it ignores.
Three intents are privileged: server members, presences and message content. A bot has to request them in code and have them switched on for it in the Developer Portal, under Bot, Privileged Gateway Intents. If the code asks for one the portal has not enabled, Discord closes the connection with error 4014, "Disallowed intent(s)".
Intents and memory
Intents decide what your bot is told about, and libraries keep much of what they are told in memory. A bot with the server members and presences intents in large servers ends up holding every member and every status change, and that is often what pushes a small bot past its memory limit.
If your bot only answers slash commands, it may need nothing beyond Guilds. Leaving out what you do not use is the cheapest memory saving there is.
FAQ
Questions
Why is message.content empty?
Because the message content intent is not enabled. Without it, Discord still sends message events but leaves out the text, embeds and attachments, except in direct messages and in messages that mention your bot. Enable it in the Developer Portal and request it in code.
How do I fix "Used disallowed intents"?
Your code requests a privileged intent that is not switched on for the bot. Open your application in the Developer Portal, go to Bot, and switch on the intents your code requests under Privileged Gateway Intents, or stop requesting them in code.
Do privileged intents need approval?
Not while your bot is small. Once it is in 100 or more servers it has to be verified, and privileged intents then have to be applied for and approved by Discord, with a reason for each.
Is intents the same number as permissions?
No. Intents choose which events your bot receives; permissions choose what it is allowed to do in a server. They are separate numbers, set in different places, and a bot needs the right value of each.
Run your bot 24/7, free