---
title: Intents
category: Topics
---

# Intents

Intents are an important part of establishing a WebSocket connection, as they define behavior regarding gateway events and impact received data via the REST API.

## Usage

```js
import { Client, GatewayIntentBits } from 'discord.js';

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

This is the most basic usage of intents for discord.js. By specifying _`GatewayIntentBits.Guilds`_, your bot will receive gateway events regarding guilds. This includes receiving initial information about guilds it is in at startup, such as role data.

You can find the full list of _`GatewayIntentBits`_ <DiscordAPITypesLink type="enum" parent="GatewayIntentBits">on the documentation</DiscordAPITypesLink> and an explanation of what each intent does [on Discord's API documentation](https://discord.com/developers/docs/topics/gateway#list-of-intents).

## Considerations

In discord.js, some intents require an extra bit of consideration.

### _`GatewayIntentBits.Guilds`_

discord.js relies heavily on caching in the library. We recommend you set at least the _`GatewayIntentBits.Guilds`_ intent to avoid these pitfalls.

### _`GatewayIntentBits.GuildMembers`_

Fetching members in a guild via <DocsLink type="class" parent="GuildMemberManager" symbol="fetch" brackets /> requests them over the gateway. As such, this intent is required and you may receive a timeout error if this intent is not specified.

<Alert title="Info" type="info">
	This is a privileged intent. Read on for more information.
</Alert>

### _`GatewayIntentBits.DirectMessages`_

This intent is required to receive direct messages. In discord.js however, you **must** specify partials as well. See the partials topic on how this is done.

### _`GatewayIntentBits.MessageContent`_

Unlike other intents, this only populates user-generated fields. See [Discord's documentation](https://discord.com/developers/docs/topics/gateway#message-content-intent) on what exactly this intent unveils.

It is a common mistake to not see the message content in a message—this is usually because this intent is not specified.

<Alert title="Info" type="info">
	This is a privileged intent. Read on for more information.
</Alert>

## Privileged intents

Some gateway events are considered privileged. Currently, these are:

- _`GatewayIntentBits.GuildPresences`_
- _`GatewayIntentBits.GuildMembers`_
- _`GatewayIntentBits.MessageContent`_

To use these intents, you will need to enable them in the developer portal. If your bot is in over 75 guilds, you will need to verify it and request usage of your desired intents.

Carefully think if you need these intents. They are opt-in so users across the platform can enjoy a higher level of privacy. Presences can expose some personal information, such as the games being played and overall online time. You might find that it isn't necessary for your bot to have this level of information about all guild members at all times.

### Disallowed intents

Should you receive an error stating you are using disallowed intents, please review your developer dashboard settings for all privileged intents you use. Check the Discord API documentation for up-to-date information.
