Documentation ¶
Index ¶
- func AutoRespond() tele.MiddlewareFunc
- func Blacklist(chats ...int64) tele.MiddlewareFunc
- func IgnoreVia() tele.MiddlewareFunc
- func Logger(logger ...*log.Logger) tele.MiddlewareFunc
- func Recover(onError ...RecoverFunc) tele.MiddlewareFunc
- func Restrict(v RestrictConfig) tele.MiddlewareFunc
- func Whitelist(chats ...int64) tele.MiddlewareFunc
- type RecoverFunc
- type RestrictConfig
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func AutoRespond ¶
func AutoRespond() tele.MiddlewareFunc
AutoRespond returns a middleware that automatically responds to every callback.
func Blacklist ¶
func Blacklist(chats ...int64) tele.MiddlewareFunc
Blacklist returns a middleware that skips the update for users specified in the chats field.
func IgnoreVia ¶
func IgnoreVia() tele.MiddlewareFunc
IgnoreVia returns a middleware that ignores all the "sent via" messages.
func Logger ¶
func Logger(logger ...*log.Logger) tele.MiddlewareFunc
Logger returns a middleware that logs incoming updates. If no custom logger provided, log.Default() will be used.
func Recover ¶ added in v3.0.1
func Recover(onError ...RecoverFunc) tele.MiddlewareFunc
Recover returns a middleware that recovers a panic happened in the handler.
func Restrict ¶
func Restrict(v RestrictConfig) tele.MiddlewareFunc
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.MiddlewareFunc
Whitelist returns a middleware that skips the update for users NOT specified in the chats field.
Types ¶
type RecoverFunc ¶ added in v3.3.6
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 // In defines a function that will be called if the chat // of an update will be found in the Chats list. In tele.HandlerFunc // Out defines a function that will be called if the chat // of an update will NOT be found in the Chats list. Out tele.HandlerFunc }
RestrictConfig defines config for Restrict middleware.