Skip to content

Commit c8c73e0

Browse files
authored
feat: Group support sending emoticon messages (#552)
1. #501 添加了表情支持,relations.go 中遗漏了对应方法添加 2. 部分文档未对 表情、视频 api 文档进行维护
1 parent fba9c35 commit c8c73e0

File tree

4 files changed

+57
-5
lines changed

4 files changed

+57
-5
lines changed

docs/message.md

Lines changed: 21 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -174,14 +174,34 @@ msg.IsSendByGroup()
174174
msg.ReplyText("hello")
175175
```
176176

177+
#### 回复表情信息
178+
179+
```go
180+
// 如果你不知道表情 md5 值但你有原文件
181+
emoticon, _ := os.Open("your Emoticon path")
182+
defer emoticon.Close()
183+
msg.ReplyEmoticon("", emoticon)
184+
185+
// 如果你有表情 md5,并且微信服务器包含该表情
186+
msg.ReplyEmoticon("md5 string", nil)
187+
```
188+
177189
#### 回复图片消息
178190

179191
```go
180-
img, _ := os.Open("your file path")
192+
img, _ := os.Open("your img path")
181193
defer img.Close()
182194
msg.ReplyImage(img)
183195
```
184196

197+
#### 回复视频消息
198+
199+
```go
200+
video, _ := os.Open("your video path")
201+
defer video.Close()
202+
msg.ReplyVideo(video)
203+
```
204+
185205
#### 回复文件消息
186206

187207
```go

docs/user.md

Lines changed: 27 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -606,6 +606,33 @@ group.SendImage(img)
606606

607607

608608

609+
#### 发送表情信息
610+
611+
```go
612+
// 如果你不知道表情 md5 值但你有原文件
613+
emoticon, _ := os.Open("your Emoticon path")
614+
615+
defer emoticon.Close()
616+
617+
group.SendEmoticon("", emoticon)
618+
619+
// 如果你有表情 md5,并且微信服务器包含该表情
620+
group.SendEmoticon("md5 string", nil)
621+
```
622+
623+
624+
#### 发送视频信息
625+
626+
```go
627+
video, _ := os.Open("your video path")
628+
629+
defer video.Close()
630+
631+
group.SendVideo(img)
632+
```
633+
634+
635+
609636
#### 发送文件消息
610637

611638
```go

relations.go

Lines changed: 8 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -181,17 +181,22 @@ func (g *Group) String() string {
181181
return fmt.Sprintf("<Group:%s>", g.NickName)
182182
}
183183

184-
// SendText 发行文本消息给当前的群组
184+
// SendText 发送文本消息给当前的群组
185185
func (g *Group) SendText(content string) (*SentMessage, error) {
186186
return g.Self().SendTextToGroup(g, content)
187187
}
188188

189-
// SendImage 发行图片消息给当前的群组
189+
// SendImage 发送图片消息给当前的群组
190190
func (g *Group) SendImage(file io.Reader) (*SentMessage, error) {
191191
return g.Self().SendImageToGroup(g, file)
192192
}
193193

194-
// SendVideo 发行视频消息给当前的群组
194+
// SendEmoticon 发送表情消息给当前的群组
195+
func (g *Group) SendEmoticon(md5 string, file io.Reader) (*SentMessage, error) {
196+
return g.Self().SendEmoticonToGroup(g, md5, file)
197+
}
198+
199+
// SendVideo 发送视频消息给当前的群组
195200
func (g *Group) SendVideo(file io.Reader) (*SentMessage, error) {
196201
return g.Self().SendVideoToGroup(g, file)
197202
}

user.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -601,7 +601,7 @@ func (s *Self) SendImageToGroup(group *Group, file io.Reader) (*SentMessage, err
601601
return s.sendImageToUser(group.User.UserName, file)
602602
}
603603

604-
// SendImageToGroup 发送图片消息给群组
604+
// SendEmoticonToGroup 发送图片消息给群组
605605
func (s *Self) SendEmoticonToGroup(group *Group, md5 string, file io.Reader) (*SentMessage, error) {
606606
return s.sendEmoticonToUser(group.User.UserName, md5, file)
607607
}

0 commit comments

Comments
 (0)