This commit is contained in:
cdle
2021-10-20 22:31:00 +08:00
parent 08539aa305
commit d5783cb44d
3 changed files with 29 additions and 26 deletions
+27
View File
@@ -170,6 +170,33 @@ func handleMessage(sender Sender) {
}
goon:
}
reply.Foreach(func(k, v []byte) error {
if string(v) == "" {
return nil
}
reg, err := regexp.Compile(string(k))
if err == nil {
if reg.FindString(sender.GetContent()) != "" {
sender.Reply(string(v))
}
}
return nil
})
recall := sillyGirl.Get("recall")
if recall != "" {
for _, v := range strings.Split(recall, "&") {
reg, err := regexp.Compile(v)
if err == nil {
if reg.FindString(sender.GetContent()) != "" {
if sender.IsAdmin() {
sender.Delete()
}
}
}
}
}
}
func FetchCookieValue(ps ...string) string {
-26
View File
@@ -1,26 +0,0 @@
package core
import "strings"
func init() {
go func() {
recall := sillyGirl.Get("recall")
if recall != "" {
rules := []string{}
for _, v := range strings.Split(recall, "&") {
rules = append(rules, "raw "+v)
}
AddCommand("", []Function{
{
Rules: rules,
Handle: func(s Sender) interface{} {
if !s.IsAdmin() {
s.Delete()
}
return nil
},
},
})
}
}()
}
+2
View File
@@ -13,6 +13,8 @@ import (
"github.com/buger/jsonparser"
)
var reply = NewBucket("reply")
type Reply struct {
Rules []string
Type string //text url