BotNetwork

Discord gateway intents explained: which ones your bot really needs

Intents decide which gateway events Discord sends your bot. Asking for fewer means less data, less memory, and fewer hoops when your bot grows.

Published 3 min read

What an intent is

When a bot connects to the Discord gateway, it sends an IDENTIFY payload with an intents integer. Each bit subscribes to a group of events. Ask for GUILD_MESSAGES and you receive message create, update and delete events in servers; leave it out and those events never reach you.

Some values from Discord's documentation:

Intent Bit Value Privileged
GUILDS 1 << 0 1 No
GUILD_MEMBERS 1 << 1 2 Yes
GUILD_MODERATION 1 << 2 4 No
GUILD_PRESENCES 1 << 8 256 Yes
GUILD_MESSAGES 1 << 9 512 No
GUILD_MESSAGE_REACTIONS 1 << 10 1024 No
DIRECT_MESSAGES 1 << 12 4096 No
MESSAGE_CONTENT 1 << 15 32768 Yes

The integer is the sum of the values you want. GUILDS + GUILD_MESSAGES + MESSAGE_CONTENT is 1 + 512 + 32768 = 33281. Libraries hide this behind named flags, and our permissions calculator covers the related permission bitfield.

The three privileged intents

Privileged intents expose more sensitive data, so they must be switched on in the Developer Portal (Bot page) and requested in code. Requesting one that is not enabled closes the connection with code 4014 ("Disallowed intent(s)").

  • Guild Members: member join, update and leave events, and requesting the full member list. Needed for welcome messages, auto-roles and member counters.
  • Guild Presences: online status and activities of members. Few bots really need it, and it generates a lot of traffic in large servers.
  • Message Content: the content, embeds, attachments and components fields of messages.

Life without Message Content

Without the Message Content intent your bot still receives message events (if it has GUILD_MESSAGES), but the content fields are empty, except for:

  • messages in DMs with the bot,
  • messages that mention the bot,
  • messages the bot sent itself.

Interactions are not affected: slash commands, buttons, select menus, modals and context menu commands all carry their data. That is why Discord recommends interactions for command bots. If your bot only answers /commands, you need GUILDS and nothing else. See slash commands in discord.js v14.

Verification and growth

  • Until your bot is in 100 servers, you can toggle privileged intents yourself.
  • Discord requires verification at that point; unverified bots cannot join more servers.
  • Verified bots must apply for each privileged intent, explaining the use case. Message Content in particular is approved for specific, user-facing needs.

Designing around interactions from the start avoids a rewrite later.

Minimal setups

Slash-command utility bot (polls, reminders, lookups):

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

Welcome and auto-role bot:

new Client({ intents: [GatewayIntentBits.Guilds, GatewayIntentBits.GuildMembers] });

Moderation bot that filters message text (needs justification when verified):

intents = discord.Intents.default()      # all non-privileged intents
intents.message_content = True
intents.members = True
bot = commands.Bot(command_prefix="!", intents=intents)

discord.Intents.default() in discord.py enables every non-privileged intent. That is convenient, but in large servers you may want discord.Intents.none() plus only what you use to reduce memory and events.

Intents and privacy

Every extra intent means personal data flowing through your process and maybe your logs. Ask for the minimum, do not log message content you do not need, and document what you keep in your privacy policy. Our guides on bot security and legal and privacy for bots go deeper.

Frequently asked questions

My bot connects but gets close code 4014. What now?

Your code requests a privileged intent that is not enabled. Either enable it in the Developer Portal or remove it from the code.

Do I need GUILD_MESSAGES for slash commands?

No. Slash commands arrive as interactions, which need no intent at all. GUILDS is still recommended so the library caches servers and channels.

Does Presence intent affect performance?

It can. In large servers presence updates are frequent, so subscribing to them increases traffic and memory use. Enable it only if a feature depends on status or activity.

Sources