ZeroBot-Plugin/plugin_chat/data.go
fumiama cb44758036 ✏️ 修复 manager 定时器错误
同时 make lint happy
2021-12-26 14:07:05 +08:00

34 lines
636 B
Go

package chat
import (
"encoding/json"
"os"
"github.com/sirupsen/logrus"
"github.com/FloatTech/ZeroBot-Plugin/utils/file"
"github.com/FloatTech/ZeroBot-Plugin/utils/process"
)
type kimo = map[string]*[]string
func initChatList(postinit func()) {
go func() {
process.SleepAbout1sTo2s()
_ = os.MkdirAll(dbpath, 0755)
data, err := file.GetLazyData(dbfile, true, true)
if err != nil {
panic(err)
}
err = json.Unmarshal(data, &kimomap)
if err != nil {
panic(err)
}
for k := range kimomap {
chatList = append(chatList, k)
}
logrus.Infoln("[chat]加载", len(chatList), "条kimoi")
postinit()
}()
}