interactions

package
v0.3.9 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: 12 Imported by: 0

Documentation

Index

Constants

View Source
const (
	PongInteractionCallbackType                     InteractionCallbackType = iota + 1
	ChannelMessageWithSourceInteractionCallbackType                         = iota + 3
	DeferredChannelMessageWithSourceInteractionCallbackType
	DeferredUpdateMessageInteractionCallbackType
	UpdateMessageInteractionCallbackType
	ApplicationCommandAutocompleteResultInteractionCallbackType
	ModalInteractionCallbackType
)

Variables

This section is empty.

Functions

This section is empty.

Types

type AutocompleteCallbackData

type AutocompleteCallbackData struct {
	Choices []commands.AutoCompleteChoice `json:"choices"`
}

type Interaction

type Interaction struct {
	Id             discord.Snowflake    `json:"id"`
	ApplicationId  discord.Snowflake    `json:"application_id"`
	Type           InteractionType      `json:"type"`
	DataInternal   *json.RawMessage     `json:"data,omitempty"`
	Data           InteractionData      `json:"-"`
	GuildId        *discord.Snowflake   `json:"guild_id,omitempty"`
	Channel        *discord.Channel     `json:"channel,omitempty"`
	ChannelId      *discord.Snowflake   `json:"channel_id,omitempty"`
	Member         *discord.Member      `json:"member,omitempty"`
	User           *discord.User        `json:"user,omitempty"`
	Token          string               `json:"token"`
	Version        int                  `json:"version"`
	Message        *discord.Message     `json:"message,omitempty"`
	AppPermissions *discord.Permissions `json:"permissions,omitempty"`
	Locale         string               `json:"locale"`
	GuildLocale    string               `json:"guild_locale"`
	// contains filtered or unexported fields
}

func Parse

func Parse(data string) (interaction *Interaction, err error)

func (*Interaction) CreateResponse added in v0.1.4

func (interaction *Interaction) CreateResponse(response InteractionResponse) error

func (*Interaction) DeferResponse added in v0.1.6

func (interaction *Interaction) DeferResponse(isEphemeral bool) error

func (*Interaction) DeleteResponse added in v0.1.4

func (interaction *Interaction) DeleteResponse() error

func (*Interaction) EditResponse added in v0.1.4

func (interaction *Interaction) EditResponse(data ResponseEditData) error

func (*Interaction) GetResponse added in v0.1.4

func (interaction *Interaction) GetResponse() (*discord.Message, error)

func (*Interaction) GetWebhook added in v0.3.6

func (interaction *Interaction) GetWebhook() *Webhook

func (*Interaction) IsPing

func (interaction *Interaction) IsPing() bool

func (*Interaction) UnmarshalJSON added in v0.1.8

func (interaction *Interaction) UnmarshalJSON(d []byte) error

type InteractionCallbackData

type InteractionCallbackData interface {
}

type InteractionCallbackType

type InteractionCallbackType uint8

type InteractionData

type InteractionData interface {
}

type InteractionResponse

type InteractionResponse struct {
	Type InteractionCallbackType `json:"type"`
	Data InteractionCallbackData `json:"data,omitempty"`
}

func CreateDeferEditResponse added in v0.1.1

func CreateDeferEditResponse() InteractionResponse

func CreateDeferMessageResponse added in v0.1.1

func CreateDeferMessageResponse() InteractionResponse

func CreatePongResponse added in v0.1.1

func CreatePongResponse() InteractionResponse

func (InteractionResponse) ToAPIGatewayResponse added in v0.1.1

func (ir InteractionResponse) ToAPIGatewayResponse() events.APIGatewayProxyResponse

type InteractionType

type InteractionType uint8
const (
	PingInteractionType InteractionType = iota + 1
	ApplicationCommandInteractionType
	MessageComponentInteractionType
	ApplicationCommandAutocompleteInteractionType
	ModalSubmitInteractionType
)

