Intents
Intents tell Discord which event categories to send your bot. Fewer intents means less traffic and memory.
Intents tell Discord which event categories to send your bot. Fewer intents means less traffic and memory.
Setting them
import { Client, GatewayIntentBits } from 'athena';
new Client(`Bot ${token}`, {
intents: [GatewayIntentBits.Guilds, GatewayIntentBits.GuildMessages, GatewayIntentBits.MessageContent]
});Accepted forms: an array of GatewayIntentBits values, an array of name strings (['Guilds', 'GuildMessages']), or a raw bitmask number. The default 3243773 is every non-privileged intent.
Inspect at runtime via client.intents.has(GatewayIntentBits.GuildMessages).
Privileged intents
Three must be enabled on your application's portal page first, and large bots need Discord approval:
GuildPresences- presence/status updates. Very high volume. Leave off unless you truly need it.GuildMembers- member add/update/remove and full member lists inGUILD_CREATE.MessageContent- thecontent,embeds,attachments, andcomponentsof messages your bot did not author or get mentioned in.
Requesting one that is not enabled closes the gateway with code 4014, surfaced as an error event.
What each intent unlocks (common ones)
| Intent | Gives you |
|---|---|
Guilds | guild, channel, thread, role, stage lifecycle events |
GuildMembers | guildMemberAdd/Update/Remove |
GuildModeration | bans, guildAuditLogEntryCreate |
GuildExpressions | emoji and sticker updates |
GuildWebhooks | webhooksUpdate |
GuildInvites | inviteCreate/Delete |
GuildVoiceStates | voice join/leave/switch |
GuildPresences | presenceUpdate |
GuildMessages | message create/update/delete (content blank without MessageContent) |
GuildMessageReactions | reaction add/remove events |
DirectMessages | DM message events |
MessageContent | message content fields |
AutoModerationConfiguration / AutoModerationExecution | auto-moderation rule and action events |
A sensible starting set
intents: [
GatewayIntentBits.Guilds,
GatewayIntentBits.GuildMessages,
GatewayIntentBits.GuildMessageReactions,
GatewayIntentBits.DirectMessages
]Add MessageContent only if you read message text outside slash commands. Add GuildMembers only if you need member events; otherwise fetch members on demand.
Performance notes
GuildPresencesis the single most expensive intent. Skipping it also means Athena never allocates presence state on members (see Caching and memory).- Use
disableEventsto skip parsing events you do not use even within an enabled intent. - Avoid
getAllUsers: trueunless you genuinely need every member cached.