# Fix "PrivilegedIntentsRequired" and "Used disallowed intents" on a Discord bot

> The two intent errors, what they mean, the checkbox in the Discord Developer Portal that fixes them, and how to ask for only the intents your bot uses.

Source: https://fadehost.com/docs/discord-bot-privileged-intents/

Two errors stop a Discord bot right after it logs in:

- discord.py: `discord.errors.PrivilegedIntentsRequired: Shard ID None is requesting privileged intents that have not been explicitly enabled in the developer portal.`
- discord.js: `Error [DisallowedIntents]: Privileged intent provided is not enabled or whitelisted.`, or the gateway closing with code 4014 `Used disallowed intents`.

Both mean the same thing: the code asks Discord for a privileged intent, and the bot's application does not have that intent switched on.

## The three privileged intents

| Intent | What it gives the bot | Typical use |
| --- | --- | --- |
| Message Content | The text of messages | Prefix commands (`!help`), moderation filters, chat games |
| Server Members | Member joins, leaves and the member list | Welcome messages, role syncing, leaderboards |
| Presence | Online status and activities | Status boards, "who is playing" features |

Slash commands, buttons and embeds need none of them. A bot that only uses slash commands can leave all three off.

## Switch them on

1. Open the [Discord Developer Portal](https://discord.com/developers/applications) and pick the application.
2. **Bot** in the left menu.
3. Under **Privileged Gateway Intents**, switch on the ones the code asks for, and **Save Changes**.
4. Restart the bot from its page on FadeHost. No redeploy is needed; the setting lives on Discord's side.

A bot in more than 100 servers has to be verified by Discord before privileged intents can stay on; below that, the switch is all it takes.

## Ask only for what you use

The error also appears when the code asks for everything by habit:

```python
# discord.py: asks for all three privileged intents, and fails without them
intents = discord.Intents.all()

# asks only for what a slash-command bot needs
intents = discord.Intents.default()
intents.message_content = True   # only if you read message text
```

```js
// discord.js: the intents list is explicit
const client = new Client({
  intents: [GatewayIntentBits.Guilds, GatewayIntentBits.GuildMessages, GatewayIntentBits.MessageContent],
})
```

Requesting an intent you do not use costs events and memory on every message and member update. Cut the list to what the code reads and the bot runs lighter.

## Still failing

- The token in the app's environment variables belongs to a different application than the one you edited. Check the application name at the top of the portal against the bot's name.
- The change did not apply: portal changes take effect on the next login, so restart the bot rather than waiting.
- The console on the bot's page prints the exact error and the crash doctor names the intent; read that line before changing code.
