From 890661f7ebe2fdeac9bed745055b6496e84dd6de Mon Sep 17 00:00:00 2001 From: Filip Hoffmann Date: Thu, 16 Jul 2026 23:55:30 +0200 Subject: [PATCH] i made the components create-only, so im committing to see if ci works --- src/grom.gleam | 118 +++++++++++++++++++++++++++++-------------------- 1 file changed, 69 insertions(+), 49 deletions(-) diff --git a/src/grom.gleam b/src/grom.gleam index 9078ea7..d529cac 100644 --- a/src/grom.gleam +++ b/src/grom.gleam @@ -11065,32 +11065,48 @@ pub fn new_inline_embed_field(create: CreateEmbedField) -> CreateEmbedField { CreateEmbedField(..create, is_inline: True) } -pub type MessageComponent { - ActionRowComponent(MessageActionRow) - SectionComponent(MessageSection) +pub type CreateMessageComponent { + CreateMessageActionRowComponent(CreateMessageActionRow) + CreateMessageSectionComponent(CreateMessageSection) } -pub type MessageActionRow { - MessageActionRow(id: Option(Int), components: List(ActionRowComponent)) +pub opaque type CreateMessageActionRow { + CreateMessageActionRow( + id: Option(Int), + components: List(CreateActionRowComponent), + ) +} + +pub fn new_message_action_row( + with components: List(CreateActionRowComponent), +) -> CreateMessageActionRow { + CreateMessageActionRow(None, components:) } -pub type ActionRowComponent { - ActionRowButton(MessageButton) - ActionRowStringSelect(MessageStringSelect) - ActionRowUserSelect(MessageUserSelect) - ActionRowRoleSelect(MessageRoleSelect) - ActionRowMentionableSelect(MessageMentionableSelect) - ActionRowChannelSelect(MessageChannelSelect) +pub fn new_message_action_row_with_id( + create: CreateMessageActionRow, + id: Int, +) -> CreateMessageActionRow { + CreateMessageActionRow(..create, id: Some(id)) } -pub type MessageButton { - MessageButtonRegular(RegularMessageButton) - MessageButtonLink(LinkMessageButton) - MessageButtonPremium(PremiumMessageButton) +pub type CreateActionRowComponent { + CreateActionRowButton(CreateMessageButton) + CreateActionRowStringSelect(CreateMessageStringSelect) + CreateActionRowUserSelect(CreateMessageUserSelect) + CreateActionRowRoleSelect(CreateMessageRoleSelect) + CreateActionRowMentionableSelect(CreateMessageMentionableSelect) + CreateActionRowChannelSelect(CreateMessageChannelSelect) } -pub type LinkMessageButton { - LinkMessageButton( +pub type CreateMessageButton { + MessageButtonRegular(CreateRegularMessageButton) + MessageButtonLink(CreateLinkMessageButton) + MessageButtonPremium(CreatePremiumMessageButton) +} + +pub opaque type CreateLinkMessageButton { + CreateLinkMessageButton( id: Option(Int), label: Option(String), emoji: Option(ComponentEmoji), @@ -11099,16 +11115,16 @@ pub type LinkMessageButton { ) } -pub type PremiumMessageButton { - PremiumMessageButton( +pub opaque type CreatePremiumMessageButton { + CreatePremiumMessageButton( id: Option(Int), sku_id: Snowflake(Sku), is_disabled: Bool, ) } -pub type RegularMessageButton { - RegularMessageButton( +pub opaque type CreateRegularMessageButton { + CreateRegularMessageButton( id: Option(Int), style: RegularButtonStyle, label: Option(String), @@ -11130,11 +11146,11 @@ pub type RegularButtonStyle { DangerRegularButton } -pub type MessageStringSelect { - MessageStringSelect( +pub opaque type CreateMessageStringSelect { + CreateMessageStringSelect( id: Option(Int), custom_id: String, - options: List(StringSelectOption), + options: List(CreateStringSelectOption), /// Shown when no value is selected. Maximum 150 characters. placeholder: Option(String), /// Minimum amount of selected values, default 1. @@ -11150,8 +11166,8 @@ pub type MessageStringSelect { ) } -pub type StringSelectOption { - StringSelectOption( +pub opaque type CreateStringSelectOption { + CreateStringSelectOption( /// User-facing name. label: String, /// Dev-facing value. @@ -11164,8 +11180,8 @@ pub type StringSelectOption { ) } -pub type MessageUserSelect { - MessageUserSelect( +pub opaque type CreateMessageUserSelect { + CreateMessageUserSelect( id: Option(Int), custom_id: String, /// Shown when no user is selected. Maximum 150 characters. @@ -11185,8 +11201,8 @@ pub type MessageUserSelect { ) } -pub type MessageRoleSelect { - MessageRoleSelect( +pub opaque type CreateMessageRoleSelect { + CreateMessageRoleSelect( id: Option(Int), custom_id: String, /// Shown when no role is selected. Maximum 150 characters. @@ -11206,8 +11222,8 @@ pub type MessageRoleSelect { ) } -pub type MessageMentionableSelect { - MessageMentionableSelect( +pub opaque type CreateMessageMentionableSelect { + CreateMessageMentionableSelect( id: Option(Int), custom_id: String, /// Shown when no mentionable is selected. Maximum 150 characters. @@ -11229,8 +11245,8 @@ pub type MessageMentionableSelect { ) } -pub type MessageChannelSelect { - MessageChannelSelect( +pub opaque type CreateMessageChannelSelect { + CreateMessageChannelSelect( id: Option(Int), custom_id: String, /// Shown when no channel is selected. Maximum 150 characters. @@ -11266,35 +11282,39 @@ pub type ChannelSelectType { SelectMediaChannels } -pub type MessageSection { - MessageSection( +pub opaque type CreateMessageSection { + CreateMessageSection( id: Option(Int), /// Between 1 and 3 components. - components: List(SectionComponent), - accessory: SectionAccessory, + components: List(CreateSectionComponent), + accessory: CreateSectionAccessory, ) } -pub type SectionComponent { - SectionTextDisplay(MessageTextDisplay) +pub type CreateSectionComponent { + CreateSectionTextDisplay(CreateMessageTextDisplay) } -pub type SectionAccessory { - SectionButton(MessageButton) - SectionThumbnail(MessageThumbnail) +pub type CreateSectionAccessory { + CreateSectionButton(CreateMessageButton) + CreateSectionThumbnail(CreateMessageThumbnail) } -pub type MessageTextDisplay { - MessageTextDisplay(id: Option(Int), content: String) +pub opaque type CreateMessageTextDisplay { + CreateMessageTextDisplay(id: Option(Int), content: String) } -pub type MessageThumbnail { - MessageThumbnail( +pub opaque type CreateMessageThumbnail { + CreateMessageThumbnail( id: Option(Int), - media: UnfurledMediaItem, + media: CreateUnfurledMediaItem, /// Max 1024 characters. description: Option(String), /// Defaults to False. is_spoiler: Bool, ) } + +pub opaque type CreateUnfurledMediaItem { + CreateUnfurledMediaItem(url: String) +} -- 2.51.2