Documentation ¶
Overview ¶
Filters are set of functions that can be used with routers to determine which handler should be called and which should not.
Index ¶
- func And(filters ...tgo.Filter) tgo.Filter
- func Command(cmd, botUsername string) tgo.Filter
- func Commands(botUsername string, cmds ...string) tgo.Filter
- func False() tgo.Filter
- func HasMessage() tgo.Filter
- func IsCallbackQuery() tgo.Filter
- func IsChannelPost() tgo.Filter
- func IsChatJoinRequest() tgo.Filter
- func IsChatMember() tgo.Filter
- func IsChosenInlineResult() tgo.Filter
- func IsEditedChannelPost() tgo.Filter
- func IsEditedMessage() tgo.Filter
- func IsInlineQuery() tgo.Filter
- func IsMessage() tgo.Filter
- func IsMyChatMember() tgo.Filter
- func IsPoll() tgo.Filter
- func IsPollAnswer() tgo.Filter
- func IsPreCheckoutQuery() tgo.Filter
- func IsPrivate() tgo.Filter
- func IsShippingQuery() tgo.Filter
- func Not(filter tgo.Filter) tgo.Filter
- func Or(filters ...tgo.Filter) tgo.Filter
- func Regex(reg *regexp.Regexp) tgo.Filter
- func Text(text string) tgo.Filter
- func Texts(texts ...string) tgo.Filter
- func True() tgo.Filter
- func Whitelist(IDs ...int64) tgo.Filter
- func WithPrefix(prefix string) tgo.Filter
- func WithSuffix(suffix string) tgo.Filter
- type Filter
- type FilterFunc
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func And ¶
And Behaves like the && operator; returns true if all of the passes filters passes, otherwise returns false.
func Commands ¶
Commands tests if the message's (and only message) text or caption matches any of the cmds.
func HasMessage ¶
func IsCallbackQuery ¶
func IsChannelPost ¶
func IsChatJoinRequest ¶
func IsChatMember ¶
func IsChosenInlineResult ¶
func IsEditedChannelPost ¶
func IsEditedMessage ¶
func IsInlineQuery ¶
func IsMyChatMember ¶
func IsPollAnswer ¶
func IsPreCheckoutQuery ¶
func IsPrivate ¶ added in v1.0.1
IsPrivate checks if the message (and only message) is inside the private chat.
func IsShippingQuery ¶
func Or ¶
Or behaves like the || operator; returns true if at least one of the passed filters passes. returns false if none of them passes.
func Regex ¶
Regex matches the update's text with the reg.
Currently works with Message's caption and text, CallbackQuery's data, and InlineQuery's query.
func Text ¶
Text checks the update's text is equal to the text.
Currently works with Message's caption and text, CallbackQuery's data, and InlineQuery's query.
func Texts ¶
Text checks the update's text is in the texts.
Currently works with Message's caption and text, CallbackQuery's data, and InlineQuery's query.
func Whitelist ¶
Whitelist checks if the update is from the whitelisted IDs.
Currently works with Message and CallbackQuery, and InlineQuery.
func WithPrefix ¶
WithPrefix tests whether the update's text begins with prefix.
Currently works with Message's caption and text, CallbackQuery's data, and InlineQuery's query.
func WithSuffix ¶
WithSuffix tests whether the update's text ends with suffix.
Currently works with Message's caption and text, CallbackQuery's data, and InlineQuery's query.
Types ¶
type Filter ¶
type Filter struct {
// contains filtered or unexported fields
}
Filter does nothing and just holds a FilterFunc.
type FilterFunc ¶
FilterFunc tests the update with its own filters.