From 07ab80dfa771b71311d268b5399b5091a470ee92 Mon Sep 17 00:00:00 2001 From: rianli Date: Mon, 25 Nov 2024 09:35:09 +0000 Subject: [PATCH] =?UTF-8?q?=E4=BF=AE=E5=A4=8Dexamples/receive-and-send?= =?UTF-8?q?=E9=85=8D=E7=BD=AE=E5=8A=A0=E8=BD=BD=E9=80=BB=E8=BE=91=20(merge?= =?UTF-8?q?=20request=20!101)?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Squash merge branch 'fix_20241122_demo_recevie_and_send' into 'master' 修复examples/receive-and-send配置加载逻辑 --- dto/webhook.go | 5 +- examples/apitest/main_test.go | 2 +- examples/{apitest => }/config.yaml.demo | 0 examples/custom-filter/config.yaml.demo | 3 -- examples/custom-logger/config.yaml.demo | 3 -- examples/custom-logger/main.go | 1 - examples/go.mod | 5 +- examples/go.sum | 2 + examples/img.png | Bin 3892 -> 0 bytes examples/receive-and-send/config.yaml.demo | 3 -- examples/receive-and-send/main.go | 5 +- .../config.yaml.demo | 3 -- examples/simulate-callback-request/main.go | 4 +- interaction/signature/interaction_test.go | 51 ++++++++++++------ interaction/webhook/webhook.go | 2 +- 15 files changed, 45 insertions(+), 44 deletions(-) rename examples/{apitest => }/config.yaml.demo (100%) delete mode 100644 examples/custom-filter/config.yaml.demo delete mode 100644 examples/custom-logger/config.yaml.demo delete mode 100644 examples/img.png delete mode 100644 examples/receive-and-send/config.yaml.demo delete mode 100644 examples/simulate-callback-request/config.yaml.demo diff --git a/dto/webhook.go b/dto/webhook.go index a53dd52..7ba54d3 100644 --- a/dto/webhook.go +++ b/dto/webhook.go @@ -8,6 +8,7 @@ type WHValidationReq struct { // WHValidationRsp 机器人回调验证响应结果 type WHValidationRsp struct { - PlainToken string `json:"plain_token"` - Signature string `json:"signature"` + PlainToken string `json:"plain_token"` + Signature string `json:"signature"` + DataVersion string `json:"data_version"` //数据格式版本号 } diff --git a/examples/apitest/main_test.go b/examples/apitest/main_test.go index fcab8b7..314b51c 100644 --- a/examples/apitest/main_test.go +++ b/examples/apitest/main_test.go @@ -7,7 +7,7 @@ import ( "testing" "time" - "gopkg.in/yaml.v2" + "gopkg.in/yaml.v3" "github.com/tencent-connect/botgo" "github.com/tencent-connect/botgo/openapi" diff --git a/examples/apitest/config.yaml.demo b/examples/config.yaml.demo similarity index 100% rename from examples/apitest/config.yaml.demo rename to examples/config.yaml.demo diff --git a/examples/custom-filter/config.yaml.demo b/examples/custom-filter/config.yaml.demo deleted file mode 100644 index 0f8790a..0000000 --- a/examples/custom-filter/config.yaml.demo +++ /dev/null @@ -1,3 +0,0 @@ -# 在这个配置文件中补充你的 appid 和 secret,并修改文件名为 config.yaml -appid : -secret : \ No newline at end of file diff --git a/examples/custom-logger/config.yaml.demo b/examples/custom-logger/config.yaml.demo deleted file mode 100644 index 0f8790a..0000000 --- a/examples/custom-logger/config.yaml.demo +++ /dev/null @@ -1,3 +0,0 @@ -# 在这个配置文件中补充你的 appid 和 secret,并修改文件名为 config.yaml -appid : -secret : \ No newline at end of file diff --git a/examples/custom-logger/main.go b/examples/custom-logger/main.go index 808dfa9..e0cf573 100644 --- a/examples/custom-logger/main.go +++ b/examples/custom-logger/main.go @@ -35,7 +35,6 @@ func main() { } // 把新的 logger 设置到 sdk 上,替换掉老的控制台 logger botgo.SetLogger(logger) - content, err := os.ReadFile("config.yaml") if err != nil { log.Fatalln("load config file failed, err:", err) diff --git a/examples/go.mod b/examples/go.mod index 85b0575..9bc4b78 100644 --- a/examples/go.mod +++ b/examples/go.mod @@ -4,9 +4,8 @@ go 1.21 require ( github.com/google/uuid v1.3.0 - github.com/tencent-connect/botgo v0.0.0-00010101000000-000000000000 + github.com/tencent-connect/botgo v0.1.7 go.uber.org/zap v1.19.1 - gopkg.in/yaml.v2 v2.4.0 gopkg.in/yaml.v3 v3.0.1 ) @@ -22,5 +21,3 @@ require ( golang.org/x/oauth2 v0.23.0 // indirect golang.org/x/sync v0.1.0 // indirect ) - -replace github.com/tencent-connect/botgo => ../ diff --git a/examples/go.sum b/examples/go.sum index d8da5c7..3eab351 100644 --- a/examples/go.sum +++ b/examples/go.sum @@ -69,6 +69,8 @@ github.com/stretchr/testify v1.7.1/go.mod h1:6Fq8oRcR53rry900zMqJjRRixrwX3KX962/ github.com/stretchr/testify v1.8.0/go.mod h1:yNjHg4UonilssWZ8iaSj1OCr/vHnekPRkoO+kdMU+MU= github.com/stretchr/testify v1.8.1 h1:w7B6lhMri9wdJUVmEZPGGhZzrYTPvgJArz7wNPgYKsk= github.com/stretchr/testify v1.8.1/go.mod h1:w2LPCIKwWwSfY2zedu0+kehJoqGctiVI29o6fzry7u4= +github.com/tencent-connect/botgo v0.1.7 h1:+RkHW9T4WOBRGQtOcFAO52VvZEKoTXFq162k2xo0Jac= +github.com/tencent-connect/botgo v0.1.7/go.mod h1:oO1sG9ybhXNickvt+CVym5khwQ+uKhTR+IhTqEfOVsI= github.com/tidwall/gjson v1.9.3 h1:hqzS9wAHMO+KVBBkLxYdkEeeFHuqr95GfClRLKlgK0E= github.com/tidwall/gjson v1.9.3/go.mod h1:/wbyibRr2FHMks5tjHJ5F8dMZh3AcwJEMf5vlfC0lxk= github.com/tidwall/match v1.1.1 h1:+Ho715JplO36QYgwN9PGYNhgZvoUSc9X2c80KVTi+GA= diff --git a/examples/img.png b/examples/img.png deleted file mode 100644 index 6e2099d64c4e9987ab9cfd3cc8163aebdb6bc1de..0000000000000000000000000000000000000000 GIT binary patch literal 0 HcmV?d00001 literal 3892 zcmV-456ke0P)YB^#07=G#Bc+} zEfI0c1-CS{GE;NQ3gN~#^&Niy^WS-M&b{}&+v|Mr!J9MxtlvFnX8xITUX5IavO*1g zAw$(76QsjbKigeeeT$? zW0C#s+qYfZn{U49!h;44ipqg4_{0-WxP0!v|NdBc_uO-ji)-Atu?s)-)KgJ9!V*O1 zL!z&Uk_m!>bSG&WOAy-NS10l7ufN9f@sWZMaty)W0LB-D2RKko8ND@dO{eO!K@e)_3S zUi}0iIm?oQg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