-
Notifications
You must be signed in to change notification settings - Fork 99
/
chatmember.go
60 lines (48 loc) · 1.31 KB
/
chatmember.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
47
48
49
50
51
52
53
54
55
56
57
58
59
60
package chatmember
import (
"github.com/PaulSonOfLars/gotgbot/v2"
"github.com/PaulSonOfLars/gotgbot/v2/ext/handlers/filters"
)
func All(_ *gotgbot.ChatMemberUpdated) bool {
return true
}
func UserId(id int64) filters.ChatMember {
return func(cm *gotgbot.ChatMemberUpdated) bool {
return cm.NewChatMember.GetUser().Id == id
}
}
func FromUserId(id int64) filters.ChatMember {
return func(cm *gotgbot.ChatMemberUpdated) bool {
return cm.From.Id == id
}
}
func ChatId(id int64) filters.ChatMember {
return func(cm *gotgbot.ChatMemberUpdated) bool {
return cm.Chat.Id == id
}
}
func Private(cm *gotgbot.ChatMemberUpdated) bool {
return cm.Chat.Type == "private"
}
func Group(cm *gotgbot.ChatMemberUpdated) bool {
return cm.Chat.Type == "group"
}
func Supergroup(cm *gotgbot.ChatMemberUpdated) bool {
return cm.Chat.Type == "supergroup"
}
func Channel(cm *gotgbot.ChatMemberUpdated) bool {
return cm.Chat.Type == "channel"
}
func InviteLink(cm *gotgbot.ChatMemberUpdated) bool {
return cm.InviteLink != nil
}
func NewStatus(status string) filters.ChatMember {
return func(cm *gotgbot.ChatMemberUpdated) bool {
return cm.NewChatMember.GetStatus() == status
}
}
func OldStatus(status string) filters.ChatMember {
return func(cm *gotgbot.ChatMemberUpdated) bool {
return cm.OldChatMember.GetStatus() == status
}
}