mirror of
https://github.com/FloatTech/ZeroBot-Plugin.git
synced 2025-12-19 13:59:39 +08:00
分离随机与评价
This commit is contained in:
parent
445d2e96ce
commit
e323e32f64
@ -17,6 +17,7 @@ var (
|
|||||||
RANDOM_API_URL = "https://api.pixivweb.com/anime18r.php?return=img"
|
RANDOM_API_URL = "https://api.pixivweb.com/anime18r.php?return=img"
|
||||||
CLASSIFY_RANDOM_API_URL = "http://saki.fumiama.top:62002/dice?url=" + RANDOM_API_URL
|
CLASSIFY_RANDOM_API_URL = "http://saki.fumiama.top:62002/dice?url=" + RANDOM_API_URL
|
||||||
VOTE_API_URL = "http://saki.fumiama.top/vote?uuid=零号&img=%s&class=%d"
|
VOTE_API_URL = "http://saki.fumiama.top/vote?uuid=零号&img=%s&class=%d"
|
||||||
|
BLOCK_REQUEST_CLASS = false
|
||||||
BLOCK_REQUEST = false
|
BLOCK_REQUEST = false
|
||||||
CACHE_IMG_FILE = "/tmp/setugt"
|
CACHE_IMG_FILE = "/tmp/setugt"
|
||||||
CACHE_URI = "file:///" + CACHE_IMG_FILE
|
CACHE_URI = "file:///" + CACHE_IMG_FILE
|
||||||
@ -35,15 +36,15 @@ func init() { // 插件主体
|
|||||||
}
|
}
|
||||||
return
|
return
|
||||||
})
|
})
|
||||||
// 随机图片
|
// 有保护的随机图片
|
||||||
zero.OnFullMatch("随机图片").SetBlock(true).SetPriority(24).
|
if CLASSIFY_RANDOM_API_URL != "" {
|
||||||
|
zero.OnFullMatch("评价图片").SetBlock(true).SetPriority(24).
|
||||||
Handle(func(ctx *zero.Ctx) {
|
Handle(func(ctx *zero.Ctx) {
|
||||||
if ctx.Event.GroupID > 0 {
|
if ctx.Event.GroupID > 0 {
|
||||||
if BLOCK_REQUEST {
|
if BLOCK_REQUEST_CLASS {
|
||||||
ctx.Send("请稍后再试哦")
|
ctx.Send("请稍后再试哦")
|
||||||
} else {
|
} else {
|
||||||
BLOCK_REQUEST = true
|
BLOCK_REQUEST_CLASS = true
|
||||||
if CLASSIFY_RANDOM_API_URL != "" {
|
|
||||||
resp, err := http.Get(CLASSIFY_RANDOM_API_URL)
|
resp, err := http.Get(CLASSIFY_RANDOM_API_URL)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
ctx.Send(fmt.Sprintf("ERROR: %v", err))
|
ctx.Send(fmt.Sprintf("ERROR: %v", err))
|
||||||
@ -78,14 +79,13 @@ func init() { // 插件主体
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
} else {
|
BLOCK_REQUEST_CLASS = false
|
||||||
ctx.Send(msgext.ImageNoCache(RANDOM_API_URL))
|
|
||||||
}
|
|
||||||
BLOCK_REQUEST = false
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
return
|
return
|
||||||
})
|
})
|
||||||
|
}
|
||||||
|
|
||||||
zero.OnFullMatch("不许好").SetBlock(true).SetPriority(24).
|
zero.OnFullMatch("不许好").SetBlock(true).SetPriority(24).
|
||||||
Handle(func(ctx *zero.Ctx) {
|
Handle(func(ctx *zero.Ctx) {
|
||||||
vote(ctx, 5)
|
vote(ctx, 5)
|
||||||
@ -94,6 +94,20 @@ func init() { // 插件主体
|
|||||||
Handle(func(ctx *zero.Ctx) {
|
Handle(func(ctx *zero.Ctx) {
|
||||||
vote(ctx, 6)
|
vote(ctx, 6)
|
||||||
})
|
})
|
||||||
|
// 直接随机图片
|
||||||
|
zero.OnFullMatch("随机图片").SetBlock(true).SetPriority(24).
|
||||||
|
Handle(func(ctx *zero.Ctx) {
|
||||||
|
if ctx.Event.GroupID > 0 {
|
||||||
|
if BLOCK_REQUEST {
|
||||||
|
ctx.Send("请稍后再试哦")
|
||||||
|
} else {
|
||||||
|
BLOCK_REQUEST = true
|
||||||
|
ctx.Send(msgext.ImageNoCache(RANDOM_API_URL))
|
||||||
|
BLOCK_REQUEST = false
|
||||||
|
}
|
||||||
|
}
|
||||||
|
return
|
||||||
|
})
|
||||||
}
|
}
|
||||||
|
|
||||||
func vote(ctx *zero.Ctx, class int) {
|
func vote(ctx *zero.Ctx, class int) {
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user