diff --git a/core/push.go b/core/push.go index cfd348e..978547f 100644 --- a/core/push.go +++ b/core/push.go @@ -1,5 +1,7 @@ package core +import "regexp" + var Pushs = map[string]func(int, string){} var GroupPushs = map[string]func(int, int, string){} @@ -27,3 +29,11 @@ func (ct *Chat) Push(content interface{}) { } } } + +func NotifyMasters(class string, content string) { + for _, v := range regexp.MustCompile(`(\d+)`).FindAllStringSubmatch(Bucket(class).Get("masters"), -1) { + if push, ok := Pushs[class]; ok { + push(Int(v[1]), content) + } + } +}