From 681a9b74f161f142c70008c6946adb1d1a251d4c Mon Sep 17 00:00:00 2001 From: cdle <798731886@qq.com> Date: Thu, 14 Oct 2021 15:16:50 +0800 Subject: [PATCH] update --- core/push.go | 8 ++++---- core/test.go | 12 ++++++++---- 2 files changed, 12 insertions(+), 8 deletions(-) diff --git a/core/push.go b/core/push.go index 1aa07b5..aed927d 100644 --- a/core/push.go +++ b/core/push.go @@ -1,7 +1,6 @@ package core import ( - "regexp" "strings" "github.com/beego/beego/v2/adapter/httplib" @@ -44,14 +43,15 @@ func NotifyMasters(content string) { 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"} { + for _, class := range []string{"tg", "qq", "wx"} { notify := Bucket(class).Get("notifiers") if notify == "" { 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 { - push(Int(v[1]), content) + push(v[1], content) } } } diff --git a/core/test.go b/core/test.go index 0e64e1c..b2fe125 100644 --- a/core/test.go +++ b/core/test.go @@ -216,6 +216,13 @@ func initSys() { return sillyGirl.Get("compiled_at") }, }, + { + Rules: []string{"notify ?"}, + Handle: func(s Sender) interface{} { + NotifyMasters(s.Get()) + return "通知成功。" + }, + }, { Rules: []string{"raw ^started_at$"}, Handle: func(s Sender) interface{} { @@ -291,10 +298,6 @@ Alias=sillyGirl.service` } s.Await(s, func(s2 Sender) interface{} { ct := s2.GetContent() - if ct == "退出接龙" { - stop = true - return "不要走决战到天亮,啊哦~" - } if strings.Contains(ct, "认输") { stop = true return nil @@ -328,6 +331,7 @@ Alias=sillyGirl.service` }) } + time.Sleep(time.Microsecond * 100) s.Reply("还玩吗?[Y/n]") s.Await(s, func(s2 Sender) interface{} { msg := s2.GetContent()