gaato/discord/model does not have a README file

ApplicationId

type ApplicationId = Id[ApplicationMarker]

A Discord snowflake ID, tagged with a phantom marker type so that IDs of different resources cannot be mixed up (Id[UserMarker] vs Id[GuildMarker]).

Wire format: Discord serializes snowflakes as decimal strings (and historically as integers in a few places). We accept both on decode and always emit a string, going through the string representation so values above 2^53 never pass through a Double.

test "parse and explicitly retag a snowflake" {
let user_id : @model.UserId = @model.Id::parse("175928847299117063")
inspect(user_id.to_string(), content="175928847299117063")
inspect(user_id.timestamp_ms(), content="1462015105796")
let guild_id : @model.GuildId = user_id.cast()
assert_eq(guild_id.value(), user_id.value())
}

AttachmentId

type AttachmentId = Id[AttachmentMarker]

A Discord snowflake ID, tagged with a phantom marker type so that IDs of different resources cannot be mixed up (Id[UserMarker] vs Id[GuildMarker]).

Wire format: Discord serializes snowflakes as decimal strings (and historically as integers in a few places). We accept both on decode and always emit a string, going through the string representation so values above 2^53 never pass through a Double.

test "parse and explicitly retag a snowflake" {
let user_id : @model.UserId = @model.Id::parse("175928847299117063")
inspect(user_id.to_string(), content="175928847299117063")
inspect(user_id.timestamp_ms(), content="1462015105796")
let guild_id : @model.GuildId = user_id.cast()
assert_eq(guild_id.value(), user_id.value())
}

AuditLogEntryId

type AuditLogEntryId = Id[AuditLogEntryMarker]

A Discord snowflake ID, tagged with a phantom marker type so that IDs of different resources cannot be mixed up (Id[UserMarker] vs Id[GuildMarker]).

Wire format: Discord serializes snowflakes as decimal strings (and historically as integers in a few places). We accept both on decode and always emit a string, going through the string representation so values above 2^53 never pass through a Double.

test "parse and explicitly retag a snowflake" {
let user_id : @model.UserId = @model.Id::parse("175928847299117063")
inspect(user_id.to_string(), content="175928847299117063")
inspect(user_id.timestamp_ms(), content="1462015105796")
let guild_id : @model.GuildId = user_id.cast()
assert_eq(guild_id.value(), user_id.value())
}

AutoModerationRuleId

type AutoModerationRuleId = Id[AutoModerationRuleMarker]

A Discord snowflake ID, tagged with a phantom marker type so that IDs of different resources cannot be mixed up (Id[UserMarker] vs Id[GuildMarker]).

Wire format: Discord serializes snowflakes as decimal strings (and historically as integers in a few places). We accept both on decode and always emit a string, going through the string representation so values above 2^53 never pass through a Double.

test "parse and explicitly retag a snowflake" {
let user_id : @model.UserId = @model.Id::parse("175928847299117063")
inspect(user_id.to_string(), content="175928847299117063")
inspect(user_id.timestamp_ms(), content="1462015105796")
let guild_id : @model.GuildId = user_id.cast()
assert_eq(guild_id.value(), user_id.value())
}

ChannelId

type ChannelId = Id[ChannelMarker]

A Discord snowflake ID, tagged with a phantom marker type so that IDs of different resources cannot be mixed up (Id[UserMarker] vs Id[GuildMarker]).

Wire format: Discord serializes snowflakes as decimal strings (and historically as integers in a few places). We accept both on decode and always emit a string, going through the string representation so values above 2^53 never pass through a Double.

test "parse and explicitly retag a snowflake" {
let user_id : @model.UserId = @model.Id::parse("175928847299117063")
inspect(user_id.to_string(), content="175928847299117063")
inspect(user_id.timestamp_ms(), content="1462015105796")
let guild_id : @model.GuildId = user_id.cast()
assert_eq(guild_id.value(), user_id.value())
}

CommandId

type CommandId = Id[CommandMarker]

A Discord snowflake ID, tagged with a phantom marker type so that IDs of different resources cannot be mixed up (Id[UserMarker] vs Id[GuildMarker]).

Wire format: Discord serializes snowflakes as decimal strings (and historically as integers in a few places). We accept both on decode and always emit a string, going through the string representation so values above 2^53 never pass through a Double.

test "parse and explicitly retag a snowflake" {
let user_id : @model.UserId = @model.Id::parse("175928847299117063")
inspect(user_id.to_string(), content="175928847299117063")
inspect(user_id.timestamp_ms(), content="1462015105796")
let guild_id : @model.GuildId = user_id.cast()
assert_eq(guild_id.value(), user_id.value())
}

CommandVersionId

type CommandVersionId = Id[CommandVersionMarker]

A Discord snowflake ID, tagged with a phantom marker type so that IDs of different resources cannot be mixed up (Id[UserMarker] vs Id[GuildMarker]).

Wire format: Discord serializes snowflakes as decimal strings (and historically as integers in a few places). We accept both on decode and always emit a string, going through the string representation so values above 2^53 never pass through a Double.

test "parse and explicitly retag a snowflake" {
let user_id : @model.UserId = @model.Id::parse("175928847299117063")
inspect(user_id.to_string(), content="175928847299117063")
inspect(user_id.timestamp_ms(), content="1462015105796")
let guild_id : @model.GuildId = user_id.cast()
assert_eq(guild_id.value(), user_id.value())
}

EmojiId

type EmojiId = Id[EmojiMarker]

A Discord snowflake ID, tagged with a phantom marker type so that IDs of different resources cannot be mixed up (Id[UserMarker] vs Id[GuildMarker]).

Wire format: Discord serializes snowflakes as decimal strings (and historically as integers in a few places). We accept both on decode and always emit a string, going through the string representation so values above 2^53 never pass through a Double.

test "parse and explicitly retag a snowflake" {
let user_id : @model.UserId = @model.Id::parse("175928847299117063")
inspect(user_id.to_string(), content="175928847299117063")
inspect(user_id.timestamp_ms(), content="1462015105796")
let guild_id : @model.GuildId = user_id.cast()
assert_eq(guild_id.value(), user_id.value())
}

EntitlementId

type EntitlementId = Id[EntitlementMarker]

A Discord snowflake ID, tagged with a phantom marker type so that IDs of different resources cannot be mixed up (Id[UserMarker] vs Id[GuildMarker]).

Wire format: Discord serializes snowflakes as decimal strings (and historically as integers in a few places). We accept both on decode and always emit a string, going through the string representation so values above 2^53 never pass through a Double.

test "parse and explicitly retag a snowflake" {
let user_id : @model.UserId = @model.Id::parse("175928847299117063")
inspect(user_id.to_string(), content="175928847299117063")
inspect(user_id.timestamp_ms(), content="1462015105796")
let guild_id : @model.GuildId = user_id.cast()
assert_eq(guild_id.value(), user_id.value())
}

GenericId

type GenericId = Id[GenericMarker]

A Discord snowflake ID, tagged with a phantom marker type so that IDs of different resources cannot be mixed up (Id[UserMarker] vs Id[GuildMarker]).

Wire format: Discord serializes snowflakes as decimal strings (and historically as integers in a few places). We accept both on decode and always emit a string, going through the string representation so values above 2^53 never pass through a Double.

test "parse and explicitly retag a snowflake" {
let user_id : @model.UserId = @model.Id::parse("175928847299117063")
inspect(user_id.to_string(), content="175928847299117063")
inspect(user_id.timestamp_ms(), content="1462015105796")
let guild_id : @model.GuildId = user_id.cast()
assert_eq(guild_id.value(), user_id.value())
}

GuildId

type GuildId = Id[GuildMarker]

A Discord snowflake ID, tagged with a phantom marker type so that IDs of different resources cannot be mixed up (Id[UserMarker] vs Id[GuildMarker]).

Wire format: Discord serializes snowflakes as decimal strings (and historically as integers in a few places). We accept both on decode and always emit a string, going through the string representation so values above 2^53 never pass through a Double.

test "parse and explicitly retag a snowflake" {
let user_id : @model.UserId = @model.Id::parse("175928847299117063")
inspect(user_id.to_string(), content="175928847299117063")
inspect(user_id.timestamp_ms(), content="1462015105796")
let guild_id : @model.GuildId = user_id.cast()
assert_eq(guild_id.value(), user_id.value())
}

IntegrationId

type IntegrationId = Id[IntegrationMarker]

A Discord snowflake ID, tagged with a phantom marker type so that IDs of different resources cannot be mixed up (Id[UserMarker] vs Id[GuildMarker]).

Wire format: Discord serializes snowflakes as decimal strings (and historically as integers in a few places). We accept both on decode and always emit a string, going through the string representation so values above 2^53 never pass through a Double.

test "parse and explicitly retag a snowflake" {
let user_id : @model.UserId = @model.Id::parse("175928847299117063")
inspect(user_id.to_string(), content="175928847299117063")
inspect(user_id.timestamp_ms(), content="1462015105796")
let guild_id : @model.GuildId = user_id.cast()
assert_eq(guild_id.value(), user_id.value())
}

InteractionId

type InteractionId = Id[InteractionMarker]

A Discord snowflake ID, tagged with a phantom marker type so that IDs of different resources cannot be mixed up (Id[UserMarker] vs Id[GuildMarker]).

Wire format: Discord serializes snowflakes as decimal strings (and historically as integers in a few places). We accept both on decode and always emit a string, going through the string representation so values above 2^53 never pass through a Double.

test "parse and explicitly retag a snowflake" {
let user_id : @model.UserId = @model.Id::parse("175928847299117063")
inspect(user_id.to_string(), content="175928847299117063")
inspect(user_id.timestamp_ms(), content="1462015105796")
let guild_id : @model.GuildId = user_id.cast()
assert_eq(guild_id.value(), user_id.value())
}

MessageId

type MessageId = Id[MessageMarker]

A Discord snowflake ID, tagged with a phantom marker type so that IDs of different resources cannot be mixed up (Id[UserMarker] vs Id[GuildMarker]).

Wire format: Discord serializes snowflakes as decimal strings (and historically as integers in a few places). We accept both on decode and always emit a string, going through the string representation so values above 2^53 never pass through a Double.

test "parse and explicitly retag a snowflake" {
let user_id : @model.UserId = @model.Id::parse("175928847299117063")
inspect(user_id.to_string(), content="175928847299117063")
inspect(user_id.timestamp_ms(), content="1462015105796")
let guild_id : @model.GuildId = user_id.cast()
assert_eq(guild_id.value(), user_id.value())
}

RoleId

type RoleId = Id[RoleMarker]

A Discord snowflake ID, tagged with a phantom marker type so that IDs of different resources cannot be mixed up (Id[UserMarker] vs Id[GuildMarker]).

Wire format: Discord serializes snowflakes as decimal strings (and historically as integers in a few places). We accept both on decode and always emit a string, going through the string representation so values above 2^53 never pass through a Double.

test "parse and explicitly retag a snowflake" {
let user_id : @model.UserId = @model.Id::parse("175928847299117063")
inspect(user_id.to_string(), content="175928847299117063")
inspect(user_id.timestamp_ms(), content="1462015105796")
let guild_id : @model.GuildId = user_id.cast()
assert_eq(guild_id.value(), user_id.value())
}

ScheduledEventId

type ScheduledEventId = Id[ScheduledEventMarker]

A Discord snowflake ID, tagged with a phantom marker type so that IDs of different resources cannot be mixed up (Id[UserMarker] vs Id[GuildMarker]).

Wire format: Discord serializes snowflakes as decimal strings (and historically as integers in a few places). We accept both on decode and always emit a string, going through the string representation so values above 2^53 never pass through a Double.

test "parse and explicitly retag a snowflake" {
let user_id : @model.UserId = @model.Id::parse("175928847299117063")
inspect(user_id.to_string(), content="175928847299117063")
inspect(user_id.timestamp_ms(), content="1462015105796")
let guild_id : @model.GuildId = user_id.cast()
assert_eq(guild_id.value(), user_id.value())
}

SkuId

type SkuId = Id[SkuMarker]

A Discord snowflake ID, tagged with a phantom marker type so that IDs of different resources cannot be mixed up (Id[UserMarker] vs Id[GuildMarker]).

Wire format: Discord serializes snowflakes as decimal strings (and historically as integers in a few places). We accept both on decode and always emit a string, going through the string representation so values above 2^53 never pass through a Double.

test "parse and explicitly retag a snowflake" {
let user_id : @model.UserId = @model.Id::parse("175928847299117063")
inspect(user_id.to_string(), content="175928847299117063")
inspect(user_id.timestamp_ms(), content="1462015105796")
let guild_id : @model.GuildId = user_id.cast()
assert_eq(guild_id.value(), user_id.value())
}

SoundboardSoundId

type SoundboardSoundId = Id[SoundboardSoundMarker]

A Discord snowflake ID, tagged with a phantom marker type so that IDs of different resources cannot be mixed up (Id[UserMarker] vs Id[GuildMarker]).

Wire format: Discord serializes snowflakes as decimal strings (and historically as integers in a few places). We accept both on decode and always emit a string, going through the string representation so values above 2^53 never pass through a Double.

test "parse and explicitly retag a snowflake" {
let user_id : @model.UserId = @model.Id::parse("175928847299117063")
inspect(user_id.to_string(), content="175928847299117063")
inspect(user_id.timestamp_ms(), content="1462015105796")
let guild_id : @model.GuildId = user_id.cast()
assert_eq(guild_id.value(), user_id.value())
}

StageInstanceId

type StageInstanceId = Id[StageInstanceMarker]

A Discord snowflake ID, tagged with a phantom marker type so that IDs of different resources cannot be mixed up (Id[UserMarker] vs Id[GuildMarker]).

Wire format: Discord serializes snowflakes as decimal strings (and historically as integers in a few places). We accept both on decode and always emit a string, going through the string representation so values above 2^53 never pass through a Double.

test "parse and explicitly retag a snowflake" {
let user_id : @model.UserId = @model.Id::parse("175928847299117063")
inspect(user_id.to_string(), content="175928847299117063")
inspect(user_id.timestamp_ms(), content="1462015105796")
let guild_id : @model.GuildId = user_id.cast()
assert_eq(guild_id.value(), user_id.value())
}

StickerId

type StickerId = Id[StickerMarker]

A Discord snowflake ID, tagged with a phantom marker type so that IDs of different resources cannot be mixed up (Id[UserMarker] vs Id[GuildMarker]).

Wire format: Discord serializes snowflakes as decimal strings (and historically as integers in a few places). We accept both on decode and always emit a string, going through the string representation so values above 2^53 never pass through a Double.

test "parse and explicitly retag a snowflake" {
let user_id : @model.UserId = @model.Id::parse("175928847299117063")
inspect(user_id.to_string(), content="175928847299117063")
inspect(user_id.timestamp_ms(), content="1462015105796")
let guild_id : @model.GuildId = user_id.cast()
assert_eq(guild_id.value(), user_id.value())
}

StickerPackId

type StickerPackId = Id[StickerPackMarker]

A Discord snowflake ID, tagged with a phantom marker type so that IDs of different resources cannot be mixed up (Id[UserMarker] vs Id[GuildMarker]).

Wire format: Discord serializes snowflakes as decimal strings (and historically as integers in a few places). We accept both on decode and always emit a string, going through the string representation so values above 2^53 never pass through a Double.

test "parse and explicitly retag a snowflake" {
let user_id : @model.UserId = @model.Id::parse("175928847299117063")
inspect(user_id.to_string(), content="175928847299117063")
inspect(user_id.timestamp_ms(), content="1462015105796")
let guild_id : @model.GuildId = user_id.cast()
assert_eq(guild_id.value(), user_id.value())
}

SubscriptionId

type SubscriptionId = Id[SubscriptionMarker]

A Discord snowflake ID, tagged with a phantom marker type so that IDs of different resources cannot be mixed up (Id[UserMarker] vs Id[GuildMarker]).

Wire format: Discord serializes snowflakes as decimal strings (and historically as integers in a few places). We accept both on decode and always emit a string, going through the string representation so values above 2^53 never pass through a Double.

test "parse and explicitly retag a snowflake" {
let user_id : @model.UserId = @model.Id::parse("175928847299117063")
inspect(user_id.to_string(), content="175928847299117063")
inspect(user_id.timestamp_ms(), content="1462015105796")
let guild_id : @model.GuildId = user_id.cast()
assert_eq(guild_id.value(), user_id.value())
}

TeamId

type TeamId = Id[TeamMarker]

A Discord snowflake ID, tagged with a phantom marker type so that IDs of different resources cannot be mixed up (Id[UserMarker] vs Id[GuildMarker]).

Wire format: Discord serializes snowflakes as decimal strings (and historically as integers in a few places). We accept both on decode and always emit a string, going through the string representation so values above 2^53 never pass through a Double.

test "parse and explicitly retag a snowflake" {
let user_id : @model.UserId = @model.Id::parse("175928847299117063")
inspect(user_id.to_string(), content="175928847299117063")
inspect(user_id.timestamp_ms(), content="1462015105796")
let guild_id : @model.GuildId = user_id.cast()
assert_eq(guild_id.value(), user_id.value())
}

UserId

type UserId = Id[UserMarker]

A Discord snowflake ID, tagged with a phantom marker type so that IDs of different resources cannot be mixed up (Id[UserMarker] vs Id[GuildMarker]).

Wire format: Discord serializes snowflakes as decimal strings (and historically as integers in a few places). We accept both on decode and always emit a string, going through the string representation so values above 2^53 never pass through a Double.

test "parse and explicitly retag a snowflake" {
let user_id : @model.UserId = @model.Id::parse("175928847299117063")
inspect(user_id.to_string(), content="175928847299117063")
inspect(user_id.timestamp_ms(), content="1462015105796")
let guild_id : @model.GuildId = user_id.cast()
assert_eq(guild_id.value(), user_id.value())
}

WebhookId

type WebhookId = Id[WebhookMarker]

A Discord snowflake ID, tagged with a phantom marker type so that IDs of different resources cannot be mixed up (Id[UserMarker] vs Id[GuildMarker]).

Wire format: Discord serializes snowflakes as decimal strings (and historically as integers in a few places). We accept both on decode and always emit a string, going through the string representation so values above 2^53 never pass through a Double.

test "parse and explicitly retag a snowflake" {
let user_id : @model.UserId = @model.Id::parse("175928847299117063")
inspect(user_id.to_string(), content="175928847299117063")
inspect(user_id.timestamp_ms(), content="1462015105796")
let guild_id : @model.GuildId = user_id.cast()
assert_eq(guild_id.value(), user_id.value())
}

AllowedMentionsError

pub(all) suberror AllowedMentionsError {
ParseAndExplicit(typ~ : AllowedMentionType)
TooManyRoles(count~ : Int)
TooManyUsers(count~ : Int)
} derive(Eq,
Debug
)

An invalid allowed-mentions configuration rejected during construction.

TimestampError

pub suberror TimestampError {
InvalidTimestamp(String)
} derive(
Debug
)

Raised when a string is not a valid ISO 8601 timestamp.

ActionMetadata

pub(all) struct ActionMetadata {
channel_id : Id[ChannelMarker]?
duration_seconds : Int?
custom_message : String?
} derive(ToJson,
Debug
,
FromJson
)

Optional execution settings for an auto-moderation action.

ActionRow

pub(all) struct ActionRow {
id : Int?
components : Array[Component]
} derive(ToJson,
Debug
,
FromJson
)

A layout row containing nested interactive components.

ActiveGuildThreads

pub(all) struct ActiveGuildThreads {
threads : Array[Channel]
members : Array[ThreadMember]
} derive(ToJson,
Debug
,
FromJson
)

Active thread channels in a guild and their membership records.

Activity

pub(all) struct Activity {
name : String
typ : ActivityType
url : Nullable[String]?
created_at : Int64
timestamps : ActivityTimestamps?
application_id : Id[ApplicationMarker]?
status_display_type : Nullable[Int]?
details : Nullable[String]?
details_url : Nullable[String]?
state : Nullable[String]?
state_url : Nullable[String]?
emoji : Nullable[ActivityEmoji]?
party : ActivityParty?
assets : ActivityAssets?
secrets : ActivitySecrets?
instance : Bool?
flags : ActivityFlags?
buttons : Array[ActivityButton]?
} derive(ToJson,
Debug
)

A Discord presence activity, including the documented Rich Presence fields.

ActivityAssets

pub(all) struct ActivityAssets {
large_image : String?
large_text : String?
large_url : String?
small_image : String?
small_text : String?
small_url : String?
invite_cover_image : String?
} derive(ToJson,
Debug
,
FromJson
)

Rich-presence artwork references and their hover texts.

ActivityButton

pub(all) struct ActivityButton {
label : String
url : String
} derive(ToJson,
Debug
,
FromJson
)

A custom label/url button shown on a rich presence.

ActivityEmoji

pub(all) struct ActivityEmoji {
name : String
id : Id[EmojiMarker]?
animated : Bool?
} derive(ToJson,
Debug
,
FromJson
)

The custom or unicode emoji attached to a custom status.

ActivityFlags

pub(all) struct ActivityFlags(UInt64) derive(Eq)

Bit set describing which rich-presence interactions an activity supports.

ActivityFlags::bits

fn ActivityFlags::bits(self : ActivityFlags) -> UInt64

ActivityFlags::from_bits

