Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 3 additions & 2 deletions components.go
Original file line number Diff line number Diff line change
Expand Up @@ -261,6 +261,7 @@ type SelectMenu struct {

Options []SelectMenuOption `json:"options,omitempty"`
Disabled bool `json:"disabled"`
Required *bool `json:"required,omitempty"`

// NOTE: Can only be used in SelectMenu with Channel menu type.
ChannelTypes []ChannelType `json:"channel_types,omitempty"`
Expand Down Expand Up @@ -296,11 +297,11 @@ func (s SelectMenu) MarshalJSON() ([]byte, error) {
// TextInput represents text input component.
type TextInput struct {
CustomID string `json:"custom_id"`
Label string `json:"label"`
Label string `json:"label,omitempty"`
Style TextInputStyle `json:"style"`
Placeholder string `json:"placeholder,omitempty"`
Value string `json:"value,omitempty"`
Required bool `json:"required"`
Required *bool `json:"required,omitempty"`
MinLength int `json:"min_length,omitempty"`
MaxLength int `json:"max_length,omitempty"`

Expand Down
4 changes: 3 additions & 1 deletion examples/modals/main.go
Original file line number Diff line number Diff line change
Expand Up @@ -34,6 +34,8 @@ func init() {
}
}

var required = true

var (
commands = []discordgo.ApplicationCommand{
{
Expand Down Expand Up @@ -72,7 +74,7 @@ var (
Component: discordgo.TextInput{
CustomID: "suggestions",
Style: discordgo.TextInputParagraph,
Required: false,
Required: &required,
MaxLength: 2000,
},
},
Expand Down