From 7548458892d97ce7011532f16fc18661bfc556a7 Mon Sep 17 00:00:00 2001 From: Patrick Peng Sun Date: Mon, 10 Jul 2017 16:00:10 +1000 Subject: [PATCH] echo adding voice content to summary. --- procEcho.go | 12 +++++++----- 1 file changed, 7 insertions(+), 5 deletions(-) diff --git a/procEcho.go b/procEcho.go index 2420d56..546b6c1 100644 --- a/procEcho.go +++ b/procEcho.go @@ -63,7 +63,7 @@ func echoSummary(ss *openIDSessionData) { } func echoInto(ss *openIDSessionData) { - kfSendTxt(ss.OpenID, "10 分钟没有输入之后 Echo将自动结束,\n输入 [结束Echo] 清除Echo模式") + kfSendTxt(ss.OpenID, "10分钟静默之后 Echo将自动结束,\n输入 [结束Echo],或者语音 ‘退出退出', 清除Echo模式") } func echoCommand(ss *openIDSessionData, in InWechatMsg) { @@ -75,7 +75,7 @@ func echoCommand(ss *openIDSessionData, in InWechatMsg) { m := in.body.(TextMsg) str, err = BuildTextMsg(openID, m.Content+"\n\n关键词 [转接] 将后续信息都转接到 客服 测试版") msg := ss.getVal("msg") - msg = msg + m.Content + msg = msg + m.Content + "\n" ss.setKvPair("msg", msg) in.replyXML(str) case PicMsg: @@ -86,6 +86,9 @@ func echoCommand(ss *openIDSessionData, in InWechatMsg) { m := in.body.(VoiceMsg) str = buildVoiceMsg(openID, m.MediaId) in.replyXML(str) + msg := ss.getVal("msg") + msg = msg + m.Recognition + "\n" + ss.setKvPair("msg", msg) kfSendTxt(openID, "翻译结果:"+m.Recognition) case VideoMsg: m := in.body.(VideoMsg) @@ -98,11 +101,10 @@ func echoCommand(ss *openIDSessionData, in InWechatMsg) { case LocationMsg: m := in.body.(LocationMsg) mid := location2MediaID(m.Location_X, m.Location_Y) - str, _ = BuildTextMsg(openID, fmt.Sprintf("long=%f, lat=%f, scale=%d", m.Location_X, m.Location_Y, m.Scale)) - in.replyXML(str) str = buildPicMsg(openID, mid) + in.replyXML(str) url := location2URL(m.Location_X, m.Location_Y) - kfSendTxt(openID, url) + kfSendTxt(openID, url+"\n"+fmt.Sprintf("long=%f, lat=%f, scale=%d", m.Location_X, m.Location_Y, m.Scale)) case LinkMsg: m := in.body.(LinkMsg) str, _ = BuildTextMsg(openID, m.Url)