middleware

package
v0.16.10 Latest Latest
Warning

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

Go to latest
Published: Sep 27, 2023 License: Apache-2.0 Imports: 3 Imported by: 9

Documentation

Index

Constants

This section is empty.

Variables

View Source
var Go handler.Middleware = func(next handler.Handler) handler.Handler {
	return func(e *events.InteractionCreate) error {
		go func() {
			if err := next(e); err != nil {
				e.Client().Logger().Errorf("failed to handle interaction: %s\n", err)
			}
		}()
		return nil
	}
}

Go is a middleware that runs the next handler in a goroutine

View Source
var Logger handler.Middleware = func(next handler.Handler) handler.Handler {
	return func(e *events.InteractionCreate) error {
		e.Client().Logger().Infof("handling interaction: %s\n", e.Interaction.ID())
		return next(e)
	}
}

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 Print

func Print(content string) handler.Middleware

Types

This section is empty.

Jump to

Keyboard shortcuts

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