gaato/discord/model does not have a README file
pub(all) suberror AllowedMentionsError {
ParseAndExplicit(typ~ : AllowedMentionType)
TooManyRoles(count~ : Int)
TooManyUsers(count~ : Int)
} derive(Eq, Debug)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(Debug, ToJson)pub(all) struct ActivityEmoji {
name : String
id : Id[EmojiMarker]?
animated : Bool?
} derive(Debug, FromJson, ToJson)impl Debug for ActivityFlagsimpl FromJson for ActivityFlagsimpl ToJson for ActivityFlagspub(all) struct ActivityInstance {
application_id : Id[ApplicationMarker]
instance_id : String
launch_id : Id[GenericMarker]
location : ActivityLocation
users : Array[Id[UserMarker]]
} derive(Debug, FromJson, ToJson)pub(all) struct ActivityLocation {
id : String
kind : ActivityLocationKind
channel_id : Id[ChannelMarker]
guild_id : Nullable[Id[GuildMarker]]?
} derive(Debug, FromJson, ToJson)impl FromJson for ActivityLocationKindimpl ToJson for ActivityLocationKindimpl FromJson for ActivityTimestampsimpl ToJson for ActivityTimestampsimpl FromJson for ActivityTypeimpl ToJson for ActivityTypeimpl ToJson for AllowedMentionTypeimpl ToJson for AllowedMentionsfn AllowedMentions::AllowedMentions(parse? : Array[AllowedMentionType], roles? : Array[Id[RoleMarker]], users? : Array[Id[UserMarker]], replied_user? : Bool) -> AllowedMentions raise AllowedMentionsErrortest "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,
})
}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(Debug, FromJson, ToJson)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(Debug, FromJson, ToJson)pub(all) struct ApplicationCommandPermission {
id : Id[GenericMarker]
typ : ApplicationCommandPermissionType
permission : Bool
} derive(Debug, FromJson, ToJson)impl FromJson for ApplicationCommandPermissionTypefn from_json(json : Json, path : JsonPath) -> ApplicationCommandPermissionType raise JsonDecodeErrorimpl ToJson for ApplicationCommandPermissionTypeimpl FromJson for ApplicationCommandTypeimpl ToJson for ApplicationCommandTypeimpl FromJson for ApplicationEventWebhookStatusimpl ToJson for ApplicationEventWebhookStatusimpl BitAnd for ApplicationFlagsimpl BitOr for ApplicationFlagsimpl Debug for ApplicationFlagsimpl FromJson for ApplicationFlagsimpl ToJson for ApplicationFlagspub(all) struct ApplicationIdentity {
user_id : Id[UserMarker]?
provider_type : String
provider_id : String?
provider_issued_user_id : String
} derive(Debug, FromJson, ToJson)pub(all) enum ApplicationIdentityDynamicField {
StringField(ApplicationIdentityDynamicStringField)
NumberField(ApplicationIdentityDynamicNumberField)
MediaField(ApplicationIdentityDynamicMediaField)
Unknown(Json)
} derive(Debug)impl FromJson for ApplicationIdentityDynamicFieldimpl ToJson for ApplicationIdentityDynamicFieldpub(all) struct ApplicationIdentityDynamicMediaField {
name : String
value : ApplicationIdentityProfileMedia
} derive(Eq, Debug, FromJson, ToJson)pub(all) struct ApplicationIdentityPrimaryProfileData {
season : String?
rank_name : String?
rank_image : ApplicationIdentityProfileMedia?
highest_rank : String?
highest_rank_image : ApplicationIdentityProfileMedia?
featured_played_character : String?
featured_played_character_image : ApplicationIdentityProfileMedia?
playtime_hours : Double?
total_wins : Int?
current_period_wins : Int?
total_games : Int?
current_period_games : Int?
total_kills : Int?
current_period_kills : Int?
total_assists : Int?
current_period_assists : Int?
total_deaths : Int?
current_period_deaths : Int?
} derive(Debug, FromJson, ToJson)pub(all) struct ApplicationIdentityProfileData {
primary : ApplicationIdentityPrimaryProfileData?
dynamic : Array[ApplicationIdentityDynamicField]?
} derive(Debug, FromJson, ToJson)impl FromJson for ApplicationIntegrationTypeimpl ToJson for ApplicationIntegrationTypepub(all) struct ApplicationIntegrationTypeConfiguration {
oauth2_install_params : InstallParams?
} derive(Debug, FromJson, ToJson)pub enum ApplicationMarker {
}fn from_json(json : Json, path : JsonPath) -> ApplicationRoleConnectionMetadataType raise JsonDecodeErrorfn ApplicationRoleConnectionMetadataType::from_int(value : Int) -> ApplicationRoleConnectionMetadataTypefn ApplicationRoleConnectionMetadataType::to_int(self : ApplicationRoleConnectionMetadataType) -> Intfn ApplicationRoleConnectionMetadataType::to_json(self : ApplicationRoleConnectionMetadataType) -> Jsonpub(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(Debug, FromJson, ToJson)impl BitAnd for AttachmentFlagsimpl BitOr for AttachmentFlagsimpl Debug for AttachmentFlagsimpl FromJson for AttachmentFlagsimpl ToJson for AttachmentFlagspub(all) struct AttachmentRequest {
id : Id[AttachmentMarker]
filename : String?
title : String?
description : String?
duration_secs : Double?
waveform : String?
is_spoiler : Bool?
} derive(Debug)impl ToJson for AttachmentRequestpub(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(Debug, FromJson, ToJson)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(Debug, FromJson, ToJson)pub(all) enum AuditLogEvent {
GuildUpdate
ChannelCreate
ChannelUpdate
ChannelDelete
ChannelOverwriteCreate
ChannelOverwriteUpdate
ChannelOverwriteDelete
ChannelPositionUpdate
MemberKick
MemberPrune
MemberBanAdd
MemberBanRemove
MemberUpdate
MemberRoleUpdate
MemberMove
MemberDisconnect
BotAdd
RoleCreate
RoleUpdate
RoleDelete
RolePositionUpdate
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)impl FromJson for AuditLogEventimpl ToJson for AuditLogEventpub(all) struct AutoModerationAction {
typ : AutoModerationActionType
metadata : ActionMetadata?
} derive(Debug, FromJson, ToJson)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(Debug, FromJson, ToJson)impl FromJson for AutoModerationActionTypeimpl ToJson for AutoModerationActionTypeimpl FromJson for AutoModerationEventTypeimpl ToJson for AutoModerationEventTypeimpl FromJson for AutoModerationKeywordPresetTypeimpl ToJson for AutoModerationKeywordPresetTypepub(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(Debug, FromJson, ToJson)pub enum AutoModerationRuleMarker {
}impl FromJson for AutoModerationTriggerTypeimpl ToJson for AutoModerationTriggerTypepub(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)impl FromJson for AvailableGuildCreateEventpub(all) struct BotActivity {
name : String
type_ : ActivityType
state : String?
url : String?
} derive(Debug, ToJson)pub(all) struct BulkBanResponse {
banned_users : Array[Id[UserMarker]]
failed_users : Array[Id[UserMarker]]
} derive(Debug, FromJson, ToJson)impl FromJson for ButtonStyleimpl ToJson for ButtonStylepub(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 : Nullable[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?
app_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(Debug, FromJson, ToJson)impl BitAnd for ChannelFlagsimpl BitOr for ChannelFlagsimpl Debug for ChannelFlagsimpl FromJson for ChannelFlagsimpl ToJson for ChannelFlagspub(all) struct ChannelInfoEvent {
guild_id : Id[GuildMarker]
channels : Array[ChannelInfo]
} derive(Debug, FromJson, ToJson)impl ToJson for ChannelInfoFieldpub(all) struct ChannelMention {
id : Id[ChannelMarker]
guild_id : Id[GuildMarker]
typ : ChannelType
name : String
} derive(Debug, FromJson, ToJson)pub(all) struct ChannelPins {
items : Array[MessagePin]
has_more : Bool
} derive(Debug, FromJson, ToJson)pub(all) struct ChannelPinsUpdateEvent {
guild_id : Id[GuildMarker]?
channel_id : Id[ChannelMarker]
last_pin_timestamp : Nullable[Timestamp]?
} derive(Debug, FromJson, ToJson)impl FromJson for ChannelTypeimpl ToJson for ChannelTypepub(all) struct ClientStatus {
desktop : PresenceStatus?
mobile : PresenceStatus?
web : PresenceStatus?
vr : PresenceStatus?
} derive(Debug, ToJson)impl FromJson for ClientStatuspub(all) struct CommandData {
id : Id[CommandMarker]
name : String
typ : ApplicationCommandType
resolved : ResolvedData?
options : Array[CommandDataOption]?
guild_id : Id[GuildMarker]?
target_id : Id[GenericMarker]?
} derive(Debug, FromJson, ToJson)pub(all) struct CommandDataOption {
name : String
typ : CommandOptionType
value : Json?
options : Array[CommandDataOption]?
focused : Bool?
} derive(Debug, FromJson, ToJson)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?
file_types : Array[FileTypeFilter]?
} derive(Debug, FromJson, ToJson)impl FromJson for CommandOptionTypeimpl ToJson for CommandOptionTypepub(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)pub(all) struct ComponentData {
custom_id : String
component_type : Int
values : Array[String]?
resolved : ResolvedData?
} derive(Debug, FromJson, ToJson)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(Debug, FromJson, ToJson)impl FromJson for ConnectionServiceimpl ToJson for ConnectionServiceimpl BitAnd for ContentScanFlagsimpl BitOr for ContentScanFlagsimpl Debug for ContentScanFlagsimpl FromJson for ContentScanFlagsimpl ToJson for ContentScanFlagspub(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(Debug, FromJson, ToJson)impl FromJson for DefaultMessageNotificationsimpl ToJson for DefaultMessageNotificationspub(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]?
components : Array[Component]?
flags : EmbedFlags?
} derive(Debug, FromJson, ToJson)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 },
],
})
}fn Embed::Embed(title? : String, description? : String, url? : String, timestamp? : Timestamp, color? : Int, footer? : EmbedFooter, image? : EmbedImage, thumbnail? : EmbedThumbnail, author? : EmbedAuthor, fields? : Array[EmbedField]) -> Embedimpl Debug for EmbedFlagsimpl FromJson for EmbedFlagsimpl ToJson for EmbedFlagspub(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(Debug, FromJson, ToJson)impl FromJson for EntitlementOwnerTypeimpl ToJson for EntitlementOwnerTypeimpl FromJson for EntitlementTypeimpl ToJson for EntitlementTypeimpl FromJson for EntryPointCommandHandlerTypeimpl ToJson for EntryPointCommandHandlerTypepub(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)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)impl FromJson for ExplicitContentFilterimpl ToJson for ExplicitContentFilterpub(all) struct FileComponent {
id : Int?
file : UnfurledMediaItem
spoiler : Bool?
name : String?
size : Int?
} derive(Debug, FromJson, ToJson)test "restrict an upload to images and PDFs" {
let filter : Array[@model.FileTypeFilter] = [Image, Extension(".pdf")]
inspect(Json(filter).stringify(), content="[\"image\",\".pdf\"]")
}impl FromJson for FileTypeFilterimpl ToJson for FileTypeFilterpub(all) struct FollowedChannel {
channel_id : Id[ChannelMarker]
webhook_id : Id[WebhookMarker]
} derive(Debug, FromJson, ToJson)impl FromJson for ForumLayoutTypeimpl ToJson for ForumLayoutTypepub(all) struct ForumTag {
id : Id[GenericMarker]
name : String
moderated : Bool
emoji_id : Nullable[Id[EmojiMarker]]
emoji_name : Nullable[String]
} derive(Debug, FromJson, ToJson)pub(all) struct ForumTagRequest {
id : Id[GenericMarker]?
name : String
moderated : Bool?
emoji_id : Id[EmojiMarker]?
emoji_name : String?
} derive(Debug)impl ToJson for ForumTagRequestpub(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)impl FromJson for GameDirectMessageimpl ToJson for GameDirectMessagepub(all) struct GatewayBotInfo {
url : String
shards : Int
session_start_limit : SessionStartLimit
} derive(Debug, FromJson, ToJson)test "opt into channel obfuscation ahead of general availability" {
let capabilities = @model.GatewayCapabilities::channel_obfuscation()
inspect(capabilities.bits(), content="32768")
}impl BitAnd for GatewayCapabilitiesimpl BitOr for GatewayCapabilitiesimpl Debug for GatewayCapabilitiesimpl ToJson for GatewayCapabilitiespub enum GenericMarker {
}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(Debug, FromJson, ToJson)pub(all) struct GuildApplicationCommandPermissions {
id : Id[CommandMarker]
application_id : Id[ApplicationMarker]
guild_id : Id[GuildMarker]
permissions : Array[ApplicationCommandPermission]
} derive(Debug, FromJson, ToJson)pub(all) struct GuildAuditLogEntryCreateEvent {
guild_id : Id[GuildMarker]
entry : AuditLogEntry
} derive(Debug)impl FromJson for GuildAuditLogEntryCreateEventpub(all) enum GuildCreateEvent {
Available(AvailableGuildCreateEvent)
Unavailable(UnavailableGuild)
} derive(Debug)impl FromJson for GuildCreateEventpub(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
PruneRequiresAdmin
Unknown(String)
} derive(Eq, Debug)impl FromJson for GuildFeatureimpl ToJson for GuildFeaturepub(all) struct GuildIntegrationsUpdateEvent {
guild_id : Id[GuildMarker]
} derive(Debug, FromJson, ToJson)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(Debug, FromJson, ToJson)pub(all) struct GuildMemberAddEvent {
guild_id : Id[GuildMarker]
guild_member : GuildMember
} derive(Debug)impl FromJson for GuildMemberAddEventimpl BitAnd for GuildMemberFlagsimpl BitOr for GuildMemberFlagsimpl Debug for GuildMemberFlagsimpl FromJson for GuildMemberFlagsimpl ToJson for GuildMemberFlagspub(all) struct GuildMemberUpdateEvent {
guild_id : Id[GuildMarker]
roles : Array[Id[RoleMarker]]
user : User
nick : Nullable[String]?
avatar : Nullable[ImageHash]
banner : Nullable[ImageHash]?
collectibles : Nullable[Collectibles]?
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(Debug, FromJson, ToJson)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(Debug, FromJson, ToJson)pub(all) struct GuildOnboarding {
guild_id : Id[GuildMarker]
prompts : Array[OnboardingPrompt]
default_channel_ids : Array[Id[ChannelMarker]]
enabled : Bool
mode : OnboardingMode
} derive(Debug, FromJson, ToJson)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(Debug, FromJson, ToJson)pub(all) struct GuildRoleDeleteEvent {
guild_id : Id[GuildMarker]
role_id : Id[RoleMarker]
} derive(Debug, FromJson, ToJson)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(Debug, FromJson, ToJson)impl FromJson for GuildScheduledEventEntityTypeimpl ToJson for GuildScheduledEventEntityTypeimpl FromJson for GuildScheduledEventPrivacyLevelimpl ToJson for GuildScheduledEventPrivacyLevelpub(all) struct GuildScheduledEventRecurrenceRule {
start : Timestamp
end : Nullable[Timestamp]?
frequency : GuildScheduledEventRecurrenceRuleFrequency
interval : Int
by_weekday : Nullable[Array[GuildScheduledEventRecurrenceRuleWeekday]]?
by_n_weekday : Nullable[Array[GuildScheduledEventRecurrenceRuleNWeekday]]?
by_month : Nullable[Array[GuildScheduledEventRecurrenceRuleMonth]]?
by_month_day : Nullable[Array[Int]]?
by_year_day : Array[Int]?
count : Int?
} derive(Debug, FromJson, ToJson)fn from_json(json : Json, path : JsonPath) -> GuildScheduledEventRecurrenceRuleFrequency raise JsonDecodeErrorfn GuildScheduledEventRecurrenceRuleFrequency::from_int(value : Int) -> GuildScheduledEventRecurrenceRuleFrequencyfn GuildScheduledEventRecurrenceRuleFrequency::to_int(self : GuildScheduledEventRecurrenceRuleFrequency) -> Intfn GuildScheduledEventRecurrenceRuleFrequency::to_json(self : GuildScheduledEventRecurrenceRuleFrequency) -> Jsonfn from_json(json : Json, path : JsonPath) -> GuildScheduledEventRecurrenceRuleMonth raise JsonDecodeErrorfn GuildScheduledEventRecurrenceRuleMonth::from_int(value : Int) -> GuildScheduledEventRecurrenceRuleMonthfn GuildScheduledEventRecurrenceRuleMonth::to_int(self : GuildScheduledEventRecurrenceRuleMonth) -> Intfn GuildScheduledEventRecurrenceRuleMonth::to_json(self : GuildScheduledEventRecurrenceRuleMonth) -> Jsonpub(all) struct GuildScheduledEventRecurrenceRuleNWeekday {
n : Int
day : GuildScheduledEventRecurrenceRuleWeekday
} derive(Debug, FromJson, ToJson)fn from_json(json : Json, path : JsonPath) -> GuildScheduledEventRecurrenceRuleWeekday raise JsonDecodeErrorfn GuildScheduledEventRecurrenceRuleWeekday::from_int(value : Int) -> GuildScheduledEventRecurrenceRuleWeekdayfn GuildScheduledEventRecurrenceRuleWeekday::to_int(self : GuildScheduledEventRecurrenceRuleWeekday) -> Intfn GuildScheduledEventRecurrenceRuleWeekday::to_json(self : GuildScheduledEventRecurrenceRuleWeekday) -> Jsonimpl FromJson for GuildScheduledEventStatusimpl ToJson for GuildScheduledEventStatuspub(all) struct GuildScheduledEventUser {
guild_scheduled_event_id : Id[ScheduledEventMarker]
user : User
guild_member : GuildMember?
} derive(Debug, FromJson, ToJson)pub(all) struct GuildScheduledEventUserEvent {
guild_scheduled_event_id : Id[ScheduledEventMarker]
user_id : Id[UserMarker]
guild_id : Id[GuildMarker]
} derive(Debug, FromJson, ToJson)pub(all) struct GuildSoundboardSoundDeleteEvent {
sound_id : Id[SoundboardSoundMarker]
guild_id : Id[GuildMarker]
} derive(Debug, FromJson, ToJson)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(Debug, FromJson, ToJson)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(Debug, FromJson, ToJson)pub(all) struct GuildTemplatePermissionOverwrite {
id : Int
typ : Int
allow : GuildTemplatePermissions
deny : GuildTemplatePermissions
} derive(Debug, FromJson, ToJson)impl Debug for GuildTemplatePermissionsimpl FromJson for GuildTemplatePermissionsimpl ToJson for GuildTemplatePermissionspub(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(Debug, FromJson, ToJson)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(Debug, FromJson, ToJson)pub(all) struct GuildWidget {
id : Id[GuildMarker]
name : String
instant_invite : Nullable[String]
channels : Array[GuildWidgetChannel]
members : Array[GuildWidgetMember]
presence_count : Int
} derive(Debug, FromJson, ToJson)pub(all) struct GuildWidgetChannel {
id : Id[ChannelMarker]
name : String
position : Int
} derive(Debug, FromJson, ToJson)pub(all) struct Id[M](UInt64)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())
}pub(all) struct InstallParams {
scopes : Array[String]
permissions : Permissions
} derive(Debug, FromJson, ToJson)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(Debug, FromJson, ToJson)pub(all) struct IntegrationDeleteEvent {
id : Id[IntegrationMarker]
guild_id : Id[GuildMarker]
application_id : Id[ApplicationMarker]?
} derive(Debug, FromJson, ToJson)impl FromJson for IntegrationEventimpl FromJson for IntegrationExpireBehaviorimpl ToJson for IntegrationExpireBehaviortest "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()))
}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)impl FromJson for Interactionimpl ToJson for Interactionpub(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(Debug, FromJson, ToJson)pub(all) struct InteractionCallbackResource {
typ : InteractionResponseType
activity_instance : InteractionCallbackActivityInstance?
message : Message?
} derive(Debug, FromJson, ToJson)pub(all) struct InteractionCallbackResponse {
interaction : InteractionCallback
resource : InteractionCallbackResource?
} derive(Debug, FromJson, ToJson)impl FromJson for InteractionContextTypeimpl ToJson for InteractionContextTypepub(all) enum InteractionData {
Command(CommandData)
Component(ComponentData)
Modal(ModalData)
Unknown(Json)
} derive(Debug)impl ToJson for InteractionDatapub(all) struct InteractionResponse {
typ : InteractionResponseType
data : Json?
} derive(Debug, FromJson, ToJson)impl FromJson for InteractionResponseTypeimpl ToJson for InteractionResponseTypeimpl FromJson for InteractionTypeimpl ToJson for InteractionTypepub(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(Debug, FromJson, ToJson)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(Debug, FromJson, ToJson)pub(all) struct InviteDeleteEvent {
channel_id : Id[ChannelMarker]
guild_id : Id[GuildMarker]?
code : String
} derive(Debug, FromJson, ToJson)impl Debug for InviteFlagsimpl FromJson for InviteFlagsimpl ToJson for InviteFlagsimpl FromJson for InviteTargetTypeimpl ToJson for InviteTargetTypeimpl FromJson for InviteTypeimpl ToJson for InviteTypepub(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)impl FromJson for LobbyMessageimpl ToJson for LobbyMessagepub(all) struct LobbyMessageDeleteEvent {
id : Id[MessageMarker]
lobby_id : Id[GenericMarker]
raw : Json
} derive(Debug)impl FromJson for LobbyMessageDeleteEventimpl ToJson for LobbyMessageDeleteEventpub(all) struct MediaGallery {
id : Int?
items : Array[MediaGalleryItem]
} derive(Debug, FromJson, ToJson)pub(all) struct MediaGalleryItem {
media : UnfurledMediaItem
description : Nullable[String]?
spoiler : Bool?
} derive(Debug, FromJson, ToJson)pub(all) enum MemberSelect {
All
Prefix(String, limit~ : Int)
Ids(Array[Id[UserMarker]])
} derive(Debug)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(Debug, FromJson, ToJson)pub(all) struct MessageActivity {
typ : MessageActivityType
party_id : String?
} derive(Debug, FromJson, ToJson)impl FromJson for MessageActivityTypeimpl ToJson for MessageActivityTypepub(all) struct MessageCreateEvent {
message : Message
guild_id : Id[GuildMarker]?
guild_member : GuildMember?
mention_members : Map[Id[UserMarker], GuildMember]
channel_type : ChannelType?
} derive(Debug)impl FromJson for MessageCreateEventpub(all) struct MessageDeleteBulkEvent {
ids : Array[Id[MessageMarker]]
channel_id : Id[ChannelMarker]
guild_id : Id[GuildMarker]?
} derive(Debug, FromJson, ToJson)pub(all) struct MessageDeleteEvent {
id : Id[MessageMarker]
channel_id : Id[ChannelMarker]
guild_id : Id[GuildMarker]?
} derive(Debug, FromJson, ToJson)impl BitAnd for MessageFlagsimpl BitOr for MessageFlagsimpl Debug for MessageFlagsimpl FromJson for MessageFlagsimpl ToJson for MessageFlagspub(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(Debug, FromJson, ToJson)pub(all) struct MessagePollVoteEvent {
user_id : Id[UserMarker]
channel_id : Id[ChannelMarker]
message_id : Id[MessageMarker]
guild_id : Id[GuildMarker]?
answer_id : Int
} derive(Debug, FromJson, ToJson)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(Debug, FromJson, ToJson)pub(all) struct MessageReactionRemoveAllEvent {
channel_id : Id[ChannelMarker]
message_id : Id[MessageMarker]
guild_id : Id[GuildMarker]?
} derive(Debug, FromJson, ToJson)pub(all) struct MessageReactionRemoveEmojiEvent {
channel_id : Id[ChannelMarker]
message_id : Id[MessageMarker]
guild_id : Id[GuildMarker]?
emoji : Emoji
} derive(Debug, FromJson, ToJson)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(Debug, FromJson, ToJson)pub(all) struct MessageReference {
typ : MessageReferenceType?
message_id : Id[MessageMarker]?
channel_id : Id[ChannelMarker]?
guild_id : Id[GuildMarker]?
fail_if_not_exists : Bool?
} derive(Debug, FromJson, ToJson)impl FromJson for MessageReferenceTypeimpl ToJson for MessageReferenceTypepub(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(Debug, FromJson, ToJson)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)impl FromJson for MessageTypeimpl ToJson for MessageTypepub(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)impl FromJson for MessageUpdateEventtest "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 : @sdkjson.Presence[String] = Absent
let cleared : @sdkjson.Presence[String] = Null
assert_true(missing.to_option() is None)
assert_true(cleared.to_option() is None)
}impl FromJson for OnboardingModeimpl ToJson for OnboardingModepub(all) struct OnboardingPrompt {
id : Id[GenericMarker]
typ : OnboardingPromptType
options : Array[OnboardingPromptOption]
title : String
single_select : Bool
required : Bool
in_onboarding : Bool
} derive(Debug, FromJson, ToJson)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(Debug, FromJson, ToJson)impl FromJson for OnboardingPromptTypeimpl ToJson for OnboardingPromptTypepub(all) struct Overwrite {
id : Id[GenericMarker]
typ : OverwriteType
allow : Permissions
deny : Permissions
} derive(Debug, FromJson, ToJson)impl FromJson for OverwriteTypeimpl ToJson for OverwriteTypepub(all) struct PartialChannel {
id : Id[ChannelMarker]
typ : ChannelType?
name : Nullable[String]?
icon : Nullable[ImageHash]?
permissions : Permissions?
} derive(Debug, FromJson, ToJson)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(Debug, FromJson, ToJson)pub(all) struct PartialRole {
id : Id[RoleMarker]
name : String
position : Int
color : Int
colors : RoleColors?
icon : Nullable[ImageHash]?
unicode_emoji : Nullable[String]?
} derive(Debug, FromJson, ToJson)impl BitAnd for Permissionsimpl BitOr for Permissionsimpl Debug for Permissionsimpl FromJson for Permissionsimpl ToJson for Permissionspub(all) struct Poll {
question : PollMedia
answers : Array[PollAnswer]
expiry : Nullable[Timestamp]
allow_multiselect : Bool
layout_type : PollLayoutType
results : PollResults?
} derive(Debug, FromJson, ToJson)pub(all) struct PollCreateRequest {
question : PollMedia
answers : Array[PollMedia]
duration : Int?
allow_multiselect : Bool?
layout_type : PollLayoutType?
} derive(Debug)impl ToJson for PollCreateRequestimpl FromJson for PollLayoutTypeimpl ToJson for PollLayoutTypepub(all) struct PollResults {
is_finalized : Bool
answer_counts : Array[PollAnswerCount]
} derive(Debug, FromJson, ToJson)impl FromJson for PremiumTierimpl ToJson for PremiumTierimpl FromJson for PremiumTypeimpl ToJson for PremiumTypeimpl FromJson for PresenceStatusimpl ToJson for PresenceStatuspub(all) struct PresenceUpdateEvent {
user : PresenceUser?
guild_id : Id[GuildMarker]?
status : PresenceStatus?
activities : Array[Activity]?
client_status : ClientStatus?
} derive(Debug, ToJson)impl FromJson for PresenceUpdateEventimpl FromJson for PresenceUserpub(all) struct RadioGroup {
id : Int?
custom_id : String
options : Array[RadioOption]
required : Bool?
value : String?
} derive(Debug, FromJson, ToJson)impl FromJson for ReactionTypeimpl ToJson for ReactionTypepub(all) struct Ready {
v : Int
user : User
guilds : Array[UnavailableGuild]
session_id : String
resume_gateway_url : String
shard : Array[Int]?
application : ReadyApplication
} derive(Debug, FromJson, ToJson)pub(all) struct ReadyApplication {
id : Id[ApplicationMarker]
flags : ApplicationFlags?
flags_new : ApplicationFlags?
} derive(Debug, FromJson, ToJson)pub(all) struct RequestChannelInfo {
guild_id : Id[GuildMarker]
fields : Array[ChannelInfoField]
} derive(Debug, ToJson)pub(all) struct RequestGuildMembers {
guild_id : Id[GuildMarker]
select : MemberSelect
presences : Bool
nonce : String?
} derive(Debug)impl ToJson for RequestGuildMemberspub(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(Debug, FromJson, ToJson)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)pub(all) struct SelectDefaultValue {
id : Id[GenericMarker]
typ : String
} derive(Debug, FromJson, ToJson)pub(all) struct SelectMenu {
id : Int?
custom_id : String
placeholder : String?
min_values : Int?
max_values : Int?
disabled : Bool?
required : Bool?
options : Array[SelectOption]?
channel_types : Array[ChannelType]?
default_values : Array[SelectDefaultValue]?
values : Array[String]?
} derive(Debug, FromJson, ToJson)impl FromJson for SessionStartLimitimpl FromJson for SortOrderTypeimpl ToJson for SortOrderTypepub(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(Debug, FromJson, ToJson)pub(all) struct SoundboardSoundsEvent {
soundboard_sounds : Array[SoundboardSound]
guild_id : Id[GuildMarker]
} derive(Debug, FromJson, ToJson)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(Debug, FromJson, ToJson)impl FromJson for StagePrivacyLevelimpl ToJson for StagePrivacyLevelpub(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(Debug, FromJson, ToJson)impl FromJson for StickerFormatTypeimpl ToJson for StickerFormatTypepub(all) struct StickerItem {
id : Id[StickerMarker]
name : String
format_type : StickerFormatType
} derive(Debug, FromJson, ToJson)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(Debug, FromJson, ToJson)pub(all) struct StickerPacksResponse {
sticker_packs : Array[StickerPack]
} derive(Debug, FromJson, ToJson)impl FromJson for StickerTypeimpl ToJson for StickerTypepub(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(Debug, FromJson, ToJson)impl FromJson for SubscriptionStatusimpl ToJson for SubscriptionStatusimpl BitAnd for SystemChannelFlagsimpl BitOr for SystemChannelFlagsimpl Debug for SystemChannelFlagsimpl FromJson for SystemChannelFlagsimpl ToJson for SystemChannelFlagsfn SystemChannelFlags::suppress_role_subscription_purchase_notification_replies() -> SystemChannelFlagsimpl FromJson for TargetUsersJobStatusCodeimpl ToJson for TargetUsersJobStatusCodepub(all) struct Team {
icon : Nullable[ImageHash]
id : Id[TeamMarker]
members : Array[TeamMember]
name : String
owner_user_id : Id[UserMarker]
} derive(Debug, FromJson, ToJson)pub(all) struct TeamMember {
membership_state : TeamMembershipState
team_id : Id[TeamMarker]
user : User
role : String?
} derive(Debug, FromJson, ToJson)impl FromJson for TeamMembershipStateimpl ToJson for TeamMembershipStatepub(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(Debug, FromJson, ToJson)impl FromJson for TextInputStyleimpl ToJson for TextInputStyleimpl FromJson for ThreadAutoArchiveDurationimpl ToJson for ThreadAutoArchiveDurationimpl FromJson for ThreadCreateEventpub(all) struct ThreadDeleteEvent {
id : Id[ChannelMarker]
guild_id : Id[GuildMarker]
parent_id : Id[ChannelMarker]
typ : ChannelType
} derive(Debug, FromJson, ToJson)pub(all) struct ThreadListSyncEvent {
guild_id : Id[GuildMarker]
channel_ids : Array[Id[ChannelMarker]]?
threads : Array[Channel]
members : Array[ThreadMember]
} derive(Debug, FromJson, ToJson)pub(all) struct ThreadMember {
id : Id[ChannelMarker]?
user_id : Id[UserMarker]?
join_timestamp : Timestamp
flags : Int
guild_member : GuildMember?
} derive(Debug, FromJson, ToJson)pub(all) struct ThreadMemberUpdateEvent {
guild_id : Id[GuildMarker]
thread_member : ThreadMember
} derive(Debug)impl FromJson for ThreadMemberUpdateEventpub(all) struct ThreadMembersUpdateEvent {
id : Id[ChannelMarker]
guild_id : Id[GuildMarker]
member_count : Int
added_members : Array[ThreadMember]?
removed_member_ids : Array[Id[UserMarker]]?
} derive(Debug, FromJson, ToJson)pub(all) struct Thumbnail {
id : Int?
media : UnfurledMediaItem
description : Nullable[String]?
spoiler : Bool?
} derive(Debug, FromJson, ToJson)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")
}pub(all) struct TypingStartEvent {
channel_id : Id[ChannelMarker]
guild_id : Id[GuildMarker]?
user_id : Id[UserMarker]
timestamp : Int64
guild_member : GuildMember?
} derive(Debug, ToJson)impl FromJson for TypingStartEventpub(all) struct UnfurledMediaItem {
url : String
proxy_url : String?
height : Nullable[Int]?
width : Nullable[Int]?
placeholder : String?
placeholder_version : Int?
content_type : String?
flags : Int?
content_scan_metadata : ContentScanMetadata?
attachment_id : String?
} derive(Debug, FromJson, ToJson)pub(all) struct UpdatePresence {
status : PresenceStatus
activities : Array[BotActivity]
afk : Bool
since : Int64?
} derive(Debug)impl ToJson for UpdatePresencefn UpdatePresence::UpdatePresence(status? : PresenceStatus, activities? : Array[BotActivity], afk? : Bool, since? : Int64) -> UpdatePresencepub(all) struct UpdateVoiceState {
guild_id : Id[GuildMarker]
channel_id : Id[ChannelMarker]?
self_mute : Bool
self_deaf : Bool
} derive(Eq, Debug)impl ToJson for UpdateVoiceStatepub(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(Debug, FromJson, ToJson)impl FromJson for VerificationLevelimpl ToJson for VerificationLevelimpl FromJson for VideoQualityModeimpl ToJson for VideoQualityModepub(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(Debug, FromJson, ToJson)pub(all) struct VoiceChannelStartTimeUpdateEvent {
id : Id[ChannelMarker]
guild_id : Id[GuildMarker]
voice_start_time : Nullable[Int64]?
} derive(Debug, FromJson, ToJson)pub(all) struct VoiceChannelStatusUpdateEvent {
id : Id[ChannelMarker]
guild_id : Id[GuildMarker]
status : Nullable[String]
} derive(Debug, FromJson, ToJson)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(Debug, FromJson, ToJson)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(Debug, FromJson, ToJson)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)pub(all) struct WebhookEventPayload {
version : Int
application_id : Id[ApplicationMarker]
typ : WebhookPayloadType
event : WebhookEventBody?
} derive(Debug, FromJson, ToJson)pub(all) enum WebhookEventType {
ApplicationAuthorized
ApplicationDeauthorized
EntitlementCreate
EntitlementUpdate
EntitlementDelete
LobbyMessageCreate
LobbyMessageUpdate
LobbyMessageDelete
GameDirectMessageCreate
GameDirectMessageUpdate
GameDirectMessageDelete
QuestUserEnrollment
Unknown(String)
} derive(Eq, Debug)impl FromJson for WebhookEventTypeimpl ToJson for WebhookEventTypeimpl FromJson for WebhookPayloadTypeimpl ToJson for WebhookPayloadTypeimpl FromJson for WebhookTypeimpl ToJson for WebhookTypepub(all) struct WebhooksUpdateEvent {
guild_id : Id[GuildMarker]
channel_id : Id[ChannelMarker]
} derive(Debug, FromJson, ToJson)pub(all) struct WelcomeScreenChannel {
channel_id : Id[ChannelMarker]
description : String
emoji_id : Nullable[Id[EmojiMarker]]
emoji_name : Nullable[String]
} derive(Debug, FromJson, ToJson)fn command_limit_violations(typ~ : ApplicationCommandType, name~ : String, name_localizations~ : Map[String, String]?, description~ : String, description_localizations~ : Map[String, String]?, options~ : Array[CommandOption]) -> Array[LimitViolation]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")]
),
)
}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]))
}let text_input_max_length : Intfn text_length(text : String) -> IntInstall
Download zipAn experimental Discord library for MoonBit: native/JS/Wasm REST, interactions, and gateway bots. Voice is in gaato/discord_voice.