Преглед на файлове

polished echo recording event and other type of message as well.

master
Patrick Peng Sun преди 8 години
родител
ревизия
7847366606
променени са 1 файла, в които са добавени 9 реда и са изтрити 3 реда
  1. +9
    -3
      procEcho.go

+ 9
- 3
procEcho.go Целия файл

@@ -85,6 +85,7 @@ func echoCommand(ss *openIDSessionData, in InWechatMsg) {
m := in.body.(PicMsg)
str = buildPicMsg(openID, m.MediaId)
in.replyXML(str)
procEchoRecordMsg(ss, "图片:..")
case VoiceMsg:
m := in.body.(VoiceMsg)
str = buildVoiceMsg(openID, m.MediaId)
@@ -95,10 +96,12 @@ func echoCommand(ss *openIDSessionData, in InWechatMsg) {
m := in.body.(VideoMsg)
str = buildVideoMsg(openID, "e2iNEiSxCX5TV1WbFd0TQMn5lilY3bylh1--lDBwi7I", "航拍春日哈工大", m.MediaId)
in.replyXML(str)
procEchoRecordMsg(ss, "视频:..")
case ShortVideoMsg:
m := in.body.(ShortVideoMsg)
str = buildVideoMsg(openID, "e2iNEiSxCX5TV1WbFd0TQMn5lilY3bylh1--lDBwi7I", "航拍春日哈工大", m.MediaId)
in.replyXML(str)
procEchoRecordMsg(ss, "小视频:..")
case LocationMsg:
m := in.body.(LocationMsg)
mid := location2MediaID(m.Location_X, m.Location_Y)
@@ -106,13 +109,15 @@ func echoCommand(ss *openIDSessionData, in InWechatMsg) {
in.replyXML(str)
url := location2URL(m.Location_X, m.Location_Y)
kfSendTxt(openID, url+"\n"+fmt.Sprintf("long=%f, lat=%f, scale=%d", m.Location_X, m.Location_Y, m.Scale))
procEchoRecordMsg(ss, "坐标:..")
case LinkMsg:
m := in.body.(LinkMsg)
str, _ = BuildTextMsg(openID, m.Url)
in.replyXML(str)
kfSendTxt(openID, m.Title+m.Description)
procEchoRecordMsg(ss, "链接:"+m.Title)
case EventMsg:
echoEvents(in)
echoEvents(ss, in)
default:
str, err = BuildTextMsg(openID, "text message")
}
@@ -123,11 +128,12 @@ func echoCommand(ss *openIDSessionData, in InWechatMsg) {
return
}

func echoEvents(in InWechatMsg) {
func echoEvents(ss *openIDSessionData, in InWechatMsg) {
openID := in.header.FromUserName
str := ""
m := in.body.(EventMsg)
log.Println("Event = " + m.Event)
//log.Println("Event = " + m.Event)
procEchoRecordMsg(ss, "事件:"+m.Event)
switch m.Event {
case "LOCATION":
mid := location2MediaID(m.Latitude, m.Longitude)

Loading…
Отказ
Запис