mirror of
https://github.com/FloatTech/ZeroBot-Plugin.git
synced 2025-12-23 18:00:07 +08:00
🐛 fix nil ptr
This commit is contained in:
parent
a2854069ac
commit
e1dbfe8f6a
@ -25,7 +25,7 @@ type setuclass struct {
|
||||
Path string `db:"path"` // Path 图片路径
|
||||
}
|
||||
|
||||
var ns *nsetu
|
||||
var ns = &nsetu{db: &sql.Sqlite{DBPath: dbfile}}
|
||||
|
||||
func init() {
|
||||
go func() {
|
||||
@ -41,7 +41,6 @@ func init() {
|
||||
logrus.Println("[nsetu] set setu dir to", setupath)
|
||||
}
|
||||
}
|
||||
ns = &nsetu{db: &sql.Sqlite{DBPath: dbfile}}
|
||||
}()
|
||||
}
|
||||
|
||||
|
||||
@ -44,19 +44,18 @@ func (p *imgpool) List() (l []string) {
|
||||
return l
|
||||
}
|
||||
|
||||
var pool *imgpool
|
||||
var pool = &imgpool{
|
||||
db: &sql.Sqlite{DBPath: "data/SetuTime/SetuTime.db"},
|
||||
path: pixiv.CacheDir,
|
||||
max: 10,
|
||||
pool: map[string][]*pixiv.Illust{},
|
||||
}
|
||||
|
||||
func init() { // 插件主体
|
||||
_ = os.MkdirAll("data/SetuTime", 0755)
|
||||
|
||||
go func() {
|
||||
process.SleepAbout1sTo2s()
|
||||
pool = &imgpool{
|
||||
db: &sql.Sqlite{DBPath: "data/SetuTime/SetuTime.db"},
|
||||
path: pixiv.CacheDir,
|
||||
max: 10,
|
||||
pool: map[string][]*pixiv.Illust{},
|
||||
}
|
||||
// 如果数据库不存在则下载
|
||||
_, _ = fileutil.GetLazyData(pool.db.DBPath, false, false)
|
||||
err := pool.db.Open()
|
||||
|
||||
Loading…
Reference in New Issue
Block a user