components

package
v0.3.5 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Jun 15, 2023 License: GPL-3.0 Imports: 3 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type ActionRow

type ActionRow struct {
	RowType    ComponentType      `json:"type"`
	Components []MessageComponent `json:"components"`
}

func (ActionRow) MarshalJSON added in v0.1.12

func (a ActionRow) MarshalJSON() ([]byte, error)

func (ActionRow) Type

func (a ActionRow) Type() ComponentType

func (ActionRow) UnmarshalJSON added in v0.1.19

func (a ActionRow) UnmarshalJSON(data []byte) error

func (ActionRow) Verify added in v0.2.6

func (a ActionRow) Verify() error

type Button

type Button struct {
	Style      ButtonStyle    `json:"style"`
	Label      *string        `json:"label,omitempty"`
	Emoji      *discord.Emoji `json:"emoji,omitempty"`
	CustomId   *string        `json:"custom_id,omitempty"`
	Url        *string        `json:"url,omitempty"`
	Disabled   *bool          `json:"disabled,omitempty"`
	ButtonType ComponentType  `json:"type"`
}

func (Button) MarshalJSON added in v0.1.18

func (button Button) MarshalJSON() ([]byte, error)

func (Button) Type

func (button Button) Type() ComponentType

func (Button) Verify added in v0.2.6

func (button Button) Verify() error

type ButtonStyle

type ButtonStyle uint8
const (
	PrimaryButtonStyle ButtonStyle = iota + 1
	SecondaryButtonStyle
	SuccessButtonStyle
	DangerButtonStyle
	LinkButtonStyle
)

type ComponentType

type ComponentType uint8
const (
	ActionRowType ComponentType = iota + 1
	ButtonType
	StringSelectType
	TextInputType
	UserSelectType
	RoleSelectType
	MentionableSelectType
	ChannelSelectType
)

type ErrComponentMissingProperty added in v0.2.6

type ErrComponentMissingProperty struct {
	Component    MessageComponent
	PropertyName string
}

func (ErrComponentMissingProperty) Error added in v0.2.6

type ErrComponentMustHaveCustomId added in v0.2.6

type ErrComponentMustHaveCustomId struct {
	Component MessageComponent
}

func (ErrComponentMustHaveCustomId) Error added in v0.2.6

type ErrComponentMustHaveStyle added in v0.2.6

type ErrComponentMustHaveStyle struct {
	Component MessageComponent
}

func (ErrComponentMustHaveStyle) Error added in v0.2.6

type ErrInvalidPropertyLength added in v0.2.6

type ErrInvalidPropertyLength struct {
	Component      interface{}
	PropertyName   string
	MaxLength      int
	MinLength      int
	PropertyLength int
	PropertyValue  interface{}
}

func (ErrInvalidPropertyLength) Error added in v0.2.6

func (e ErrInvalidPropertyLength) Error() string

type ErrLinkButtonCannotHaveCustomId added in v0.2.6

type ErrLinkButtonCannotHaveCustomId struct {
	Component Button
}

func (ErrLinkButtonCannotHaveCustomId) Error added in v0.2.6

type ErrLinkButtonMustHaveUrl added in v0.2.6

type ErrLinkButtonMustHaveUrl struct {
	Component Button
}

func (ErrLinkButtonMustHaveUrl) Error added in v0.2.6

func (e ErrLinkButtonMustHaveUrl) Error() string

type ErrNestedActionRow added in v0.2.6

type ErrNestedActionRow struct {
	Components []MessageComponent
}

func (ErrNestedActionRow) Error added in v0.2.6

func (e ErrNestedActionRow) Error() string

type ErrNonLinkButtonCannotHaveUrl added in v0.2.6

type ErrNonLinkButtonCannotHaveUrl struct {
	Component Button
}

func (ErrNonLinkButtonCannotHaveUrl) Error added in v0.2.6

type ErrNonStringSelectMenuCannotHaveOptions added in v0.2.6

type ErrNonStringSelectMenuCannotHaveOptions struct {
	Component SelectMenu
}

func (ErrNonStringSelectMenuCannotHaveOptions) Error added in v0.2.6