fn ActivityFlags::from_bits(bits : UInt64) -> ActivityFlags

ActivityInstance

pub(all) struct ActivityInstance {
application_id : Id[ApplicationMarker]
instance_id : String
launch_id : Id[GenericMarker]
location : ActivityLocation
users : Array[Id[UserMarker]]
} derive(ToJson,
Debug
,
FromJson
)

A live instance of an application activity.

ActivityLocation

pub(all) struct ActivityLocation {
id : String
kind : ActivityLocationKind
channel_id : Id[ChannelMarker]
guild_id : Nullable[Id[GuildMarker]]?
} derive(ToJson,
Debug
,
FromJson
)

The Discord location hosting an application activity instance.

ActivityLocationKind

pub(all) enum ActivityLocationKind {
GuildChannel
PrivateChannel
Unknown(String)
} derive(Eq,
Debug
)

The channel context hosting an application activity instance.

ActivityLocationKind::from_string

fn ActivityLocationKind::from_string(value : String) -> ActivityLocationKind

ActivityLocationKind::to_string

fn ActivityLocationKind::to_string(self : ActivityLocationKind) -> String

ActivityParty

pub(all) struct ActivityParty {
id : String?
size : Array[Int]?
} derive(ToJson,
Debug
,
FromJson
)

The rich-presence party, with size as [current, max] when present.

ActivitySecrets

pub(all) struct ActivitySecrets {
join : String?
spectate : String?
match_ : String?
} derive(ToJson,
Debug
,
FromJson
)

Secrets for joining or spectating a rich-presence session.

ActivityTimestamps

pub(all) struct ActivityTimestamps {
start : Int64?
end : Int64?
} derive(
Debug
)

Unix millisecond start and end times of an activity.

ActivityTimestampsWire

type ActivityTimestampsWire derive(
FromJson
)

ActivityType

pub(all) enum ActivityType {
Playing
Streaming
Listening
Watching
Custom
Competing
Unknown(Int)
} derive(Eq,
Debug
)

An activity category reported in a presence update.

ActivityType::from_int

fn ActivityType::from_int(value : Int) -> ActivityType

ActivityType::to_int

fn ActivityType::to_int(self : ActivityType) -> Int

ActivityWire

type ActivityWire derive(
FromJson
)

AllowedMentionType

pub(all) enum AllowedMentionType {
Roles
Users
Everyone
} derive(Eq,
Debug
)

A mention category Discord may derive directly from message content.

AllowedMentions

pub struct AllowedMentions {
// private fields
} derive(
Debug
)

Controls which mentions Discord resolves and notifies for an outgoing message.

Use AllowedMentions(...) so parse categories and explicit ID lists cannot conflict. The stored arrays are copied during construction to preserve that invariant if callers later mutate their input arrays.

AllowedMentions::AllowedMentions

fn AllowedMentions::AllowedMentions(parse? : Array[AllowedMentionType], roles? : Array[Id[RoleMarker]], users? : Array[Id[UserMarker]], replied_user? : Bool) -> AllowedMentions raise AllowedMentionsError

Construct a validated allowed-mentions object.

test "allow selected users without parsing every user mention" {
let user_id : @model.UserId = Id(42UL)
let mentions = @model.AllowedMentions(
parse=[Roles],
users=[user_id],
replied_user=false,
)
json_inspect(mentions, content={
"parse": ["roles"],
"users": ["42"],
"replied_user": false,
})
}

AllowedMentions::none

Suppress every mention parsed from message content.

AllowedMentions::safe_default

fn AllowedMentions::safe_default() -> AllowedMentions

Allow user and role mentions while suppressing @everyone and @here. This is the HTTP client's default for ordinary channel messages.

Application

pub(all) struct Application {
id : Id[ApplicationMarker]
name : String
icon : Nullable[ImageHash]
description : String
bot : User?
owner : User?
flags : ApplicationFlags?
flags_new : ApplicationFlags?
approximate_guild_count : Int?
approximate_user_install_count : Int?
rpc_origins : Array[String]?
bot_public : Bool?
bot_require_code_grant : Bool?
terms_of_service_url : String?
privacy_policy_url : String?
verify_key : String?
team : Nullable[Team]?
guild_id : Id[GuildMarker]?
guild : PartialGuild?
primary_sku_id : Id[SkuMarker]?
slug : String?
cover_image : ImageHash?
approximate_user_authorization_count : Int?
redirect_uris : Array[String]?
interactions_endpoint_url : Nullable[String]?
role_connections_verification_url : Nullable[String]?
event_webhooks_url : Nullable[String]?
event_webhooks_status : ApplicationEventWebhookStatus?
event_webhooks_types : Array[String]?
tags : Array[String]?
install_params : InstallParams?
integration_types_config : Map[String, ApplicationIntegrationTypeConfiguration]?
custom_install_url : String?
} derive(ToJson,
Debug
,
FromJson
)

A Discord application record. Fields that are absent from partial application payloads remain optional on receipt.

Application::effective_flags

fn Application::effective_flags(self : Application) -> ApplicationFlags?

Return Discord's full response bitfield when present, falling back to the legacy numeric flags field for older payloads.

ApplicationAuthorizedEvent

pub(all) struct ApplicationAuthorizedEvent {
integration_type : ApplicationIntegrationType?
user : User
scopes : Array[String]
guild : Guild?
} derive(ToJson,
Debug
,
FromJson
)

Data sent when a user authorizes an application.

ApplicationCommand

pub(all) struct ApplicationCommand {
id : Id[CommandMarker]
typ : ApplicationCommandType?
application_id : Id[ApplicationMarker]
guild_id : Id[GuildMarker]?
name : String
name_localizations : Nullable[Map[String, String]]?
description : String
description_localizations : Nullable[Map[String, String]]?
options : Array[CommandOption]?
default_member_permissions : Nullable[Permissions]
dm_permission : Bool?
nsfw : Bool?
integration_types : Array[ApplicationIntegrationType]?
contexts : Nullable[Array[InteractionContextType]]?
version : Id[CommandVersionMarker]
handler : EntryPointCommandHandlerType?
name_localized : String?
description_localized : String?
} derive(ToJson,
Debug
,
FromJson
)

A registered Discord application command.

ApplicationCommandPermission

pub(all) struct ApplicationCommandPermission {
id : Id[GenericMarker]
typ : ApplicationCommandPermissionType
permission : Bool
} derive(ToJson,
Debug
,
FromJson
)

One role, user, or channel permission override for an application command.

ApplicationCommandPermissionType

pub(all) enum ApplicationCommandPermissionType {
Role
User
Channel
Unknown(Int)
} derive(Eq,
Debug
)

The target kind of an application-command permission override.

ApplicationCommandPermissionType::from_int

ApplicationCommandPermissionType::to_int

ApplicationCommandType

pub(all) enum ApplicationCommandType {
ChatInput
User
Message
PrimaryEntryPoint
Unknown(Int)
} derive(Eq,
Debug
)

The invocation category of an application command.

ApplicationCommandType::from_int

fn ApplicationCommandType::from_int(value : Int) -> ApplicationCommandType

ApplicationCommandType::to_int

ApplicationDeauthorizedEvent

pub(all) struct ApplicationDeauthorizedEvent {
user : User
} derive(ToJson,
Debug
,
FromJson
)

Data sent when a user deauthorizes an application.

ApplicationEventWebhookStatus

pub(all) enum ApplicationEventWebhookStatus {
Disabled
Enabled
DisabledByDiscord
Unknown(Int)
} derive(Eq,
Debug
)

Whether Discord delivers event webhooks to the application; DisabledByDiscord means delivery was deactivated for inactivity.

ApplicationEventWebhookStatus::from_int

ApplicationEventWebhookStatus::to_int

ApplicationFlags

pub(all) struct ApplicationFlags(UInt64) derive(Eq)

Bit flags describing capabilities and privileged access for an application.

ApplicationFlags::application_auto_moderation_rule_create_badge

fn ApplicationFlags::application_auto_moderation_rule_create_badge() -> ApplicationFlags

ApplicationFlags::application_command_badge

fn ApplicationFlags::application_command_badge() -> ApplicationFlags

ApplicationFlags::bits

fn ApplicationFlags::bits(self : ApplicationFlags) -> UInt64

ApplicationFlags::contains

fn ApplicationFlags::contains(self : ApplicationFlags, other : ApplicationFlags) -> Bool

ApplicationFlags::embedded

ApplicationFlags::embedded_first_party

fn ApplicationFlags::embedded_first_party() -> ApplicationFlags

ApplicationFlags::embedded_iap

fn ApplicationFlags::embedded_iap() -> ApplicationFlags

ApplicationFlags::embedded_released

fn ApplicationFlags::embedded_released() -> ApplicationFlags

ApplicationFlags::from_bits

fn ApplicationFlags::from_bits(bits : UInt64) -> ApplicationFlags

ApplicationFlags::gateway_guild_members

fn ApplicationFlags::gateway_guild_members() -> ApplicationFlags

ApplicationFlags::gateway_guild_members_limited

fn ApplicationFlags::gateway_guild_members_limited() -> ApplicationFlags

ApplicationFlags::gateway_message_content

fn ApplicationFlags::gateway_message_content() -> ApplicationFlags

ApplicationFlags::gateway_message_content_limited

fn ApplicationFlags::gateway_message_content_limited() -> ApplicationFlags

ApplicationFlags::gateway_presence

fn ApplicationFlags::gateway_presence() -> ApplicationFlags

ApplicationFlags::gateway_presence_limited

fn ApplicationFlags::gateway_presence_limited() -> ApplicationFlags

ApplicationFlags::group_dm_create

fn ApplicationFlags::group_dm_create() -> ApplicationFlags

ApplicationFlags::managed_emoji

fn ApplicationFlags::managed_emoji() -> ApplicationFlags

ApplicationFlags::none

ApplicationFlags::rpc_has_connected

fn ApplicationFlags::rpc_has_connected() -> ApplicationFlags

ApplicationFlags::verification_pending_guild_limit

fn ApplicationFlags::verification_pending_guild_limit() -> ApplicationFlags

ApplicationIntegrationType

pub(all) enum ApplicationIntegrationType {
GuildInstall
UserInstall
Unknown(Int)
} derive(Eq,
Debug
)

Where an application command is installed.

ApplicationIntegrationType::from_int

ApplicationIntegrationType::to_int

ApplicationIntegrationTypeConfiguration

pub(all) struct ApplicationIntegrationTypeConfiguration {
oauth2_install_params : InstallParams?
} derive(ToJson,
Debug
,
FromJson
)

Installation settings for one application integration context.

ApplicationMarker

pub enum ApplicationMarker {
}

Phantom marker types for Id[M]. These are empty enums: they have no values and exist only at the type level.

ApplicationRoleConnection

pub(all) struct ApplicationRoleConnection {
platform_name : Nullable[String]
platform_username : Nullable[String]
metadata : Json
} derive(ToJson,
Debug
,
FromJson
)

Metadata attached to a user's application role connection.

ApplicationRoleConnectionMetadata

pub(all) struct ApplicationRoleConnectionMetadata {
typ : ApplicationRoleConnectionMetadataType
key : String
name : String
name_localizations : Nullable[Map[String, String]]?
description : String
description_localizations : Nullable[Map[String, String]]?
} derive(ToJson,
Debug
,
FromJson
)

One application role connection metadata record.

ApplicationRoleConnectionMetadataType

pub(all) enum ApplicationRoleConnectionMetadataType {
IntegerLessThanOrEqual
IntegerGreaterThanOrEqual
IntegerEqual
IntegerNotEqual
DatetimeLessThanOrEqual
DatetimeGreaterThanOrEqual
BooleanEqual
BooleanNotEqual
Unknown(Int)
} derive(Eq,
Debug
)

The comparison used for an application role connection metadata record.

ApplicationRoleConnectionMetadataType::from_int

ApplicationRoleConnectionMetadataType::to_int

ArchivedThreads

pub(all) struct ArchivedThreads {
threads : Array[Channel]
members : Array[ThreadMember]
has_more : Bool
} derive(ToJson,
Debug
,
FromJson
)

Archived thread channels and their membership records.

Attachment

pub(all) struct Attachment {
id : Id[AttachmentMarker]
filename : String
title : String?
description : String?
content_type : String?
size : Int
url : String
proxy_url : String
height : Nullable[Int]?
width : Nullable[Int]?
ephemeral : Bool?
duration_secs : Double?
waveform : String?
flags : AttachmentFlags?
placeholder : String?
placeholder_version : Int?
clip_participants : Array[User]?
clip_created_at : Timestamp?
application : Nullable[Application]?
} derive(ToJson,
Debug
,
FromJson
)

A file attached to a Discord message.

AttachmentFlags

pub(all) struct AttachmentFlags(UInt64) derive(Eq)

Bit flags describing special properties of an attachment.

AttachmentFlags::bits

fn AttachmentFlags::bits(self : AttachmentFlags) -> UInt64

AttachmentFlags::contains

fn AttachmentFlags::contains(self : AttachmentFlags, other : AttachmentFlags) -> Bool

AttachmentFlags::from_bits

fn AttachmentFlags::from_bits(bits : UInt64) -> AttachmentFlags

AttachmentFlags::is_animated

fn AttachmentFlags::is_animated() -> AttachmentFlags

AttachmentFlags::is_clip

AttachmentFlags::is_remix

AttachmentFlags::is_spoiler

fn AttachmentFlags::is_spoiler() -> AttachmentFlags

AttachmentFlags::is_thumbnail

fn AttachmentFlags::is_thumbnail() -> AttachmentFlags

AttachmentFlags::none

AttachmentMarker

pub enum AttachmentMarker {
}

AttachmentRequest

pub(all) struct AttachmentRequest {
id : Id[AttachmentMarker]
filename : String?
title : String?
description : String?
duration_secs : Double?
waveform : String?
is_spoiler : Bool?
} derive(
Debug
)

An existing attachment to retain when editing a message, per the documented attachment-request structure. description and is_spoiler may be updated in place; absent fields are omitted from the wire, leaving them unchanged. New uploads are announced by the typed wrappers from their files parameter instead.

AuditLog

pub(all) struct AuditLog {
audit_log_entries : Array[AuditLogEntry]
users : Array[User]
webhooks : Array[Webhook]
integrations : Array[Integration]
application_commands : Array[ApplicationCommand]
auto_moderation_rules : Array[AutoModerationRule]
threads : Array[Channel]
guild_scheduled_events : Array[GuildScheduledEvent]
} derive(ToJson,
Debug
,
FromJson
)

A guild audit log with referenced domain objects.

AuditLogChange

pub(all) struct AuditLogChange {
key : String
new_value : Json?
old_value : Json?
} derive(ToJson,
Debug
,
FromJson
)

A raw before-and-after field change recorded in an audit entry.

AuditLogEntry

pub(all) struct AuditLogEntry {
target_id : Nullable[String]
changes : Array[AuditLogChange]?
user_id : Nullable[Id[UserMarker]]
id : Id[AuditLogEntryMarker]
action_type : AuditLogEvent
options : Json?
reason : String?
} derive(ToJson,
Debug
,
FromJson
)

One actor action recorded in a guild audit log.

AuditLogEntryMarker

pub enum AuditLogEntryMarker {
}

AuditLogEvent

pub(all) enum AuditLogEvent {
GuildUpdate
ChannelCreate
ChannelUpdate
ChannelDelete
ChannelOverwriteCreate
ChannelOverwriteUpdate
ChannelOverwriteDelete
MemberKick
MemberPrune
MemberBanAdd
MemberBanRemove
MemberUpdate
MemberRoleUpdate
MemberMove
MemberDisconnect
BotAdd
RoleCreate
RoleUpdate
RoleDelete
InviteCreate
InviteUpdate
InviteDelete
WebhookCreate
WebhookUpdate
WebhookDelete
EmojiCreate
EmojiUpdate
EmojiDelete
MessageDelete
MessageBulkDelete
MessagePin
MessageUnpin
IntegrationCreate
IntegrationUpdate
IntegrationDelete
StageInstanceCreate
StageInstanceUpdate
StageInstanceDelete
StickerCreate
StickerUpdate
StickerDelete
GuildScheduledEventCreate
GuildScheduledEventUpdate
GuildScheduledEventDelete
ThreadCreate
ThreadUpdate
ThreadDelete
ApplicationCommandPermissionUpdate
SoundboardSoundCreate
SoundboardSoundUpdate
SoundboardSoundDelete
AutoModerationRuleCreate
AutoModerationRuleUpdate
AutoModerationRuleDelete
AutoModerationBlockMessage
AutoModerationFlagToChannel
AutoModerationUserCommunicationDisabled
AutoModerationQuarantineUser
CreatorMonetizationRequestCreated
CreatorMonetizationTermsAccepted
OnboardingPromptCreate
OnboardingPromptUpdate
OnboardingPromptDelete
OnboardingCreate
OnboardingUpdate
HomeSettingsCreate
HomeSettingsUpdate
VoiceChannelStatusCreate
VoiceChannelStatusDelete
Unknown(Int)
} derive(Eq,
Debug
)

The action category recorded by a guild audit log.

AuditLogEvent::from_int

fn AuditLogEvent::from_int(value : Int) -> AuditLogEvent

AuditLogEvent::to_int

fn AuditLogEvent::to_int(self : AuditLogEvent) -> Int

AuthorizationInformation

pub(all) struct AuthorizationInformation {
application : Application
scopes : Array[String]
expires : Timestamp
user : User?
} derive(ToJson,
Debug
,
FromJson
)

Details about the OAuth2 authorization represented by an access token.

Discord returns a partial application object here. Application is safe for that payload because it requires only the guaranteed id, name, icon, and description fields; all other application fields are optional.

AutoModerationAction

An action executed when an auto-moderation rule matches.

AutoModerationActionExecutionEvent

pub(all) struct AutoModerationActionExecutionEvent {
guild_id : Id[GuildMarker]
action : AutoModerationAction
rule_id : Id[AutoModerationRuleMarker]
rule_trigger_type : AutoModerationTriggerType
user_id : Id[UserMarker]
channel_id : Id[ChannelMarker]?
message_id : Id[MessageMarker]?
alert_system_message_id : Id[MessageMarker]?
content : String
matched_keyword : Nullable[String]
matched_content : Nullable[String]
} derive(ToJson,
Debug
,
FromJson
)

An auto-moderation action was executed against user content.

AutoModerationActionType

pub(all) enum AutoModerationActionType {
BlockMessage
SendAlertMessage
Timeout
BlockMemberInteraction
Unknown(Int)
} derive(Eq,
Debug
)

The operation performed by auto moderation.

AutoModerationActionType::from_int

AutoModerationActionType::to_int

AutoModerationEventType

pub(all) enum AutoModerationEventType {
MessageSend
MemberUpdate
Unknown(Int)
} derive(Eq,
Debug
)

The guild event evaluated by an auto-moderation rule.

AutoModerationEventType::from_int

AutoModerationEventType::to_int

AutoModerationKeywordPresetType

pub(all) enum AutoModerationKeywordPresetType {
Profanity
SexualContent
Slurs
Unknown(Int)
} derive(Eq,
Debug
)

A built-in keyword set used by auto moderation.

AutoModerationKeywordPresetType::from_int

AutoModerationKeywordPresetType::to_int

AutoModerationRule

pub(all) struct AutoModerationRule {
id : Id[AutoModerationRuleMarker]
guild_id : Id[GuildMarker]
name : String
creator_id : Id[UserMarker]
event_type : AutoModerationEventType
trigger_type : AutoModerationTriggerType
trigger_metadata : TriggerMetadata
actions : Array[AutoModerationAction]
enabled : Bool
exempt_roles : Array[Id[RoleMarker]]
exempt_channels : Array[Id[ChannelMarker]]
} derive(ToJson,
Debug
,
FromJson
)

A guild auto-moderation rule and its configured actions.

AutoModerationRuleMarker

pub enum AutoModerationRuleMarker {
}

AutoModerationTriggerType

pub(all) enum AutoModerationTriggerType {
Keyword
Spam
KeywordPreset
MentionSpam
MemberProfile
Unknown(Int)
} derive(Eq,
Debug
)

The condition category that activates an auto-moderation rule.

AutoModerationTriggerType::from_int

AutoModerationTriggerType::to_int

AvailableGuildCreateEvent

pub(all) struct AvailableGuildCreateEvent {
guild : Guild
joined_at : Timestamp
large : Bool
unavailable : Bool?
member_count : Int
voice_states : Array[VoiceState]
members : Array[GuildMember]
channels : Array[Channel]
threads : Array[Channel]
presences : Array[PresenceUpdateEvent]
stage_instances : Array[StageInstance]
guild_scheduled_events : Array[GuildScheduledEvent]
soundboard_sounds : Array[SoundboardSound]
} derive(
Debug
)

The complete guild and gateway-only collections sent when it becomes available to the client.

AvatarDecorationData

pub(all) struct AvatarDecorationData {
asset : ImageHash
sku_id : Id[SkuMarker]
} derive(Eq, ToJson,
Debug
,
FromJson
)

Metadata identifying the decoration displayed over a user's avatar.

BaseTheme

pub(all) enum BaseTheme {
Unset
Dark
Light
Darker
Midnight
Unknown(Int)
} derive(Eq,
Debug
)

The base client theme a SharedClientTheme gradient is mixed against.
impl ToJson for BaseTheme

