tadpole/intent
Gateway intents as a bitfield, with privileged-intent detection. Discord sends only the event families you subscribe to, and the subscription is this bitfield inside the IDENTIFY payload.
When you reach for this
Building the intents half of a tadpole config. Start empty with
new, switch bits on with enable; the value is opaque, so a
typo’d integer cannot reach Discord through it.
import tadpole/intent
let intents =
intent.new()
|> intent.enable(intent.guilds)
|> intent.enable(intent.guild_messages)
|> intent.enable(intent.message_content)
The privileged trio
Three bits sit behind toggles in the Developer Portal (Bot → Privileged Gateway Intents), and requesting one without its toggle ends the connection with close code 4014 the moment the bot identifies:
intent.guild_members— Server Membersintent.guild_presences— Presenceintent.message_content— Message Content; without it, other users’ messages arrive with emptycontent
check_privileged lists which privileged bits a config requests;
tadpole refuses nothing — Discord does the enforcing, after connect.
The guide’s “Privileged intents” section has the whole story.
The wire
to_int produces the raw integer the IDENTIFY payload carries;
tadpole/gateway/shard does exactly that when
it builds its ShardConfig. intent_name names one bit for logs and
rendered errors; to_string names them all, or “(none)”.
Every function here is total bit arithmetic, so nothing fails at runtime. The one failure is configurational — a privileged bit without its portal toggle — and it surfaces as close 4014 after connect, not as an error from this module.
See also
tadpole— where intents land in the configtadpole/guide— the portal-toggle walkthroughtadpole/error—IntentsNotPrivileged, the one related variant
Types
Values
pub const auto_moderation_configuration: Int
pub const auto_moderation_execution: Int
pub fn check_privileged(intents: Intents) -> List(Int)
Requesting these without the Developer Portal toggles ends in close code 4014 at Identify.
pub const direct_message_polls: Int
pub const direct_message_reactions: Int
pub const direct_message_typing: Int
pub const direct_messages: Int
pub const guild_expressions: Int
pub const guild_integrations: Int
pub const guild_invites: Int
pub const guild_members: Int
pub const guild_message_polls: Int
pub const guild_message_reactions: Int
pub const guild_message_typing: Int
pub const guild_messages: Int
pub const guild_moderation: Int
pub const guild_presences: Int
pub const guild_scheduled_events: Int
pub const guild_voice_states: Int
pub const guild_webhooks: Int
pub fn intent_name(intent: Int) -> String
pub fn is_privileged(intent: Int) -> Bool
pub const message_content: Int
pub const privileged: List(Int)