update
This commit is contained in:
@@ -170,6 +170,33 @@ func handleMessage(sender Sender) {
|
|||||||
}
|
}
|
||||||
goon:
|
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 {
|
func FetchCookieValue(ps ...string) string {
|
||||||
|
|||||||
@@ -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
|
|
||||||
},
|
|
||||||
},
|
|
||||||
})
|
|
||||||
}
|
|
||||||
}()
|
|
||||||
}
|
|
||||||
@@ -13,6 +13,8 @@ import (
|
|||||||
"github.com/buger/jsonparser"
|
"github.com/buger/jsonparser"
|
||||||
)
|
)
|
||||||
|
|
||||||
|
var reply = NewBucket("reply")
|
||||||
|
|
||||||
type Reply struct {
|
type Reply struct {
|
||||||
Rules []string
|
Rules []string
|
||||||
Type string //text url
|
Type string //text url
|
||||||
|
|||||||
Reference in New Issue
Block a user