mirror of
https://github.com/FloatTech/ZeroBot-Plugin.git
synced 2025-12-20 06:20:08 +08:00
升级ACGImage,隐藏一些包暴露的函数
This commit is contained in:
parent
f8e150786a
commit
bda336dff5
3
go.mod
3
go.mod
@ -4,8 +4,9 @@ go 1.16
|
||||
|
||||
require (
|
||||
github.com/FloatTech/AnimeAPI v0.0.0-20210713044920-63367fe18ccd
|
||||
github.com/FloatTech/ZeroBot-ACGImage v1.4.3
|
||||
github.com/FloatTech/ZeroBot-ACGImage v1.5.1
|
||||
github.com/FloatTech/ZeroBot-Plugin-Timer v1.3.4
|
||||
github.com/FloatTech/Zerobot-ACGImage-Classify v1.2.1
|
||||
github.com/StackExchange/wmi v1.2.1 // indirect
|
||||
github.com/go-ole/go-ole v1.2.5 // indirect
|
||||
github.com/robfig/cron v1.2.0
|
||||
|
||||
4
go.sum
4
go.sum
@ -16,6 +16,8 @@ github.com/FloatTech/ZeroBot-ACGImage v1.4.2 h1:/jj/+5a4EeejeqIDkeUbaxpCpZfLPCOD
|
||||
github.com/FloatTech/ZeroBot-ACGImage v1.4.2/go.mod h1:CtEYnFTjgzH4v1jaowyyjBmjSKK3p8WPXExfGnVmx1E=
|
||||
github.com/FloatTech/ZeroBot-ACGImage v1.4.3 h1:lQTKfrVYdO5T+4KfC8U2bIxYnZql2hG2tSo/msTGRcI=
|
||||
github.com/FloatTech/ZeroBot-ACGImage v1.4.3/go.mod h1:CtEYnFTjgzH4v1jaowyyjBmjSKK3p8WPXExfGnVmx1E=
|
||||
github.com/FloatTech/ZeroBot-ACGImage v1.5.1 h1:iolon1PR4AjEJJmUHEDfCXL8tBZOx5W21hRvNirX1Bw=
|
||||
github.com/FloatTech/ZeroBot-ACGImage v1.5.1/go.mod h1:Q9k43tGy2c5sDxw3XZc2An4YfqkN1wWIXeXUH2GlaBg=
|
||||
github.com/FloatTech/ZeroBot-Plugin-Timer v1.2.4 h1:BMrSHJO1lWKTKU1DCK+XEpTaK38FMlBEIywFLIiatu8=
|
||||
github.com/FloatTech/ZeroBot-Plugin-Timer v1.2.4/go.mod h1:femu/wVuqVSN/rg209qksMx8/2OKUF8l1PZCNg4RwVA=
|
||||
github.com/FloatTech/ZeroBot-Plugin-Timer v1.3.1 h1:AT/nudxY5murKpEyP+ZZTczknSipeZPP2tId6/2I7Nw=
|
||||
@ -26,6 +28,8 @@ github.com/FloatTech/ZeroBot-Plugin-Timer v1.3.3 h1:NXk18XCfy4cCSMXru/NHfCdf26o3
|
||||
github.com/FloatTech/ZeroBot-Plugin-Timer v1.3.3/go.mod h1:NuODdnVhf9AClsJBdYFqnL9sQE7VIRZyZos37J286n0=
|
||||
github.com/FloatTech/ZeroBot-Plugin-Timer v1.3.4 h1:nRJqY/S7TRlN32MQGIBH3UWfVrpjxpJXCnp42pd2O2Q=
|
||||
github.com/FloatTech/ZeroBot-Plugin-Timer v1.3.4/go.mod h1:NuODdnVhf9AClsJBdYFqnL9sQE7VIRZyZos37J286n0=
|
||||
github.com/FloatTech/Zerobot-ACGImage-Classify v1.2.1 h1:HEdT6yq06lV94jcArutpyqQLaPpczs0bTd6gdwVG1ps=
|
||||
github.com/FloatTech/Zerobot-ACGImage-Classify v1.2.1/go.mod h1:swPvVKyXu1YFWZ7Kt6R79LgIa16hs4cE1E5LroBB2SQ=
|
||||
github.com/StackExchange/wmi v0.0.0-20210224194228-fe8f1750fd46 h1:5sXbqlSomvdjlRbWyNqkPsJ3Fg+tQZCbgeX1VGljbQY=
|
||||
github.com/StackExchange/wmi v0.0.0-20210224194228-fe8f1750fd46/go.mod h1:3eOhrUMpNV+6aFIbp5/iudMxNCF27Vw2OZgy4xEx0Fg=
|
||||
github.com/StackExchange/wmi v1.2.0 h1:noJEYkMQVlFCEAc+2ma5YyRhlfjcWfZqk5sBRYozdyM=
|
||||
|
||||
@ -26,13 +26,6 @@ func init() {
|
||||
zero.OnFullMatch("来份萝莉").
|
||||
Handle(func(ctx *zero.Ctx) {
|
||||
go func() {
|
||||
min := func(a, b int) int {
|
||||
if a < b {
|
||||
return a
|
||||
} else {
|
||||
return b
|
||||
}
|
||||
}
|
||||
for i := 0; i < min(cap(QUEUE)-len(QUEUE), 2); i++ {
|
||||
resp, err := http.Get(API)
|
||||
if err != nil {
|
||||
@ -63,3 +56,11 @@ func init() {
|
||||
}
|
||||
})
|
||||
}
|
||||
|
||||
func min(a, b int) int {
|
||||
if a < b {
|
||||
return a
|
||||
} else {
|
||||
return b
|
||||
}
|
||||
}
|
||||
|
||||
@ -56,7 +56,7 @@ var (
|
||||
)
|
||||
|
||||
func init() { // 插件主体
|
||||
zero.OnRegex(`^来份(.*)$`, FirstValueInList(POOL.List)).SetBlock(true).SetPriority(20).
|
||||
zero.OnRegex(`^来份(.*)$`, firstValueInList(POOL.List)).SetBlock(true).SetPriority(20).
|
||||
Handle(func(ctx *zero.Ctx) {
|
||||
if !limit.Load(ctx.Event.UserID).Acquire() {
|
||||
ctx.SendChain(message.Text("请稍后重试0x0..."))
|
||||
@ -65,7 +65,7 @@ func init() { // 插件主体
|
||||
var type_ = ctx.State["regex_matched"].([]string)[1]
|
||||
// 补充池子
|
||||
go func() {
|
||||
times := Min(POOL.Max-POOL.Size(type_), 2)
|
||||
times := min(POOL.Max-POOL.Size(type_), 2)
|
||||
for i := 0; i < times; i++ {
|
||||
illust := &pixiv.Illust{}
|
||||
// 查询出一张图片
|
||||
@ -101,7 +101,7 @@ func init() { // 插件主体
|
||||
return
|
||||
})
|
||||
|
||||
zero.OnRegex(`^添加(.*?)(\d+)$`, FirstValueInList(POOL.List), zero.SuperUserPermission).SetBlock(true).SetPriority(21).
|
||||
zero.OnRegex(`^添加(.*?)(\d+)$`, firstValueInList(POOL.List), zero.SuperUserPermission).SetBlock(true).SetPriority(21).
|
||||
Handle(func(ctx *zero.Ctx) {
|
||||
var (
|
||||
type_ = ctx.State["regex_matched"].([]string)[1]
|
||||
@ -133,7 +133,7 @@ func init() { // 插件主体
|
||||
return
|
||||
})
|
||||
|
||||
zero.OnRegex(`^删除(.*?)(\d+)$`, FirstValueInList(POOL.List), zero.SuperUserPermission).SetBlock(true).SetPriority(22).
|
||||
zero.OnRegex(`^删除(.*?)(\d+)$`, firstValueInList(POOL.List), zero.SuperUserPermission).SetBlock(true).SetPriority(22).
|
||||
Handle(func(ctx *zero.Ctx) {
|
||||
var (
|
||||
type_ = ctx.State["regex_matched"].([]string)[1]
|
||||
@ -167,8 +167,8 @@ func init() { // 插件主体
|
||||
})
|
||||
}
|
||||
|
||||
// FirstValueInList 判断正则匹配的第一个参数是否在列表中
|
||||
func FirstValueInList(list []string) zero.Rule {
|
||||
// firstValueInList 判断正则匹配的第一个参数是否在列表中
|
||||
func firstValueInList(list []string) zero.Rule {
|
||||
return func(ctx *zero.Ctx) bool {
|
||||
first := ctx.State["regex_matched"].([]string)[1]
|
||||
for i := range list {
|
||||
@ -180,8 +180,8 @@ func FirstValueInList(list []string) zero.Rule {
|
||||
}
|
||||
}
|
||||
|
||||
// Min 返回两数最小值
|
||||
func Min(a, b int) int {
|
||||
// min 返回两数最小值
|
||||
func min(a, b int) int {
|
||||
switch {
|
||||
default:
|
||||
return a
|
||||
|
||||
@ -133,7 +133,6 @@ func (db *Sqlite) Select(table string, objptr interface{}, condition string) (er
|
||||
if err != nil {
|
||||
return err
|
||||
}
|
||||
return nil
|
||||
}
|
||||
return errors.New("数据库无此条件项目")
|
||||
}
|
||||
|
||||
Loading…
Reference in New Issue
Block a user