This commit is contained in:
cdle
2023-07-03 11:10:19 +08:00
parent 681a744e1d
commit c4a870ebaa
6 changed files with 30 additions and 13 deletions
+1 -1
View File
@@ -8,6 +8,6 @@
</head> </head>
<body> <body>
<div id="root"></div> <div id="root"></div>
<script src="/admin/umi.d0eb6c40.js"></script> <script src="/admin/umi.d1959e52.js"></script>
</body></html> </body></html>
File diff suppressed because one or more lines are too long
File diff suppressed because one or more lines are too long
File diff suppressed because one or more lines are too long
+11 -1
View File
@@ -507,7 +507,7 @@ func initPlugin(data string, uuid string) (*common.Function, []func(), error) {
defer func() { defer func() {
err := recover() err := recover()
if err != nil { if err != nil {
pluginConsole(uuid).Error("脚本错误:", err) pluginConsole(uuid).Error(err)
// s.Reply(fmt.Sprint(err)) // s.Reply(fmt.Sprint(err))
} }
}() }()
@@ -627,9 +627,19 @@ func initPlugin(data string, uuid string) (*common.Function, []func(), error) {
running = func() bool { running = func() bool {
return f.Running return f.Running
} }
return f, cbs, err return f, cbs, err
} }
func GetFunctionByUUID(uuid string) *common.Function {
for _, f := range Functions {
if f.UUID == uuid {
return f
}
}
return nil
}
func ChatID(p interface{}) string { func ChatID(p interface{}) string {
switch p := p.(type) { switch p := p.(type) {
case int: case int:
+7
View File
@@ -11,6 +11,7 @@ type PMsg struct {
Class string `json:"class"` Class string `json:"class"`
Unix int `json:"unix"` Unix int `json:"unix"`
Content string `json:"content"` Content string `json:"content"`
Version string `json:"version"`
} }
var plugin_messages = MakeBucket("plugin_messages") var plugin_messages = MakeBucket("plugin_messages")
@@ -19,6 +20,11 @@ func WritePluginMessage(uuid string, class string, content string) {
if uuid == "" { if uuid == "" {
return return
} }
var version = ""
f := GetFunctionByUUID(uuid)
if f != nil {
version = f.Version
}
var data = plugin_messages.GetBytes(uuid) var data = plugin_messages.GetBytes(uuid)
pmsgs := []PMsg{} pmsgs := []PMsg{}
json.Unmarshal(data, &pmsgs) json.Unmarshal(data, &pmsgs)
@@ -28,6 +34,7 @@ func WritePluginMessage(uuid string, class string, content string) {
Class: class, Class: class,
Unix: int(time.Now().Unix()), Unix: int(time.Now().Unix()),
Content: content, Content: content,
Version: version,
} }
for i := range pmsgs { for i := range pmsgs {
if pmsgs[i].Class != class { if pmsgs[i].Class != class {