type ErrSelectOptionMustHaveLabel added in v0.2.6

type ErrSelectOptionMustHaveLabel struct {
	Option SelectOption
}

func (ErrSelectOptionMustHaveLabel) Error added in v0.2.6

type ErrSelectOptionMustHaveValue added in v0.2.6

type ErrSelectOptionMustHaveValue struct {
	Option SelectOption
}

func (ErrSelectOptionMustHaveValue) Error added in v0.2.6

type ErrStringSelectMenuMustHaveOptions added in v0.2.6

type ErrStringSelectMenuMustHaveOptions struct {
	Component SelectMenu
}

func (ErrStringSelectMenuMustHaveOptions) Error added in v0.2.6

type ErrTooManyComponents added in v0.2.6

type ErrTooManyComponents struct {
	Components []MessageComponent
}

func (ErrTooManyComponents) Error added in v0.2.6

func (e ErrTooManyComponents) Error() string

type MessageComponent

type MessageComponent interface {
	Type() ComponentType
	Verify() error
}

MessageComponent can be made of any variables, so it's a map until we parse it into a specific component.

type MessageComponentData

type MessageComponentData struct {
	CustomId string                `json:"custom_id"`
	Type     ComponentType         `json:"component_type"`
	Values   []string              `json:"values"`
	Resolved *discord.ResolvedData `json:"resolved,omitempty"`
}

type MessageComponentWrapper

type MessageComponentWrapper struct {
	// contains filtered or unexported fields
}

func (*MessageComponentWrapper) MarshalJSON

func (m *MessageComponentWrapper) MarshalJSON() ([]byte, error)

func (*MessageComponentWrapper) UnmarshalJSON

func (m *MessageComponentWrapper) UnmarshalJSON(data []byte) error

type ModalSubmitData

type ModalSubmitData struct {
	CustomId   string             `json:"custom_id"`
	Components []MessageComponent `json:"components"`
}

func (ModalSubmitData) UnmarshalJSON added in v0.1.19

func (m ModalSubmitData) UnmarshalJSON(data []byte) error

type SelectMenu

type SelectMenu struct {
	MenuType     ComponentType         `json:"type"`
	CustomId     string                `json:"custom_id"`
	Options      []SelectOption        `json:"options,omitempty"`
	ChannelTypes []discord.ChannelType `json:"channel_types,omitempty"`
	Placeholder  *string               `json:"placeholder,omitempty"`
	MinValues    *uint8                `json:"min_values,omitempty"`
	MaxValues    *uint8                `json:"max_values,omitempty"`
	Disabled     *bool                 `json:"disabled,omitempty"`
}

func (SelectMenu) Type

func (selectMenu SelectMenu) Type() ComponentType

func (SelectMenu) Verify added in v0.2.6

func (selectMenu SelectMenu) Verify() error

type SelectOption

type SelectOption struct {
	Label       string         `json:"label"`
	Value       string         `json:"value"`
	Description *string        `json:"description,omitempty"`
	Emoji       *discord.Emoji `json:"emoji,omitempty"`
	Default     *bool          `json:"default,omitempty"`
}

func (SelectOption) Verify added in v0.2.6

func (selectOption SelectOption) Verify() error

type TextInput added in v0.1.19

type TextInput struct {
	TextInputType ComponentType  `json:"type"`
	CustomId      string         `json:"custom_id"`
	Style         TextInputStyle `json:"style"`
	Label         string         `json:"label"`
	MinLength     int            `json:"min_length"`
	MaxLength     int            `json:"max_length"`
	Required      bool           `json:"required"`
	Value         string         `json:"value"`
	Placeholder   string         `json:"placeholder"`
}

func (TextInput) MarshalJSON added in v0.1.19

func (t TextInput) MarshalJSON() ([]byte, error)

func (TextInput) Type added in v0.1.19

func (t TextInput) Type() ComponentType

func (TextInput) Verify added in v0.2.6

func (t TextInput) Verify() error

type TextInputStyle added in v0.1.19

type TextInputStyle uint8
const (
	ShortTextInputStyle TextInputStyle = iota + 1
	LongTextInputStyle
)

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL