mirror of
https://github.com/FloatTech/ZeroBot-Plugin.git
synced 2026-02-06 15:20:22 +00:00
Compare commits
4 Commits
v1.2.5-bet
...
v1.2.5-bet
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
fc0d020a04 | ||
|
|
617e2c9885 | ||
|
|
bb1130490b | ||
|
|
ca18a323e3 |
@@ -58,6 +58,8 @@ zerobot [-h] [-t token] [-u url] [-n nickname] [-p prefix] [-d|w] [-g 监听地
|
||||
- [x] /还原 xxx (在发送的群/用户还原xxx的开启状态到初始状态)
|
||||
- [x] /禁止 service qq1 qq2... (禁止 qqs 使用服务 service)
|
||||
- [x] /允许 service qq1 qq2... (重新允许 qqs 使用服务 service)
|
||||
- [x] /封禁 qq1 qq2... (禁止 qqs 使用全部服务)
|
||||
- [x] /解封 qq1 qq2... (允许 qqs 使用全部服务)
|
||||
- [x] /用法 xxx
|
||||
- [x] /服务列表
|
||||
- [x] /服务详情
|
||||
@@ -165,6 +167,8 @@ zerobot [-h] [-t token] [-u url] [-n nickname] [-p prefix] [-d|w] [-g 监听地
|
||||
- [x] 评价图片(发送一张图片让bot评分)
|
||||
- **DeepDanbooru二次元图标签识别** `import _ github.com/FloatTech/ZeroBot-Plugin/plugin_danbooru`
|
||||
- [x] 鉴赏图片[图片]
|
||||
- **叔叔的AI二次元图片放大** `import _ "github.com/FloatTech/ZeroBot-Plugin/plugin_scale"`
|
||||
- [x] 放大图片[图片]
|
||||
- **每日运势** `import _ github.com/FloatTech/ZeroBot-Plugin/plugin_fortune`
|
||||
- [x] 运势 | 抽签
|
||||
- [x] 设置底图[车万 DC4 爱因斯坦 星空列车 樱云之恋 富婆妹 李清歌 公主连结 原神 明日方舟 碧蓝航线 碧蓝幻想 战双 阴阳师 赛马娘]
|
||||
|
||||
2
data
2
data
Submodule data updated: f84539a9f2...663410335c
4
go.mod
4
go.mod
@@ -3,8 +3,8 @@ module github.com/FloatTech/ZeroBot-Plugin
|
||||
go 1.17
|
||||
|
||||
require (
|
||||
github.com/FloatTech/AnimeAPI v1.2.5-beta2
|
||||
github.com/FloatTech/zbputils v1.2.5-beta1
|
||||
github.com/FloatTech/AnimeAPI v1.2.5-beta6
|
||||
github.com/FloatTech/zbputils v1.2.5-beta6
|
||||
github.com/antchfx/htmlquery v1.2.4
|
||||
github.com/corona10/goimagehash v1.0.3
|
||||
github.com/fogleman/gg v1.3.0
|
||||
|
||||
8
go.sum
8
go.sum
@@ -1,8 +1,8 @@
|
||||
github.com/FloatTech/AnimeAPI v1.2.5-beta2 h1:O8PGLzLLQNGNtJoq+gkpvkEe2JdaZ3vP9pD4+0ASPPk=
|
||||
github.com/FloatTech/AnimeAPI v1.2.5-beta2/go.mod h1:tWU3xDvkSqnFD8SCTS5oko1UhkVlrNLK6PmN0ea6n6Q=
|
||||
github.com/FloatTech/AnimeAPI v1.2.5-beta6 h1:H91PtZI74fKYoQ9yEb11/n2ltw+TQuPaGthzQl4EKVk=
|
||||
github.com/FloatTech/AnimeAPI v1.2.5-beta6/go.mod h1:vKbLI2uuJJLZceI6cqNgr/4PWLNHMEhCop83DrdVwpU=
|
||||
github.com/FloatTech/bot-manager v1.0.0/go.mod h1:8YYRJ16oroGHQGD2En0oVnmcKJkxR9O/jd5BPSfWfOQ=
|
||||
github.com/FloatTech/zbputils v1.2.5-beta1 h1:wptmjPpsaoK77igPKFmdUB86AWPyNyuEtT7LNYt2t4U=
|
||||
github.com/FloatTech/zbputils v1.2.5-beta1/go.mod h1:1VE4gxnrr+uRz/TDPgx3GT8GmVayoF5e0wolBQU3t+k=
|
||||
github.com/FloatTech/zbputils v1.2.5-beta6 h1:WLJLAvqloLuPqTZdbChnXlufMSQMKYFZ2xVHAW8CmEM=
|
||||
github.com/FloatTech/zbputils v1.2.5-beta6/go.mod h1:1VE4gxnrr+uRz/TDPgx3GT8GmVayoF5e0wolBQU3t+k=
|
||||
github.com/Mrs4s/MiraiGo v0.0.0-20211120033824-43b23f4e6fcb h1:Rkj28fqIwGx/EgBzRYtpmJRfH6wqVn7cNdc7aJ0QE4M=
|
||||
github.com/Mrs4s/MiraiGo v0.0.0-20211120033824-43b23f4e6fcb/go.mod h1:imVKbfKqqeit+C/eaWGb4MKQ3z3gN6pRpBU5RMtp5so=
|
||||
github.com/PuerkitoBio/goquery v1.5.1/go.mod h1:GsLWisAFVj4WgDibEWF4pvYnkVQBpKBKeU+7zCJoLcc=
|
||||
|
||||
4
main.go
4
main.go
@@ -69,6 +69,7 @@ import (
|
||||
_ "github.com/FloatTech/ZeroBot-Plugin/plugin_nativewife" // 本地老婆
|
||||
_ "github.com/FloatTech/ZeroBot-Plugin/plugin_nsfw" // nsfw图片识别
|
||||
_ "github.com/FloatTech/ZeroBot-Plugin/plugin_saucenao" // 以图搜图
|
||||
_ "github.com/FloatTech/ZeroBot-Plugin/plugin_scale" // 叔叔的AI二次元图片放大
|
||||
_ "github.com/FloatTech/ZeroBot-Plugin/plugin_setutime" // 来份涩图
|
||||
_ "github.com/FloatTech/ZeroBot-Plugin/plugin_tracemoe" // 搜番
|
||||
_ "github.com/FloatTech/ZeroBot-Plugin/plugin_vtb_quotation" // vtb语录
|
||||
@@ -79,6 +80,8 @@ import (
|
||||
zero "github.com/wdvxdr1123/ZeroBot"
|
||||
"github.com/wdvxdr1123/ZeroBot/driver"
|
||||
"github.com/wdvxdr1123/ZeroBot/message"
|
||||
|
||||
"github.com/FloatTech/ZeroBot-Plugin/order"
|
||||
)
|
||||
|
||||
var (
|
||||
@@ -156,6 +159,7 @@ func getKanban() string {
|
||||
}
|
||||
|
||||
func main() {
|
||||
order.Wait()
|
||||
printBanner()
|
||||
// 帮助
|
||||
zero.OnFullMatchGroup([]string{"/help", ".help", "菜单"}, zero.OnlyToMe).SetBlock(true).
|
||||
|
||||
14
order/init.go
Normal file
14
order/init.go
Normal file
@@ -0,0 +1,14 @@
|
||||
package order
|
||||
|
||||
import "sync"
|
||||
|
||||
var wg sync.WaitGroup
|
||||
|
||||
// DoneOnExit 在退出时执行 Done
|
||||
func DoneOnExit() func() {
|
||||
wg.Add(1)
|
||||
return wg.Done
|
||||
}
|
||||
|
||||
// Wait 等待
|
||||
var Wait = wg.Wait
|
||||
@@ -44,6 +44,7 @@ const (
|
||||
PrioReborn
|
||||
PrioRuncode
|
||||
PrioSauceNao
|
||||
PrioScale
|
||||
PrioScore
|
||||
PrioSetuTime
|
||||
PrioShaDiao
|
||||
|
||||
@@ -89,7 +89,7 @@ func init() { // 插件主体
|
||||
}
|
||||
})
|
||||
// 上传一张图进行评价
|
||||
engine.OnKeywordGroup([]string{"评价图片"}, zero.OnlyPublic, ctxext.CmdMatch, ctxext.MustGiven).SetBlock(true).
|
||||
engine.OnKeywordGroup([]string{"评价图片"}, zero.OnlyGroup, ctxext.CmdMatch, ctxext.MustGiven).SetBlock(true).
|
||||
Handle(func(ctx *zero.Ctx) {
|
||||
ctx.SendChain(message.Text("少女祈祷中..."))
|
||||
for _, url := range ctx.State["image_url"].([]string) {
|
||||
|
||||
@@ -5,6 +5,8 @@ import (
|
||||
|
||||
"github.com/FloatTech/zbputils/process"
|
||||
log "github.com/sirupsen/logrus"
|
||||
|
||||
"github.com/FloatTech/ZeroBot-Plugin/order"
|
||||
)
|
||||
|
||||
const (
|
||||
@@ -19,6 +21,7 @@ var bdb *bilibilipushdb
|
||||
// 加载数据库
|
||||
func init() {
|
||||
go func() {
|
||||
defer order.DoneOnExit()()
|
||||
process.SleepAbout1sTo2s()
|
||||
_ = os.MkdirAll(dbpath, 0755)
|
||||
os.RemoveAll(cachePath)
|
||||
|
||||
@@ -8,6 +8,8 @@ import (
|
||||
"github.com/FloatTech/zbputils/file"
|
||||
"github.com/FloatTech/zbputils/process"
|
||||
"github.com/FloatTech/zbputils/sql"
|
||||
|
||||
"github.com/FloatTech/ZeroBot-Plugin/order"
|
||||
)
|
||||
|
||||
const dbpath = "data/BookReview/"
|
||||
@@ -18,6 +20,7 @@ var db = &sql.Sqlite{DBPath: dbfile}
|
||||
// 加载数据库
|
||||
func init() {
|
||||
go func() {
|
||||
defer order.DoneOnExit()()
|
||||
process.SleepAbout1sTo2s()
|
||||
// os.RemoveAll(dbpath)
|
||||
_ = os.MkdirAll(dbpath, 0755)
|
||||
|
||||
@@ -8,12 +8,15 @@ import (
|
||||
|
||||
"github.com/FloatTech/zbputils/file"
|
||||
"github.com/FloatTech/zbputils/process"
|
||||
|
||||
"github.com/FloatTech/ZeroBot-Plugin/order"
|
||||
)
|
||||
|
||||
type kimo = map[string]*[]string
|
||||
|
||||
func initChatList(postinit func()) {
|
||||
go func() {
|
||||
defer order.DoneOnExit()()
|
||||
process.SleepAbout1sTo2s()
|
||||
_ = os.MkdirAll(dbpath, 0755)
|
||||
data, err := file.GetLazyData(dbfile, true, true)
|
||||
|
||||
@@ -8,6 +8,8 @@ import (
|
||||
"github.com/FloatTech/zbputils/file"
|
||||
"github.com/FloatTech/zbputils/process"
|
||||
"github.com/FloatTech/zbputils/sql"
|
||||
|
||||
"github.com/FloatTech/ZeroBot-Plugin/order"
|
||||
)
|
||||
|
||||
const (
|
||||
@@ -20,6 +22,7 @@ var db = &sql.Sqlite{DBPath: dbfile}
|
||||
// 加载数据库
|
||||
func init() {
|
||||
go func() {
|
||||
defer order.DoneOnExit()()
|
||||
process.SleepAbout1sTo2s()
|
||||
// os.RemoveAll(dbpath)
|
||||
_ = os.MkdirAll(dbpath, 0755)
|
||||
|
||||
@@ -8,6 +8,8 @@ import (
|
||||
"github.com/FloatTech/zbputils/file"
|
||||
"github.com/FloatTech/zbputils/process"
|
||||
"github.com/FloatTech/zbputils/sql"
|
||||
|
||||
"github.com/FloatTech/ZeroBot-Plugin/order"
|
||||
)
|
||||
|
||||
const (
|
||||
@@ -20,6 +22,7 @@ var db = &sql.Sqlite{DBPath: dbfile}
|
||||
// 加载数据库
|
||||
func init() {
|
||||
go func() {
|
||||
defer order.DoneOnExit()()
|
||||
process.SleepAbout1sTo2s()
|
||||
// os.RemoveAll(dbpath)
|
||||
_ = os.MkdirAll(dbpath, 0755)
|
||||
|
||||
@@ -8,6 +8,8 @@ import (
|
||||
"github.com/FloatTech/zbputils/file"
|
||||
"github.com/FloatTech/zbputils/process"
|
||||
"github.com/FloatTech/zbputils/sql"
|
||||
|
||||
"github.com/FloatTech/ZeroBot-Plugin/order"
|
||||
)
|
||||
|
||||
const (
|
||||
@@ -22,6 +24,7 @@ var (
|
||||
// 加载数据库
|
||||
func init() {
|
||||
go func() {
|
||||
defer order.DoneOnExit()()
|
||||
process.SleepAbout1sTo2s()
|
||||
_ = os.MkdirAll(dbpath, 0755)
|
||||
_, err := file.GetLazyData(dbfile, false, true)
|
||||
|
||||
@@ -32,7 +32,7 @@ func init() { // 插件主体
|
||||
"- 鉴赏图片[图片]",
|
||||
})
|
||||
// 上传一张图进行评价
|
||||
engine.OnKeywordGroup([]string{"鉴赏图片"}, zero.OnlyPublic, ctxext.CmdMatch, ctxext.MustGiven).SetBlock(true).
|
||||
engine.OnKeywordGroup([]string{"鉴赏图片"}, zero.OnlyGroup, ctxext.CmdMatch, ctxext.MustGiven).SetBlock(true).
|
||||
Handle(func(ctx *zero.Ctx) {
|
||||
ctx.SendChain(message.Text("少女祈祷中..."))
|
||||
for _, url := range ctx.State["image_url"].([]string) {
|
||||
|
||||
@@ -12,6 +12,8 @@ import (
|
||||
"github.com/FloatTech/zbputils/file"
|
||||
"github.com/FloatTech/zbputils/process"
|
||||
"github.com/FloatTech/zbputils/sql"
|
||||
|
||||
"github.com/FloatTech/ZeroBot-Plugin/order"
|
||||
)
|
||||
|
||||
const (
|
||||
@@ -28,6 +30,7 @@ type text struct {
|
||||
|
||||
func init() {
|
||||
go func() {
|
||||
defer order.DoneOnExit()()
|
||||
process.SleepAbout1sTo2s()
|
||||
err := os.MkdirAll(datapath, 0755)
|
||||
if err != nil {
|
||||
|
||||
@@ -7,6 +7,8 @@ import (
|
||||
|
||||
"github.com/FloatTech/zbputils/file"
|
||||
"github.com/FloatTech/zbputils/process"
|
||||
|
||||
"github.com/FloatTech/ZeroBot-Plugin/order"
|
||||
)
|
||||
|
||||
type joke struct {
|
||||
@@ -22,6 +24,7 @@ const (
|
||||
// 加载数据库
|
||||
func init() {
|
||||
go func() {
|
||||
defer order.DoneOnExit()()
|
||||
process.SleepAbout1sTo2s()
|
||||
_ = os.MkdirAll(dbpath, 0755)
|
||||
_, err := file.GetLazyData(dbfile, false, true)
|
||||
|
||||
@@ -68,6 +68,7 @@ var engine = control.Register("manager", order.PrioManager, &control.Options{
|
||||
|
||||
func init() { // 插件主体
|
||||
go func() {
|
||||
defer order.DoneOnExit()()
|
||||
process.SleepAbout1sTo2s()
|
||||
_ = os.MkdirAll(datapath, 0755)
|
||||
clock = timer.NewClock(db)
|
||||
|
||||
@@ -16,6 +16,8 @@ import (
|
||||
"github.com/FloatTech/zbputils/file"
|
||||
"github.com/FloatTech/zbputils/process"
|
||||
"github.com/FloatTech/zbputils/sql"
|
||||
|
||||
"github.com/FloatTech/ZeroBot-Plugin/order"
|
||||
)
|
||||
|
||||
// setuclass holds setus in a folder, which is the class name.
|
||||
@@ -29,6 +31,7 @@ var ns = &nsetu{db: &sql.Sqlite{DBPath: dbfile}}
|
||||
|
||||
func init() {
|
||||
go func() {
|
||||
defer order.DoneOnExit()()
|
||||
process.SleepAbout1sTo2s()
|
||||
err := os.MkdirAll(datapath, 0755)
|
||||
if err != nil {
|
||||
|
||||
@@ -16,7 +16,7 @@ func init() {
|
||||
Help: "nsfw图片识别\n- nsfw打分[图片]",
|
||||
})
|
||||
// 上传一张图进行评价
|
||||
engine.OnKeywordGroup([]string{"nsfw打分"}, zero.OnlyPublic, ctxext.CmdMatch, ctxext.MustGiven).SetBlock(true).
|
||||
engine.OnKeywordGroup([]string{"nsfw打分"}, zero.OnlyGroup, ctxext.CmdMatch, ctxext.MustGiven).SetBlock(true).
|
||||
Handle(func(ctx *zero.Ctx) {
|
||||
url := ctx.State["image_url"].([]string)
|
||||
if len(url) > 0 {
|
||||
@@ -51,7 +51,7 @@ func judge(p nsfw.Picture) string {
|
||||
return "普通哦"
|
||||
}
|
||||
c := ""
|
||||
if p.Drawings > 0.3 {
|
||||
if p.Drawings > 0.3 || p.Neutral < 0.3 {
|
||||
c = "二次元"
|
||||
} else {
|
||||
c = "三次元"
|
||||
|
||||
@@ -8,6 +8,8 @@ import (
|
||||
"github.com/FloatTech/zbputils/file"
|
||||
"github.com/FloatTech/zbputils/process"
|
||||
"github.com/FloatTech/zbputils/sql"
|
||||
|
||||
"github.com/FloatTech/ZeroBot-Plugin/order"
|
||||
)
|
||||
|
||||
const (
|
||||
@@ -19,11 +21,7 @@ var db = &sql.Sqlite{DBPath: dbfile}
|
||||
|
||||
func init() {
|
||||
go func() {
|
||||
defer func() {
|
||||
if err := recover(); err != nil {
|
||||
log.Println(err)
|
||||
}
|
||||
}()
|
||||
defer order.DoneOnExit()()
|
||||
process.SleepAbout1sTo2s()
|
||||
_ = os.MkdirAll(dbpath, 0755)
|
||||
_, _ = file.GetLazyData(dbfile, false, true)
|
||||
|
||||
@@ -9,6 +9,8 @@ import (
|
||||
|
||||
"github.com/FloatTech/zbputils/file"
|
||||
"github.com/FloatTech/zbputils/process"
|
||||
|
||||
"github.com/FloatTech/ZeroBot-Plugin/order"
|
||||
)
|
||||
|
||||
const (
|
||||
@@ -27,6 +29,7 @@ var (
|
||||
|
||||
func init() {
|
||||
go func() {
|
||||
defer order.DoneOnExit()()
|
||||
process.SleepAbout1sTo2s()
|
||||
err := os.MkdirAll(datapath, 0755)
|
||||
if err != nil {
|
||||
|
||||
104
plugin_scale/main.go
Normal file
104
plugin_scale/main.go
Normal file
@@ -0,0 +1,104 @@
|
||||
// Package scale 叔叔的AI二次元图片放大
|
||||
package scale
|
||||
|
||||
import (
|
||||
"os"
|
||||
"strconv"
|
||||
"time"
|
||||
|
||||
"github.com/FloatTech/AnimeAPI/nsfw"
|
||||
"github.com/FloatTech/AnimeAPI/scale"
|
||||
"github.com/FloatTech/zbputils/control"
|
||||
"github.com/FloatTech/zbputils/ctxext"
|
||||
"github.com/FloatTech/zbputils/file"
|
||||
zero "github.com/wdvxdr1123/ZeroBot"
|
||||
"github.com/wdvxdr1123/ZeroBot/message"
|
||||
|
||||
"github.com/FloatTech/ZeroBot-Plugin/order"
|
||||
)
|
||||
|
||||
const cachedir = "data/scale/"
|
||||
|
||||
func init() {
|
||||
_ = os.RemoveAll(cachedir)
|
||||
err := os.MkdirAll(cachedir, 0755)
|
||||
if err != nil {
|
||||
panic(err)
|
||||
}
|
||||
engine := control.Register("scale", order.PrioScale, &control.Options{
|
||||
DisableOnDefault: false,
|
||||
Help: "叔叔的AI二次元图片放大\n- 放大图片[图片]",
|
||||
})
|
||||
// 上传一张图进行评价
|
||||
engine.OnKeywordGroup([]string{"放大图片"}, zero.OnlyGroup, ctxext.CmdMatch, ctxext.MustGiven, getPara).SetBlock(true).
|
||||
Handle(func(ctx *zero.Ctx) {
|
||||
url := ctx.State["image_url"].([]string)
|
||||
if len(url) > 0 {
|
||||
ctx.SendChain(message.Text("少女祈祷中..."))
|
||||
p, err := nsfw.Classify(url[0])
|
||||
if err != nil {
|
||||
ctx.SendChain(message.Text("ERROR:", err))
|
||||
return
|
||||
}
|
||||
if p[0].Drawings < 0.1 || p[0].Neutral > 0.8 {
|
||||
ctx.SendChain(message.Text("请发送二次元图片!"))
|
||||
return
|
||||
}
|
||||
paras := ctx.State["scale_paras"].([2]int)
|
||||
data, err := scale.Get(url[0], paras[0], paras[1], 2)
|
||||
if err != nil {
|
||||
ctx.SendChain(message.Text("ERROR:", err))
|
||||
return
|
||||
}
|
||||
n := cachedir + strconv.Itoa(int(ctx.Event.UserID))
|
||||
f, err := os.Create(n)
|
||||
if err != nil {
|
||||
ctx.SendChain(message.Text("ERROR:", err))
|
||||
return
|
||||
}
|
||||
f.Write(data)
|
||||
f.Close()
|
||||
ctx.SendChain(message.Image("file:///" + file.BOTPATH + "/" + n))
|
||||
}
|
||||
})
|
||||
}
|
||||
|
||||
func getPara(ctx *zero.Ctx) bool {
|
||||
next := zero.NewFutureEvent("message", 999, false, zero.CheckUser(ctx.Event.UserID))
|
||||
recv, cancel := next.Repeat()
|
||||
i := 0
|
||||
paras := [2]int{}
|
||||
ctx.SendChain(message.Text("请输入模型序号\n0.", scale.Models[0], "\n1.", scale.Models[1], "\n2.", scale.Models[2], "\n3.", scale.Models[3], "\n4.", scale.Models[4]))
|
||||
for {
|
||||
select {
|
||||
case <-time.After(time.Second * 120):
|
||||
return false
|
||||
case e := <-recv:
|
||||
msg := e.Message.ExtractPlainText()
|
||||
num, err := strconv.Atoi(msg)
|
||||
if err != nil {
|
||||
ctx.SendChain(message.Text("请输入数字!"))
|
||||
continue
|
||||
}
|
||||
switch i {
|
||||
case 0:
|
||||
if num < 0 || num > 4 {
|
||||
ctx.SendChain(message.Text("模型序号非法!"))
|
||||
continue
|
||||
}
|
||||
paras[0] = num
|
||||
ctx.SendChain(message.Text("请输入放大倍数(2-4)"))
|
||||
case 1:
|
||||
if num < 2 || num > 4 {
|
||||
ctx.SendChain(message.Text("放大倍数非法!"))
|
||||
continue
|
||||
}
|
||||
cancel()
|
||||
paras[1] = num
|
||||
ctx.State["scale_paras"] = paras
|
||||
return true
|
||||
}
|
||||
i++
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -8,6 +8,8 @@ import (
|
||||
"github.com/FloatTech/zbputils/file"
|
||||
"github.com/FloatTech/zbputils/process"
|
||||
"github.com/FloatTech/zbputils/txt2img"
|
||||
|
||||
"github.com/FloatTech/ZeroBot-Plugin/order"
|
||||
)
|
||||
|
||||
const (
|
||||
@@ -22,6 +24,7 @@ var sdb *scoredb
|
||||
// 加载数据库
|
||||
func init() {
|
||||
go func() {
|
||||
defer order.DoneOnExit()()
|
||||
process.SleepAbout1sTo2s()
|
||||
_, err := file.GetLazyData(txt2img.BoldFontFile, false, true)
|
||||
if err != nil {
|
||||
|
||||
@@ -55,6 +55,7 @@ func init() { // 插件主体
|
||||
_ = os.MkdirAll("data/SetuTime", 0755)
|
||||
|
||||
go func() {
|
||||
defer order.DoneOnExit()()
|
||||
process.SleepAbout1sTo2s()
|
||||
// 如果数据库不存在则下载
|
||||
_, _ = fileutil.GetLazyData(pool.db.DBPath, false, false)
|
||||
|
||||
@@ -3,20 +3,15 @@ package sleepmanage
|
||||
import (
|
||||
"os"
|
||||
|
||||
log "github.com/sirupsen/logrus"
|
||||
|
||||
"github.com/FloatTech/zbputils/process"
|
||||
|
||||
"github.com/FloatTech/ZeroBot-Plugin/order"
|
||||
"github.com/FloatTech/ZeroBot-Plugin/plugin_sleep_manage/model"
|
||||
)
|
||||
|
||||
func init() {
|
||||
go func() {
|
||||
defer func() {
|
||||
if err := recover(); err != nil {
|
||||
log.Println(err)
|
||||
}
|
||||
}()
|
||||
defer order.DoneOnExit()()
|
||||
process.SleepAbout1sTo2s()
|
||||
_ = os.MkdirAll(dbpath, 0755)
|
||||
model.Initialize(dbfile)
|
||||
|
||||
@@ -6,11 +6,13 @@ import (
|
||||
|
||||
"github.com/FloatTech/zbputils/process"
|
||||
|
||||
"github.com/FloatTech/ZeroBot-Plugin/order"
|
||||
"github.com/FloatTech/ZeroBot-Plugin/plugin_vtb_quotation/model"
|
||||
)
|
||||
|
||||
func init() {
|
||||
go func() {
|
||||
defer order.DoneOnExit()()
|
||||
process.SleepAbout1sTo2s()
|
||||
log.Println("[vtb/cron] 开启vtb数据库日常更新")
|
||||
vtbDaily()
|
||||
|
||||
@@ -5,11 +5,14 @@ import (
|
||||
|
||||
"github.com/FloatTech/zbputils/file"
|
||||
"github.com/FloatTech/zbputils/process"
|
||||
|
||||
"github.com/FloatTech/ZeroBot-Plugin/order"
|
||||
)
|
||||
|
||||
// 加载数据库
|
||||
func init() {
|
||||
go func() {
|
||||
defer order.DoneOnExit()()
|
||||
process.SleepAbout1sTo2s()
|
||||
_ = os.MkdirAll(dbpath, 0755)
|
||||
_, _ = file.GetLazyData(dbfile, false, false)
|
||||
|
||||
Reference in New Issue
Block a user