diff --git a/procEcho.go b/procEcho.go index fde761d..c1fb8f5 100644 --- a/procEcho.go +++ b/procEcho.go @@ -33,16 +33,27 @@ func echoStart(ss *openIDSessionData, in InWechatMsg) { } func echoServe(ss *openIDSessionData, in InWechatMsg) { + stopEcho := false if in.header.MsgType == "text" { - if in.body.(TextMsg).Content == "结束Echo" { - in.replyText("echo 正式结束") - echoSummary(ss) - echoClean(ss) + if in.body.(TextMsg).Content == "结束Echo" || in.body.(TextMsg).Content == "结束echo" { + stopEcho = true return } } - ss.refreshExpire(600) - echoCommand(ss, in) + if in.header.MsgType == "voice" { + if in.body.(VoiceMsg).Recognition == "退出退出。" { + stopEcho = true + } + } + + if stopEcho { + in.replyText("echo 正式结束") + echoSummary(ss) + echoClean(ss) + } else { + ss.refreshExpire(600) + echoCommand(ss, in) + } }