This commit is contained in:
cdle
2021-10-08 11:42:15 +08:00
parent de57bcb254
commit cbb16963e4
2 changed files with 35 additions and 13 deletions
+1
View File
@@ -12,3 +12,4 @@ data
dwz
replies
qinglongs
sets.conf
+22 -1
View File
@@ -1,6 +1,12 @@
package core
import "regexp"
import (
"regexp"
"strings"
"sync"
"github.com/beego/beego/v2/adapter/httplib"
)
var Pushs = map[string]func(int, string){}
var GroupPushs = map[string]func(int, int, string){}
@@ -30,10 +36,24 @@ func (ct *Chat) Push(content interface{}) {
}
}
var notLock sync.Locker
var msgs = map[string]string{}
func NotifyMasters(content string) {
go func() {
content = strings.Trim(content, " ")
notLock.Lock()
defer notLock.Unlock()
if _, ok := msgs[content]; ok {
return
}
msgs[content] = ""
if sillyGirl.GetBool("ignore_notify", false) == true {
return
}
if token := sillyGirl.Get("pushplus"); token != "" {
httplib.Get("http://www.pushplus.plus/send?token=" + token + "&title=0101010&content=" + content + "&template=html")
}
for _, class := range []string{"tg", "qq"} {
notify := Bucket(class).Get("notifiers")
if notify == "" {
@@ -45,4 +65,5 @@ func NotifyMasters(content string) {
}
}
}
}()
}