components

package
v0.2.5 Latest Latest
Warning

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

Go to latest
Published: May 8, 2023 License: GPL-3.0 Imports: 2 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

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

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 MessageComponent

type MessageComponent interface {
	Type() ComponentType
}

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

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"`
}

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

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