Documentation ¶
Index ¶
- Variables
- func Defer(interactionType discord.InteractionType, updateMessage bool, ephemeral bool) handler.Middleware
- func GoDefer(interactionType discord.InteractionType, updateMessage bool, ephemeral bool) handler.Middleware
- func GoErr(h handler.ErrorHandler) handler.Middleware
- func GoErrDefer(h handler.ErrorHandler, interactionType discord.InteractionType, ...) handler.Middleware
- func Print(content string) handler.Middleware
Constants ¶
This section is empty.
Variables ¶
var Go = GoErr(func(event *handler.InteractionEvent, err error) { event.Client().Logger().Error("failed to handle interaction", slog.Any("err", err)) })
Go is a middleware that runs the next handler in a goroutine.
var Logger handler.Middleware = func(next handler.Handler) handler.Handler { return func(event *handler.InteractionEvent) error { event.Client().Logger().Info("handling interaction", slog.Int64("interaction_id", int64(event.Interaction.ID()))) return next(event) } }
Functions ¶
func Defer ¶ added in v0.16.8
func Defer(interactionType discord.InteractionType, updateMessage bool, ephemeral bool) handler.Middleware
Defer is a middleware that defers the specified interaction type. If updateMessage is true, it will respond with discord.InteractionResponseTypeDeferredUpdateMessage instead of discord.InteractionResponseTypeDeferredCreateMessage. If ephemeral is true, it will respond with discord.MessageFlagEphemeral flag in case of a discord.InteractionResponseTypeDeferredCreateMessage. Note: You can use this middleware multiple times with different interaction types. Note: You can use this middleware in combination with the Go middleware to defer & run in a goroutine.
func GoDefer ¶ added in v0.17.1
func GoDefer(interactionType discord.InteractionType, updateMessage bool, ephemeral bool) handler.Middleware
GoDefer combines Go and Defer
func GoErr ¶ added in v0.17.1
func GoErr(h handler.ErrorHandler) handler.Middleware
GoErr is a middleware that runs the next handler in a goroutine and lets you handle the error which may occur.
func GoErrDefer ¶ added in v0.17.1
func GoErrDefer(h handler.ErrorHandler, interactionType discord.InteractionType, updateMessage bool, ephemeral bool) handler.Middleware
GoErrDefer combines GoErr and Defer
func Print ¶
func Print(content string) handler.Middleware
Types ¶
This section is empty.