Browse Source

fix(components): renamed TextInputStyleType to TextInputStyle and fixed example

nitroflap 2 years ago
parent
commit
e6b33f37b7
2 changed files with 13 additions and 13 deletions
  1. 11 11
      components.go
  2. 2 2
      examples/modals/main.go

+ 11 - 11
components.go

@@ -201,14 +201,14 @@ func (m SelectMenu) MarshalJSON() ([]byte, error) {
 
 // TextInput represents text input component.
 type TextInput struct {
-	CustomID    string        `json:"custom_id"`
-	Label       string        `json:"label"`
+	CustomID    string         `json:"custom_id"`
+	Label       string         `json:"label"`
 	Style       TextInputStyle `json:"style"`
-	Placeholder string        `json:"placeholder,omitempty"`
-	Value       string        `json:"value,omitempty"`
-	Required    bool          `json:"required,omitempty"`
-	MinLength   int           `json:"min_length,omitempty"`
-	MaxLength   int           `json:"max_length,omitempty"`
+	Placeholder string         `json:"placeholder,omitempty"`
+	Value       string         `json:"value,omitempty"`
+	Required    bool           `json:"required,omitempty"`
+	MinLength   int            `json:"min_length,omitempty"`
+	MaxLength   int            `json:"max_length,omitempty"`
 }
 
 // Type is a method to get the type of a component.
@@ -229,11 +229,11 @@ func (m TextInput) MarshalJSON() ([]byte, error) {
 	})
 }
 
-// TextInputStyleType is style of text in TextInput component.
-type TextInputStyleType uint
+// TextInputStyle is style of text in TextInput component.
+type TextInputStyle uint
 
 // Text styles
 const (
-	TextInputShort     TextStyleType = 1
-	TextInputParagraph TextStyleType = 2
+	TextInputShort     TextInputStyle = 1
+	TextInputParagraph TextInputStyle = 2
 )

+ 2 - 2
examples/modals/main.go

@@ -54,7 +54,7 @@ var (
 								discordgo.TextInput{
 									CustomID:    "opinion",
 									Label:       "What is your opinion on them?",
-									Style:       discordgo.TextStyleShort,
+									Style:       discordgo.TextInputShort,
 									Placeholder: "Don't be shy, share your opinion with us",
 									Required:    true,
 									MaxLength:   300,
@@ -67,7 +67,7 @@ var (
 								discordgo.TextInput{
 									CustomID:  "suggestions",
 									Label:     "What would you suggest to improve them?",
-									Style:     discordgo.TextStyleParagraph,
+									Style:     discordgo.TextInputParagraph,
 									Required:  false,
 									MaxLength: 2000,
 								},