handler

package
v0.15.0 Latest Latest
Warning

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

Go to latest
Published: Jan 24, 2023 License: Apache-2.0 Imports: 7 Imported by: 67

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type AutocompleteEvent

type AutocompleteEvent struct {
	*events.AutocompleteInteractionCreate
	Variables map[string]string
}

func (*AutocompleteEvent) CreateFollowupMessage

func (e *AutocompleteEvent) CreateFollowupMessage(messageCreate discord.MessageCreate, opts ...rest.RequestOpt) (*discord.Message, error)

func (*AutocompleteEvent) DeleteFollowupMessage

func (e *AutocompleteEvent) DeleteFollowupMessage(messageID snowflake.ID, opts ...rest.RequestOpt) error

func (*AutocompleteEvent) DeleteInteractionResponse

func (e *AutocompleteEvent) DeleteInteractionResponse(opts ...rest.RequestOpt) error

func (*AutocompleteEvent) GetFollowupMessage

func (e *AutocompleteEvent) GetFollowupMessage(messageID snowflake.ID, opts ...rest.RequestOpt) (*discord.Message, error)

func (*AutocompleteEvent) GetInteractionResponse

func (e *AutocompleteEvent) GetInteractionResponse(opts ...rest.RequestOpt) (*discord.Message, error)

func (*AutocompleteEvent) UpdateFollowupMessage

func (e *AutocompleteEvent) UpdateFollowupMessage(messageID snowflake.ID, messageUpdate discord.MessageUpdate, opts ...rest.RequestOpt) (*discord.Message, error)

func (*AutocompleteEvent) UpdateInteractionResponse

func (e *AutocompleteEvent) UpdateInteractionResponse(messageUpdate discord.MessageUpdate, opts ...rest.RequestOpt) (*discord.Message, error)

type AutocompleteHandler

type AutocompleteHandler func(e *AutocompleteEvent) error

type CommandEvent

type CommandEvent struct {
	*events.ApplicationCommandInteractionCreate
	Variables map[string]string
}

func (*CommandEvent) CreateFollowupMessage

func (e *CommandEvent) CreateFollowupMessage(messageCreate discord.MessageCreate, opts ...rest.RequestOpt) (*discord.Message, error)

func (*CommandEvent) DeleteFollowupMessage

func (e *CommandEvent) DeleteFollowupMessage(messageID snowflake.ID, opts ...rest.RequestOpt) error

func (*CommandEvent) DeleteInteractionResponse

func (e *CommandEvent) DeleteInteractionResponse(opts ...rest.RequestOpt) error

func (*CommandEvent) GetFollowupMessage

func (e *CommandEvent) GetFollowupMessage(messageID snowflake.ID, opts ...rest.RequestOpt) (*discord.Message, error)

func (*CommandEvent) GetInteractionResponse

func (e *CommandEvent) GetInteractionResponse(opts ...rest.RequestOpt) (*discord.Message, error)

func (*CommandEvent) UpdateFollowupMessage

func (e *CommandEvent) UpdateFollowupMessage(messageID snowflake.ID, messageUpdate discord.MessageUpdate, opts ...rest.RequestOpt) (*discord.Message, error)

func (*CommandEvent) UpdateInteractionResponse

func (e *CommandEvent) UpdateInteractionResponse(messageUpdate discord.MessageUpdate, opts ...rest.RequestOpt) (*discord.Message, error)

type CommandHandler

type CommandHandler func(e *CommandEvent) error

type ComponentEvent

type ComponentEvent struct {
	*events.ComponentInteractionCreate
	Variables map[string]string
}

func (*ComponentEvent) CreateFollowupMessage

func (e *ComponentEvent) CreateFollowupMessage(messageCreate discord.MessageCreate, opts ...rest.RequestOpt) (*discord.Message, error)

func (*ComponentEvent) DeleteFollowupMessage

func (e *ComponentEvent) DeleteFollowupMessage(messageID snowflake.ID, opts ...rest.RequestOpt) error

func (*ComponentEvent) DeleteInteractionResponse

func (e *ComponentEvent) DeleteInteractionResponse(opts ...rest.RequestOpt) error

