From 4141982bd09260c72b708946bf152adae5c7f6c0 Mon Sep 17 00:00:00 2001 From: Patrick Peng Sun Date: Tue, 2 May 2017 14:56:13 +1000 Subject: [PATCH] voice recognition test --- server.go | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/server.go b/server.go index 2fdb645..7c75bc4 100644 --- a/server.go +++ b/server.go @@ -61,6 +61,10 @@ func answerWechatPost(w http.ResponseWriter, r *http.Request) { fmt.Printf("decrypt as: %s", d) h := ReadCommonHeader(d) reply, _ := BuildTextMsg(h.MsgType, h.FromUserName) + if h.MsgType == "voice" { + a := ReadVoiceMsg(d) + reply, _ = BuildTextMsg(a.Recognition, h.FromUserName) + } w.Header().Set("Content-Type", "text/xml; charset=utf-8") fmt.Fprint(w, reply) return