优化GetLazyData

This commit is contained in:
源文雨
2022-05-05 13:31:22 +08:00
parent 17a8c10f8c
commit a8fba6e7b5
23 changed files with 46 additions and 74 deletions

View File

@@ -8,7 +8,6 @@ import (
"github.com/FloatTech/zbputils/control"
"github.com/FloatTech/zbputils/ctxext"
"github.com/FloatTech/zbputils/file"
)
func init() {
@@ -20,10 +19,9 @@ func init() {
en.OnRegex("^抽象翻译((\\s|[\\r\\n]|[\\p{Han}\\p{P}A-Za-z0-9])+)$",
ctxext.DoOnceOnSuccess(func(ctx *zero.Ctx) bool {
dbpath := en.DataFolder()
db.DBPath = dbpath + "cxh.db"
db.DBPath = en.DataFolder() + "cxh.db"
// os.RemoveAll(dbpath)
_, _ = file.GetLazyData(db.DBPath, false, true)
_, _ = en.GetLazyData("cxh.db", true)
err := db.Create("pinyin", &pinyin{})
if err != nil {
ctx.SendChain(message.Text("ERROR:", err))