type MessageCallbackData

type MessageCallbackData struct {
	TTS             *bool                         `json:"tts,omitempty"`
	Content         *string                       `json:"content,omitempty"`
	Embeds          []discord.Embed               `json:"embeds,omitempty"`
	AllowedMentions *discord.AllowedMentions      `json:"allowed_mentions,omitempty"`
	Flags           *int                          `json:"flags,omitempty"`
	Components      []components.MessageComponent `json:"components,omitempty"`
	Attachments     []discord.Attachment          `json:"attachments,omitempty"`
}

type ModalCallback

type ModalCallback struct {
	CustomId   string                        `json:"custom_id"`
	Title      string                        `json:"title"`
	Components []components.MessageComponent `json:"components"`
}

type ResponseEditData added in v0.1.4

type ResponseEditData struct {
	Content         *string                       `json:"content,omitempty"`
	Embeds          []discord.Embed               `json:"embeds,omitempty"`
	AllowedMentions *discord.AllowedMentions      `json:"allowed_mentions"`
	Components      []components.MessageComponent `json:"components"`
}

func (ResponseEditData) Verify added in v0.2.6

func (data ResponseEditData) Verify() error

type Webhook added in v0.3.0

type Webhook struct {
	Id            discord.Snowflake  `json:"id"`
	Type          uint8              `json:"type"`
	GuildId       *discord.Snowflake `json:"guild_id,omitempty"`
	ChannelId     *discord.Snowflake `json:"channel_id,omitempty"`
	User          *discord.User      `json:"user,omitempty"`
	Name          *string            `json:"name,omitempty"`
	Avatar        *string            `json:"avatar,omitempty"`
	Token         *string            `json:"token,omitempty"`
	ApplicationId *discord.Snowflake `json:"application_id,omitempty"`
	SourceGuild   *discord.Guild     `json:"source_guild,omitempty"`
	SourceChannel *discord.Channel   `json:"source_channel,omitempty"`
	Url           *string            `json:"url,omitempty"`
}

func WebhookFromUrl added in v0.3.0

func WebhookFromUrl(url string) (webhook *Webhook, err error)

func (*Webhook) DeleteMessage added in v0.3.0

func (hook *Webhook) DeleteMessage(messageId string) error

func (*Webhook) EditMessage added in v0.3.0

func (hook *Webhook) EditMessage(messageId string, data ResponseEditData) error

func (*Webhook) GetMessage added in v0.3.0

func (hook *Webhook) GetMessage(req WebhookGetMessageRequest) (message *discord.Message, err error)

func (*Webhook) GetUrl added in v0.3.0

func (hook *Webhook) GetUrl() string

func (*Webhook) Send added in v0.3.0

func (hook *Webhook) Send(req WebhookRequest) (err error)

type WebhookGetMessageRequest added in v0.3.0

type WebhookGetMessageRequest struct {
	// String so it can be "@original"
	MessageId string             `json:"-"` // Not sent in request body
	ThreadId  *discord.Snowflake `json:"thread_id,omitempty"`
}

type WebhookMessageResponse added in v0.1.4

type WebhookMessageResponse struct {
}

type WebhookRequest added in v0.3.0

type WebhookRequest struct {
	Content         *string                       `json:"content,omitempty"`
	Username        string                        `json:"username,omitempty"`
	AvatarUrl       string                        `json:"avatar_url,omitempty"`
	TTS             *bool                         `json:"tts,omitempty"`
	Embeds          []discord.Embed               `json:"embeds,omitempty"`
	AllowedMentions *discord.AllowedMentions      `json:"allowed_mentions,omitempty"`
	Flags           *int                          `json:"flags,omitempty"`
	Components      []components.MessageComponent `json:"components,omitempty"`
	Attachments     []discord.Attachment          `json:"attachments,omitempty"`
	ThreadName      string                        `json:"thread_name,omitempty"`
}

Jump to

Keyboard shortcuts

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