From 2e5b932be2842f1d346b2c493fe7c8e0bcc305c0 Mon Sep 17 00:00:00 2001 From: cdle <798731886@qq.com> Date: Wed, 6 Oct 2021 09:56:56 +0800 Subject: [PATCH] update --- core/otto.go | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/core/otto.go b/core/otto.go index 6dcf684..1151980 100644 --- a/core/otto.go +++ b/core/otto.go @@ -144,8 +144,14 @@ func init() { } template = strings.Replace(template, "ImType()", fmt.Sprintf(`"%s"`, s.GetImType()), -1) template = strings.Replace(template, "GetChatID()", fmt.Sprint(s.GetChatID()), -1) + param := func(call otto.Value) otto.Value { + i, _ := call.ToInteger() + v, _ := otto.ToValue(s.Get(int(i - 1))) + return v + } vm := otto.New() vm.Set("set", set) + vm.Set("param", param) vm.Set("get", get) vm.Set("request", request) vm.Set("push", push)