-
Notifications
You must be signed in to change notification settings - Fork 99
/
choseninlineresult.go
46 lines (37 loc) · 1.04 KB
/
choseninlineresult.go
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
package choseninlineresult
import (
"strings"
"github.com/PaulSonOfLars/gotgbot/v2"
"github.com/PaulSonOfLars/gotgbot/v2/ext/handlers/filters"
)
func All(_ *gotgbot.ChosenInlineResult) bool {
return true
}
func FromUserID(id int64) filters.ChosenInlineResult {
return func(cir *gotgbot.ChosenInlineResult) bool {
return cir.From.Id == id
}
}
func Query(q string) filters.ChosenInlineResult {
return func(cir *gotgbot.ChosenInlineResult) bool {
return cir.Query == q
}
}
func QueryPrefix(prefix string) filters.ChosenInlineResult {
return func(cir *gotgbot.ChosenInlineResult) bool {
return strings.HasPrefix(cir.Query, prefix)
}
}
func QuerySuffix(suffix string) filters.ChosenInlineResult {
return func(cir *gotgbot.ChosenInlineResult) bool {
return strings.HasSuffix(cir.Query, suffix)
}
}
func InlineMessageId(msgId string) filters.ChosenInlineResult {
return func(cir *gotgbot.ChosenInlineResult) bool {
return cir.InlineMessageId == msgId
}
}
func Location(cir *gotgbot.ChosenInlineResult) bool {
return cir.Location != nil
}