filters

package
v0.1.3 Latest Latest
Warning

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

Go to latest
Published: Nov 28, 2023 License: MIT Imports: 3 Imported by: 1

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func And

func And(filters ...tgo.Filter) tgo.Filter

And Behaves like the && operator; returns true if all of the passes filters passes, otherwise returns false.

func Blacklist

func Blacklist(IDs ...int64) tgo.Filter

Blacklist compares IDs with the sender-id of the message or callback query. returns false if sender-id is in the blacklist.

func Command

func Command(cmd, botUsername string) tgo.Filter

func Commands

func Commands(prefix, botUsername string, cmds ...string) tgo.Filter

func ExtractUpdate

func ExtractUpdate(update *tgo.Update) any

func ExtractUpdateText

func ExtractUpdateText(update *tgo.Update) string

func False

func False() tgo.Filter

False does nothing and just always returns false.

func HasMessage

func HasMessage() tgo.Filter

func IsCallbackQuery

func IsCallbackQuery() tgo.Filter

func IsChannelPost

func IsChannelPost() tgo.Filter

func IsChatJoinRequest

func IsChatJoinRequest() tgo.Filter

func IsChatMember

func IsChatMember() tgo.Filter

func IsChosenInlineResult

func IsChosenInlineResult() tgo.Filter

func IsEditedChannelPost

func IsEditedChannelPost() tgo.Filter

func IsEditedMessage

func IsEditedMessage() tgo.Filter

func IsInlineQuery

func IsInlineQuery() tgo.Filter

func IsMessage

func IsMessage() tgo.Filter

func IsMyChatMember

func IsMyChatMember() tgo.Filter

func IsPoll

func IsPoll() tgo.Filter

func IsPollAnswer

func IsPollAnswer() tgo.Filter

func IsPreCheckoutQuery

func IsPreCheckoutQuery() tgo.Filter

func IsShippingQuery

func IsShippingQuery() tgo.Filter

func Not

func Not(filter tgo.Filter) tgo.Filter

Not Behaves like the ! operator; returns the opposite of the filter result

func Or

func Or(filters ...tgo.Filter) tgo.Filter

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

func Regex(reg *regexp.Regexp) tgo.Filter

Regex matches the update (message's text or caption, callback query, inline query) with the passed regexp.

func Text

func Text(text string) tgo.Filter

Text compares the update (message's text or caption, callback query, inline query) with the passed text.

func Texts

func Texts(texts ...string) tgo.Filter

Texts compares the update (message's text or caption, callback query, inline query) with the passed texts.

func True

func True() tgo.Filter

True does nothing and just always returns true.

func Whitelist

func Whitelist(IDs ...int64) tgo.Filter

Whitelist compares IDs with the sender-id of the message or callback query. returns true if sender-id is in the blacklist.

func WithPrefix

func WithPrefix(prefix string) tgo.Filter

WithPrefix tests whether the update (message's text or caption, callback query, inline query) begins with prefix.

func WithSuffix

func WithSuffix(suffix string) tgo.Filter

WithPrefix tests whether the update (message's text or caption, callback query, inline query) ends with suffix.

Types

type Filter

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

func NewFilter

func NewFilter(f FilterFunc) *Filter

func (Filter) Check

func (f Filter) Check(update *tgo.Update) bool

type FilterFunc

type FilterFunc func(update *tgo.Update) bool

Jump to

Keyboard shortcuts

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