interaction

package
v0.0.0-...-8fd61c5 Latest Latest
Warning

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

Go to latest
Published: Dec 1, 2024 License: BSD-3-Clause Imports: 10 Imported by: 23

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type ApplicationCommand

type ApplicationCommand struct {
	Id                uint64                     `json:"id,string,omitempty"`
	Type              ApplicationCommandType     `json:"application_command_type"`
	ApplicationId     uint64                     `json:"application_id,string,omitempty"`
	Name              string                     `json:"name"`
	Description       string                     `json:"description"`
	Options           []ApplicationCommandOption `json:"options"`
	DefaultPermission bool                       `json:"default_permission,omitempty"`
}

type ApplicationCommandAutoCompleteInteraction

type ApplicationCommandAutoCompleteInteraction struct {
	InteractionMetadata
	Data ApplicationCommandAutoCompleteInteractionData `json:"data"`
}

type ApplicationCommandAutoCompleteInteractionData

type ApplicationCommandAutoCompleteInteractionData struct {
	Id      uint64                                    `json:"id,string"`
	Name    string                                    `json:"name"`
	Options []ApplicationCommandInteractionDataOption `json:"options"`
	Type    ApplicationCommandType                    `json:"type"`
}

type ApplicationCommandAutoCompleteResultResponse

type ApplicationCommandAutoCompleteResultResponse struct {
	Response
	Data struct {
		Choices []ApplicationCommandOptionChoice `json:"choices"`
	} `json:"data"`
}

======================================================== Auto Complete Result Response ========================================================

type ApplicationCommandCallbackData

type ApplicationCommandCallbackData struct {
	Tts             bool                   `json:"tts"`
	Content         string                 `json:"content,omitempty"`
	Embeds          []*embed.Embed         `json:"embeds,omitempty"`
	AllowedMentions message.AllowedMention `json:"allowed_mentions,omitempty"`
	Flags           uint                   `json:"flags"`
	Components      []component.Component  `json:"components,omitempty"`
}

type ApplicationCommandInteraction

type ApplicationCommandInteraction struct {
	InteractionMetadata
	Data *ApplicationCommandInteractionData `json:"data"`
}

If GuildId is not null, Member will be present and User will not. If GuildId is null, Member will not be present, and User will.

type ApplicationCommandInteractionData

type ApplicationCommandInteractionData struct {
	Id       uint64                                    `json:"id,string"`
	Name     string                                    `json:"name"`
	Type     ApplicationCommandType                    `json:"type"`
	Resolved ResolvedData                              `json:"resolved"`
	Options  []ApplicationCommandInteractionDataOption `json:"options"`
	TargetId uint64                                    `json:"target_id,string"`
}

type ApplicationCommandInteractionDataOption

type ApplicationCommandInteractionDataOption struct {
	Name    string                                    `json:"name"`
	Value   interface{}                               `json:"value,omitempty"`
	Options []ApplicationCommandInteractionDataOption `json:"options,omitempty"`
	Focused bool                                      `json:"focused"`
}

type ApplicationCommandOption

type ApplicationCommandOption struct {
	Type         ApplicationCommandOptionType     `json:"type"`
	Name         string                           `json:"name"`
	Description  string                           `json:"description"`
	Default      bool                             `json:"default"`
	Required     bool                             `json:"required"`
	Choices      []ApplicationCommandOptionChoice `json:"choices,omitempty"`
	Autocomplete bool                             `json:"autocomplete"`
	Options      []ApplicationCommandOption       `json:"options,omitempty"`
	ChannelTypes []channel.ChannelType            `json:"channel_types,omitempty"`
}

type ApplicationCommandOptionChoice

type ApplicationCommandOptionChoice struct {
	Name  string      `json:"name"`
	Value interface{} `json:"value"` // string, int or double
}

type ApplicationCommandOptionType

type ApplicationCommandOptionType uint8
const (
	OptionTypeSubCommand ApplicationCommandOptionType = iota + 1
	OptionTypeSubCommandGroup
	OptionTypeString
	OptionTypeInteger
	OptionTypeBoolean
	OptionTypeUser
	OptionTypeChannel
	OptionTypeRole
	OptionTypeMentionable
	OptionTypeNumber
	OptionTypeAttachment
)

type ApplicationCommandPermissionType

type ApplicationCommandPermissionType uint8
const (
	ApplicationCommandPermissionTypeRole ApplicationCommandPermissionType = iota + 1
	ApplicationCommandPermissionTypeUser
)

type ApplicationCommandPermissions

type ApplicationCommandPermissions struct {
	Id         uint64                           `json:"id,string"`
	Type       ApplicationCommandPermissionType `json:"type"`
	Permission bool                             `json:"permission"`
}

type ApplicationCommandType

type ApplicationCommandType uint8
const (
	ApplicationCommandTypeChatInput ApplicationCommandType = iota + 1
	ApplicationCommandTypeUser
	ApplicationCommandTypeMessage
)

type ButtonInteractionData

type ButtonInteractionData struct {
	MessageComponentInteractionBaseData
}

func (ButtonInteractionData) Type

type IMessageComponentInteractionData

type IMessageComponentInteractionData interface {
	Type() component.ComponentType
}

type Interaction

type Interaction struct {
	Version uint8           `json:"version"`
	Type    InteractionType `json:"type"`
}

type InteractionMetadata

