mirror of
https://github.com/FloatTech/ZeroBot-Plugin.git
synced 2025-12-19 22:00:11 +08:00
✏️ 增加 Diana 插件保存反馈
This commit is contained in:
parent
0bffc38be4
commit
bbc96a83d7
@ -6,10 +6,8 @@ import (
|
|||||||
"math/rand"
|
"math/rand"
|
||||||
"time"
|
"time"
|
||||||
|
|
||||||
zero "github.com/wdvxdr1123/ZeroBot"
|
|
||||||
"github.com/wdvxdr1123/ZeroBot/message"
|
|
||||||
|
|
||||||
"github.com/FloatTech/ZeroBot-Plugin/plugin_diana/data"
|
"github.com/FloatTech/ZeroBot-Plugin/plugin_diana/data"
|
||||||
|
zero "github.com/wdvxdr1123/ZeroBot"
|
||||||
)
|
)
|
||||||
|
|
||||||
func init() {
|
func init() {
|
||||||
@ -18,7 +16,7 @@ func init() {
|
|||||||
Handle(func(ctx *zero.Ctx) {
|
Handle(func(ctx *zero.Ctx) {
|
||||||
rand.Seed(time.Now().UnixNano())
|
rand.Seed(time.Now().UnixNano())
|
||||||
// 绕过第一行发病
|
// 绕过第一行发病
|
||||||
ctx.SendChain(message.Text((*data.Array)[rand.Intn(len(*data.Array)-1)+1]))
|
ctx.Send((*data.Array)[rand.Intn(len(*data.Array)-1)+1])
|
||||||
})
|
})
|
||||||
// 逆天
|
// 逆天
|
||||||
zero.OnFullMatch("发大病", zero.OnlyToMe).
|
zero.OnFullMatch("发大病", zero.OnlyToMe).
|
||||||
@ -32,6 +30,8 @@ func init() {
|
|||||||
err := data.AddText(ctx.State["regex_matched"].([]string)[1])
|
err := data.AddText(ctx.State["regex_matched"].([]string)[1])
|
||||||
if err != nil {
|
if err != nil {
|
||||||
ctx.Send(fmt.Sprintf("ERROR: %v", err))
|
ctx.Send(fmt.Sprintf("ERROR: %v", err))
|
||||||
|
} else {
|
||||||
|
ctx.Send("记住啦!")
|
||||||
}
|
}
|
||||||
})
|
})
|
||||||
}
|
}
|
||||||
|
|||||||
@ -95,7 +95,7 @@ func AddText(txt string) error {
|
|||||||
if txt != "" && !isin(sum) {
|
if txt != "" && !isin(sum) {
|
||||||
compo.Array = append(compo.Array, txt)
|
compo.Array = append(compo.Array, txt)
|
||||||
md5s = append(md5s, sum)
|
md5s = append(md5s, sum)
|
||||||
savecompo()
|
return savecompo()
|
||||||
}
|
}
|
||||||
return nil
|
return nil
|
||||||
}
|
}
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user