From 2099b1af7ae32e01e24ed5d043b297da990b4eda Mon Sep 17 00:00:00 2001 From: cdle Date: Sat, 3 Jun 2023 20:05:55 +0800 Subject: [PATCH] x --- .gitignore | 3 ++- core/carry.go | 2 +- core/plugin_core.go | 14 +++++++++++--- 3 files changed, 14 insertions(+), 5 deletions(-) diff --git a/.gitignore b/.gitignore index 3b5f058..b6b2eb3 100644 --- a/.gitignore +++ b/.gitignore @@ -28,4 +28,5 @@ develop/core *.db dist/ core/dist -.verysync \ No newline at end of file +.verysync +test \ No newline at end of file diff --git a/core/carry.go b/core/carry.go index 2b33e2e..3b227c5 100644 --- a/core/carry.go +++ b/core/carry.go @@ -378,7 +378,7 @@ func init() { var scripts = map[string]string{} functions := Functions for _, function := range functions { - if function.UUID != "" && len(function.Rules) == 0 && !function.OnStart && !function.Module { + if function.UUID != "" && len(function.Rules) == 0 && !function.OnStart && !function.Module && function.Http == nil && function.Reply == nil { scripts[function.UUID] = function.Title + ".js" } } diff --git a/core/plugin_core.go b/core/plugin_core.go index 79c4f4d..4fcf0d6 100644 --- a/core/plugin_core.go +++ b/core/plugin_core.go @@ -101,7 +101,7 @@ func initPlugins() { continue } script := string(fetchScript(p.Address, key)) - if f, _ := initPlugin(script, p.UUID); f.Cron != "" || f.Module || f.OnStart { + if f, _ := initPlugin(script, p.UUID); f.CreateAt != "" { fin = &storage.Final{ Now: script, } @@ -492,7 +492,7 @@ func initPlugin(data string, uuid string) (*common.Function, error) { f.Init(plt, botid) return f }) - vm.Set("GetAdapter", func(plt, botid string) map[string]interface{} { + getAdapter := func(plt, botid string) map[string]interface{} { adapter, err := GetAdapter(plt, botid) errstr := "" if err != nil { @@ -502,13 +502,21 @@ func initPlugin(data string, uuid string) (*common.Function, error) { "error": errstr, "adapter": adapter, } - }) + } + vm.Set("GetAdapter", getAdapter) + vm.Set("getAdapter", getAdapter) vm.Set("getAdapterBotsID", GetAdapterBotsID) vm.Set("getAdapterBotPlts", GetAdapterBotPlts) + vm.Set("GetAdapterBotsID", GetAdapterBotsID) + vm.Set("GetAdapterBotPlts", GetAdapterBotPlts) vm.Set("running", running) + vm.Set("Running", running) vm.Set("uuid", func() string { return uuid }) + vm.Set("UUID", func() string { + return uuid + }) if set != nil { set(vm) }