🎨 优化代码

This commit is contained in:
fumiama 2021-08-06 23:27:55 +08:00
parent a861a1d169
commit b767f5500a

View File

@ -11,17 +11,21 @@ import (
"github.com/wdvxdr1123/ZeroBot/message" "github.com/wdvxdr1123/ZeroBot/message"
) )
const (
datapath = "data/acgimage/"
cacheuri = "file:///" + datapath + "cache"
lolipxy = "http://sayuri.fumiama.top:62002/dice?class=0&loli=true&r18=true"
)
var ( var (
lolipxy = "http://sayuri.fumiama.top:62002/dice?class=0&loli=true&r18=true"
// r18有一定保护一般不会发出图片 // r18有一定保护一般不会发出图片
randapi = "&loli=true&r18=true" randapi = "&loli=true&r18=true"
msgof = make(map[int64]int64) msgof = make(map[int64]int64)
datapath = "data/acgimage/"
cachefile = datapath + "cache"
cacheuri = "file:///" + cachefile
) )
func init() { // 插件主体 func init() { // 插件主体
// 初始化 classify
classify.Init(datapath)
zero.OnRegex(`^设置随机图片网址(.*)$`, zero.SuperUserPermission).SetBlock(true).SetPriority(20). zero.OnRegex(`^设置随机图片网址(.*)$`, zero.SuperUserPermission).SetBlock(true).SetPriority(20).
Handle(func(ctx *zero.Ctx) { Handle(func(ctx *zero.Ctx) {
url := ctx.State["regex_matched"].([]string)[1] url := ctx.State["regex_matched"].([]string)[1]