BaseTheme::from_int

fn BaseTheme::from_int(value : Int) -> BaseTheme

BaseTheme::to_int

fn BaseTheme::to_int(self : BaseTheme) -> Int

BulkBanResponse

pub(all) struct BulkBanResponse {
banned_users : Array[Id[UserMarker]]
failed_users : Array[Id[UserMarker]]
} derive(ToJson,
Debug
,
FromJson
)

The result of banning several users in one request.

Button

pub(all) struct Button {
id : Int?
style : ButtonStyle
label : String?
emoji : Emoji?
custom_id : String?
sku_id : Id[SkuMarker]?
url : String?
disabled : Bool?
} derive(ToJson,
Debug
,
FromJson
)

A clickable button component.

ButtonStyle

pub(all) enum ButtonStyle {
Primary
Secondary
Success
Danger
Link
Premium
Unknown(Int)
} derive(Eq,
Debug
)

The visual and behavioral style of a button.

ButtonStyle::from_int

fn ButtonStyle::from_int(value : Int) -> ButtonStyle

ButtonStyle::to_int

fn ButtonStyle::to_int(self : ButtonStyle) -> Int

Channel

pub(all) struct Channel {
id : Id[ChannelMarker]
typ : ChannelType
guild_id : Id[GuildMarker]?
position : Int?
permission_overwrites : Array[Overwrite]?
name : Nullable[String]?
topic : Nullable[String]?
nsfw : Bool?
last_message_id : Nullable[Id[MessageMarker]]?
bitrate : Int?
user_limit : Int?
rate_limit_per_user : Int?
recipients : Array[User]?
icon : Nullable[ImageHash]?
owner_id : Id[UserMarker]?
application_id : Id[ApplicationMarker]?
managed : Bool?
parent_id : Nullable[Id[ChannelMarker]]?
last_pin_timestamp : Nullable[Timestamp]?
rtc_region : Nullable[String]?
video_quality_mode : VideoQualityMode?
message_count : Int?
member_count : Int?
thread_metadata : ThreadMetadata?
thread_member : ThreadMember?
default_auto_archive_duration : ThreadAutoArchiveDuration?
permissions : Permissions?
flags : ChannelFlags?
total_message_sent : Int?
available_tags : Array[ForumTag]?
applied_tags : Array[Id[GenericMarker]]?
default_reaction_emoji : Nullable[DefaultReaction]?
default_thread_rate_limit_per_user : Int?
default_sort_order : Nullable[SortOrderType]?
default_forum_layout : ForumLayoutType?
} derive(ToJson,
Debug
,
FromJson
)

A flat channel model covering every Discord channel variant.

ChannelFlags

pub(all) struct ChannelFlags(UInt64) derive(Eq)

Bit flags describing special behavior assigned to a channel.

ChannelFlags::active_channels_removed

fn ChannelFlags::active_channels_removed() -> ChannelFlags

ChannelFlags::bits

fn ChannelFlags::bits(self : ChannelFlags) -> UInt64

ChannelFlags::clyde_ai

fn ChannelFlags::clyde_ai() -> ChannelFlags

ChannelFlags::contains

fn ChannelFlags::contains(self : ChannelFlags, other : ChannelFlags) -> Bool

ChannelFlags::from_bits

fn ChannelFlags::from_bits(bits : UInt64) -> ChannelFlags

ChannelFlags::guild_feed_removed

fn ChannelFlags::guild_feed_removed() -> ChannelFlags

ChannelFlags::hide_media_download_options

fn ChannelFlags::hide_media_download_options() -> ChannelFlags

ChannelFlags::is_guild_resource_channel

fn ChannelFlags::is_guild_resource_channel() -> ChannelFlags

ChannelFlags::is_scheduled_for_deletion

fn ChannelFlags::is_scheduled_for_deletion() -> ChannelFlags

ChannelFlags::is_spam

fn ChannelFlags::is_spam() -> ChannelFlags

ChannelFlags::none

ChannelFlags::pinned

fn ChannelFlags::pinned() -> ChannelFlags

ChannelFlags::require_tag

fn ChannelFlags::require_tag() -> ChannelFlags

ChannelInfo

pub(all) struct ChannelInfo {
id : Id[ChannelMarker]
status : Nullable[String]?
voice_start_time : Nullable[Int64]?
} derive(ToJson,
Debug
,
FromJson
)

Ephemeral status and voice-session data for one channel.

ChannelInfoEvent

pub(all) struct ChannelInfoEvent {
guild_id : Id[GuildMarker]
channels : Array[ChannelInfo]
} derive(ToJson,
Debug
,
FromJson
)

Ephemeral voice-channel information returned for a guild.

ChannelMarker

pub enum ChannelMarker {
}

ChannelMention

pub(all) struct ChannelMention {
id : Id[ChannelMarker]
guild_id : Id[GuildMarker]
typ : ChannelType
name : String
} derive(ToJson,
Debug
,
FromJson
)

A channel referenced directly in message content.

ChannelPins

pub(all) struct ChannelPins {
items : Array[MessagePin]
has_more : Bool
} derive(ToJson,
Debug
,
FromJson
)

One page from GET /channels/{channel.id}/messages/pins.

ChannelPinsUpdateEvent

pub(all) struct ChannelPinsUpdateEvent {
guild_id : Id[GuildMarker]?
channel_id : Id[ChannelMarker]
last_pin_timestamp : Nullable[Timestamp]?
} derive(ToJson,
Debug
,
FromJson
)

The most recent pin timestamp changed for a channel.

ChannelType

pub(all) enum ChannelType {
GuildText
Dm
GuildVoice
GroupDm
GuildCategory
GuildAnnouncement
AnnouncementThread
PublicThread
PrivateThread
GuildStageVoice
GuildDirectory
GuildForum
GuildMedia
Unknown(Int)
} derive(Eq,
Debug
)

The type of a channel.

