Skip to content

Commit

Permalink
Close issues#16
Browse files Browse the repository at this point in the history
Close issues#16
  • Loading branch information
wizjin committed Sep 7, 2014
1 parent 54ef5cf commit 60221a0
Show file tree
Hide file tree
Showing 2 changed files with 31 additions and 23 deletions.
46 changes: 24 additions & 22 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -71,36 +71,38 @@ func Func(w weixin.ResponseWriter, r *weixin.Request) {

可以注册的处理函数类型有以下几种

* `weixin.MsgTypeText` 接收文本消息
* `weixin.MsgTypeImage` 接收图片消息
* `weixin.MsgTypeVoice` 接收语音消息
* `weixin.MsgTypeVideo` 接收视频消息
* `weixin.MsgTypeLocation` 接收地理位置消息
* `weixin.MsgTypeLink` 接收链接消息
* `weixin.MsgTypeEventSubscribe` 接收关注事件
* `weixin.MsgTypeEventUnsubscribe` 接收取消关注事件
* `weixin.MsgTypeEventScan` 接收扫描二维码事件
* `weixin.MsgTypeEventClick` 接收自定义菜单事件
- `weixin.MsgTypeText` 接收文本消息
- `weixin.MsgTypeImage` 接收图片消息
- `weixin.MsgTypeVoice` 接收语音消息
- `weixin.MsgTypeVideo` 接收视频消息
- `weixin.MsgTypeLocation` 接收地理位置消息
- `weixin.MsgTypeLink` 接收链接消息
- `weixin.MsgTypeEventSubscribe` 接收关注事件
- `weixin.MsgTypeEventUnsubscribe` 接收取消关注事件
- `weixin.MsgTypeEventScan` 接收扫描二维码事件
- `weixin.MsgTypeEventView` 接收点击菜单跳转链接时的事件
- `weixin.MsgTypeEventClick` 接收自定义菜单事件
- `weixin.MsgTypeEventLocation` 接收上报地理位置事件

### 发送被动响应消息

需要发送被动响应消息,可通过`weixin.ResponseWriter`的下列方法完成

* `ReplyText(text)` 回复文本消息
* `ReplyImage(mediaId)` 回复图片消息
* `ReplyVoice(mediaId)` 回复语音消息
* `ReplyVideo(mediaId, title, description)` 回复视频消息
* `ReplyMusic(music)` 回复音乐消息
* `ReplyNews(articles)` 回复图文消息
- `ReplyText(text)` 回复文本消息
- `ReplyImage(mediaId)` 回复图片消息
- `ReplyVoice(mediaId)` 回复语音消息
- `ReplyVideo(mediaId, title, description)` 回复视频消息
- `ReplyMusic(music)` 回复音乐消息
- `ReplyNews(articles)` 回复图文消息

### 发送客服消息

* `PostText(text)` 发送文本消息
* `PostImage(mediaId)` 发送图片消息
* `PostVoice(mediaId)` 发送语音消息
* `PostVideo(mediaId, title, description)` 发送视频消息
* `PostMusic(music)` 发送音乐消息
* `PostNews(articles)` 发送图文消息
- `PostText(text)` 发送文本消息
- `PostImage(mediaId)` 发送图片消息
- `PostVoice(mediaId)` 发送语音消息
- `PostVideo(mediaId, title, description)` 发送视频消息
- `PostMusic(music)` 发送音乐消息
- `PostNews(articles)` 发送图文消息

### 上传/下载多媒体文件

Expand Down
8 changes: 7 additions & 1 deletion weixin.go
Original file line number Diff line number Diff line change
Expand Up @@ -25,8 +25,11 @@ const (
msgEvent = "event"
EventSubscribe = "subscribe"
EventUnsubscribe = "unsubscribe"
EventScan = "scan"
EventScan = "SCAN"
EventView = "VIEW"
EventClick = "CLICK"
EventLocation = "LOCATION"

// Message type
MsgTypeDefault = ".*"
MsgTypeText = "text"
Expand All @@ -39,7 +42,10 @@ const (
MsgTypeEventSubscribe = msgEvent + "\\." + EventSubscribe
MsgTypeEventUnsubscribe = msgEvent + "\\." + EventUnsubscribe
MsgTypeEventScan = msgEvent + "\\." + EventScan
MsgTypeEventView = msgEvent + "\\." + EventView
MsgTypeEventClick = msgEvent + "\\." + EventClick
MsgTypeEventLocation = msgEvent + "\\." + EventLocation

// Media type
MediaTypeImage = "image"
MediaTypeVoice = "voice"
Expand Down

0 comments on commit 60221a0

Please sign in to comment.