feat(components): add more types and id field
This commit is contained in:
parent
2d15f13e65
commit
e0f5cdab0a
1 changed files with 20 additions and 0 deletions
|
@ -18,6 +18,14 @@ const (
|
|||
RoleSelectMenuComponent ComponentType = 6
|
||||
MentionableSelectMenuComponent ComponentType = 7
|
||||
ChannelSelectMenuComponent ComponentType = 8
|
||||
SectionComponent ComponentType = 9
|
||||
TextDisplayComponent ComponentType = 10
|
||||
ThumbnailComponent ComponentType = 11
|
||||
MediaGalleryComponent ComponentType = 12
|
||||
FileComponent ComponentType = 13
|
||||
SeparatorComponent ComponentType = 14
|
||||
ContentInventoryEntryComponent ComponentType = 16
|
||||
ContainerComponent ComponentType = 17
|
||||
)
|
||||
|
||||
// MessageComponent is a base interface for all message components.
|
||||
|
@ -68,7 +76,11 @@ func MessageComponentFromJSON(b []byte) (MessageComponent, error) {
|
|||
|
||||
// ActionsRow is a container for components within one row.
|
||||
type ActionsRow struct {
|
||||
// Can contain Button, SelectMenu and TextInput.
|
||||
// NOTE: maximum of 5.
|
||||
Components []MessageComponent `json:"components"`
|
||||
// Unique identifier for the component; auto populated through increment if not provided.
|
||||
ID string `json:"id,omitempty"`
|
||||
}
|
||||
|
||||
// MarshalJSON is a method for marshaling ActionsRow to a JSON object.
|
||||
|
@ -144,6 +156,8 @@ type Button struct {
|
|||
CustomID string `json:"custom_id,omitempty"`
|
||||
// Identifier for a purchasable SKU. Only available when using premium-style buttons.
|
||||
SKUID string `json:"sku_id,omitempty"`
|
||||
// Unique identifier for the component; auto populated through increment if not provided.
|
||||
ID string `json:"id,omitempty"`
|
||||
}
|
||||
|
||||
// MarshalJSON is a method for marshaling Button to a JSON object.
|
||||
|
@ -230,6 +244,9 @@ type SelectMenu struct {
|
|||
|
||||
// NOTE: Can only be used in SelectMenu with Channel menu type.
|
||||
ChannelTypes []ChannelType `json:"channel_types,omitempty"`
|
||||
|
||||
// Unique identifier for the component; auto populated through increment if not provided.
|
||||
ID string `json:"id,omitempty"`
|
||||
}
|
||||
|
||||
// Type is a method to get the type of a component.
|
||||
|
@ -263,6 +280,9 @@ type TextInput struct {
|
|||
Required bool `json:"required"`
|
||||
MinLength int `json:"min_length,omitempty"`
|
||||
MaxLength int `json:"max_length,omitempty"`
|
||||
|
||||
// Unique identifier for the component; auto populated through increment if not provided.
|
||||
ID string `json:"id,omitempty"`
|
||||
}
|
||||
|
||||
// Type is a method to get the type of a component.
|
||||
|
|
Loading…
Reference in a new issue