mirror of
https://github.com/FloatTech/ZeroBot-Plugin.git
synced 2026-02-12 02:00:24 +00:00
✨ fortune 增加下载锁;优化 gui 插件控制
This commit is contained in:
@@ -128,23 +128,11 @@ func updateAllPluginStatus(context *gin.Context) {
|
||||
}
|
||||
enable = parse["enable"].(bool)
|
||||
}
|
||||
var groups []int64
|
||||
zero.RangeBot(func(id int64, ctx *zero.Ctx) bool {
|
||||
for _, group := range ctx.GetGroupList().Array() {
|
||||
groups = append(groups, group.Get("group_id").Int())
|
||||
}
|
||||
return true
|
||||
})
|
||||
|
||||
ctrl.ForEach(func(key string, manager *ctrl.Control) bool {
|
||||
if enable {
|
||||
for _, group := range groups {
|
||||
manager.Enable(group)
|
||||
}
|
||||
manager.Enable(0)
|
||||
} else {
|
||||
for _, group := range groups {
|
||||
manager.Disable(group)
|
||||
}
|
||||
manager.Disable(0)
|
||||
}
|
||||
return true
|
||||
})
|
||||
@@ -175,18 +163,11 @@ func updatePluginAllGroupStatus(context *gin.Context) {
|
||||
context.JSON(404, nil)
|
||||
return
|
||||
}
|
||||
zero.RangeBot(func(id int64, ctx *zero.Ctx) bool {
|
||||
for _, group := range ctx.GetGroupList().Array() {
|
||||
if enable {
|
||||
control.Enable(group.Get("group_id").Int())
|
||||
} else {
|
||||
control.Disable(group.Get("group_id").Int())
|
||||
}
|
||||
}
|
||||
|
||||
return true
|
||||
})
|
||||
|
||||
if enable {
|
||||
control.Enable(0)
|
||||
} else {
|
||||
control.Disable(0)
|
||||
}
|
||||
context.JSON(200, nil)
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user