middleware

package
v2.0.1 Latest Latest
Warning

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

Go to latest
Published: Nov 5, 2023 License: MIT Imports: 3 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func AutoRespond

func AutoRespond(c *tele.Context) error

AutoRespond returns a middleware that automatically responds to every callback.

func Blacklist

func Blacklist(chats ...int64) tele.HandlerFunc

Blacklist returns a middleware that skips the update for users specified in the chats field.

func IgnoreVia

func IgnoreVia(c *tele.Context) error

IgnoreVia returns a middleware that ignores all the "sent via" messages.

func Logger

func Logger(logger tele.Logger) tele.HandlerFunc

Logger returns a middleware that logs incoming updates. If no custom logger provided, log.Default() will be used.

func Recover

func Recover(onError ...func(error)) tele.HandlerFunc

Recover returns a middleware that recovers a panic happened in the handler.

func Restrict

func Restrict(v RestrictConfig) tele.HandlerFunc

Restrict returns a middleware that handles a list of provided chats with the logic defined by In and Out functions. If the chat is found in the Chats field, In function will be called, otherwise Out function will be called.

func Whitelist

func Whitelist(chats ...int64) tele.HandlerFunc

Whitelist returns a middleware that skips the update for users NOT specified in the chats field.

Types

type RestrictConfig

type RestrictConfig struct {
	// Chats is a list of chats that are going to be affected
	// by either In or Out function.
	Chats []int64
}

RestrictConfig defines config for Restrict middleware.

Jump to

Keyboard shortcuts

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