This commit is contained in:
cdle
2021-10-14 15:16:50 +08:00
parent 7346720df7
commit 681a9b74f1
2 changed files with 12 additions and 8 deletions
+4 -4
View File
@@ -1,7 +1,6 @@
package core package core
import ( import (
"regexp"
"strings" "strings"
"github.com/beego/beego/v2/adapter/httplib" "github.com/beego/beego/v2/adapter/httplib"
@@ -44,14 +43,15 @@ func NotifyMasters(content string) {
if token := sillyGirl.Get("pushplus"); token != "" { if token := sillyGirl.Get("pushplus"); token != "" {
httplib.Get("http://www.pushplus.plus/send?token=" + token + "&title=0101010&content=" + content + "&template=html") httplib.Get("http://www.pushplus.plus/send?token=" + token + "&title=0101010&content=" + content + "&template=html")
} }
for _, class := range []string{"tg", "qq"} { for _, class := range []string{"tg", "qq", "wx"} {
notify := Bucket(class).Get("notifiers") notify := Bucket(class).Get("notifiers")
if notify == "" { if notify == "" {
notify = Bucket(class).Get("masters") notify = Bucket(class).Get("masters")
} }
for _, v := range regexp.MustCompile(`(\d+)`).FindAllStringSubmatch(notify, -1) {
for _, v := range strings.Split(notify, "&") {
if push, ok := Pushs[class]; ok { if push, ok := Pushs[class]; ok {
push(Int(v[1]), content) push(v[1], content)
} }
} }
} }
+8 -4
View File
@@ -216,6 +216,13 @@ func initSys() {
return sillyGirl.Get("compiled_at") return sillyGirl.Get("compiled_at")
}, },
}, },
{
Rules: []string{"notify ?"},
Handle: func(s Sender) interface{} {
NotifyMasters(s.Get())
return "通知成功。"
},
},
{ {
Rules: []string{"raw ^started_at$"}, Rules: []string{"raw ^started_at$"},
Handle: func(s Sender) interface{} { Handle: func(s Sender) interface{} {
@@ -291,10 +298,6 @@ Alias=sillyGirl.service`
} }
s.Await(s, func(s2 Sender) interface{} { s.Await(s, func(s2 Sender) interface{} {
ct := s2.GetContent() ct := s2.GetContent()
if ct == "退出接龙" {
stop = true
return "不要走决战到天亮,啊哦~"
}
if strings.Contains(ct, "认输") { if strings.Contains(ct, "认输") {
stop = true stop = true
return nil return nil
@@ -328,6 +331,7 @@ Alias=sillyGirl.service`
}) })
} }
time.Sleep(time.Microsecond * 100)
s.Reply("还玩吗?[Y/n]") s.Reply("还玩吗?[Y/n]")
s.Await(s, func(s2 Sender) interface{} { s.Await(s, func(s2 Sender) interface{} {
msg := s2.GetContent() msg := s2.GetContent()