This is the reference implementation of the wire-enum pattern used across the whole model layer: an Unknown(raw) catch-all so decoding never fails on values Discord adds later, plus total to_int/from_int conversions and hand-written JSON impls (the derived enum representation is not Discord's scalar encoding).

ChannelType::from_int

fn ChannelType::from_int(value : Int) -> ChannelType

ChannelType::to_int

fn ChannelType::to_int(self : ChannelType) -> Int

Checkbox

pub(all) struct Checkbox {
id : Int?
custom_id : String
default : Bool?
value : Bool?
} derive(ToJson,
Debug
,
FromJson
)

A single modal checkbox.

CheckboxGroup

pub(all) struct CheckboxGroup {
id : Int?
custom_id : String
options : Array[RadioOption]
min_values : Int?
max_values : Int?
required : Bool?
values : Array[String]?
} derive(ToJson,
Debug
,
FromJson
)

A modal checkbox group accepting zero or more options.

ClientStatus

pub(all) struct ClientStatus {
desktop : PresenceStatus?
mobile : PresenceStatus?
web : PresenceStatus?
} derive(ToJson,
Debug
)

The Discord client families on which a user is active.

Collectibles

Collectible profile cosmetics owned by a user or guild member.

CommandData

pub(all) struct CommandData {
id : Id[CommandMarker]
name : String
typ : ApplicationCommandType
resolved : ResolvedData?
options : Array[CommandDataOption]?
guild_id : Id[GuildMarker]?
target_id : Id[GenericMarker]?
} derive(ToJson,
Debug
,
FromJson
)

Application-command data carried by command and autocomplete interactions.

CommandDataOption

pub(all) struct CommandDataOption {
name : String
typ : CommandOptionType
value : Json?
options : Array[CommandDataOption]?
focused : Bool?
} derive(ToJson,
Debug
,
FromJson
)

A submitted command option with its raw scalar or nested option value.

CommandMarker

pub enum CommandMarker {
}

CommandOption

pub(all) struct CommandOption {
typ : CommandOptionType
name : String
name_localizations : Nullable[Map[String, String]]?
description : String
description_localizations : Nullable[Map[String, String]]?
required : Bool?
choices : Array[CommandOptionChoice]?
options : Array[CommandOption]?
channel_types : Array[ChannelType]?
min_value : Json?
max_value : Json?
min_length : Int?
max_length : Int?
autocomplete : Bool?
} derive(ToJson,
Debug
,
FromJson
)

A flat command option supporting every current slash-command option shape.

CommandOptionChoice

pub(all) struct CommandOptionChoice {
name : String
name_localizations : Nullable[Map[String, String]]?
value : Json
} derive(ToJson,
Debug
,
FromJson
)

A named value offered as a predefined command option choice.

CommandOptionType

pub(all) enum CommandOptionType {
SubCommand
SubCommandGroup
String
Integer
Boolean
User
Channel
Role
Mentionable
Number
Attachment
Unknown(Int)
} derive(Eq,
Debug
)

The value category accepted by a command option.

CommandOptionType::from_int

fn CommandOptionType::from_int(value : Int) -> CommandOptionType

CommandOptionType::to_int

fn CommandOptionType::to_int(self : CommandOptionType) -> Int

CommandVersionMarker

pub enum CommandVersionMarker {
}

Component

pub(all) enum Component {
ActionRow(ActionRow)
Button(Button)
StringSelect(SelectMenu)
TextInput(TextInput)
UserSelect(SelectMenu)
RoleSelect(SelectMenu)
MentionableSelect(SelectMenu)
ChannelSelect(SelectMenu)
Section(Section)
TextDisplay(TextDisplay)
Thumbnail(Thumbnail)
MediaGallery(MediaGallery)
File(FileComponent)
Separator(Separator)
Container(Container)
Label(Label)
FileUpload(FileUpload)
RadioGroup(RadioGroup)
CheckboxGroup(CheckboxGroup)
Checkbox(Checkbox)
Unknown(Json)
} derive(
Debug
)

A Discord message component dispatched by its numeric wire discriminator.
impl ToJson for Component

ComponentData

pub(all) struct ComponentData {
custom_id : String
component_type : Int
values : Array[String]?
resolved : ResolvedData?
} derive(ToJson,
Debug
,
FromJson
)

Component-specific data carried by a message component interaction.

Connection

pub(all) struct Connection {
id : String
name : String
typ : ConnectionService
revoked : Bool?
integrations : Array[Integration]?
verified : Bool
friend_sync : Bool
show_activity : Bool
two_way_link : Bool
visibility : Int
} derive(ToJson,
Debug
,
FromJson
)

A user's linked external service account.

ConnectionService

pub(all) enum ConnectionService {
AmazonMusic
BattleNet
Bluesky
BungieNet
Crunchyroll
Domain
Ebay
EpicGames
Facebook
Github
Instagram
LeagueOfLegends
Mastodon
Paypal
PlaystationNetwork
Reddit
RiotGames
Roblox
Spotify
Skype
Steam
Tiktok
Twitch
X
Xbox
Youtube
Unknown(String)
} derive(Eq,
Debug
)

An external service linked to a Discord user account.

ConnectionService::from_string

fn ConnectionService::from_string(value : String) -> ConnectionService

ConnectionService::to_string

fn ConnectionService::to_string(self : ConnectionService) -> String

Container

pub(all) struct Container {
id : Int?
components : Array[Component]
accent_color : Nullable[Int]?
spoiler : Bool?
} derive(ToJson,
Debug
,
FromJson
)

A Components v2 container with an optional accent color.

CurrentUserGuild

pub(all) struct CurrentUserGuild {
id : Id[GuildMarker]
name : String
icon : Nullable[ImageHash]
banner : Nullable[ImageHash]
owner : Bool
permissions : Permissions
features : Array[GuildFeature]
approximate_member_count : Int?
approximate_presence_count : Int?
} derive(ToJson,
Debug
,
FromJson
)

The partial guild representation returned for the current user's guilds.

DefaultMessageNotifications

pub(all) enum DefaultMessageNotifications {
AllMessages
OnlyMentions
Unknown(Int)
} derive(Eq,
Debug
)

Discord's default message notification level.

DefaultMessageNotifications::from_int

DefaultMessageNotifications::to_int

DefaultReaction

pub(all) struct DefaultReaction {
emoji_id : Nullable[Id[EmojiMarker]]
emoji_name : Nullable[String]
} derive(ToJson,
Debug
,
FromJson
)

The default custom or Unicode reaction for a forum or media channel.

Embed

pub(all) struct Embed {
title : String?
typ : EmbedType?
url : String?
description : String?
timestamp : Timestamp?
color : Int?
footer : EmbedFooter?
image : EmbedImage?
thumbnail : EmbedThumbnail?
video : EmbedVideo?
provider : EmbedProvider?
author : EmbedAuthor?
fields : Array[EmbedField]?
flags : EmbedFlags?
} derive(ToJson,
Debug
,
FromJson
)

Rich content embedded in a Discord message.

Use Embed(...) to construct outgoing embeds from fields Discord accepts when sending. Embed models remain public records so received metadata can be inspected. Pass outgoing values to Client::create_message(embeds=[...]), CommandReply::message(embeds=[...]), ctx.respond, or a followup method. Discord applies its documented embed count and text-length limits.

test "construct an outgoing embed" {
let embed = @model.Embed(
title="Build complete",
description="All checks passed.",
timestamp=Timestamp("2026-07-15T00:00:00Z"),
color=0x57F287,
footer=EmbedFooter("build 42"),
fields=[
EmbedField("Target", "native", inline=true),
EmbedField("Tests", "325 passed", inline=true),
],
)
json_inspect(embed, content={
"title": "Build complete",
"description": "All checks passed.",
"timestamp": "2026-07-15T00:00:00Z",
"color": 5763719,
"footer": { "text": "build 42" },
"fields": [
{ "name": "Target", "value": "native", "inline": true },
{ "name": "Tests", "value": "325 passed", "inline": true },
],
})
}

Embed::Embed

fn Embed::Embed(title? : String, description? : String, url? : String, timestamp? : Timestamp, color? : Int, footer? : EmbedFooter, image? : EmbedImage, thumbnail? : EmbedThumbnail, author? : EmbedAuthor, fields? : Array[EmbedField]) -> Embed

Construct an embed containing only fields accepted in outgoing payloads. Receive-only fields are left unset. The fields array is copied so later mutations of the caller's array do not affect the embed.

EmbedAuthor

pub(all) struct EmbedAuthor {
name : String
url : String?
icon_url : String?
proxy_icon_url : String?
} derive(ToJson,
Debug
,
FromJson
)

Author information displayed at the top of an embed.

EmbedAuthor::EmbedAuthor

fn EmbedAuthor::EmbedAuthor(name : String, url? : String, icon_url? : String) -> EmbedAuthor

Construct author information for an outgoing embed.

EmbedField

pub(all) struct EmbedField {
name : String
value : String
inline : Bool?
} derive(ToJson,
Debug
,
FromJson
)

A named value displayed in an embed's field grid.

EmbedField::EmbedField

fn EmbedField::EmbedField(name : String, value : String, inline? : Bool) -> EmbedField

Construct a field for an outgoing embed.

EmbedFlags

pub(all) struct EmbedFlags(UInt64) derive(Eq)

Bit flags describing special rendering behavior of an embed.

EmbedFlags::bits

fn EmbedFlags::bits(self : EmbedFlags) -> UInt64

EmbedFlags::from_bits

fn EmbedFlags::from_bits(bits : UInt64) -> EmbedFlags

EmbedFlags::is_content_inventory_entry

fn EmbedFlags::is_content_inventory_entry() -> EmbedFlags

EmbedFooter

pub(all) struct EmbedFooter {
text : String
icon_url : String?
proxy_icon_url : String?
} derive(ToJson,
Debug
,
FromJson
)

Footer text and optional icon URLs for an embed.

EmbedFooter::EmbedFooter

fn EmbedFooter::EmbedFooter(text : String, icon_url? : String) -> EmbedFooter

Construct footer content for an outgoing embed.

EmbedImage

pub(all) struct EmbedImage {
url : String
proxy_url : String?
height : Int?
width : Int?
} derive(ToJson,
Debug
,
FromJson
)

Image media displayed within an embed.

EmbedImage::EmbedImage

fn EmbedImage::EmbedImage(url : String) -> EmbedImage

Construct image media for an outgoing embed.

EmbedProvider

pub(all) struct EmbedProvider {
name : String?
url : String?
} derive(ToJson,
Debug
,
FromJson
)

Attribution information for the provider of an embed.

EmbedThumbnail

pub(all) struct EmbedThumbnail {
url : String
proxy_url : String?
height : Int?
width : Int?
} derive(ToJson,
Debug
,
FromJson
)

Thumbnail media displayed beside an embed.

EmbedThumbnail::EmbedThumbnail

fn EmbedThumbnail::EmbedThumbnail(url : String) -> EmbedThumbnail

Construct thumbnail media for an outgoing embed.

EmbedType

pub(all) enum EmbedType {
Rich
Image
Video
Gifv
Article
Link
AutoModerationMessage
PollResult
Unknown(String)
} derive(Eq,
Debug
)

The string discriminator describing an embed's rendering category.
impl ToJson for EmbedType

EmbedType::from_string

fn EmbedType::from_string(value : String) -> EmbedType

EmbedType::to_string

fn EmbedType::to_string(self : EmbedType) -> String

EmbedVideo

pub(all) struct EmbedVideo {
url : String?
proxy_url : String?
height : Int?
width : Int?
} derive(ToJson,
Debug
,
FromJson
)

Video media attached to an embed.

Emoji

pub(all) struct Emoji {
id : Nullable[Id[EmojiMarker]]?
name : Nullable[String]
animated : Bool?
roles : Array[Id[RoleMarker]]?
user : User?
require_colons : Bool?
managed : Bool?
available : Bool?
} derive(ToJson,
Debug
,
FromJson
)

A Discord custom or reaction emoji.

EmojiMarker

pub enum EmojiMarker {
}

Entitlement

pub(all) struct Entitlement {
id : Id[EntitlementMarker]
sku_id : Id[SkuMarker]
application_id : Id[ApplicationMarker]
user_id : Id[UserMarker]?
typ : EntitlementType
deleted : Bool
starts_at : Nullable[Timestamp]?
ends_at : Nullable[Timestamp]?
guild_id : Id[GuildMarker]?
consumed : Bool?
} derive(ToJson,
Debug
,
FromJson
)

A grant of access to a Discord application SKU.

EntitlementMarker

pub enum EntitlementMarker {
}

EntitlementOwnerType

pub(all) enum EntitlementOwnerType {
Guild
User
Unknown(Int)
} derive(Eq,
Debug
)

The owner scope used when creating a test entitlement.

EntitlementOwnerType::from_int

fn EntitlementOwnerType::from_int(value : Int) -> EntitlementOwnerType

EntitlementOwnerType::to_int

fn EntitlementOwnerType::to_int(self : EntitlementOwnerType) -> Int

EntitlementType

pub(all) enum EntitlementType {
Purchase
PremiumSubscription
DeveloperGift
TestModePurchase
FreePurchase
UserGift
PremiumPurchase
ApplicationSubscription
Unknown(Int)
} derive(Eq,
Debug
)

The origin of an application entitlement.

EntitlementType::from_int

fn EntitlementType::from_int(value : Int) -> EntitlementType

EntitlementType::to_int

fn EntitlementType::to_int(self : EntitlementType) -> Int

EntityMetadata

pub(all) struct EntityMetadata {
location : String?
} derive(ToJson,
Debug
,
FromJson
)

Optional metadata describing a scheduled event's external entity.

EntryPointCommandHandlerType

pub(all) enum EntryPointCommandHandlerType {
AppHandler
DiscordLaunchActivity
Unknown(Int)
} derive(Eq,
Debug
)

The handler used for a primary entry-point command.

EntryPointCommandHandlerType::from_int

EntryPointCommandHandlerType::to_int

Event

pub(all) enum Event {
ApplicationCommandPermissionsUpdate(GuildApplicationCommandPermissions)
AutoModerationActionExecution(AutoModerationActionExecutionEvent)
AutoModerationRuleCreate(AutoModerationRule)
AutoModerationRuleDelete(AutoModerationRule)
AutoModerationRuleUpdate(AutoModerationRule)
ChannelCreate(Channel)
ChannelDelete(Channel)
ChannelInfo(ChannelInfoEvent)
ChannelPinsUpdate(ChannelPinsUpdateEvent)
ChannelUpdate(Channel)
EntitlementCreate(Entitlement)
EntitlementDelete(Entitlement)
EntitlementUpdate(Entitlement)
GuildAuditLogEntryCreate(GuildAuditLogEntryCreateEvent)
GuildBanAdd(GuildBanEvent)
GuildBanRemove(GuildBanEvent)
GuildCreate(GuildCreateEvent)
GuildDelete(UnavailableGuild)
GuildEmojisUpdate(GuildEmojisUpdateEvent)
GuildIntegrationsUpdate(GuildIntegrationsUpdateEvent)
GuildMemberAdd(GuildMemberAddEvent)
GuildMemberRemove(GuildMemberRemoveEvent)
GuildMembersChunk(GuildMembersChunkEvent)
GuildMemberUpdate(GuildMemberUpdateEvent)
GuildRoleCreate(GuildRoleEvent)
GuildRoleDelete(GuildRoleDeleteEvent)
GuildRoleUpdate(GuildRoleEvent)
GuildScheduledEventCreate(GuildScheduledEvent)
GuildScheduledEventDelete(GuildScheduledEvent)
GuildScheduledEventUpdate(GuildScheduledEvent)
GuildScheduledEventUserAdd(GuildScheduledEventUserEvent)
GuildScheduledEventUserRemove(GuildScheduledEventUserEvent)
GuildSoundboardSoundCreate(SoundboardSound)
GuildSoundboardSoundDelete(GuildSoundboardSoundDeleteEvent)
GuildSoundboardSoundsUpdate(SoundboardSoundsEvent)
GuildSoundboardSoundUpdate(SoundboardSound)
SoundboardSounds(SoundboardSoundsEvent)
GuildStickersUpdate(GuildStickersUpdateEvent)
GuildUpdate(Guild)
IntegrationCreate(IntegrationEvent)
IntegrationDelete(IntegrationDeleteEvent)
IntegrationUpdate(IntegrationEvent)
InteractionCreate(Interaction)
InviteCreate(InviteCreateEvent)
InviteDelete(InviteDeleteEvent)
MessageCreate(MessageCreateEvent)
MessageDelete(MessageDeleteEvent)
MessageDeleteBulk(MessageDeleteBulkEvent)
MessagePollVoteAdd(MessagePollVoteEvent)
MessagePollVoteRemove(MessagePollVoteEvent)
MessageReactionAdd(MessageReactionAddEvent)
MessageReactionRemove(MessageReactionRemoveEvent)
MessageReactionRemoveAll(MessageReactionRemoveAllEvent)
MessageReactionRemoveEmoji(MessageReactionRemoveEmojiEvent)
MessageUpdate(MessageUpdateEvent)
PresenceUpdate(PresenceUpdateEvent)
RateLimited(GatewayRateLimitedEvent)
Ready(Ready)
Resumed
StageInstanceCreate(StageInstance)
StageInstanceDelete(StageInstance)
StageInstanceUpdate(StageInstance)
SubscriptionCreate(Subscription)
SubscriptionDelete(Subscription)
SubscriptionUpdate(Subscription)
ThreadCreate(ThreadCreateEvent)
ThreadDelete(ThreadDeleteEvent)
ThreadListSync(ThreadListSyncEvent)
ThreadMembersUpdate(ThreadMembersUpdateEvent)
ThreadMemberUpdate(ThreadMemberUpdateEvent)
ThreadUpdate(Channel)
TypingStart(TypingStartEvent)
UserUpdate(User)
VoiceChannelEffectSend(VoiceChannelEffectSendEvent)
VoiceChannelStartTimeUpdate(VoiceChannelStartTimeUpdateEvent)
VoiceChannelStatusUpdate(VoiceChannelStatusUpdateEvent)
VoiceServerUpdate(VoiceServerUpdateEvent)
VoiceStateUpdate(VoiceState)
WebhooksUpdate(WebhooksUpdateEvent)
Unknown(t~ : String, d~ : Json)
} derive(
Debug
)

A gateway dispatch event decoded by its wire event name.

Unknown event names retain both the name and payload for forward compatibility.

EventKind

pub(all) enum EventKind {
KApplicationCommandPermissionsUpdate
KAutoModerationActionExecution
KAutoModerationRuleCreate
KAutoModerationRuleDelete
KAutoModerationRuleUpdate
KChannelCreate
KChannelDelete
KChannelInfo
KChannelPinsUpdate
KChannelUpdate
KEntitlementCreate
KEntitlementDelete
KEntitlementUpdate
KGuildAuditLogEntryCreate
KGuildBanAdd
KGuildBanRemove
KGuildCreate
KGuildDelete
KGuildEmojisUpdate
KGuildIntegrationsUpdate
KGuildMemberAdd
KGuildMemberRemove
KGuildMembersChunk
KGuildMemberUpdate
KGuildRoleCreate
KGuildRoleDelete
KGuildRoleUpdate
KGuildScheduledEventCreate
KGuildScheduledEventDelete
KGuildScheduledEventUpdate
KGuildScheduledEventUserAdd
KGuildScheduledEventUserRemove
KGuildSoundboardSoundCreate
KGuildSoundboardSoundDelete
KGuildSoundboardSoundsUpdate
KGuildSoundboardSoundUpdate
KSoundboardSounds
KGuildStickersUpdate
KGuildUpdate
KIntegrationCreate
KIntegrationDelete
KIntegrationUpdate
KInteractionCreate
KInviteCreate
KInviteDelete
KMessageCreate
KMessageDelete
KMessageDeleteBulk
KMessagePollVoteAdd
KMessagePollVoteRemove
KMessageReactionAdd
KMessageReactionRemove
KMessageReactionRemoveAll
KMessageReactionRemoveEmoji
KMessageUpdate
KPresenceUpdate
KRateLimited
KReady
KResumed
KStageInstanceCreate
KStageInstanceDelete
KStageInstanceUpdate
KSubscriptionCreate
KSubscriptionDelete
KSubscriptionUpdate
KThreadCreate
KThreadDelete
KThreadListSync
KThreadMembersUpdate
KThreadMemberUpdate
KThreadUpdate
KTypingStart
KUserUpdate
KVoiceChannelEffectSend
KVoiceChannelStartTimeUpdate
KVoiceChannelStatusUpdate
KVoiceServerUpdate
KVoiceStateUpdate
KWebhooksUpdate
KUnknown
} derive(Eq,
Debug
)

A dispatch event category without its payload.

EventKind::of_name

fn EventKind::of_name(t : String) -> EventKind

Map a gateway dispatch name (e.g. "MESSAGE_CREATE") to its kind; unrecognized names map to KUnknown.

EventKind::required_intents

fn EventKind::required_intents(self : EventKind) -> Intents

Gateway intents that can cause this dispatch event to be delivered.

Events shared by guild and direct-message contexts return the union of both intents. MESSAGE_CONTENT is deliberately absent because it controls field visibility rather than event delivery.

ExplicitContentFilter

pub(all) enum ExplicitContentFilter {
Disabled
MembersWithoutRoles
AllMembers
Unknown(Int)
} derive(Eq,
Debug
)

Discord's explicit content filter level.

ExplicitContentFilter::from_int

fn ExplicitContentFilter::from_int(value : Int) -> ExplicitContentFilter

ExplicitContentFilter::to_int

FileComponent

pub(all) struct FileComponent {
id : Int?
file : UnfurledMediaItem
spoiler : Bool?
name : String?
size : Int?
} derive(ToJson,
Debug
,
FromJson
)

A file attachment rendered as a Components v2 file component.

FileUpload

pub(all) struct FileUpload {
id : Int?
custom_id : String
min_values : Int?
max_values : Int?
required : Bool?
values : Array[String]?
} derive(ToJson,
Debug
,
FromJson
)

A modal file upload component.

FollowedChannel

pub(all) struct FollowedChannel {
channel_id : Id[ChannelMarker]
webhook_id : Id[WebhookMarker]
} derive(ToJson,
Debug
,
FromJson
)

The announcement channel and webhook created by following a channel.

ForumLayoutType

pub(all) enum ForumLayoutType {
NotSet
ListView
GalleryView
Unknown(Int)
} derive(Eq,
Debug
)

The presentation layout used by a forum channel.

ForumLayoutType::from_int

fn ForumLayoutType::from_int(value : Int) -> ForumLayoutType

ForumLayoutType::to_int

fn ForumLayoutType::to_int(self : ForumLayoutType) -> Int

ForumTag

pub(all) struct ForumTag {
id : Id[GenericMarker]
name : String
moderated : Bool
emoji_id : Nullable[Id[EmojiMarker]]
emoji_name : Nullable[String]
} derive(ToJson,
Debug
,
FromJson
)

A tag available for categorizing threads in a forum or media channel.

ForumTagRequest

pub(all) struct ForumTagRequest {
id : Id[GenericMarker]?
name : String
moderated : Bool?
emoji_id : Id[EmojiMarker]?
emoji_name : String?
} derive(
Debug
)

A forum tag as sent in available_tags when creating or modifying a forum or media channel. Only name is required; omit id to create a new tag, keep an existing tag's id to update it in place. At most one of emoji_id and emoji_name may be set.

GameDirectMessage

pub(all) struct GameDirectMessage {
id : Id[MessageMarker]
typ : MessageType?
content : String?
channel_id : Id[ChannelMarker]?
channel : Channel?
author : User?
recipient_id : Id[UserMarker]?
timestamp : Timestamp?
edited_timestamp : Nullable[Timestamp]?
flags : MessageFlags?
application_id : Id[ApplicationMarker]?
attachments : Array[Attachment]?
components : Array[Component]?
activity : MessageActivity?
application : Json?
raw : Json
} derive(
Debug
)

A compact, lossless view of a Social SDK direct message.

These webhook objects may be standard messages or the smaller SDK DM shape. Fields that differ between those forms are optional, and raw preserves all unmodeled standard-message and SDK extension fields.

GatewayBotInfo

pub(all) struct GatewayBotInfo {
url : String
shards : Int
session_start_limit : SessionStartLimit
} derive(ToJson,
Debug
,
FromJson
)

Response of GET /gateway/bot.

GatewayOpcode

pub(all) enum GatewayOpcode {
Dispatch
Heartbeat
Identify
PresenceUpdate
VoiceStateUpdate
Resume
Reconnect
RequestGuildMembers
InvalidSession
Hello
HeartbeatAck
RequestSoundboardSounds
Unknown(Int)
} derive(Eq,
Debug
)

Gateway opcodes (send and receive).

GatewayOpcode::from_int

fn GatewayOpcode::from_int(value : Int) -> GatewayOpcode

GatewayOpcode::to_int

fn GatewayOpcode::to_int(self : GatewayOpcode) -> Int

GatewayRateLimitedEvent

pub(all) struct GatewayRateLimitedEvent {
opcode : Int
retry_after : Double
meta : Json
} derive(ToJson,
Debug
,
FromJson
)

A gateway request was rate limited.

GenericMarker

pub enum GenericMarker {
}

Guild

pub(all) struct Guild {
id : Id[GuildMarker]
name : String
icon : Nullable[ImageHash]
icon_hash : Nullable[ImageHash]?
splash : Nullable[ImageHash]
discovery_splash : Nullable[ImageHash]
owner : Bool?
owner_id : Id[UserMarker]
permissions : Permissions?
afk_channel_id : Nullable[Id[ChannelMarker]]
afk_timeout : Int
widget_enabled : Bool?
widget_channel_id : Nullable[Id[ChannelMarker]]?
verification_level : VerificationLevel
default_message_notifications : DefaultMessageNotifications
explicit_content_filter : ExplicitContentFilter
roles : Array[Role]
emojis : Array[Emoji]
features : Array[GuildFeature]
mfa_level : MfaLevel
application_id : Nullable[Id[ApplicationMarker]]
system_channel_id : Nullable[Id[ChannelMarker]]
system_channel_flags : SystemChannelFlags
rules_channel_id : Nullable[Id[ChannelMarker]]
max_presences : Nullable[Int]?
max_members : Int?
vanity_url_code : Nullable[String]
description : Nullable[String]
banner : Nullable[ImageHash]
premium_tier : PremiumTier
premium_subscription_count : Int?
preferred_locale : String
public_updates_channel_id : Nullable[Id[ChannelMarker]]
max_video_channel_users : Int?
max_stage_video_channel_users : Int?
approximate_member_count : Int?
approximate_presence_count : Int?
welcome_screen : WelcomeScreen?
nsfw_level : NsfwLevel?
stickers : Array[Sticker]?
premium_progress_bar_enabled : Bool?
safety_alerts_channel_id : Nullable[Id[ChannelMarker]]
incidents_data : Nullable[IncidentsData]?
} derive(ToJson,
Debug
,
FromJson
)

A Discord guild and its configured capabilities.

GuildApplicationCommandPermissions

pub(all) struct GuildApplicationCommandPermissions {
id : Id[CommandMarker]
application_id : Id[ApplicationMarker]
guild_id : Id[GuildMarker]
permissions : Array[ApplicationCommandPermission]
} derive(ToJson,
Debug
,
FromJson
)

Guild-scoped permission overrides for one application command.

GuildAuditLogEntryCreateEvent

pub(all) struct GuildAuditLogEntryCreateEvent {
guild_id : Id[GuildMarker]
entry : AuditLogEntry
} derive(
Debug
)

An audit-log entry created in a guild, decoded from the flattened object.

GuildBan

pub(all) struct GuildBan {
reason : Nullable[String]
user : User
} derive(ToJson,
Debug
,
FromJson
)

A ban record pairing a user with an optional reason.

GuildBanEvent

pub(all) struct GuildBanEvent {
guild_id : Id[GuildMarker]
user : User
} derive(ToJson,
Debug
,
FromJson
)

A user ban added to or removed from a guild.

GuildCreateEvent

pub(all) enum GuildCreateEvent {
Available(AvailableGuildCreateEvent)
Unavailable(UnavailableGuild)
} derive(
Debug
)

A guild-create dispatch is either a complete available guild or the small unavailable-guild sentinel emitted while Discord is having an outage.

GuildEmojisUpdateEvent

pub(all) struct GuildEmojisUpdateEvent {
guild_id : Id[GuildMarker]
emojis : Array[Emoji]
} derive(ToJson,
Debug
,
FromJson
)

Guild emoji collection replacement.

GuildFeature

pub(all) enum GuildFeature {
AnimatedBanner
AnimatedIcon
ApplicationCommandPermissionsV2
AutoModeration
Banner
Community
CreatorMonetizableProvisional
CreatorStorePage
DeveloperSupportServer
Discoverable
Featurable
HasDirectoryEntry
Hub
InvitesDisabled
InviteSplash
LinkedToHub
MemberVerificationGateEnabled
MoreSoundboard
MonetizationEnabled
MoreStickers
News
Partnered
PreviewEnabled
PrivateThreads
RaidAlertsDisabled
RelayEnabled
RoleIcons
RoleSubscriptionsAvailableForPurchase
RoleSubscriptionsEnabled
Soundboard
TicketedEventsEnabled
VanityUrl
Verified
VipRegions
WelcomeScreenEnabled
GuildTags
EnhancedRoleColors
GuestsEnabled
PinPermissionMigrationComplete
Unknown(String)
} derive(Eq,
Debug
)

A capability enabled for a Discord guild.

GuildFeature::from_string

fn GuildFeature::from_string(value : String) -> GuildFeature

GuildFeature::to_string

fn GuildFeature::to_string(self : GuildFeature) -> String

GuildIntegrationsUpdateEvent

pub(all) struct GuildIntegrationsUpdateEvent {
guild_id : Id[GuildMarker]
} derive(ToJson,
Debug
,
FromJson
)

Notification that a guild's integrations changed.

GuildMarker

pub enum GuildMarker {
}

GuildMember

pub(all) struct GuildMember {
user : User?
nick : Nullable[String]?
avatar : Nullable[ImageHash]?
banner : Nullable[ImageHash]?
roles : Array[Id[RoleMarker]]
joined_at : Nullable[Timestamp]
premium_since : Nullable[Timestamp]?
deaf : Bool?
mute : Bool?
flags : GuildMemberFlags?
pending : Bool?
permissions : Permissions?
communication_disabled_until : Nullable[Timestamp]?
avatar_decoration_data : Nullable[AvatarDecorationData]?
collectibles : Nullable[Collectibles]?
} derive(ToJson,
Debug
,
FromJson
)

A user's membership state and profile within a guild.

GuildMemberAddEvent

pub(all) struct GuildMemberAddEvent {
guild_id : Id[GuildMarker]
guild_member : GuildMember
} derive(
Debug
)

A guild member joined event decoded from Discord's flattened member object.

GuildMemberFlags

pub(all) struct GuildMemberFlags(UInt64) derive(Eq)

Bit flags describing onboarding, verification, and moderation member state.

GuildMemberFlags::auto_mod_quarantined_guild_tag

fn GuildMemberFlags::auto_mod_quarantined_guild_tag() -> GuildMemberFlags

GuildMemberFlags::automod_quarantined_bio

fn GuildMemberFlags::automod_quarantined_bio() -> GuildMemberFlags

GuildMemberFlags::automod_quarantined_username_or_guild_nickname

fn GuildMemberFlags::automod_quarantined_username_or_guild_nickname() -> GuildMemberFlags

GuildMemberFlags::bits

fn GuildMemberFlags::bits(self : GuildMemberFlags) -> UInt64

GuildMemberFlags::bypasses_verification

fn GuildMemberFlags::bypasses_verification() -> GuildMemberFlags

GuildMemberFlags::completed_home_actions

fn GuildMemberFlags::completed_home_actions() -> GuildMemberFlags

GuildMemberFlags::completed_onboarding

fn GuildMemberFlags::completed_onboarding() -> GuildMemberFlags

GuildMemberFlags::contains

fn GuildMemberFlags::contains(self : GuildMemberFlags, other : GuildMemberFlags) -> Bool

GuildMemberFlags::did_rejoin

GuildMemberFlags::dm_settings_upsell_acknowledged

fn GuildMemberFlags::dm_settings_upsell_acknowledged() -> GuildMemberFlags

GuildMemberFlags::from_bits

fn GuildMemberFlags::from_bits(bits : UInt64) -> GuildMemberFlags

GuildMemberFlags::is_guest

GuildMemberFlags::none

GuildMemberFlags::started_home_actions

fn GuildMemberFlags::started_home_actions() -> GuildMemberFlags

GuildMemberFlags::started_onboarding

fn GuildMemberFlags::started_onboarding() -> GuildMemberFlags

GuildMemberRemoveEvent

pub(all) struct GuildMemberRemoveEvent {
guild_id : Id[GuildMarker]
user : User
} derive(ToJson,
Debug
,
FromJson
)

A user removed from a guild.

GuildMemberUpdateEvent

pub(all) struct GuildMemberUpdateEvent {
guild_id : Id[GuildMarker]
roles : Array[Id[RoleMarker]]
user : User
nick : Nullable[String]?
avatar : Nullable[ImageHash]
joined_at : Nullable[Timestamp]
premium_since : Nullable[Timestamp]?
deaf : Bool?
mute : Bool?
pending : Bool?
communication_disabled_until : Nullable[Timestamp]?
flags : GuildMemberFlags?
avatar_decoration_data : Nullable[AvatarDecorationData]?
} derive(ToJson,
Debug
,
FromJson
)

Mutable guild-member fields delivered by GUILD_MEMBER_UPDATE.

GuildMembersChunkEvent

pub(all) struct GuildMembersChunkEvent {
guild_id : Id[GuildMarker]
members : Array[GuildMember]
chunk_index : Int
chunk_count : Int
not_found : Array[Json]?
presences : Array[PresenceUpdateEvent]?
nonce : String?
} derive(ToJson,
Debug
,
FromJson
)

A chunk returned by a gateway guild-member request.

GuildMessageSearchResults

pub(all) struct GuildMessageSearchResults {
doing_deep_historical_index : Bool?
documents_indexed : Int?
total_results : Int?
messages : Array[Array[Message]]?
threads : Array[Channel]?
members : Array[ThreadMember]?
retry_after : Int?
code : Int?
message : String?
} derive(ToJson,
Debug
,
FromJson
)

A guild message search response. All fields are optional because Discord returns either completed results or an HTTP 202 indexing response. When retry_after is Some, the search index was not ready and the caller should retry after that many seconds.

GuildOnboarding

pub(all) struct GuildOnboarding {
guild_id : Id[GuildMarker]
prompts : Array[OnboardingPrompt]
default_channel_ids : Array[Id[ChannelMarker]]
enabled : Bool
mode : OnboardingMode
} derive(ToJson,
Debug
,
FromJson
)

A guild's onboarding configuration.

GuildPreview

pub(all) struct GuildPreview {
id : Id[GuildMarker]
name : String
icon : Nullable[ImageHash]
splash : Nullable[ImageHash]
discovery_splash : Nullable[ImageHash]
emojis : Array[Emoji]
features : Array[GuildFeature]
approximate_member_count : Int
approximate_presence_count : Int
description : Nullable[String]
stickers : Array[Sticker]
} derive(ToJson,
Debug
,
FromJson
)

A guild's public preview, available for discoverable guilds.

GuildPruneResult

pub(all) struct GuildPruneResult {
pruned : Nullable[Int]
} derive(ToJson,
Debug
,
FromJson
)

The number of members pruned, or null when a begin-prune request did not compute the count.

GuildRoleDeleteEvent

pub(all) struct GuildRoleDeleteEvent {
guild_id : Id[GuildMarker]
role_id : Id[RoleMarker]
} derive(ToJson,
Debug
,
FromJson
)

A role deleted from a guild.

GuildRoleEvent

pub(all) struct GuildRoleEvent {
guild_id : Id[GuildMarker]
role : Role
} derive(ToJson,
Debug
,
FromJson
)

A role created or updated in a guild.

GuildScheduledEvent

pub(all) struct GuildScheduledEvent {
id : Id[ScheduledEventMarker]
guild_id : Id[GuildMarker]
channel_id : Nullable[Id[ChannelMarker]]
creator_id : Nullable[Id[UserMarker]]?
name : String
description : Nullable[String]?
scheduled_start_time : Timestamp
scheduled_end_time : Nullable[Timestamp]
privacy_level : GuildScheduledEventPrivacyLevel
status : GuildScheduledEventStatus
entity_type : GuildScheduledEventEntityType
entity_id : Nullable[Id[GenericMarker]]
entity_metadata : Nullable[EntityMetadata]
creator : User?
user_count : Int?
image : Nullable[ImageHash]?
recurrence_rule : Nullable[GuildScheduledEventRecurrenceRule]
} derive(ToJson,
Debug
,
FromJson
)

A guild event scheduled for a stage, voice channel, or external location.

GuildScheduledEventEntityType

pub(all) enum GuildScheduledEventEntityType {
StageInstance
Voice
External
Unknown(Int)
} derive(Eq,
Debug
)

The hosting entity used by a scheduled event.

GuildScheduledEventEntityType::from_int

GuildScheduledEventEntityType::to_int

GuildScheduledEventPrivacyLevel

pub(all) enum GuildScheduledEventPrivacyLevel {
GuildOnly
Unknown(Int)
} derive(Eq,
Debug
)

The audience allowed to access a scheduled event.

GuildScheduledEventPrivacyLevel::from_int

GuildScheduledEventPrivacyLevel::to_int

GuildScheduledEventRecurrenceRule

pub(all) struct GuildScheduledEventRecurrenceRule {
start : Timestamp
end : Nullable[Timestamp]?
frequency : GuildScheduledEventRecurrenceRuleFrequency
interval : Int
by_weekday : Array[GuildScheduledEventRecurrenceRuleWeekday]?
by_n_weekday : Array[GuildScheduledEventRecurrenceRuleNWeekday]?
by_month : Array[GuildScheduledEventRecurrenceRuleMonth]?
by_month_day : Array[Int]?
by_year_day : Array[Int]?
count : Int?
} derive(ToJson,
Debug
,
FromJson
)

A recurrence schedule attached to a guild scheduled event.

GuildScheduledEventRecurrenceRuleFrequency

pub(all) enum GuildScheduledEventRecurrenceRuleFrequency {
Yearly
Monthly
Weekly
Daily
Unknown(Int)
} derive(Eq,
Debug
)

GuildScheduledEventRecurrenceRuleMonth

pub(all) enum GuildScheduledEventRecurrenceRuleMonth {
January
February
March
April
May
June
July
August
September
October
November
December
Unknown(Int)
} derive(Eq,
Debug
)

A calendar month used by a scheduled-event recurrence rule.

GuildScheduledEventRecurrenceRuleMonth::from_int

GuildScheduledEventRecurrenceRuleMonth::to_int

GuildScheduledEventRecurrenceRuleNWeekday

pub(all) struct GuildScheduledEventRecurrenceRuleNWeekday {
n : Int
day : GuildScheduledEventRecurrenceRuleWeekday
} derive(ToJson,
Debug
,
FromJson
)

An ordinal weekday constraint such as the first Monday of a month.

GuildScheduledEventRecurrenceRuleWeekday

pub(all) enum GuildScheduledEventRecurrenceRuleWeekday {
Monday
Tuesday
Wednesday
Thursday
Friday
Saturday
Sunday
Unknown(Int)
} derive(Eq,
Debug
)

A weekday used by a scheduled-event recurrence rule (Monday is zero).

GuildScheduledEventRecurrenceRuleWeekday::from_int

GuildScheduledEventRecurrenceRuleWeekday::to_int

GuildScheduledEventStatus

pub(all) enum GuildScheduledEventStatus {
Scheduled
Active
Completed
Canceled
Unknown(Int)
} derive(Eq,
Debug
)

The lifecycle state of a scheduled event.

GuildScheduledEventStatus::from_int

GuildScheduledEventStatus::to_int

GuildScheduledEventUser

pub(all) struct GuildScheduledEventUser {
guild_scheduled_event_id : Id[ScheduledEventMarker]
user : User
guild_member : GuildMember?
} derive(ToJson,
Debug
,
FromJson
)

A user interested in a guild scheduled event.

GuildScheduledEventUserEvent

pub(all) struct GuildScheduledEventUserEvent {
guild_scheduled_event_id : Id[ScheduledEventMarker]
user_id : Id[UserMarker]
guild_id : Id[GuildMarker]
} derive(ToJson,
Debug
,
FromJson
)

A user added to or removed from a scheduled guild event.

GuildSoundboardSoundDeleteEvent

pub(all) struct GuildSoundboardSoundDeleteEvent {
sound_id : Id[SoundboardSoundMarker]
guild_id : Id[GuildMarker]
} derive(ToJson,
Debug
,
FromJson
)

A soundboard sound deleted from a guild.

GuildStickersUpdateEvent

pub(all) struct GuildStickersUpdateEvent {
guild_id : Id[GuildMarker]
stickers : Array[Sticker]
} derive(ToJson,
Debug
,
FromJson
)

Guild sticker collection replacement.

GuildTemplate

pub(all) struct GuildTemplate {
code : String
name : String
description : Nullable[String]
usage_count : Int
creator_id : Id[UserMarker]
creator : User
created_at : Timestamp
updated_at : Timestamp
source_guild_id : Id[GuildMarker]
serialized_source_guild : GuildTemplateSource
is_dirty : Nullable[Bool]
} derive(ToJson,
Debug
,
FromJson
)

A reusable Discord guild template and its serialized guild snapshot.

GuildTemplateChannel

pub(all) struct GuildTemplateChannel {
id : Int
typ : ChannelType
name : String
position : Int
topic : Nullable[String]?
bitrate : Int?
user_limit : Int?
nsfw : Bool?
rate_limit_per_user : Int?
parent_id : Nullable[Int]?
permission_overwrites : Array[GuildTemplatePermissionOverwrite]?
} derive(ToJson,
Debug
,
FromJson
)

A channel in a template snapshot, using integer placeholder IDs.

GuildTemplatePermissionOverwrite

pub(all) struct GuildTemplatePermissionOverwrite {
id : Int
typ : Int
allow : GuildTemplatePermissions
deny : GuildTemplatePermissions
} derive(ToJson,
Debug
,
FromJson
)

A permission overwrite using a template placeholder ID.

GuildTemplatePermissions

pub(all) struct GuildTemplatePermissions(UInt64) derive(Eq)

GuildTemplateRole

pub(all) struct GuildTemplateRole {
id : Int
name : String
permissions : GuildTemplatePermissions
color : Int
colors : Nullable[RoleColors]?
hoist : Bool
mentionable : Bool
icon : Nullable[ImageHash]?
unicode_emoji : Nullable[String]?
} derive(ToJson,
Debug
,
FromJson
)

A role in a template snapshot, using the snapshot's integer placeholder ID.

GuildTemplateSource

pub(all) struct GuildTemplateSource {
name : String?
description : Nullable[String]?
region : String?
verification_level : VerificationLevel?
default_message_notifications : DefaultMessageNotifications?
explicit_content_filter : ExplicitContentFilter?
preferred_locale : String?
afk_timeout : Int?
roles : Array[GuildTemplateRole]?
channels : Array[GuildTemplateChannel]?
afk_channel_id : Nullable[Int]?
system_channel_id : Nullable[Int]?
system_channel_flags : SystemChannelFlags?
icon_hash : Nullable[ImageHash]?
} derive(ToJson,
Debug
,
FromJson
)

Stable guild settings exposed in a serialized template snapshot.

Discord uses integer placeholder IDs for nested roles and channels in this payload, so this is intentionally distinct from PartialGuild.

GuildVanityUrl

pub(all) struct GuildVanityUrl {
code : Nullable[String]
uses : Int
} derive(ToJson,
Debug
,
FromJson
)

A guild's vanity invite code and its current use count.

GuildWidget

pub(all) struct GuildWidget {
id : Id[GuildMarker]
name : String
instant_invite : Nullable[String]
channels : Array[GuildWidgetChannel]
members : Array[GuildWidgetMember]
presence_count : Int
} derive(ToJson,
Debug
,
FromJson
)

The public JSON representation of a guild widget.

GuildWidgetChannel

pub(all) struct GuildWidgetChannel {
id : Id[ChannelMarker]
name : String
position : Int
} derive(ToJson,
Debug
,
FromJson
)

A voice channel shown in a public guild widget.

GuildWidgetMember

pub(all) struct GuildWidgetMember {
id : String
username : String
discriminator : String
avatar : Nullable[String]
status : String
avatar_url : String
} derive(ToJson,
Debug
,
FromJson
)

An anonymized member shown in a public guild widget. Widget member IDs are opaque strings rather than Discord snowflakes.

GuildWidgetSettings

pub(all) struct GuildWidgetSettings {
enabled : Bool
channel_id : Nullable[Id[ChannelMarker]]
} derive(ToJson,
Debug
,
FromJson
)

Whether a guild widget is enabled and the channel it links to.

Hello

pub(all) struct Hello {
heartbeat_interval : Int
} derive(ToJson,
Debug
,
FromJson
)

Payload of opcode 10 (Hello).
pub(all) struct Id[M](UInt64)

A Discord snowflake ID, tagged with a phantom marker type so that IDs of different resources cannot be mixed up (Id[UserMarker] vs Id[GuildMarker]).

Wire format: Discord serializes snowflakes as decimal strings (and historically as integers in a few places). We accept both on decode and always emit a string, going through the string representation so values above 2^53 never pass through a Double.

test "parse and explicitly retag a snowflake" {
let user_id : @model.UserId = @model.Id::parse("175928847299117063")
inspect(user_id.to_string(), content="175928847299117063")
inspect(user_id.timestamp_ms(), content="1462015105796")
let guild_id : @model.GuildId = user_id.cast()
assert_eq(guild_id.value(), user_id.value())
}
impl Compare for Id[M]
impl Eq for Id[M]
impl Hash for Id[M]
impl Show for Id[M]
impl ToJson for Id[M]
impl Debug for Id[M]

Id::cast

fn[M, N] Id::cast(self : Id[M]) -> Id[N]

Re-tag an ID with a different marker, for the few places where Discord aliases ID domains (e.g. the @everyone role ID equals the guild ID).

Id::parse

fn[M] Id::parse(s : StringView) -> Id[M] raise

Parse a decimal snowflake string.

Id::timestamp_ms

fn[M] Id::timestamp_ms(self : Id[M]) -> Int64

Milliseconds since the Unix epoch encoded in the snowflake.

Id::value

fn[M] Id::value(self : Id[M]) -> UInt64

The raw snowflake value.

ImageHash

pub(all) struct ImageHash(String) derive(Eq)

A guild/user avatar or icon hash, kept raw (e.g. a_1269e74af4df7417b13759eae50c83dc).
impl ToJson for ImageHash

ImageHash::is_animated

fn ImageHash::is_animated(self : ImageHash) -> Bool

Animated assets (GIF avatars etc.) are prefixed with a_.

ImageHash::to_string

fn ImageHash::to_string(self : ImageHash) -> String

IncidentsData

pub(all) struct IncidentsData {
invites_disabled_until : Nullable[Timestamp]?
dms_disabled_until : Nullable[Timestamp]?
dm_spam_detected_at : Nullable[Timestamp]?
raid_detected_at : Nullable[Timestamp]?
} derive(ToJson,
Debug
,
FromJson
)

Temporary safety restrictions and detection timestamps for a guild.

InstallParams

pub(all) struct InstallParams {
scopes : Array[String]
permissions : Permissions
} derive(ToJson,
Debug
,
FromJson
)

Default OAuth2 installation scopes and bot permissions for an application.

Integration

pub(all) struct Integration {
id : Id[IntegrationMarker]?
name : String?
typ : String?
enabled : Bool?
syncing : Bool?
role_id : Id[RoleMarker]?
enable_emoticons : Bool?
expire_behavior : IntegrationExpireBehavior?
expire_grace_period : Int?
user : User?
account : IntegrationAccount?
synced_at : Timestamp?
subscriber_count : Int?
revoked : Bool?
application : IntegrationApplication?
application_id : Id[ApplicationMarker]?
scopes : Array[String]?
} derive(ToJson,
Debug
,
FromJson
)

A guild integration. All fields are optional because audit logs and user connections carry documented partial forms of this object.

IntegrationAccount

pub(all) struct IntegrationAccount {
id : String
name : String
} derive(ToJson,
Debug
,
FromJson
)

The provider-side account an integration is linked to.

IntegrationApplication

pub(all) struct IntegrationApplication {
id : Id[ApplicationMarker]
name : String
icon : Nullable[ImageHash]
description : String
bot : User?
} derive(ToJson,
Debug
,
FromJson
)

The OAuth2 application backing a Discord-app integration.

IntegrationDeleteEvent

pub(all) struct IntegrationDeleteEvent {
id : Id[IntegrationMarker]
guild_id : Id[GuildMarker]
application_id : Id[ApplicationMarker]?
} derive(ToJson,
Debug
,
FromJson
)

A guild integration deletion.

IntegrationEvent

pub(all) struct IntegrationEvent {
guild_id : Id[GuildMarker]
integration : Json
} derive(
Debug
)

A guild integration payload retained raw alongside its guild id.

IntegrationExpireBehavior

pub(all) enum IntegrationExpireBehavior {
RemoveRole
Kick
Unknown(Int)
} derive(Eq,
Debug
)

What happens to a subscriber when their integration expires.

IntegrationExpireBehavior::from_int

IntegrationExpireBehavior::to_int

IntegrationMarker

pub enum IntegrationMarker {
}

Intents

pub(all) struct Intents(UInt) derive(Eq)

Gateway intents: the server-side event subscription bitfield sent in Identify. Unknown bits are preserved. Wire format: JSON number.

test "compose the gateway event subscriptions a bot needs" {
let intents = @model.Intents::guilds() |
@model.Intents::guild_messages() |
@model.Intents::message_content()
inspect(
intents.bits(),
content=(
#|33281
),
)
assert_true(intents.contains(@model.Intents::message_content()))
}
impl BitAnd for Intents
impl BitOr for Intents
impl ToJson for Intents

Intents::auto_moderation_configuration

fn Intents::auto_moderation_configuration() -> Intents

AUTO_MODERATION_CONFIGURATION: auto moderation rule events.

Intents::auto_moderation_execution

fn Intents::auto_moderation_execution() -> Intents

AUTO_MODERATION_EXECUTION: auto moderation action execution events.

Intents::bits

fn Intents::bits(self : Intents) -> UInt

Intents::contains

fn Intents::contains(self : Intents, other : Intents) -> Bool

Intents::direct_message_polls

fn Intents::direct_message_polls() -> Intents

DIRECT_MESSAGE_POLLS: poll vote events in DM channels.

Intents::direct_message_reactions

fn Intents::direct_message_reactions() -> Intents

DIRECT_MESSAGE_REACTIONS: reaction events in DM channels.

Intents::direct_message_typing

fn Intents::direct_message_typing() -> Intents

DIRECT_MESSAGE_TYPING: typing indicators in DM channels.

Intents::direct_messages

fn Intents::direct_messages() -> Intents

DIRECT_MESSAGES: message events in DM channels.

Intents::from_bits

fn Intents::from_bits(bits : UInt) -> Intents

Intents::guild_expressions

fn Intents::guild_expressions() -> Intents

GUILD_EXPRESSIONS: emoji, sticker, and soundboard sound updates.

Intents::guild_integrations

fn Intents::guild_integrations() -> Intents

GUILD_INTEGRATIONS: integration create, update, and delete events.

Intents::guild_invites

fn Intents::guild_invites() -> Intents

GUILD_INVITES: invite create and delete events.

Intents::guild_members

fn Intents::guild_members() -> Intents

GUILD_MEMBERS (privileged): member join, leave, and update events. Must also be enabled in the developer portal.

Intents::guild_message_polls

fn Intents::guild_message_polls() -> Intents

GUILD_MESSAGE_POLLS: poll vote events in guilds.

Intents::guild_message_reactions

fn Intents::guild_message_reactions() -> Intents

GUILD_MESSAGE_REACTIONS: reaction events in guilds.

Intents::guild_message_typing

fn Intents::guild_message_typing() -> Intents

GUILD_MESSAGE_TYPING: typing indicators in guilds.

Intents::guild_messages

fn Intents::guild_messages() -> Intents

GUILD_MESSAGES: message events in guilds. Content fields also need message_content.

Intents::guild_moderation

fn Intents::guild_moderation() -> Intents

GUILD_MODERATION: ban events and audit log entry creation.

Intents::guild_presences

fn Intents::guild_presences() -> Intents

GUILD_PRESENCES (privileged): member presence updates. Must also be enabled in the developer portal.

Intents::guild_scheduled_events

fn Intents::guild_scheduled_events() -> Intents

GUILD_SCHEDULED_EVENTS: scheduled event lifecycle and user subscription events.

Intents::guild_voice_states

fn Intents::guild_voice_states() -> Intents

GUILD_VOICE_STATES: voice state updates and voice channel effects.

Intents::guild_webhooks

fn Intents::guild_webhooks() -> Intents

GUILD_WEBHOOKS: webhook update events.

Intents::guilds

fn Intents::guilds() -> Intents

GUILDS: guild, channel, thread, role, and stage lifecycle events.

Intents::message_content

fn Intents::message_content() -> Intents

MESSAGE_CONTENT (privileged): unlocks content, embeds, attachments, and components on guild messages not addressed to the bot. Delivers no events by itself; must also be enabled in the developer portal.

Intents::none

fn Intents::none() -> Intents

Interaction

pub(all) struct Interaction {
id : Id[InteractionMarker]
application_id : Id[ApplicationMarker]
typ : InteractionType
data : InteractionData?
guild : PartialGuild?
guild_id : Id[GuildMarker]?
channel : Channel?
channel_id : Id[ChannelMarker]?
guild_member : GuildMember?
user : User?
token : String
version : Int
message : Message?
app_permissions : Permissions?
locale : String?
guild_locale : String?
entitlements : Array[Entitlement]?
authorizing_integration_owners : Map[String, String]?
context : InteractionContextType?
attachment_size_limit : Int?
} derive(
Debug
)

An interaction delivered by Discord to an application.

InteractionCallback

pub(all) struct InteractionCallback {
id : Id[InteractionMarker]
typ : InteractionType
activity_instance_id : String?
response_message_id : Id[MessageMarker]?
response_message_loading : Bool?
response_message_ephemeral : Bool?
} derive(ToJson,
Debug
,
FromJson
)

The interaction as seen by the callback endpoint.

InteractionCallbackActivityInstance

pub(all) struct InteractionCallbackActivityInstance {
id : String
} derive(ToJson,
Debug
,
FromJson
)

The Activity instance launched by an interaction response. Distinct from the fuller ActivityInstance resource returned by the application endpoints.

InteractionCallbackResource

pub(all) struct InteractionCallbackResource {
typ : InteractionResponseType
activity_instance : InteractionCallbackActivityInstance?
message : Message?
} derive(ToJson,
Debug
,
FromJson
)

What the interaction response created. message is set for message callbacks, activity_instance when an Activity was launched.

InteractionCallbackResponse

pub(all) struct InteractionCallbackResponse {
interaction : InteractionCallback
resource : InteractionCallbackResource?
} derive(ToJson,
Debug
,
FromJson
)

The envelope returned by Create Interaction Response when the caller asks for it with with_response=true.

InteractionContextType

pub(all) enum InteractionContextType {
Guild
BotDm
PrivateChannel
Unknown(Int)
} derive(Eq,
Debug
)

Where an interaction was triggered.

InteractionContextType::from_int

fn InteractionContextType::from_int(value : Int) -> InteractionContextType

InteractionContextType::to_int

InteractionData

pub(all) enum InteractionData {
Command(CommandData)
Component(ComponentData)
Modal(ModalData)
Unknown(Json)
} derive(
Debug
)

Polymorphic interaction data selected by the parent interaction type.

InteractionMarker

pub enum InteractionMarker {
}

InteractionResponse

A response envelope sent for an interaction callback.

InteractionResponseType

pub(all) enum InteractionResponseType {
Pong
ChannelMessageWithSource
DeferredChannelMessageWithSource
DeferredUpdateMessage
UpdateMessage
Autocomplete
Modal
PremiumRequired
LaunchActivity
Unknown(Int)
} derive(Eq,
Debug
)

The callback behavior requested by an interaction response.

InteractionResponseType::from_int

InteractionResponseType::to_int

InteractionType

pub(all) enum InteractionType {
Ping
ApplicationCommand
MessageComponent
ApplicationCommandAutocomplete
ModalSubmit
Unknown(Int)
} derive(Eq,
Debug
)

The dispatch category of an interaction.

InteractionType::from_int

fn InteractionType::from_int(value : Int) -> InteractionType

InteractionType::to_int

fn InteractionType::to_int(self : InteractionType) -> Int

Invite

pub(all) struct Invite {
typ : InviteType?
code : String
guild : PartialGuild?
channel : Nullable[PartialChannel]?
inviter : User?
target_type : InviteTargetType?
target_user : User?
target_application : Application?
approximate_presence_count : Int?
approximate_member_count : Int?
expires_at : Nullable[Timestamp]?
guild_scheduled_event : GuildScheduledEvent?
flags : InviteFlags?
roles : Array[PartialRole]?
uses : Int?
max_uses : Int?
max_age : Int?
temporary : Bool?
created_at : Timestamp?
} derive(ToJson,
Debug
,
FromJson
)

A Discord invite with optional usage metadata.

InviteCreateEvent

pub(all) struct InviteCreateEvent {
channel_id : Id[ChannelMarker]
code : String
created_at : Timestamp
guild_id : Id[GuildMarker]?
inviter : User?
max_age : Int
max_uses : Int
target_type : InviteTargetType?
target_user : User?
target_application : Json?
temporary : Bool
uses : Int
expires_at : Nullable[Timestamp]
role_ids : Array[Id[RoleMarker]]?
} derive(ToJson,
Debug
,
FromJson
)

An invite created in a channel.

InviteDeleteEvent

pub(all) struct InviteDeleteEvent {
channel_id : Id[ChannelMarker]
guild_id : Id[GuildMarker]?
code : String
} derive(ToJson,
Debug
,
FromJson
)

An invite deleted from a channel.

InviteFlags

pub(all) struct InviteFlags(UInt64) derive(Eq)

Bit flags describing a guild invite.

InviteFlags::bits

fn InviteFlags::bits(self : InviteFlags) -> UInt64

InviteFlags::from_bits

fn InviteFlags::from_bits(bits : UInt64) -> InviteFlags

InviteFlags::is_guest_invite

fn InviteFlags::is_guest_invite() -> InviteFlags

InviteTargetType

pub(all) enum InviteTargetType {
Stream
EmbeddedApplication
Unknown(Int)
} derive(Eq,
Debug
)

The special target carried by a voice channel invite.

InviteTargetType::from_int

fn InviteTargetType::from_int(value : Int) -> InviteTargetType

InviteTargetType::to_int

fn InviteTargetType::to_int(self : InviteTargetType) -> Int

InviteType

pub(all) enum InviteType {
Guild
GroupDm
Friend
Unknown(Int)
} derive(Eq,
Debug
)

The destination category of a Discord invite.

InviteType::from_int

fn InviteType::from_int(value : Int) -> InviteType

InviteType::to_int

fn InviteType::to_int(self : InviteType) -> Int

Label

pub(all) struct Label {
id : Int?
label : String?
description : String?
component : Component
} derive(ToJson,
Debug
,
FromJson
)

A modal label wrapping one interactive component.

LobbyMessage

pub(all) struct LobbyMessage {
id : Id[MessageMarker]
typ : MessageType
content : String
lobby_id : Id[GenericMarker]
channel_id : Id[ChannelMarker]
author : User
metadata : Json?
flags : MessageFlags
application_id : Id[ApplicationMarker]?
timestamp : Timestamp?
edited_timestamp : Nullable[Timestamp]?
raw : Json
} derive(
Debug
)

A lobby message view for outbound webhook events.

The documented fields are decoded for direct use while raw preserves the complete object, including SDK extensions that are not a Lobby domain.

LobbyMessageDeleteEvent

pub(all) struct LobbyMessageDeleteEvent {
id : Id[MessageMarker]
lobby_id : Id[GenericMarker]
raw : Json
} derive(
Debug
)

MediaGallery

A gallery containing one to ten media items.

MediaGalleryItem

pub(all) struct MediaGalleryItem {
media : UnfurledMediaItem
description : String?
spoiler : Bool?
} derive(ToJson,
Debug
,
FromJson
)

One item in a media gallery.

Message

pub(all) struct Message {
id : Id[MessageMarker]
channel_id : Id[ChannelMarker]
author : User
content : String
timestamp : Timestamp
edited_timestamp : Nullable[Timestamp]
tts : Bool
mention_everyone : Bool
mentions : Array[User]
mention_roles : Array[Id[RoleMarker]]
mention_channels : Array[ChannelMention]?
attachments : Array[Attachment]
embeds : Array[Embed]
reactions : Array[Reaction]?
nonce : Nonce?
pinned : Bool
webhook_id : Id[WebhookMarker]?
typ : MessageType
activity : MessageActivity?
application_id : Id[ApplicationMarker]?
message_reference : MessageReference?
flags : MessageFlags?
referenced_message : Nullable[Message]?
thread : Channel?
components : Array[Component]?
sticker_items : Array[StickerItem]?
position : Int?
role_subscription_data : RoleSubscriptionData?
poll : Poll?
call : MessageCall?
application : Application?
interaction_metadata : MessageInteractionMetadata?
resolved : ResolvedData?
message_snapshots : Array[MessageSnapshot]?
shared_client_theme : SharedClientTheme?
} derive(ToJson,
Debug
,
FromJson
)

A message sent to a Discord channel.

MessageActivity

pub(all) struct MessageActivity {
typ : MessageActivityType
party_id : String?
} derive(ToJson,
Debug
,
FromJson
)

Rich Presence activity metadata attached to a message.

MessageActivityType

pub(all) enum MessageActivityType {
Join
Spectate
Listen
JoinRequest
Unknown(Int)
} derive(Eq,
Debug
)

The Rich Presence action represented by a message activity.

MessageActivityType::from_int

fn MessageActivityType::from_int(value : Int) -> MessageActivityType

MessageActivityType::to_int

fn MessageActivityType::to_int(self : MessageActivityType) -> Int

MessageCall

pub(all) struct MessageCall {
participants : Array[Id[UserMarker]]
ended_timestamp : Nullable[Timestamp]?
} derive(ToJson,
Debug
,
FromJson
)

Participant and end-time data for a call message.

MessageCreateEvent

pub(all) struct MessageCreateEvent {
message : Message
guild_id : Id[GuildMarker]?
guild_member : GuildMember?
mention_members : Map[Id[UserMarker], GuildMember]
channel_type : ChannelType?
} derive(
Debug
)

A message-create dispatch with gateway-only message fields.

MessageDeleteBulkEvent

pub(all) struct MessageDeleteBulkEvent {
ids : Array[Id[MessageMarker]]
channel_id : Id[ChannelMarker]
guild_id : Id[GuildMarker]?
} derive(ToJson,
Debug
,
FromJson
)

A bulk message deletion.

MessageDeleteEvent

pub(all) struct MessageDeleteEvent {
id : Id[MessageMarker]
channel_id : Id[ChannelMarker]
guild_id : Id[GuildMarker]?
} derive(ToJson,
Debug
,
FromJson
)

A message deletion containing only resource identifiers.

MessageFlags

pub(all) struct MessageFlags(UInt64) derive(Eq)

Bit flags describing delivery and presentation behavior of a message.

MessageFlags::bits

fn MessageFlags::bits(self : MessageFlags) -> UInt64

MessageFlags::contains

fn MessageFlags::contains(self : MessageFlags, other : MessageFlags) -> Bool

MessageFlags::crossposted

fn MessageFlags::crossposted() -> MessageFlags

MessageFlags::ephemeral

fn MessageFlags::ephemeral() -> MessageFlags

MessageFlags::failed_to_mention_some_roles_in_thread

fn MessageFlags::failed_to_mention_some_roles_in_thread() -> MessageFlags

MessageFlags::from_bits

fn MessageFlags::from_bits(bits : UInt64) -> MessageFlags

MessageFlags::has_snapshot

fn MessageFlags::has_snapshot() -> MessageFlags

MessageFlags::has_thread

fn MessageFlags::has_thread() -> MessageFlags

MessageFlags::is_components_v2

fn MessageFlags::is_components_v2() -> MessageFlags

MessageFlags::is_crosspost

fn MessageFlags::is_crosspost() -> MessageFlags

MessageFlags::is_voice_message

fn MessageFlags::is_voice_message() -> MessageFlags

MessageFlags::loading

fn MessageFlags::loading() -> MessageFlags

MessageFlags::none

fn MessageFlags::should_show_link_not_discord_warning() -> MessageFlags

MessageFlags::source_message_deleted

fn MessageFlags::source_message_deleted() -> MessageFlags

MessageFlags::suppress_embeds

fn MessageFlags::suppress_embeds() -> MessageFlags

MessageFlags::suppress_notifications

fn MessageFlags::suppress_notifications() -> MessageFlags

MessageFlags::urgent

fn MessageFlags::urgent() -> MessageFlags

MessageInteractionMetadata

pub(all) struct MessageInteractionMetadata {
id : Id[InteractionMarker]
typ : InteractionType
user : User
authorizing_integration_owners : Map[String, String]
original_response_message_id : Id[MessageMarker]?
target_user : User?
target_message_id : Id[MessageMarker]?
interacted_message_id : Id[MessageMarker]?
triggering_interaction_metadata : MessageInteractionMetadata?
} derive(ToJson,
Debug
,
FromJson
)

Metadata identifying the interaction that produced a message.

The optional fields cover the documented command, component, and modal variants. type determines which subset is present.

MessageMarker

pub enum MessageMarker {
}

MessagePin

pub(all) struct MessagePin {
pinned_at : Timestamp
message : Message
} derive(ToJson,
Debug
,
FromJson
)

One entry returned by the paginated channel-pins endpoint.

MessagePollVoteEvent

pub(all) struct MessagePollVoteEvent {
user_id : Id[UserMarker]
channel_id : Id[ChannelMarker]
message_id : Id[MessageMarker]
guild_id : Id[GuildMarker]?
answer_id : Int
} derive(ToJson,
Debug
,
FromJson
)

A user added or removed a vote from a poll answer.

MessageReactionAddEvent

pub(all) struct MessageReactionAddEvent {
user_id : Id[UserMarker]
channel_id : Id[ChannelMarker]
message_id : Id[MessageMarker]
guild_id : Id[GuildMarker]?
guild_member : GuildMember?
emoji : Emoji
message_author_id : Id[UserMarker]?
burst : Bool
burst_colors : Array[String]?
typ : Int
} derive(ToJson,
Debug
,
FromJson
)

A reaction added to a message.

MessageReactionRemoveAllEvent

pub(all) struct MessageReactionRemoveAllEvent {
channel_id : Id[ChannelMarker]
message_id : Id[MessageMarker]
guild_id : Id[GuildMarker]?
} derive(ToJson,
Debug
,
FromJson
)

All reactions removed from a message.

MessageReactionRemoveEmojiEvent

pub(all) struct MessageReactionRemoveEmojiEvent {
channel_id : Id[ChannelMarker]
message_id : Id[MessageMarker]
guild_id : Id[GuildMarker]?
emoji : Emoji
} derive(ToJson,
Debug
,
FromJson
)

Every reaction for one emoji removed from a message.

MessageReactionRemoveEvent

pub(all) struct MessageReactionRemoveEvent {
user_id : Id[UserMarker]
channel_id : Id[ChannelMarker]
message_id : Id[MessageMarker]
guild_id : Id[GuildMarker]?
emoji : Emoji
burst : Bool
typ : Int
} derive(ToJson,
Debug
,
FromJson
)

A reaction removed from a message.

MessageReference

pub(all) struct MessageReference {
typ : MessageReferenceType?
message_id : Id[MessageMarker]?
channel_id : Id[ChannelMarker]?
guild_id : Id[GuildMarker]?
fail_if_not_exists : Bool?
} derive(ToJson,
Debug
,
FromJson
)

Origin identifiers and delivery behavior for a message reference.

MessageReferenceType

pub(all) enum MessageReferenceType {
Default
Forward
Unknown(Int)
} derive(Eq,
Debug
)

The reference mode used for a reply or forwarded message.

MessageReferenceType::from_int

fn MessageReferenceType::from_int(value : Int) -> MessageReferenceType

MessageReferenceType::to_int

fn MessageReferenceType::to_int(self : MessageReferenceType) -> Int

MessageSnapshot

A forwarded message snapshot.

MessageSnapshotContent

pub(all) struct MessageSnapshotContent {
typ : MessageType?
content : String?
embeds : Array[Embed]?
attachments : Array[Attachment]?
timestamp : Timestamp?
edited_timestamp : Nullable[Timestamp]?
flags : MessageFlags?
mentions : Array[User]?
mention_roles : Array[Id[RoleMarker]]?
sticker_items : Array[StickerItem]?
components : Array[Component]?
} derive(ToJson,
Debug
,
FromJson
)

The documented subset of a message retained in a forwarded snapshot.

MessageType

pub(all) enum MessageType {
Default
RecipientAdd
RecipientRemove
Call
ChannelNameChange
ChannelIconChange
ChannelPinnedMessage
UserJoin
GuildBoost
GuildBoostTier1
GuildBoostTier2
GuildBoostTier3
ChannelFollowAdd
GuildDiscoveryDisqualified
GuildDiscoveryRequalified
GuildDiscoveryGracePeriodInitialWarning
GuildDiscoveryGracePeriodFinalWarning
ThreadCreated
Reply
ChatInputCommand
ThreadStarterMessage
GuildInviteReminder
ContextMenuCommand
AutoModerationAction
RoleSubscriptionPurchase
InteractionPremiumUpsell
StageStart
StageEnd
StageSpeaker
StageRaiseHand
StageTopic
GuildApplicationPremiumSubscription
GuildIncidentAlertModeEnabled
GuildIncidentAlertModeDisabled
GuildIncidentReportRaid
GuildIncidentReportFalseAlarm
PurchaseNotification
PollResult
Unknown(Int)
} derive(Eq,
Debug
)

The system or user event category represented by a message.

MessageType::from_int

fn MessageType::from_int(value : Int) -> MessageType

MessageType::to_int

fn MessageType::to_int(self : MessageType) -> Int

MessageUpdateEvent

pub(all) struct MessageUpdateEvent {
message : Message
before : Message?
guild_id : Id[GuildMarker]?
guild_member : GuildMember?
mention_members : Map[Id[UserMarker], GuildMember]
channel_type : ChannelType?
} derive(
Debug
)

A message-update dispatch with the same gateway-only fields as message creation.

MessageUpdateEvent::is_edit

fn MessageUpdateEvent::is_edit(self : MessageUpdateEvent) -> Bool

Whether this update changed the message's edit timestamp.

Without before, this uses the presence of an edited timestamp as a heuristic and may misclassify pin or unfurl updates to an already-edited message as edits.

MfaLevel

pub(all) enum MfaLevel {
None
Elevated
Unknown(Int)
} derive(Eq,
Debug
)

Discord's guild MFA level.
impl ToJson for MfaLevel

MfaLevel::from_int

fn MfaLevel::from_int(value : Int) -> MfaLevel

MfaLevel::to_int

fn MfaLevel::to_int(self : MfaLevel) -> Int

ModalData

pub(all) struct ModalData {
custom_id : String
components : Array[Component]
resolved : ResolvedData?
} derive(ToJson,
Debug
,
FromJson
)

Submitted modal data containing the modal's component tree.

Nameplate

pub(all) struct Nameplate {
sku_id : Id[SkuMarker]
asset : String
label : String
palette : String
} derive(ToJson,
Debug
,
FromJson
)

A profile nameplate collectible.

Nonce

pub(all) enum Nonce {
Str(String)
Num(Int64)
} derive(Eq,
Debug
)

A client nonce represented as either its string or integer wire form.
impl ToJson for Nonce

NsfwLevel

pub(all) enum NsfwLevel {
Default
Explicit
Safe
AgeRestricted
Unknown(Int)
} derive(Eq,
Debug
)

Discord's guild NSFW level.
impl ToJson for NsfwLevel

NsfwLevel::from_int

fn NsfwLevel::from_int(value : Int) -> NsfwLevel

NsfwLevel::to_int

fn NsfwLevel::to_int(self : NsfwLevel) -> Int

Nullable

pub(all) enum Nullable[T] {
Null
Value(T)
} derive(Eq,
Debug
)

A field that is always present on the wire but may be JSON null.

Use as a struct field type: Nullable[T] for "present, maybe null", Nullable[T]? for "maybe absent, maybe null" (composes with the derived FromJson/ToJson optional-field handling).

test "convert nullable and PATCH values to options" {
let nickname = @model.Nullable::from_option(Some("Moon"))
debug_inspect(
nickname.to_option(),
content=(
#|Some("Moon")
),
)
let missing : @model.Undefinable[String] = Missing
let cleared : @model.Undefinable[String] = Null
assert_true(missing.to_option() is None)
assert_true(cleared.to_option() is None)
}
impl ToJson for Nullable[T]

Nullable::from_option

fn[T] Nullable::from_option(opt : T?) -> Nullable[T]

Value for Some, Null for None.

Nullable::to_option

fn[T] Nullable::to_option(self : Nullable[T]) -> T?

Some for a value, None for JSON null.

ObjBuilder

pub struct ObjBuilder {
// private fields
}

Incremental JSON object builder for request bodies.

Field emission rules match Discord's PATCH semantics:
  • field: always emitted
  • opt: emitted only when Some
  • und: Missing omitted, Null emitted as JSON null, Value emitted

test "build a PATCH object with omitted and cleared fields" {
let nickname : String? = None
let avatar : @model.Undefinable[String] = Null
json_inspect(
@model.ObjBuilder()
.field("name", "discord.mbt")
.opt("nickname", nickname)
.und("avatar", avatar)
.build(),
content={ "name": "discord.mbt", "avatar": null },
)
}

ObjBuilder::ObjBuilder

fn ObjBuilder::ObjBuilder() -> ObjBuilder

Create an empty builder.

ObjBuilder::build

fn ObjBuilder::build(self : ObjBuilder) -> Json

The accumulated JSON object.

ObjBuilder::field

fn[T : ToJson] ObjBuilder::field(self : ObjBuilder, key : String, value : T) -> ObjBuilder

Set key to value unconditionally.

ObjBuilder::opt

fn[T : ToJson] ObjBuilder::opt(self : ObjBuilder, key : String, value : T?) -> ObjBuilder

Set key when value is present; omit the field otherwise.

ObjBuilder::und

fn[T : ToJson] ObjBuilder::und(self : ObjBuilder, key : String, value : Undefinable[T]) -> ObjBuilder

Set key from an Undefinable: a value, an explicit JSON null, or omitted entirely when Missing.

OnboardingMode

pub(all) enum OnboardingMode {
Default
Advanced
Unknown(Int)
} derive(Eq,
Debug
)

How extensively onboarding is configured for a guild.

OnboardingMode::from_int

fn OnboardingMode::from_int(value : Int) -> OnboardingMode

OnboardingMode::to_int

fn OnboardingMode::to_int(self : OnboardingMode) -> Int

OnboardingPrompt

pub(all) struct OnboardingPrompt {
id : Id[GenericMarker]
typ : OnboardingPromptType
options : Array[OnboardingPromptOption]
title : String
single_select : Bool
required : Bool
in_onboarding : Bool
} derive(ToJson,
Debug
,
FromJson
)

A question presented during guild onboarding.

OnboardingPromptOption

pub(all) struct OnboardingPromptOption {
id : Id[GenericMarker]
channel_ids : Array[Id[ChannelMarker]]
role_ids : Array[Id[RoleMarker]]
emoji : Emoji?
emoji_id : Id[EmojiMarker]?
emoji_name : String?
emoji_animated : Bool?
title : String
description : Nullable[String]
} derive(ToJson,
Debug
,
FromJson
)

A selectable answer to an onboarding prompt.

OnboardingPromptType

pub(all) enum OnboardingPromptType {
MultipleChoice
Dropdown
Unknown(Int)
} derive(Eq,
Debug
)

The input control used by an onboarding prompt.

OnboardingPromptType::from_int

fn OnboardingPromptType::from_int(value : Int) -> OnboardingPromptType

OnboardingPromptType::to_int

fn OnboardingPromptType::to_int(self : OnboardingPromptType) -> Int

Overwrite

A role or member permission override on a channel.

OverwriteType

pub(all) enum OverwriteType {
Role
Member
Unknown(Int)
} derive(Eq,
Debug
)

The target category of a permission overwrite.

OverwriteType::from_int

fn OverwriteType::from_int(value : Int) -> OverwriteType

OverwriteType::to_int

fn OverwriteType::to_int(self : OverwriteType) -> Int

PartialChannel

pub(all) struct PartialChannel {
id : Id[ChannelMarker]
typ : ChannelType?
name : Nullable[String]?
icon : Nullable[ImageHash]?
permissions : Permissions?
} derive(ToJson,
Debug
,
FromJson
)

The documented subset of a channel embedded in another Discord resource.

PartialGuild

pub(all) struct PartialGuild {
id : Id[GuildMarker]
name : String?
icon : Nullable[ImageHash]?
splash : Nullable[ImageHash]?
banner : Nullable[ImageHash]?
description : Nullable[String]?
features : Array[GuildFeature]?
verification_level : VerificationLevel?
vanity_url_code : Nullable[String]?
nsfw_level : NsfwLevel?
premium_subscription_count : Int?
locale : String?
} derive(ToJson,
Debug
,
FromJson
)

The documented subset of a guild embedded in another Discord resource.

Partial guild payloads vary by endpoint, so fields other than id are optional on receipt.

PartialRole

pub(all) struct PartialRole {
id : Id[RoleMarker]
name : String
position : Int
color : Int
colors : RoleColors?
icon : Nullable[ImageHash]?
unicode_emoji : Nullable[String]?
} derive(ToJson,
Debug
,
FromJson
)

The subset of a role returned on an invite.

Permissions

pub(all) struct Permissions(UInt64) derive(Eq)

Guild/channel permissions bitfield. Unknown bits are preserved.

Wire format: a decimal string (Discord serializes permissions as strings because they exceed JavaScript's 53-bit safe-integer range).

Permissions::add_reactions

fn Permissions::add_reactions() -> Permissions

Permissions::administrator

fn Permissions::administrator() -> Permissions

Permissions::attach_files

fn Permissions::attach_files() -> Permissions

Permissions::ban_members

fn Permissions::ban_members() -> Permissions

Permissions::bits

fn Permissions::bits(self : Permissions) -> UInt64

Permissions::bypass_slowmode

fn Permissions::bypass_slowmode() -> Permissions

Permissions::change_nickname

fn Permissions::change_nickname() -> Permissions

Permissions::connect

fn Permissions::connect() -> Permissions

Permissions::contains

fn Permissions::contains(self : Permissions, other : Permissions) -> Bool

Permissions::create_events

fn Permissions::create_events() -> Permissions

Permissions::create_guild_expressions

fn Permissions::create_guild_expressions() -> Permissions

Permissions::create_instant_invite

fn Permissions::create_instant_invite() -> Permissions

Permissions::create_private_threads

fn Permissions::create_private_threads() -> Permissions

Permissions::create_public_threads

fn Permissions::create_public_threads() -> Permissions

Permissions::deafen_members

fn Permissions::deafen_members() -> Permissions

fn Permissions::embed_links() -> Permissions

Permissions::from_bits

fn Permissions::from_bits(bits : UInt64) -> Permissions

Permissions::kick_members

fn Permissions::kick_members() -> Permissions

Permissions::manage_channels

fn Permissions::manage_channels() -> Permissions

Permissions::manage_events

fn Permissions::manage_events() -> Permissions

Permissions::manage_guild

fn Permissions::manage_guild() -> Permissions

Permissions::manage_guild_expressions

fn Permissions::manage_guild_expressions() -> Permissions

Permissions::manage_messages

fn Permissions::manage_messages() -> Permissions

Permissions::manage_nicknames

fn Permissions::manage_nicknames() -> Permissions

Permissions::manage_roles

fn Permissions::manage_roles() -> Permissions

Permissions::manage_threads

fn Permissions::manage_threads() -> Permissions

Permissions::manage_webhooks

fn Permissions::manage_webhooks() -> Permissions

Permissions::mention_everyone

fn Permissions::mention_everyone() -> Permissions

Permissions::moderate_members

fn Permissions::moderate_members() -> Permissions

Permissions::move_members

fn Permissions::move_members() -> Permissions

Permissions::mute_members

fn Permissions::mute_members() -> Permissions

Permissions::none

fn Permissions::none() -> Permissions

Permissions::pin_messages

fn Permissions::pin_messages() -> Permissions

Permissions::priority_speaker

fn Permissions::priority_speaker() -> Permissions

Permissions::read_message_history

fn Permissions::read_message_history() -> Permissions

Permissions::request_to_speak

fn Permissions::request_to_speak() -> Permissions

Permissions::send_messages

fn Permissions::send_messages() -> Permissions

Permissions::send_messages_in_threads

fn Permissions::send_messages_in_threads() -> Permissions

Permissions::send_polls

fn Permissions::send_polls() -> Permissions

Permissions::send_tts_messages

fn Permissions::send_tts_messages() -> Permissions

Permissions::send_voice_messages

fn Permissions::send_voice_messages() -> Permissions

Permissions::set_voice_channel_status

fn Permissions::set_voice_channel_status() -> Permissions

Permissions::speak

fn Permissions::speak() -> Permissions

Permissions::stream

fn Permissions::stream() -> Permissions

Permissions::use_application_commands

fn Permissions::use_application_commands() -> Permissions

Permissions::use_embedded_activities

fn Permissions::use_embedded_activities() -> Permissions

Permissions::use_external_apps

fn Permissions::use_external_apps() -> Permissions

Permissions::use_external_emojis

fn Permissions::use_external_emojis() -> Permissions

Permissions::use_external_sounds

fn Permissions::use_external_sounds() -> Permissions

Permissions::use_external_stickers

fn Permissions::use_external_stickers() -> Permissions

Permissions::use_soundboard

fn Permissions::use_soundboard() -> Permissions

Permissions::use_vad

fn Permissions::use_vad() -> Permissions

Permissions::view_audit_log

fn Permissions::view_audit_log() -> Permissions

Permissions::view_channel

fn Permissions::view_channel() -> Permissions

Permissions::view_creator_monetization_analytics

fn Permissions::view_creator_monetization_analytics() -> Permissions

Permissions::view_guild_insights

fn Permissions::view_guild_insights() -> Permissions

Poll

pub(all) struct Poll {
question : PollMedia
answers : Array[PollAnswer]
expiry : Nullable[Timestamp]
allow_multiselect : Bool
layout_type : PollLayoutType
results : PollResults?
} derive(ToJson,
Debug
,
FromJson
)

A poll attached to a Discord message.

PollAnswer

pub(all) struct PollAnswer {
answer_id : Int
poll_media : PollMedia
} derive(ToJson,
Debug
,
FromJson
)

A selectable answer in a poll.

PollAnswerCount

pub(all) struct PollAnswerCount {
id : Int
count : Int
me_voted : Bool
} derive(ToJson,
Debug
,
FromJson
)

Vote count and current-user state for one poll answer.

PollAnswerVoters

pub(all) struct PollAnswerVoters {
users : Array[User]
} derive(ToJson,
Debug
,
FromJson
)

Users returned by the poll answer-voters endpoint.

PollCreateRequest

pub(all) struct PollCreateRequest {
question : PollMedia
answers : Array[PollMedia]
duration : Int?
allow_multiselect : Bool?
layout_type : PollLayoutType?
} derive(
Debug
)

Poll definition attached when creating a message or executing a webhook. Answers carry their media directly; Discord assigns the answer ids. duration is the number of hours the poll stays open (up to 32 days, default 24).

PollLayoutType

pub(all) enum PollLayoutType {
Default
Unknown(Int)
} derive(Eq,
Debug
)

The presentation layout used by a poll.

PollLayoutType::from_int

fn PollLayoutType::from_int(value : Int) -> PollLayoutType

PollLayoutType::to_int

fn PollLayoutType::to_int(self : PollLayoutType) -> Int

PollMedia

pub(all) struct PollMedia {
text : String?
emoji : Emoji?
} derive(ToJson,
Debug
,
FromJson
)

Text and emoji content used by a poll question or answer.

PollResults

pub(all) struct PollResults {
is_finalized : Bool
answer_counts : Array[PollAnswerCount]
} derive(ToJson,
Debug
,
FromJson
)

Aggregated results for a poll.

PremiumTier

pub(all) enum PremiumTier {
None
Tier1
Tier2
Tier3
Unknown(Int)
} derive(Eq,
Debug
)

Discord's guild premium tier.

PremiumTier::from_int

fn PremiumTier::from_int(value : Int) -> PremiumTier

PremiumTier::to_int

fn PremiumTier::to_int(self : PremiumTier) -> Int

PremiumType

pub(all) enum PremiumType {
None
NitroClassic
Nitro
NitroBasic
Unknown(Int)
} derive(Eq,
Debug
)

The type of Nitro subscription on a user's account.

PremiumType::from_int

fn PremiumType::from_int(value : Int) -> PremiumType

PremiumType::to_int

fn PremiumType::to_int(self : PremiumType) -> Int

PresenceStatus

pub(all) enum PresenceStatus {
Idle
Dnd
Online
Offline
Unknown(String)
} derive(Eq,
Debug
)

A user's overall presence state.

PresenceStatus::from_string

fn PresenceStatus::from_string(value : String) -> PresenceStatus

PresenceStatus::to_string

fn PresenceStatus::to_string(self : PresenceStatus) -> String

PresenceUpdateEvent

pub(all) struct PresenceUpdateEvent {
user : PresenceUser?
guild_id : Id[GuildMarker]?
status : PresenceStatus?
activities : Array[Activity]?
client_status : ClientStatus?
} derive(ToJson,
Debug
)

A gateway presence update decoded field-by-field.

Discord does not validate the presence payload. A missing field or a field whose value has the wrong type is represented as None; one bad field never prevents the rest of the event from being delivered.

PresenceUser

pub(all) struct PresenceUser {
id : Id[UserMarker]?
} derive(ToJson,
Debug
)

The user fragment carried by a presence update.

Discord only normally requires id, but explicitly warns that presence fields and their types are not validated. Keeping the id optional lets a malformed user fragment remain observable without rejecting the event.

RadioGroup

pub(all) struct RadioGroup {
id : Int?
custom_id : String
options : Array[RadioOption]
required : Bool?
value : String?
} derive(ToJson,
Debug
,
FromJson
)

A modal radio group accepting one option.

RadioOption

pub(all) struct RadioOption {
value : String
label : String
description : String?
default : Bool?
} derive(ToJson,
Debug
,
FromJson
)

A selectable option shared by radio and checkbox groups.

Reaction

pub(all) struct Reaction {
count : Int
count_details : ReactionCountDetails
me : Bool
me_burst : Bool
emoji : Emoji
burst_colors : Array[String]
} derive(ToJson,
Debug
,
FromJson
)

Aggregate reaction state for one emoji on a message.

ReactionCountDetails

pub(all) struct ReactionCountDetails {
burst : Int
normal : Int
} derive(ToJson,
Debug
,
FromJson
)

Normal and burst reaction counts for a reaction.

ReactionType

pub(all) enum ReactionType {
Normal
Burst
Unknown(Int)
} derive(Eq,
Debug
)

Whether a reaction is a normal or a burst (super) reaction, as selected by the type query parameter of the reaction endpoints.

ReactionType::from_int

fn ReactionType::from_int(value : Int) -> ReactionType

ReactionType::to_int

fn ReactionType::to_int(self : ReactionType) -> Int

Ready

pub(all) struct Ready {
v : Int
user : User
guilds : Array[UnavailableGuild]
session_id : String
resume_gateway_url : String
shard : Array[Int]?
application : ReadyApplication
} derive(ToJson,
Debug
,
FromJson
)

Payload of the READY dispatch.

ReadyApplication

Partial application object included in READY.

ResolvedData

pub(all) struct ResolvedData {
users : Map[String, User]?
members : Map[String, GuildMember]?
roles : Map[String, Role]?
channels : Map[String, Channel]?
messages : Map[String, Message]?
attachments : Map[String, Attachment]?
} derive(ToJson,
Debug
,
FromJson
)

Entity maps resolved alongside interaction option values.

Role

pub(all) struct Role {
id : Id[RoleMarker]
name : String
color : Int
colors : RoleColors?
hoist : Bool
icon : Nullable[ImageHash]?
unicode_emoji : Nullable[String]?
position : Int
permissions : Permissions
managed : Bool
mentionable : Bool
tags : RoleTags?
flags : RoleFlags?
} derive(ToJson,
Debug
,
FromJson
)

A Discord guild role and its permissions.

RoleColors

pub(all) struct RoleColors {
primary_color : Int
secondary_color : Nullable[Int]
tertiary_color : Nullable[Int]
} derive(ToJson,
Debug
,
FromJson
)

Primary and optional enhanced gradient colors of a role.

RoleFlags

pub(all) struct RoleFlags(UInt64) derive(Eq)

Bit flags describing special behavior assigned to a role.
impl BitAnd for RoleFlags
impl BitOr for RoleFlags
impl ToJson for RoleFlags

RoleFlags::bits

fn RoleFlags::bits(self : RoleFlags) -> UInt64

RoleFlags::contains

fn RoleFlags::contains(self : RoleFlags, other : RoleFlags) -> Bool

RoleFlags::from_bits

fn RoleFlags::from_bits(bits : UInt64) -> RoleFlags

RoleFlags::in_prompt

fn RoleFlags::in_prompt() -> RoleFlags

RoleFlags::none

fn RoleFlags::none() -> RoleFlags

RoleMarker

pub enum RoleMarker {
}

RoleSubscriptionData

pub(all) struct RoleSubscriptionData {
role_subscription_listing_id : Id[SkuMarker]
tier_name : String
total_months_subscribed : Int
is_renewal : Bool
} derive(ToJson,
Debug
,
FromJson
)

Subscription tier data attached to a role purchase message.

RoleTags

pub(all) struct RoleTags {
bot_id : Id[UserMarker]?
premium_subscriber : Bool
integration_id : Id[IntegrationMarker]?
subscription_listing_id : Id[SkuMarker]?
available_for_purchase : Bool
guild_connections : Bool
} derive(Eq,
Debug
)

Role ownership tags, including null-valued markers whose presence means true.

Discord represents premium_subscriber, available_for_purchase, and guild_connections as optional fields whose only wire value is null. Their Boolean values record whether each field was present.
impl ToJson for RoleTags

ScheduledEventMarker

pub enum ScheduledEventMarker {
}

Section

pub(all) struct Section {
id : Int?
components : Array[Component]
accessory : Component
} derive(ToJson,
Debug
,
FromJson
)

A section containing text components and a button or thumbnail accessory.

SelectDefaultValue

pub(all) struct SelectDefaultValue {
id : Id[GenericMarker]
typ : String
} derive(ToJson,
Debug
,
FromJson
)

A preselected entity in an auto-populated select menu.

SelectMenu

pub(all) struct SelectMenu {
id : Int?
custom_id : String
placeholder : String?
min_values : Int?
max_values : Int?
disabled : Bool?
options : Array[SelectOption]?
channel_types : Array[ChannelType]?
default_values : Array[SelectDefaultValue]?
values : Array[String]?
} derive(ToJson,
Debug
,
FromJson
)

A text or auto-populated select menu component.

SelectOption

pub(all) struct SelectOption {
label : String
value : String
description : String?
emoji : Emoji?
default : Bool?
} derive(ToJson,
Debug
,
FromJson
)

A selectable option in a string select menu.

Separator

pub(all) struct Separator {
id : Int?
divider : Bool?
spacing : Int?
} derive(ToJson,
Debug
,
FromJson
)

A visual separator between Components v2 content blocks.

SessionStartLimit

pub(all) struct SessionStartLimit {
total : Int
remaining : Int
reset_after : Int64
max_concurrency : Int
} derive(ToJson,
Debug
)

Identify session allowance: how many session starts remain in the current window and how many shards may identify concurrently.

SessionStartLimitWire

type SessionStartLimitWire derive(
FromJson
)

SharedClientTheme

pub(all) struct SharedClientTheme {
colors : Array[String]
gradient_angle : Int
base_mix : Int
base_theme : Nullable[BaseTheme]?
} derive(ToJson,
Debug
,
FromJson
)

Theme colors shared by an activity-card message.

Sku

pub(all) struct Sku {
id : Id[SkuMarker]
typ : SkuType
application_id : Id[ApplicationMarker]
name : String
slug : String
flags : SkuFlags
} derive(ToJson,
Debug
,
FromJson
)

A purchasable Discord application product.

SkuFlags

pub(all) struct SkuFlags(UInt64) derive(Eq)

Bit flags describing availability and subscription scope for a SKU.
impl BitAnd for SkuFlags
impl BitOr for SkuFlags
impl ToJson for SkuFlags

SkuFlags::available

fn SkuFlags::available() -> SkuFlags

SkuFlags::bits

fn SkuFlags::bits(self : SkuFlags) -> UInt64

SkuFlags::contains

fn SkuFlags::contains(self : SkuFlags, other : SkuFlags) -> Bool

SkuFlags::from_bits

fn SkuFlags::from_bits(bits : UInt64) -> SkuFlags

SkuFlags::guild_subscription

fn SkuFlags::guild_subscription() -> SkuFlags

SkuFlags::none

fn SkuFlags::none() -> SkuFlags

SkuFlags::user_subscription

fn SkuFlags::user_subscription() -> SkuFlags

SkuMarker

pub enum SkuMarker {
}

SkuType

pub(all) enum SkuType {
Durable
Consumable
Subscription
SubscriptionGroup
Unknown(Int)
} derive(Eq,
Debug
)

The product category represented by a SKU.
impl ToJson for SkuType

SkuType::from_int

fn SkuType::from_int(value : Int) -> SkuType

SkuType::to_int

fn SkuType::to_int(self : SkuType) -> Int

SortOrderType

pub(all) enum SortOrderType {
LatestActivity
CreationDate
Unknown(Int)
} derive(Eq,
Debug
)

The ordering used for posts in a forum or media channel.

SortOrderType::from_int

fn SortOrderType::from_int(value : Int) -> SortOrderType

SortOrderType::to_int

fn SortOrderType::to_int(self : SortOrderType) -> Int

SoundboardSound

pub(all) struct SoundboardSound {
name : String
sound_id : Id[SoundboardSoundMarker]
volume : Double
emoji_id : Nullable[Id[EmojiMarker]]
emoji_name : Nullable[String]
guild_id : Id[GuildMarker]?
available : Bool
user : User?
} derive(ToJson,
Debug
,
FromJson
)

A reusable soundboard sound configured for Discord playback.

SoundboardSoundMarker

pub enum SoundboardSoundMarker {
}

SoundboardSoundsEvent

pub(all) struct SoundboardSoundsEvent {
soundboard_sounds : Array[SoundboardSound]
guild_id : Id[GuildMarker]
} derive(ToJson,
Debug
,
FromJson
)

The complete soundboard sound collection for a guild.

StageInstance

pub(all) struct StageInstance {
id : Id[StageInstanceMarker]
guild_id : Id[GuildMarker]
channel_id : Id[ChannelMarker]
topic : String
privacy_level : StagePrivacyLevel
guild_scheduled_event_id : Nullable[Id[ScheduledEventMarker]]
} derive(ToJson,
Debug
,
FromJson
)

A live stage instance associated with a guild stage channel.

StageInstanceMarker

pub enum StageInstanceMarker {
}

StagePrivacyLevel

pub(all) enum StagePrivacyLevel {
Public
GuildOnly
Unknown(Int)
} derive(Eq,
Debug
)

The audience allowed to discover a stage instance.

StagePrivacyLevel::from_int

fn StagePrivacyLevel::from_int(value : Int) -> StagePrivacyLevel

StagePrivacyLevel::to_int

fn StagePrivacyLevel::to_int(self : StagePrivacyLevel) -> Int

Sticker

pub(all) struct Sticker {
id : Id[StickerMarker]
pack_id : Id[StickerPackMarker]?
name : String
description : Nullable[String]
tags : String
asset : String?
typ : StickerType
format_type : StickerFormatType
available : Bool?
guild_id : Id[GuildMarker]?
user : User?
sort_value : Int?
} derive(ToJson,
Debug
,
FromJson
)

A Discord standard or guild sticker.

StickerFormatType

pub(all) enum StickerFormatType {
Png
Apng
Lottie
Gif
Unknown(Int)
} derive(Eq,
Debug
)

The media format used by a sticker asset.

StickerFormatType::from_int

fn StickerFormatType::from_int(value : Int) -> StickerFormatType

StickerFormatType::to_int

fn StickerFormatType::to_int(self : StickerFormatType) -> Int

StickerItem

pub(all) struct StickerItem {
id : Id[StickerMarker]
name : String
format_type : StickerFormatType
} derive(ToJson,
Debug
,
FromJson
)

The compact sticker representation included in messages.

StickerMarker

pub enum StickerMarker {
}

StickerPack

pub(all) struct StickerPack {
id : Id[StickerPackMarker]
stickers : Array[Sticker]
name : String
sku_id : Id[SkuMarker]
cover_sticker_id : Id[StickerMarker]?
description : String
banner_asset_id : Id[GenericMarker]?
} derive(ToJson,
Debug
,
FromJson
)

A purchasable collection of standard stickers.

StickerPackMarker

pub enum StickerPackMarker {
}

StickerPacksResponse

pub(all) struct StickerPacksResponse {
sticker_packs : Array[StickerPack]
} derive(ToJson,
Debug
,
FromJson
)

The envelope returned by the sticker-packs listing endpoint.

StickerType

pub(all) enum StickerType {
Standard
Guild
Unknown(Int)
} derive(Eq,
Debug
)

The origin category of a sticker.

StickerType::from_int

fn StickerType::from_int(value : Int) -> StickerType

StickerType::to_int

fn StickerType::to_int(self : StickerType) -> Int

Subscription

pub(all) struct Subscription {
id : Id[GenericMarker]
user_id : Id[UserMarker]
sku_ids : Array[Id[SkuMarker]]
entitlement_ids : Array[Id[EntitlementMarker]]
renewal_sku_ids : Nullable[Array[Id[SkuMarker]]]
current_period_start : Timestamp
current_period_end : Timestamp
status : SubscriptionStatus
canceled_at : Nullable[Timestamp]
country : String?
} derive(ToJson,
Debug
,
FromJson
)

A user's recurring subscription to one or more application SKUs.

SubscriptionMarker

pub enum SubscriptionMarker {
}

SubscriptionStatus

pub(all) enum SubscriptionStatus {
Active
Ending
Inactive
Unknown(Int)
} derive(Eq,
Debug
)

The renewal state of a Discord application subscription.

SubscriptionStatus::from_int

fn SubscriptionStatus::from_int(value : Int) -> SubscriptionStatus

SubscriptionStatus::to_int

fn SubscriptionStatus::to_int(self : SubscriptionStatus) -> Int

SystemChannelFlags

pub(all) struct SystemChannelFlags(UInt64) derive(Eq)

Bit flags controlling messages sent to a guild system channel.

SystemChannelFlags::bits

fn SystemChannelFlags::bits(self : SystemChannelFlags) -> UInt64

SystemChannelFlags::contains

fn SystemChannelFlags::contains(self : SystemChannelFlags, other : SystemChannelFlags) -> Bool

SystemChannelFlags::from_bits

fn SystemChannelFlags::from_bits(bits : UInt64) -> SystemChannelFlags

SystemChannelFlags::none

SystemChannelFlags::suppress_guild_reminder_notifications

fn SystemChannelFlags::suppress_guild_reminder_notifications() -> SystemChannelFlags

SystemChannelFlags::suppress_join_notification_replies

fn SystemChannelFlags::suppress_join_notification_replies() -> SystemChannelFlags

SystemChannelFlags::suppress_join_notifications

fn SystemChannelFlags::suppress_join_notifications() -> SystemChannelFlags

SystemChannelFlags::suppress_premium_subscriptions

fn SystemChannelFlags::suppress_premium_subscriptions() -> SystemChannelFlags

SystemChannelFlags::suppress_role_subscription_purchase_notification_replies

fn SystemChannelFlags::suppress_role_subscription_purchase_notification_replies() -> SystemChannelFlags

SystemChannelFlags::suppress_role_subscription_purchase_notifications

fn SystemChannelFlags::suppress_role_subscription_purchase_notifications() -> SystemChannelFlags

TargetUsersJobStatus

pub(all) struct TargetUsersJobStatus {
status : TargetUsersJobStatusCode
total_users : Int
processed_users : Int
created_at : Timestamp
completed_at : Nullable[Timestamp]
error_message : String?
} derive(ToJson,
Debug
,
FromJson
)

Progress and outcome of an invite target-user CSV update.

TargetUsersJobStatusCode

pub(all) enum TargetUsersJobStatusCode {
Unspecified
Processing
Completed
Failed
Unknown(Int)
} derive(Eq,
Debug
)

State of an invite target-user CSV update job.

TargetUsersJobStatusCode::from_int

TargetUsersJobStatusCode::to_int

Team

pub(all) struct Team {
icon : Nullable[ImageHash]
id : Id[TeamMarker]
members : Array[TeamMember]
name : String
owner_user_id : Id[UserMarker]
} derive(ToJson,
Debug
,
FromJson
)

A Discord developer team and its members.

TeamMarker

pub enum TeamMarker {
}

TeamMember

pub(all) struct TeamMember {
membership_state : TeamMembershipState
team_id : Id[TeamMarker]
user : User
role : String?
} derive(ToJson,
Debug
,
FromJson
)

A user's membership record within a developer team.

TeamMembershipState

pub(all) enum TeamMembershipState {
Invited
Accepted
Unknown(Int)
} derive(Eq,
Debug
)

A user's invitation state within a developer team.

TeamMembershipState::from_int

fn TeamMembershipState::from_int(value : Int) -> TeamMembershipState

TeamMembershipState::to_int

fn TeamMembershipState::to_int(self : TeamMembershipState) -> Int

TextDisplay

pub(all) struct TextDisplay {
id : Int?
content : String
} derive(ToJson,
Debug
,
FromJson
)

A markdown text block displayed in a Components v2 layout.

TextInput

pub(all) struct TextInput {
id : Int?
custom_id : String
style : TextInputStyle?
label : String?
min_length : Int?
max_length : Int?
required : Bool?
value : String?
placeholder : String?
} derive(ToJson,
Debug
,
FromJson
)

A free-form text input component used in a modal.

TextInputStyle

pub(all) enum TextInputStyle {
Short
Paragraph
Unknown(Int)
} derive(Eq,
Debug
)

The single-line or multi-line style of a text input.

TextInputStyle::from_int

fn TextInputStyle::from_int(value : Int) -> TextInputStyle

TextInputStyle::to_int

fn TextInputStyle::to_int(self : TextInputStyle) -> Int

ThreadAutoArchiveDuration

pub(all) enum ThreadAutoArchiveDuration {
OneHour
OneDay
ThreeDays
OneWeek
Unknown(Int)
} derive(Eq,
Debug
)

The inactivity duration in minutes before a thread is archived.

ThreadAutoArchiveDuration::from_int

ThreadAutoArchiveDuration::to_int

ThreadCreateEvent

pub(all) struct ThreadCreateEvent {
channel : Channel
newly_created : Bool?
} derive(
Debug
)

A thread channel delivered with THREAD_CREATE-only metadata.

ThreadDeleteEvent

pub(all) struct ThreadDeleteEvent {
id : Id[ChannelMarker]
guild_id : Id[GuildMarker]
parent_id : Id[ChannelMarker]
typ : ChannelType
} derive(ToJson,
Debug
,
FromJson
)

A deleted thread's identifying fields.

ThreadListSyncEvent

pub(all) struct ThreadListSyncEvent {
guild_id : Id[GuildMarker]
channel_ids : Array[Id[ChannelMarker]]?
threads : Array[Channel]
members : Array[ThreadMember]
} derive(ToJson,
Debug
,
FromJson
)

Threads and memberships synchronized for a guild.

ThreadMember

pub(all) struct ThreadMember {
id : Id[ChannelMarker]?
user_id : Id[UserMarker]?
join_timestamp : Timestamp
flags : Int
guild_member : GuildMember?
} derive(ToJson,
Debug
,
FromJson
)

A user's membership state in a thread.

ThreadMemberUpdateEvent

pub(all) struct ThreadMemberUpdateEvent {
guild_id : Id[GuildMarker]
thread_member : ThreadMember
} derive(
Debug
)

The current user's thread membership decoded from a flattened object.

ThreadMembersUpdateEvent

pub(all) struct ThreadMembersUpdateEvent {
id : Id[ChannelMarker]
guild_id : Id[GuildMarker]
member_count : Int
added_members : Array[ThreadMember]?
removed_member_ids : Array[Id[UserMarker]]?
} derive(ToJson,
Debug
,
FromJson
)

Membership changes for a thread.

ThreadMetadata

pub(all) struct ThreadMetadata {
archived : Bool
auto_archive_duration : ThreadAutoArchiveDuration
archive_timestamp : Timestamp
locked : Bool
invitable : Bool?
create_timestamp : Timestamp?
} derive(ToJson,
Debug
,
FromJson
)

Metadata controlling a thread's archive and lock state.

Thumbnail

pub(all) struct Thumbnail {
id : Int?
media : UnfurledMediaItem
description : String?
spoiler : Bool?
} derive(ToJson,
Debug
,
FromJson
)

A thumbnail accessory rendered from an unfurled media item.

Timestamp

pub(all) struct Timestamp(String) derive(Eq)

An ISO 8601 timestamp, kept as the raw string for lossless round-tripping. Discord sends e.g. 2021-03-11T18:15:37.907000+00:00.
impl ToJson for Timestamp

Timestamp::to_string

fn Timestamp::to_string(self : Timestamp) -> String

Timestamp::unix_ms

fn Timestamp::unix_ms(self : Timestamp) -> Int64 raise TimestampError

Parse the timestamp into milliseconds since the Unix epoch.

Supports the shapes Discord emits: YYYY-MM-DDTHH:MM:SS[.f...](Z|±HH:MM).

test "parse a Discord timestamp without losing its source text" {
let timestamp = @model.Timestamp("2021-03-11T18:15:37.907000+00:00")
inspect(timestamp.to_string(), content="2021-03-11T18:15:37.907000+00:00")
inspect(timestamp.unix_ms(), content="1615486537907")
}

TriggerMetadata

pub(all) struct TriggerMetadata {
keyword_filter : Array[String]?
presets : Array[AutoModerationKeywordPresetType]?
allow_list : Array[String]?
regex_patterns : Array[String]?
mention_total_limit : Int?
mention_raid_protection_enabled : Bool?
} derive(ToJson,
Debug
,
FromJson
)

Optional condition settings used by auto-moderation triggers.

TypingStartEvent

pub(all) struct TypingStartEvent {
channel_id : Id[ChannelMarker]
guild_id : Id[GuildMarker]?
user_id : Id[UserMarker]
timestamp : Int64
guild_member : GuildMember?
} derive(ToJson,
Debug
)

TypingStartEventWire

type TypingStartEventWire derive(
FromJson
)

UnavailableGuild

pub(all) struct UnavailableGuild {
id : Id[GuildMarker]
unavailable : Bool
} derive(ToJson,
Debug
,
FromJson
)

A guild that is temporarily unavailable to the client.

Undefinable

pub(all) enum Undefinable[T] {
Missing
Null
Value(T)
} derive(Eq,
Debug
)

Tri-state value for PATCH-style requests: leave a field untouched (Missing, omitted from the payload), clear it (Null, an explicit JSON null), or set it (Value).

This is an input type for request builders (see ObjBuilder::und); it is not meant to appear in received models. Decoding never produces Missing.
impl ToJson for Undefinable[T]

Undefinable::to_option

fn[T] Undefinable::to_option(self : Undefinable[T]) -> T?

Some for a value; None for both JSON null and an absent field.

UnfurledMediaItem

pub(all) struct UnfurledMediaItem {
url : String
proxy_url : String?
height : Int?
width : Int?
placeholder : String?
placeholder_version : Int?
content_type : String?
flags : Int?
attachment_id : String?
} derive(ToJson,
Debug
,
FromJson
)

Media metadata used by thumbnail, gallery, and file components.

User

pub(all) struct User {
id : Id[UserMarker]
username : String
discriminator : String
global_name : Nullable[String]?
avatar : Nullable[ImageHash]
bot : Bool?
system : Bool?
mfa_enabled : Bool?
banner : Nullable[ImageHash]?
accent_color : Nullable[Int]?
locale : String?
verified : Bool?
email : Nullable[String]?
flags : UserFlags?
premium_type : PremiumType?
public_flags : UserFlags?
avatar_decoration : Nullable[ImageHash]?
avatar_decoration_data : Nullable[AvatarDecorationData]?
collectibles : Nullable[Collectibles]?
primary_guild : Nullable[UserPrimaryGuild]?
} derive(ToJson,
Debug
,
FromJson
)

A Discord user account returned by the API.

UserFlags

pub(all) struct UserFlags(UInt64) derive(Eq)

Bit flags describing badges and account properties assigned to a user.
impl BitAnd for UserFlags
impl BitOr for UserFlags
impl ToJson for UserFlags

UserFlags::active_developer

fn UserFlags::active_developer() -> UserFlags

UserFlags::bits

fn UserFlags::bits(self : UserFlags) -> UInt64

UserFlags::bot_http_interactions

fn UserFlags::bot_http_interactions() -> UserFlags

UserFlags::bug_hunter_level_1

fn UserFlags::bug_hunter_level_1() -> UserFlags

UserFlags::bug_hunter_level_2

fn UserFlags::bug_hunter_level_2() -> UserFlags

UserFlags::certified_moderator

fn UserFlags::certified_moderator() -> UserFlags

UserFlags::collaborator

fn UserFlags::collaborator() -> UserFlags

UserFlags::contains

fn UserFlags::contains(self : UserFlags, other : UserFlags) -> Bool

UserFlags::disable_premium

fn UserFlags::disable_premium() -> UserFlags

UserFlags::from_bits

fn UserFlags::from_bits(bits : UInt64) -> UserFlags

UserFlags::has_unread_urgent_messages

fn UserFlags::has_unread_urgent_messages() -> UserFlags

UserFlags::hype_squad_online_house_1

fn UserFlags::hype_squad_online_house_1() -> UserFlags

UserFlags::hype_squad_online_house_2

fn UserFlags::hype_squad_online_house_2() -> UserFlags

UserFlags::hype_squad_online_house_3

fn UserFlags::hype_squad_online_house_3() -> UserFlags

UserFlags::hypesquad

fn UserFlags::hypesquad() -> UserFlags

UserFlags::mfa_sms

fn UserFlags::mfa_sms() -> UserFlags

UserFlags::none

fn UserFlags::none() -> UserFlags

UserFlags::partner

fn UserFlags::partner() -> UserFlags

UserFlags::premium_early_supporter

fn UserFlags::premium_early_supporter() -> UserFlags

UserFlags::premium_promo_dismissed

fn UserFlags::premium_promo_dismissed() -> UserFlags

UserFlags::quarantined

fn UserFlags::quarantined() -> UserFlags

UserFlags::restricted_collaborator

fn UserFlags::restricted_collaborator() -> UserFlags

UserFlags::spammer

fn UserFlags::spammer() -> UserFlags

UserFlags::staff

fn UserFlags::staff() -> UserFlags

UserFlags::team_pseudo_user

fn UserFlags::team_pseudo_user() -> UserFlags

UserFlags::verified_bot

fn UserFlags::verified_bot() -> UserFlags

UserFlags::verified_developer

fn UserFlags::verified_developer() -> UserFlags

UserMarker

pub enum UserMarker {
}

UserPrimaryGuild

pub(all) struct UserPrimaryGuild {
identity_guild_id : Nullable[Id[GuildMarker]]?
identity_enabled : Nullable[Bool]?
tag : Nullable[String]?
badge : Nullable[ImageHash]?
} derive(ToJson,
Debug
,
FromJson
)

The primary-guild identity displayed on a user's profile.

VerificationLevel

pub(all) enum VerificationLevel {
None
Low
Medium
High
VeryHigh
Unknown(Int)
} derive(Eq,
Debug
)

Discord's guild verification level.

VerificationLevel::from_int

fn VerificationLevel::from_int(value : Int) -> VerificationLevel

VerificationLevel::to_int

fn VerificationLevel::to_int(self : VerificationLevel) -> Int

VideoQualityMode

pub(all) enum VideoQualityMode {
Auto
Full
Unknown(Int)
} derive(Eq,
Debug
)

The camera quality mode used by a voice channel.

VideoQualityMode::from_int

fn VideoQualityMode::from_int(value : Int) -> VideoQualityMode

VideoQualityMode::to_int

fn VideoQualityMode::to_int(self : VideoQualityMode) -> Int

VoiceChannelEffectSendEvent

pub(all) struct VoiceChannelEffectSendEvent {
channel_id : Id[ChannelMarker]
guild_id : Id[GuildMarker]
user_id : Id[UserMarker]
emoji : Nullable[Emoji]?
animation_type : Nullable[Int]?
animation_id : Int?
sound_id : Json?
sound_volume : Double?
} derive(ToJson,
Debug
,
FromJson
)

A visual or soundboard effect sent in a voice channel.

VoiceChannelStartTimeUpdateEvent

pub(all) struct VoiceChannelStartTimeUpdateEvent {
id : Id[ChannelMarker]
guild_id : Id[GuildMarker]
voice_start_time : Nullable[Int64]?
} derive(ToJson,
Debug
,
FromJson
)

A voice channel's session start time changed.

VoiceChannelStatusUpdateEvent

pub(all) struct VoiceChannelStatusUpdateEvent {
id : Id[ChannelMarker]
guild_id : Id[GuildMarker]
status : Nullable[String]
} derive(ToJson,
Debug
,
FromJson
)

A voice channel's text status changed.

VoiceRegion

pub(all) struct VoiceRegion {
id : String
name : String
optimal : Bool
deprecated : Bool
custom : Bool
} derive(ToJson,
Debug
,
FromJson
)

A voice server region available to Discord clients.

VoiceServerUpdateEvent

pub(all) struct VoiceServerUpdateEvent {
token : String
guild_id : Id[GuildMarker]
endpoint : Nullable[String]
} derive(ToJson,
Debug
,
FromJson
)

Voice server connection information for a guild.

VoiceState

pub(all) struct VoiceState {
guild_id : Id[GuildMarker]?
channel_id : Nullable[Id[ChannelMarker]]
user_id : Id[UserMarker]
guild_member : GuildMember?
session_id : String
deaf : Bool
mute : Bool
self_deaf : Bool
self_mute : Bool
self_stream : Bool?
self_video : Bool?
suppress : Bool
request_to_speak_timestamp : Nullable[Timestamp]
} derive(ToJson,
Debug
,
FromJson
)

A user's connection state in a Discord voice channel.

Webhook

pub(all) struct Webhook {
id : Id[WebhookMarker]
typ : WebhookType
guild_id : Nullable[Id[GuildMarker]]?
channel_id : Nullable[Id[ChannelMarker]]
user : User?
name : Nullable[String]
avatar : Nullable[ImageHash]
token : String?
application_id : Nullable[Id[ApplicationMarker]]
source_guild : PartialGuild?
source_channel : PartialChannel?
url : String?
} derive(ToJson,
Debug
,
FromJson
)

A Discord webhook and its execution metadata.

WebhookEvent

pub(all) enum WebhookEvent {
ApplicationAuthorized(ApplicationAuthorizedEvent)
ApplicationDeauthorized(ApplicationDeauthorizedEvent)
EntitlementCreate(Entitlement)
EntitlementUpdate(Entitlement)
EntitlementDelete(Entitlement)
LobbyMessageCreate(LobbyMessage)
LobbyMessageUpdate(LobbyMessage)
LobbyMessageDelete(LobbyMessageDeleteEvent)
GameDirectMessageCreate(GameDirectMessage)
GameDirectMessageUpdate(GameDirectMessage)
GameDirectMessageDelete(GameDirectMessage)
QuestUserEnrollment
Unknown(typ~ : String, data~ : Json?)
} derive(
Debug
)

A webhook event projected into its documented payload shape.

Known event names always use a typed variant. Unknown names retain their original name and optional data for forward compatibility.

WebhookEventBody

pub(all) struct WebhookEventBody {
typ : WebhookEventType
timestamp : Timestamp
data : Json?
} derive(ToJson,
Debug
,
FromJson
)

The timestamped body nested inside an event webhook payload.

WebhookEventBody::project

fn WebhookEventBody::project(self : WebhookEventBody) -> WebhookEvent raise

Decode the event-specific data carried by this body.

Unknown event names never raise. A known event raises when its data does not match the documented wire shape.

WebhookEventPayload

pub(all) struct WebhookEventPayload {
version : Int
application_id : Id[ApplicationMarker]
typ : WebhookPayloadType
event : WebhookEventBody?
} derive(ToJson,
Debug
,
FromJson
)

An outbound HTTP webhook event payload sent by Discord.

WebhookEventType

pub(all) enum WebhookEventType {
ApplicationAuthorized
ApplicationDeauthorized
EntitlementCreate
EntitlementUpdate
EntitlementDelete
LobbyMessageCreate
LobbyMessageUpdate
LobbyMessageDelete
GameDirectMessageCreate
GameDirectMessageUpdate
GameDirectMessageDelete
QuestUserEnrollment
Unknown(String)
} derive(Eq,
Debug
)

A subscribable outbound webhook event category.

WebhookEventType::from_string

fn WebhookEventType::from_string(value : String) -> WebhookEventType

WebhookEventType::to_string

fn WebhookEventType::to_string(self : WebhookEventType) -> String

WebhookMarker

pub enum WebhookMarker {
}

WebhookPayloadType

pub(all) enum WebhookPayloadType {
Ping
Event
Unknown(Int)
} derive(Eq,
Debug
)

The outer category of an outbound Discord webhook payload.

WebhookPayloadType::from_int

fn WebhookPayloadType::from_int(value : Int) -> WebhookPayloadType

WebhookPayloadType::to_int

fn WebhookPayloadType::to_int(self : WebhookPayloadType) -> Int

WebhookType

pub(all) enum WebhookType {
Incoming
ChannelFollower
Application
Unknown(Int)
} derive(Eq,
Debug
)

The behavior category of a Discord webhook.

WebhookType::from_int

fn WebhookType::from_int(value : Int) -> WebhookType

WebhookType::to_int

fn WebhookType::to_int(self : WebhookType) -> Int

WebhooksUpdateEvent

pub(all) struct WebhooksUpdateEvent {
guild_id : Id[GuildMarker]
channel_id : Id[ChannelMarker]
} derive(ToJson,
Debug
,
FromJson
)

Webhook configuration changed in a guild channel.

WelcomeScreen

pub(all) struct WelcomeScreen {
description : Nullable[String]
welcome_channels : Array[WelcomeScreenChannel]
} derive(ToJson,
Debug
,
FromJson
)

The welcome screen shown to new members of a community guild.

WelcomeScreenChannel

pub(all) struct WelcomeScreenChannel {
channel_id : Id[ChannelMarker]
description : String
emoji_id : Nullable[Id[EmojiMarker]]
emoji_name : Nullable[String]
} derive(ToJson,
Debug
,
FromJson
)

A channel suggested on a guild welcome screen.

dispatch_event

fn dispatch_event(t : String, d : Json) -> Event raise

Decode a dispatch payload by event name.

Unknown names never raise. A known event raises only when its payload does not match the modeled wire shape; the gateway converts that failure into an unknown event so shard processing remains lenient.

flatten

fn[T] flatten(field : Nullable[T]?) -> T?

Collapse an optional nullable field to a plain option: None for both an absent key and JSON null, Some(v) for a present value.

This is a lossy view. Do not use it when the distinction between a missing key and JSON null matters, such as when building PATCH bodies or merging cache updates.

test "flatten optional nullable fields" {
let absent : @model.Nullable[String]? = None
let null_value : @model.Nullable[String]? = Some(Null)
let present : @model.Nullable[String]? = Some(Value("Moon"))
debug_inspect(
[
@model.flatten(absent),
@model.flatten(null_value),
@model.flatten(present),
],
content=(
#|[None, None, Some("Moon")]
),
)
}

requires_components_v2

fn requires_components_v2(components : Array[Component]) -> Bool

Whether any top-level component requires Discord's Components V2 message flag.

test "detect top-level Components V2 layouts" {
let row : @model.Component = ActionRow({ id: None, components: [], })
let container : @model.Component = Container({
id: None,
components: [],
accent_color: None,
spoiler: None,
})
assert_false(@model.requires_components_v2([row]))
assert_true(@model.requires_components_v2([row, container]))
}