Discord-Bots2 Minuten Lesezeit

Fix Used disallowed intents and Discord Gateway code 4014

Resolve DisallowedIntents in discord.js or PrivilegedIntentsRequired in discord.py by matching your bot’s gateway intents to the Discord Developer Portal.

Find the privileged intent your bot requests

Discord closes the gateway with 4014 when the bot requests a privileged intent unavailable to its application. discord.js may report DisallowedIntents. discord.py may raise PrivilegedIntentsRequired. Open the client initialization in the starting file. Look for member, presence or message content access, including a setting that enables every intent at once.

Siehe: Discord Gateway intent reference for the three privileged intents and how approval works.

Request only the events the bot uses

For a slash-command bot that needs guild context, start with the guilds intent and add an intent when an event handler needs it. For a bot that needs member events, presences or ordinary message contents, open the application’s Bot → Privileged Gateway Intents settings and enable the specific access. Verified apps need approval for the relevant intents. Check the portal for the application’s status.

A guilds-only discord.js client
import { Client, GatewayIntentBits } from 'discord.js';
const client = new Client({ intents: [GatewayIntentBits.Guilds] });
A guilds-only discord.py client
import discord
from discord.ext import commands

intents = discord.Intents.none()
intents.guilds = True
bot = commands.Bot(command_prefix="!", intents=intents)

Reconnect and test one event

Save the portal settings, deploy the code change if needed and restart. Look for the ready event. Invoke the slash command or produce the specific member, presence or message event the bot handles. If slash commands work but prefix commands are ignored, use the message-content checklist. If Discord rejects login before the gateway connects, check the bot token.