✏️ 修复 vtb panic 判断失误

This commit is contained in:
fumiama 2021-11-22 22:33:29 +08:00
parent fa063a05f7
commit 12f96bb95c

View File

@ -7,12 +7,15 @@ import (
"os" "os"
"github.com/FloatTech/ZeroBot-Plugin/utils/file" "github.com/FloatTech/ZeroBot-Plugin/utils/file"
"github.com/FloatTech/ZeroBot-Plugin/utils/process"
) )
const pburl = "https://codechina.csdn.net/u011570312/ZeroBot-Plugin/-/raw/master/" + dbfile const pburl = "https://codechina.csdn.net/u011570312/ZeroBot-Plugin/-/raw/master/" + dbfile
// 加载数据库 // 加载数据库
func init() { func init() {
go func() {
process.SleepAbout1sTo2s()
_ = os.MkdirAll(dbpath, 0755) _ = os.MkdirAll(dbpath, 0755)
if !file.IsExist(dbfile) { // 如果没有数据库,则从 url 下载 if !file.IsExist(dbfile) { // 如果没有数据库,则从 url 下载
f, err := os.Create(dbfile) f, err := os.Create(dbfile)
@ -28,10 +31,12 @@ func init() {
data, err := io.ReadAll(resp.Body) data, err := io.ReadAll(resp.Body)
if err == nil && len(data) > 0 { if err == nil && len(data) > 0 {
_, _ = f.Write(data) _, _ = f.Write(data)
return
} }
panic(err) panic(err)
} }
} }
panic(err) panic(err)
} }
}()
} }