IntentBits / GatewayIntentBits
Lunibee exports two intent constant objects to accommodate different coding styles. Both resolve to the same bitfield values.
Import
Section titled “Import”import { IntentBits, GatewayIntentBits, Intents } from "lunibee";import { IntentBits, GatewayIntentBits, Intents } from "lunibee";IntentBits— idiomatic camelCase keys (e.g.IntentBits.guilds)GatewayIntentBits— Discord-standard PascalCase keys (e.g.GatewayIntentBits.Guilds)Intents— alias forIntentBits
Usage Styles
Section titled “Usage Styles”Array form (recommended with IntentBits)
Section titled “Array form (recommended with IntentBits)”import { Client, IntentBits } from "lunibee";
const client = new Client({ token: process.env.DISCORD_TOKEN!, intents: [ IntentBits.guilds, IntentBits.guildMessages, IntentBits.messageContent, ],});import { Client, IntentBits } from "lunibee";
const client = new Client({ token: process.env.DISCORD_TOKEN, intents: [ IntentBits.guilds, IntentBits.guildMessages, IntentBits.messageContent, ],});Bitwise OR form (works with either)
Section titled “Bitwise OR form (works with either)”import { Client, GatewayIntentBits } from "lunibee";
const client = new Client({ token: process.env.DISCORD_TOKEN!, intents: GatewayIntentBits.Guilds | GatewayIntentBits.GuildMessages | GatewayIntentBits.MessageContent,});import { Client, GatewayIntentBits } from "lunibee";
const client = new Client({ token: process.env.DISCORD_TOKEN, intents: GatewayIntentBits.Guilds | GatewayIntentBits.GuildMessages | GatewayIntentBits.MessageContent,});Full Intent Reference
Section titled “Full Intent Reference”GatewayIntentBits (PascalCase) |
IntentBits (camelCase) |
Bit | Type |
|---|---|---|---|
Guilds |
guilds |
1 << 0 |
Standard |
GuildMembers |
guildMembers |
1 << 1 |
Privileged |
GuildModeration |
guildModeration |
1 << 2 |
Standard |
GuildExpressions |
guildExpressions |
1 << 3 |
Standard |
GuildIntegrations |
guildIntegrations |
1 << 4 |
Standard |
GuildWebhooks |
guildWebhooks |
1 << 5 |
Standard |
GuildInvites |
guildInvites |
1 << 6 |
Standard |
GuildVoiceStates |
guildVoiceStates |
1 << 7 |
Standard |
GuildPresences |
guildPresences |
1 << 8 |
Privileged |
GuildMessages |
guildMessages |
1 << 9 |
Standard |
GuildMessageReactions |
guildMessageReactions |
1 << 10 |
Standard |
GuildMessageTyping |
guildMessageTyping |
1 << 11 |
Standard |
DirectMessages |
directMessages |
1 << 12 |
Standard |
DirectMessageReactions |
directMessageReactions |
1 << 13 |
Standard |
DirectMessageTyping |
directMessageTyping |
1 << 14 |
Standard |
MessageContent |
messageContent |
1 << 15 |
Privileged |
GuildScheduledEvents |
guildScheduledEvents |
1 << 16 |
Standard |
AutoModerationConfiguration |
autoModerationConfiguration |
1 << 20 |
Standard |
AutoModerationExecution |
autoModerationExecution |
1 << 21 |
Standard |
GuildMessagePolls |
guildMessagePolls |
1 << 24 |
Standard |
DirectMessagePolls |
directMessagePolls |
1 << 25 |
Standard |
Privileged Intents
Section titled “Privileged Intents”[!IMPORTANT]
GuildMembers,GuildPresences, andMessageContentare privileged intents. You must enable them in the Discord Developer Portal under Bot → Privileged Gateway Intents before your bot can use them.
resolveGatewayIntents
Section titled “resolveGatewayIntents”A utility function that converts any GatewayIntentResolvable to a raw integer bitfield:
import { resolveGatewayIntents, IntentBits } from "lunibee";
const bits = resolveGatewayIntents([IntentBits.guilds, IntentBits.guildMessages]);// → 513 (1 | 512)import { resolveGatewayIntents, IntentBits } from "lunibee";
const bits = resolveGatewayIntents([IntentBits.guilds, IntentBits.guildMessages]);// → 513 (1 | 512)Accepts:
- A number: returned as-is.
- A string key from either intent object (e.g.
"Guilds","guilds"). - An array of any of the above.