router

package
v1.3.2 Latest Latest
Warning

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

Go to latest
Published: Mar 5, 2025 License: MIT Imports: 10 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func NotFoundHandlerWithMessage

func NotFoundHandlerWithMessage(_ context.Context, msg telegram_bot.Update) (telegram_bot.Chattable, error)

Types

type BotError

type BotError interface {
	BotResponse(chatId int64) telegram_bot.Chattable
}

type HandlerFunc

type HandlerFunc func(ctx context.Context, msg telegram_bot.Update) (telegram_bot.Chattable, error)

type Middleware

type Middleware func(next HandlerFunc) HandlerFunc

func DefaultMiddlewares

func DefaultMiddlewares(logger log.Logger) []Middleware

func ErrorHandler

func ErrorHandler(logger log.Logger) Middleware

func Log

func Log(logger log.Logger) Middleware

func Recovery

func Recovery() Middleware

func RequestId

func RequestId() Middleware

type Router

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

func NewRouter

func NewRouter(middlewares ...Middleware) *Router

func (*Router) Handle

func (*Router) Handler

func (r *Router) Handler(updateType string, command string, handler HandlerFunc)

func (*Router) SetNotFoundHandler

func (r *Router) SetNotFoundHandler(notFoundHandler HandlerFunc)

Jump to

Keyboard shortcuts

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