21
21
_ Component = (* StringSelectMenuComponent )(nil )
22
22
_ InteractiveComponent = (* StringSelectMenuComponent )(nil )
23
23
_ SelectMenuComponent = (* StringSelectMenuComponent )(nil )
24
+ _ LabelSubComponent = (* StringSelectMenuComponent )(nil )
24
25
)
25
26
26
27
// NewStringSelectMenu builds a new SelectMenuComponent from the provided values
@@ -43,10 +44,11 @@ type StringSelectMenuComponent struct {
43
44
// MaxValues is the maximum number of options that can be selected.
44
45
// Defaults to 1. Maximum is 25.
45
46
MaxValues int `json:"max_values,omitempty"`
46
- Disabled bool `json:"disabled,omitempty"`
47
47
Options []StringSelectMenuOption `json:"options,omitempty"`
48
48
// Required Indicates if the select menu is required to submit the Modal.
49
- Required bool `json:"required,omitempty"`
49
+ Required bool `json:"required"`
50
+ // Disabled whether the select menu is disabled (only supported in messages)
51
+ Disabled bool `json:"disabled"`
50
52
// Values is only set when the StringSelectMenuComponent is received from an InteractionTypeModalSubmit
51
53
Values []string `json:"values,omitempty"`
52
54
}
@@ -153,8 +155,8 @@ func (c StringSelectMenuComponent) RemoveOption(index int) StringSelectMenuCompo
153
155
}
154
156
155
157
// WithID returns a new StringSelectMenuComponent with the provided ID
156
- func (c StringSelectMenuComponent ) WithID (i int ) StringSelectMenuComponent {
157
- c .ID = i
158
+ func (c StringSelectMenuComponent ) WithID (id int ) StringSelectMenuComponent {
159
+ c .ID = id
158
160
return c
159
161
}
160
162
@@ -233,7 +235,8 @@ type UserSelectMenuComponent struct {
233
235
DefaultValues []SelectMenuDefaultValue `json:"default_values,omitempty"`
234
236
MinValues * int `json:"min_values,omitempty"`
235
237
MaxValues int `json:"max_values,omitempty"`
236
- Disabled bool `json:"disabled,omitempty"`
238
+ // Disabled whether the select menu is disabled (only supported in messages)
239
+ Disabled bool `json:"disabled"`
237
240
}
238
241
239
242
func (c UserSelectMenuComponent ) MarshalJSON () ([]byte , error ) {
@@ -329,6 +332,12 @@ func (c UserSelectMenuComponent) RemoveDefaultValue(index int) UserSelectMenuCom
329
332
return c
330
333
}
331
334
335
+ // WithID returns a new UserSelectMenuComponent with the provided ID
336
+ func (c UserSelectMenuComponent ) WithID (id int ) UserSelectMenuComponent {
337
+ c .ID = id
338
+ return c
339
+ }
340
+
332
341
var (
333
342
_ Component = (* UserSelectMenuComponent )(nil )
334
343
_ InteractiveComponent = (* UserSelectMenuComponent )(nil )
@@ -350,7 +359,8 @@ type RoleSelectMenuComponent struct {
350
359
DefaultValues []SelectMenuDefaultValue `json:"default_values,omitempty"`
351
360
MinValues * int `json:"min_values,omitempty"`
352
361
MaxValues int `json:"max_values,omitempty"`
353
- Disabled bool `json:"disabled,omitempty"`
362
+ // Disabled whether the select menu is disabled (only supported in messages)
363
+ Disabled bool `json:"disabled"`
354
364
}
355
365
356
366
func (c RoleSelectMenuComponent ) MarshalJSON () ([]byte , error ) {
@@ -446,6 +456,12 @@ func (c RoleSelectMenuComponent) RemoveDefaultValue(index int) RoleSelectMenuCom
446
456
return c
447
457
}
448
458
459
+ // WithID returns a new RoleSelectMenuComponent with the provided ID
460
+ func (c RoleSelectMenuComponent ) WithID (id int ) RoleSelectMenuComponent {
461
+ c .ID = id
462
+ return c
463
+ }
464
+
449
465
var (
450
466
_ Component = (* MentionableSelectMenuComponent )(nil )
451
467
_ InteractiveComponent = (* MentionableSelectMenuComponent )(nil )
@@ -467,7 +483,8 @@ type MentionableSelectMenuComponent struct {
467
483
DefaultValues []SelectMenuDefaultValue `json:"default_values,omitempty"`
468
484
MinValues * int `json:"min_values,omitempty"`
469
485
MaxValues int `json:"max_values,omitempty"`
470
- Disabled bool `json:"disabled,omitempty"`
486
+ // Disabled whether the select menu is disabled (only supported in messages)
487
+ Disabled bool `json:"disabled"`
471
488
}
472
489
473
490
func (c MentionableSelectMenuComponent ) MarshalJSON () ([]byte , error ) {
@@ -560,6 +577,12 @@ func (c MentionableSelectMenuComponent) RemoveDefaultValue(index int) Mentionabl
560
577
return c
561
578
}
562
579
580
+ // WithID returns a new MentionableSelectMenuComponent with the provided ID
581
+ func (c MentionableSelectMenuComponent ) WithID (id int ) MentionableSelectMenuComponent {
582
+ c .ID = id
583
+ return c
584
+ }
585
+
563
586
var (
564
587
_ Component = (* ChannelSelectMenuComponent )(nil )
565
588
_ InteractiveComponent = (* ChannelSelectMenuComponent )(nil )
@@ -581,8 +604,9 @@ type ChannelSelectMenuComponent struct {
581
604
DefaultValues []SelectMenuDefaultValue `json:"default_values,omitempty"`
582
605
MinValues * int `json:"min_values,omitempty"`
583
606
MaxValues int `json:"max_values,omitempty"`
584
- Disabled bool `json:"disabled,omitempty"`
585
607
ChannelTypes []ChannelType `json:"channel_types,omitempty"`
608
+ // Disabled whether the select menu is disabled (only supported in messages)
609
+ Disabled bool `json:"disabled"`
586
610
}
587
611
588
612
func (c ChannelSelectMenuComponent ) MarshalJSON () ([]byte , error ) {
@@ -684,9 +708,15 @@ func (c ChannelSelectMenuComponent) RemoveDefaultValue(index int) ChannelSelectM
684
708
return c
685
709
}
686
710
711
+ // WithID returns a new ChannelSelectMenuComponent with the provided ID
712
+ func (c ChannelSelectMenuComponent ) WithID (id int ) ChannelSelectMenuComponent {
713
+ c .ID = id
714
+ return c
715
+ }
716
+
687
717
type SelectMenuDefaultValue struct {
688
- ID snowflake.ID `json:"id"`
689
718
Type SelectMenuDefaultValueType `json:"type"`
719
+ ID snowflake.ID `json:"id"`
690
720
}
691
721
692
722
type SelectMenuDefaultValueType string
@@ -700,23 +730,23 @@ const (
700
730
// NewSelectMenuDefaultUser returns a new SelectMenuDefaultValue of type SelectMenuDefaultValueTypeUser
701
731
func NewSelectMenuDefaultUser (id snowflake.ID ) SelectMenuDefaultValue {
702
732
return SelectMenuDefaultValue {
703
- ID : id ,
704
733
Type : SelectMenuDefaultValueTypeUser ,
734
+ ID : id ,
705
735
}
706
736
}
707
737
708
738
// NewSelectMenuDefaultRole returns a new SelectMenuDefaultValue of type SelectMenuDefaultValueTypeRole
709
739
func NewSelectMenuDefaultRole (id snowflake.ID ) SelectMenuDefaultValue {
710
740
return SelectMenuDefaultValue {
711
- ID : id ,
712
741
Type : SelectMenuDefaultValueTypeRole ,
742
+ ID : id ,
713
743
}
714
744
}
715
745
716
746
// NewSelectMenuDefaultChannel returns a new SelectMenuDefaultValue of type SelectMenuDefaultValueTypeChannel
717
747
func NewSelectMenuDefaultChannel (id snowflake.ID ) SelectMenuDefaultValue {
718
748
return SelectMenuDefaultValue {
719
- ID : id ,
720
749
Type : SelectMenuDefaultValueTypeChannel ,
750
+ ID : id ,
721
751
}
722
752
}
0 commit comments