type InteractionMetadata struct {
	Interaction
	Id             uint64                    `json:"id,string"`
	ApplicationId  uint64                    `json:"application_id,string"`
	GuildId        objects.NullableSnowflake `json:"guild_id"`
	ChannelId      uint64                    `json:"channel_id,string"`
	Channel        channel.PartialChannel    `json:"channel"`
	Member         *member.Member            `json:"member"`
	User           *user.User                `json:"user"`
	Token          string                    `json:"token"`
	AppPermissions uint64                    `json:"app_permissions,string"`
	Locale         string                    `json:"locale"`
	GuildLocale    string                    `json:"guild_locale"`
	Entitlements   []entitlement.Entitlement `json:"entitlements"`
}

type InteractionType

type InteractionType uint8
const (
	InteractionTypePing InteractionType = iota + 1
	InteractionTypeApplicationCommand
	InteractionTypeMessageComponent
	InteractionTypeApplicationCommandAutoComplete
	InteractionTypeModalSubmit
)

type MessageComponentInteraction

type MessageComponentInteraction struct {
	InteractionMetadata
	Data    MessageComponentInteractionData `json:"data"`
	Message message.Message                 `json:"message"`
}

type MessageComponentInteractionBaseData

type MessageComponentInteractionBaseData struct {
	ComponentType component.ComponentType `json:"component_type"`
	CustomId      string                  `json:"custom_id"`
}

type MessageComponentInteractionData

type MessageComponentInteractionData struct {
	ComponentType component.ComponentType `json:"component_type"`
	IMessageComponentInteractionData
}

func (MessageComponentInteractionData) AsButton

func (MessageComponentInteractionData) AsSelectMenu

func (*MessageComponentInteractionData) UnmarshalJSON

func (d *MessageComponentInteractionData) UnmarshalJSON(data []byte) error

type ModalResponse

type ModalResponse struct {
	Response
	Data ModalResponseData `json:"data"`
}

======================================================== Modal Response ========================================================

func NewModalResponse

func NewModalResponse(customId, title string, components []component.Component) ModalResponse

type ModalResponseData

type ModalResponseData struct {
	CustomId   string                `json:"custom_id"`
	Title      string                `json:"title"`
	Components []component.Component `json:"components"`
}

type ModalSubmitInteraction

type ModalSubmitInteraction struct {
	InteractionMetadata
	Data ModalSubmitInteractionData `json:"data"`
}

type ModalSubmitInteractionActionRowData

type ModalSubmitInteractionActionRowData struct {
	Type       component.ComponentType               `json:"type"`
	Components []ModalSubmitInteractionComponentData `json:"components"`
}

type ModalSubmitInteractionComponentData

type ModalSubmitInteractionComponentData struct {
	Type     component.ComponentType `json:"type"`
	CustomId string                  `json:"custom_id"`
	Value    string                  `json:"value"`
}

type ModalSubmitInteractionData

type ModalSubmitInteractionData struct {
	CustomId   string                                `json:"custom_id"`
	Components []ModalSubmitInteractionActionRowData `json:"components"`
}

type PingInteraction

type PingInteraction struct {
	Interaction
}

type PremiumRequiredResponse

type PremiumRequiredResponse struct {
	Response
	Data struct{} `json:"data"`
}

======================================================== Premium Required Response ========================================================

func NewPremiumRequiredResponse

func NewPremiumRequiredResponse() PremiumRequiredResponse

type ResolvedData

type ResolvedData struct {
	Users       map[objects.Snowflake]user.User          `json:"users"`
	Members     map[objects.Snowflake]member.Member      `json:"members"`
	Roles       map[objects.Snowflake]guild.Role         `json:"roles"`
	Channels    map[objects.Snowflake]channel.Channel    `json:"channels"`
	Messages    map[objects.Snowflake]message.Message    `json:"messages"`
	Attachments map[objects.Snowflake]channel.Attachment `json:"attachments"`
}

type Response

type Response struct {
	Type ResponseType `json:"type"`
}

type ResponseAckWithSource

type ResponseAckWithSource struct {
	Response
	Data struct {
		Flags uint `json:"flags"`
	} `json:"data"`
}

======================================================== Ack With Source Response ========================================================

func NewResponseAckWithSource

func NewResponseAckWithSource(flags uint) ResponseAckWithSource

type ResponseChannelMessage

type ResponseChannelMessage struct {
	Response
	Data ApplicationCommandCallbackData `json:"data"`
}

======================================================== Channel Message Response ========================================================

type ResponseDeferredMessageUpdate

type ResponseDeferredMessageUpdate struct {
	Response
}

======================================================== Deferred Message Update Response ========================================================

func NewResponseDeferredMessageUpdate

func NewResponseDeferredMessageUpdate() ResponseDeferredMessageUpdate

type ResponsePong

type ResponsePong struct {
	Response
}

======================================================== Pong Response ========================================================

func NewResponsePong

func NewResponsePong() ResponsePong

type ResponseType

type ResponseType uint8
const (
	ResponseTypePong ResponseType = iota + 1

	ResponseTypeChannelMessageWithSource
	ResponseTypeACKWithSource
	ResponseTypeDeferredMessageUpdate
	ResponseTypeUpdateMessage
	ResponseTypeApplicationCommandAutoCompleteResult
	ResponseTypeModal
	ResponseTypePremiumRequired
)

type ResponseUpdateMessage

type ResponseUpdateMessage struct {
	Response
	Data ResponseUpdateMessageData `json:"data"`
}

======================================================== Update message Response ========================================================

type ResponseUpdateMessageData

type ResponseUpdateMessageData struct {
	Content    *string               `json:"content"`
	Embeds     []*embed.Embed        `json:"embeds"`
	Components []component.Component `json:"components"`
}

TODO: Improve this

type SelectMenuInteractionData

type SelectMenuInteractionData struct {
	MessageComponentInteractionBaseData
	Values []string `json:"values"`
}

func (SelectMenuInteractionData) Type

Directories

Path Synopsis

Jump to

Keyboard shortcuts

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