botmw

package
v0.0.0-...-407f28a Latest Latest
Warning

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

Go to latest
Published: Mar 25, 2023 License: MIT Imports: 9 Imported by: 0

Documentation

Overview

Package botmw provides middlewares for bot handler.

Index

Constants

This section is empty.

Variables

View Source
var ErrTimeout = errors.New("timed out")

ErrTimeout is returned by Timeout middleware when handler timed out.

Functions

func AppendRequestIDOnError

func AppendRequestIDOnError() botx.Middleware

AppendRequestIDOnError is a middleware that responds with error message.

func Logger

func Logger(lg *slog.Logger) botx.Middleware

Logger is a middleware that logs all requests

func Recover

func Recover(lg *slog.Logger) botx.Middleware

Recover is a middleware that recovers from panics.

func RequestID

func RequestID() botx.Middleware

RequestID is a middleware that adds request id to context.

func Timeout

func Timeout(dur time.Duration) botx.Middleware

Timeout sets the timeout for handler.

Types

This section is empty.

Jump to

Keyboard shortcuts

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