mirror of
https://github.com/FloatTech/ZeroBot-Plugin.git
synced 2025-12-20 06:20:08 +08:00
Add files via upload
This commit is contained in:
parent
e7630b5904
commit
6bbcdfcd58
36
plugin_purechat/data.go
Normal file
36
plugin_purechat/data.go
Normal file
@ -0,0 +1,36 @@
|
|||||||
|
package purechat
|
||||||
|
|
||||||
|
import (
|
||||||
|
"encoding/json"
|
||||||
|
"os"
|
||||||
|
|
||||||
|
"github.com/sirupsen/logrus"
|
||||||
|
|
||||||
|
"github.com/FloatTech/zbputils/file"
|
||||||
|
"github.com/FloatTech/zbputils/process"
|
||||||
|
|
||||||
|
"github.com/FloatTech/ZeroBot-Plugin/order"
|
||||||
|
)
|
||||||
|
|
||||||
|
type kimogo = map[string]*[]string
|
||||||
|
|
||||||
|
func initPureChatList(postinit func()) {
|
||||||
|
go func() {
|
||||||
|
defer order.DoneOnExit()()
|
||||||
|
process.SleepAbout1sTo2s()
|
||||||
|
_ = os.MkdirAll(dbpath, 0755)
|
||||||
|
data, err := file.GetLazyData(dbfile, true, true)
|
||||||
|
if err != nil {
|
||||||
|
panic(err)
|
||||||
|
}
|
||||||
|
err = json.Unmarshal(data, &kimogomap)
|
||||||
|
if err != nil {
|
||||||
|
panic(err)
|
||||||
|
}
|
||||||
|
for k := range kimogomap {
|
||||||
|
chatList = append(chatList, k)
|
||||||
|
}
|
||||||
|
logrus.Infoln("[purechat]加载", len(chatList), "条kimoi")
|
||||||
|
postinit()
|
||||||
|
}()
|
||||||
|
}
|
||||||
Loading…
Reference in New Issue
Block a user