ZeroBot-Plugin/plugin_chat/data.go
2021-12-21 22:09:43 +08:00

28 lines
504 B
Go

package chat
import (
"encoding/json"
"os"
"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)
}
json.Unmarshal(data, &kimomap)
for k := range kimomap {
chatList = append(chatList, k)
}
postinit()
}()
}