func (*ComponentEvent) GetFollowupMessage

func (e *ComponentEvent) GetFollowupMessage(messageID snowflake.ID, opts ...rest.RequestOpt) (*discord.Message, error)

func (*ComponentEvent) GetInteractionResponse

func (e *ComponentEvent) GetInteractionResponse(opts ...rest.RequestOpt) (*discord.Message, error)

func (*ComponentEvent) UpdateFollowupMessage

func (e *ComponentEvent) UpdateFollowupMessage(messageID snowflake.ID, messageUpdate discord.MessageUpdate, opts ...rest.RequestOpt) (*discord.Message, error)

func (*ComponentEvent) UpdateInteractionResponse

func (e *ComponentEvent) UpdateInteractionResponse(messageUpdate discord.MessageUpdate, opts ...rest.RequestOpt) (*discord.Message, error)

type ComponentHandler

type ComponentHandler func(e *ComponentEvent) error

type Handler

type Handler func(e *events.InteractionCreate)

type Middleware

type Middleware func(next Handler) Handler

type Middlewares

type Middlewares []Middleware

type ModalEvent

type ModalEvent struct {
	*events.ModalSubmitInteractionCreate
	Variables map[string]string
}

func (*ModalEvent) CreateFollowupMessage

func (e *ModalEvent) CreateFollowupMessage(messageCreate discord.MessageCreate, opts ...rest.RequestOpt) (*discord.Message, error)

func (*ModalEvent) DeleteFollowupMessage

func (e *ModalEvent) DeleteFollowupMessage(messageID snowflake.ID, opts ...rest.RequestOpt) error

func (*ModalEvent) DeleteInteractionResponse

func (e *ModalEvent) DeleteInteractionResponse(opts ...rest.RequestOpt) error

func (*ModalEvent) GetFollowupMessage

func (e *ModalEvent) GetFollowupMessage(messageID snowflake.ID, opts ...rest.RequestOpt) (*discord.Message, error)

func (*ModalEvent) GetInteractionResponse

func (e *ModalEvent) GetInteractionResponse(opts ...rest.RequestOpt) (*discord.Message, error)

func (*ModalEvent) UpdateFollowupMessage

func (e *ModalEvent) UpdateFollowupMessage(messageID snowflake.ID, messageUpdate discord.MessageUpdate, opts ...rest.RequestOpt) (*discord.Message, error)

func (*ModalEvent) UpdateInteractionResponse

func (e *ModalEvent) UpdateInteractionResponse(messageUpdate discord.MessageUpdate, opts ...rest.RequestOpt) (*discord.Message, error)

type ModalHandler

type ModalHandler func(e *ModalEvent) error

type Route

type Route interface {
	// Match returns true if the given path matches the Route.
	Match(path string, t discord.InteractionType) bool

	// Handle handles the given interaction event.
	Handle(path string, variables map[string]string, e *events.InteractionCreate) error
}

type Router

type Router interface {
	bot.EventListener
	Route

	// Use adds the given middlewares to the current Router
	Use(middlewares ...Middleware)

	// With returns a new Router with the given middlewares
	With(middlewares ...Middleware) Router

	// Group creates a new Router and adds it to the current Router.
	Group(fn func(r Router))

	// Route creates a new sub-router with the given pattern and adds it to the current Router.
	Route(pattern string, fn func(r Router)) Router

	// Mount mounts the given router with the given pattern to the current Router.
	Mount(pattern string, r Router)

	// HandleCommand registers the given CommandHandler to the current Router.
	HandleCommand(pattern string, h CommandHandler)

	// HandleAutocomplete registers the given AutocompleteHandler to the current Router.
	HandleAutocomplete(pattern string, h AutocompleteHandler)

	// HandleComponent registers the given ComponentHandler to the current Router.
	HandleComponent(pattern string, h ComponentHandler)

	// HandleModal registers the given ModalHandler to the current Router.
	HandleModal(pattern string, h ModalHandler)
}

func New

func New() Router

Directories

Path Synopsis

Jump to

Keyboard shortcuts

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