mirror of https://github.com/tucnak/telebot
You cannot select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
26 lines
508 B
Go
26 lines
508 B
Go
package middleware
|
|
|
|
import tele "gopkg.in/telebot.v3"
|
|
|
|
func AutoRespond() tele.MiddlewareFunc {
|
|
return func(next tele.HandlerFunc) tele.HandlerFunc {
|
|
return func(c tele.Context) error {
|
|
if c.Callback() != nil {
|
|
defer c.Respond()
|
|
}
|
|
return next(c)
|
|
}
|
|
}
|
|
}
|
|
|
|
func IgnoreVia() tele.MiddlewareFunc {
|
|
return func(next tele.HandlerFunc) tele.HandlerFunc {
|
|
return func(c tele.Context) error {
|
|
if msg := c.Message(); msg != nil && msg.Via != nil {
|
|
return nil
|
|
}
|
|
return next(c)
|
|
}
|
|
}
|
|
}
|