mirror of
https://github.com/eatmoreapple/openwechat.git
synced 2026-04-22 23:07:16 +08:00
feat: Group support sending emoticon messages (#552)
1. #501 添加了表情支持,relations.go 中遗漏了对应方法添加 2. 部分文档未对 表情、视频 api 文档进行维护
This commit is contained in:
+21
-1
@@ -174,14 +174,34 @@ msg.IsSendByGroup()
|
||||
msg.ReplyText("hello")
|
||||
```
|
||||
|
||||
#### 回复表情信息
|
||||
|
||||
```go
|
||||
// 如果你不知道表情 md5 值但你有原文件
|
||||
emoticon, _ := os.Open("your Emoticon path")
|
||||
defer emoticon.Close()
|
||||
msg.ReplyEmoticon("", emoticon)
|
||||
|
||||
// 如果你有表情 md5,并且微信服务器包含该表情
|
||||
msg.ReplyEmoticon("md5 string", nil)
|
||||
```
|
||||
|
||||
#### 回复图片消息
|
||||
|
||||
```go
|
||||
img, _ := os.Open("your file path")
|
||||
img, _ := os.Open("your img path")
|
||||
defer img.Close()
|
||||
msg.ReplyImage(img)
|
||||
```
|
||||
|
||||
#### 回复视频消息
|
||||
|
||||
```go
|
||||
video, _ := os.Open("your video path")
|
||||
defer video.Close()
|
||||
msg.ReplyVideo(video)
|
||||
```
|
||||
|
||||
#### 回复文件消息
|
||||
|
||||
```go
|
||||
|
||||
@@ -606,6 +606,33 @@ group.SendImage(img)
|
||||
|
||||
|
||||
|
||||
#### 发送表情信息
|
||||
|
||||
```go
|
||||
// 如果你不知道表情 md5 值但你有原文件
|
||||
emoticon, _ := os.Open("your Emoticon path")
|
||||
|
||||
defer emoticon.Close()
|
||||
|
||||
group.SendEmoticon("", emoticon)
|
||||
|
||||
// 如果你有表情 md5,并且微信服务器包含该表情
|
||||
group.SendEmoticon("md5 string", nil)
|
||||
```
|
||||
|
||||
|
||||
#### 发送视频信息
|
||||
|
||||
```go
|
||||
video, _ := os.Open("your video path")
|
||||
|
||||
defer video.Close()
|
||||
|
||||
group.SendVideo(img)
|
||||
```
|
||||
|
||||
|
||||
|
||||
#### 发送文件消息
|
||||
|
||||
```go
|
||||
|
||||
+8
-3
@@ -181,17 +181,22 @@ func (g *Group) String() string {
|
||||
return fmt.Sprintf("<Group:%s>", g.NickName)
|
||||
}
|
||||
|
||||
// SendText 发行文本消息给当前的群组
|
||||
// SendText 发送文本消息给当前的群组
|
||||
func (g *Group) SendText(content string) (*SentMessage, error) {
|
||||
return g.Self().SendTextToGroup(g, content)
|
||||
}
|
||||
|
||||
// SendImage 发行图片消息给当前的群组
|
||||
// SendImage 发送图片消息给当前的群组
|
||||
func (g *Group) SendImage(file io.Reader) (*SentMessage, error) {
|
||||
return g.Self().SendImageToGroup(g, file)
|
||||
}
|
||||
|
||||
// SendVideo 发行视频消息给当前的群组
|
||||
// SendEmoticon 发送表情消息给当前的群组
|
||||
func (g *Group) SendEmoticon(md5 string, file io.Reader) (*SentMessage, error) {
|
||||
return g.Self().SendEmoticonToGroup(g, md5, file)
|
||||
}
|
||||
|
||||
// SendVideo 发送视频消息给当前的群组
|
||||
func (g *Group) SendVideo(file io.Reader) (*SentMessage, error) {
|
||||
return g.Self().SendVideoToGroup(g, file)
|
||||
}
|
||||
|
||||
@@ -601,7 +601,7 @@ func (s *Self) SendImageToGroup(group *Group, file io.Reader) (*SentMessage, err
|
||||
return s.sendImageToUser(group.User.UserName, file)
|
||||
}
|
||||
|
||||
// SendImageToGroup 发送图片消息给群组
|
||||
// SendEmoticonToGroup 发送图片消息给群组
|
||||
func (s *Self) SendEmoticonToGroup(group *Group, md5 string, file io.Reader) (*SentMessage, error) {
|
||||
return s.sendEmoticonToUser(group.User.UserName, md5, file)
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user