package nechotron import "strings" type FilterFn func(u *Update) bool func TextStartsWith(text string) FilterFn { return func(u *Update) bool { return strings.HasPrefix(u.Text(), text) } } func TextStartsWithAny(subs ...string) FilterFn { return func(u *Update) bool { text := u.Text() for _, sub := range subs { if strings.HasPrefix(text, sub) { return true } } return false } } func TextHas(text string) FilterFn { return func(u *Update) bool { return strings.Contains(u.Text(), text) } } func TextHasAny(subs ...string) FilterFn { return func(u *Update) bool { text := u.Text() for _, sub := range subs { if strings.Contains(text, sub) { return true } } return false } }