chore(components): rename InputText to TextInput

This commit is contained in:
nitroflap 2022-02-09 03:39:28 +03:00
parent 09e3d894b7
commit a0095c14ed
No known key found for this signature in database
GPG key ID: 810F53DB0E0F81A8

View file

@ -13,7 +13,7 @@ const (
ActionsRowComponent ComponentType = 1 ActionsRowComponent ComponentType = 1
ButtonComponent ComponentType = 2 ButtonComponent ComponentType = 2
SelectMenuComponent ComponentType = 3 SelectMenuComponent ComponentType = 3
InputTextComponent ComponentType = 4 TextInputComponent ComponentType = 4
) )
// MessageComponent is a base interface for all message components. // MessageComponent is a base interface for all message components.
@ -43,8 +43,8 @@ func (umc *unmarshalableMessageComponent) UnmarshalJSON(src []byte) error {
umc.MessageComponent = &Button{} umc.MessageComponent = &Button{}
case SelectMenuComponent: case SelectMenuComponent:
umc.MessageComponent = &SelectMenu{} umc.MessageComponent = &SelectMenu{}
case InputTextComponent: case TextInputComponent:
umc.MessageComponent = &InputText{} umc.MessageComponent = &TextInput{}
default: default:
return fmt.Errorf("unknown component type: %d", v.Type) return fmt.Errorf("unknown component type: %d", v.Type)
} }
@ -199,8 +199,8 @@ func (m SelectMenu) MarshalJSON() ([]byte, error) {
}) })
} }
// InputText represents text input component. // TextInput represents text input component.
type InputText struct { type TextInput struct {
CustomID string `json:"custom_id,omitempty"` CustomID string `json:"custom_id,omitempty"`
Label string `json:"label"` Label string `json:"label"`
Style TextStyleType `json:"style"` Style TextStyleType `json:"style"`
@ -212,13 +212,13 @@ type InputText struct {
} }
// Type is a method to get the type of a component. // Type is a method to get the type of a component.
func (InputText) Type() ComponentType { func (TextInput) Type() ComponentType {
return InputTextComponent return TextInputComponent
} }
// MarshalJSON is a method for marshaling InputText to a JSON object. // MarshalJSON is a method for marshaling TextInput to a JSON object.
func (m InputText) MarshalJSON() ([]byte, error) { func (m TextInput) MarshalJSON() ([]byte, error) {
type inputText InputText type inputText TextInput
return json.Marshal(struct { return json.Marshal(struct {
inputText inputText
@ -229,7 +229,7 @@ func (m InputText) MarshalJSON() ([]byte, error) {
}) })
} }
// TextStyleType is style of text in InputText component. // TextStyleType is style of text in TextInput component.
type TextStyleType uint type TextStyleType uint
// Text styles // Text styles