imux

package module
v0.0.0-...-b8a8c70 Latest Latest
Warning

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

Go to latest
Published: Mar 8, 2023 License: MIT Imports: 7 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func Respond

func Respond(response *discordgo.InteractionResponse, request *InteractionRequest)

Respond will take the response and send it to discord.

Types

type InteractionHandler

type InteractionHandler = func(*discordgo.InteractionResponse, *InteractionRequest)

InteractionHandler is standard signature for interaction handler functions. should feel similar to http.Handler.

func LogInteraction

func LogInteraction(next InteractionHandler) InteractionHandler

LogInteraction is a middleware to print structured log lines for interactions

use "github.com/rs/zerolog/log".Ctx(request.Context) to get the logger.

type InteractionMiddleware

type InteractionMiddleware = func(InteractionHandler) InteractionHandler

type InteractionMux

type InteractionMux struct {
	// contains filtered or unexported fields
}

InteractionMux handles interaction commands.

func NewInteractionMux

func NewInteractionMux(ctx context.Context) InteractionMux

func (*InteractionMux) Add

func (i *InteractionMux) Add(command string, handler InteractionHandler)

func (*InteractionMux) Serve

Serve will serve interaction responses to be used by discordgo session.AddHandler()

func (*InteractionMux) Use

func (i *InteractionMux) Use(middlewares ...InteractionMiddleware)

Use appends a middleware to the middleware stack

type InteractionRequest

type InteractionRequest struct {
	Session     *discordgo.Session
	Interaction *discordgo.InteractionCreate
	Context     context.Context
}

Jump to

Keyboard shortcuts

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