添加文件群发和消息撤回功能
This commit is contained in:
parent
b843d9aa8c
commit
e07ab1059a
10
message.go
10
message.go
@ -472,6 +472,16 @@ func (s *SentMessage) Revoke() error {
|
||||
return s.Self.RevokeMessage(s)
|
||||
}
|
||||
|
||||
// 转发该消息给好友
|
||||
func (s *SentMessage) ForwardToFriends(friends ...*Friend) error {
|
||||
return s.Self.ForwardMessageToFriends(s, friends...)
|
||||
}
|
||||
|
||||
// 转发该消息给群组
|
||||
func (s *SentMessage) ForwardToGroups(groups ...*Group) error {
|
||||
return s.Self.ForwardMessageToGroups(s, groups...)
|
||||
}
|
||||
|
||||
type appmsg struct {
|
||||
Type int `xml:"type"`
|
||||
AppId string `xml:"appid,attr"` // wxeb7ec651dd0aefa9
|
||||
|
22
relations.go
22
relations.go
@ -172,6 +172,28 @@ func (f Friends) SendImage(file *os.File, delay ...time.Duration) error {
|
||||
return nil
|
||||
}
|
||||
|
||||
// 群发文件
|
||||
func (f Friends)SendFile(file *os.File, delay ...time.Duration) error {
|
||||
total := getTotalDuration(delay...)
|
||||
var (
|
||||
sentMessage *SentMessage
|
||||
err error
|
||||
self *Self
|
||||
)
|
||||
for _, friend := range f {
|
||||
self = friend.Self
|
||||
time.Sleep(total)
|
||||
if sentMessage != nil {
|
||||
err = self.ForwardMessageToFriends(sentMessage, f...)
|
||||
return err
|
||||
}
|
||||
if sentMessage, err = friend.SendFile(file); err != nil {
|
||||
return err
|
||||
}
|
||||
}
|
||||
return nil
|
||||
}
|
||||
|
||||
type Group struct{ *User }
|
||||
|
||||
// implement fmt.Stringer
|
||||
|
Loading…
x
Reference in New Issue
Block a user