Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Update relations.go #422

Merged
merged 1 commit into from
Nov 3, 2023
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
10 changes: 10 additions & 0 deletions relations.go
Original file line number Diff line number Diff line change
Expand Up @@ -135,6 +135,16 @@ func (f Friends) SendText(text string, delays ...time.Duration) error {
self := f.First().Self()
return self.SendTextToFriends(text, delay, f...)
}
//向所有好友随机时间间隔发送消息。
func (f Friends) BroadcastTextToFriendsByRandomTime(msg string) error {
for _, friend := range f {
time.Sleep(time.Duration(rand.Intn(10)) * time.Second) //随机休眠0-10秒
if _, err := friend.SendText(msg); err != nil {
return err
}
}
return nil
}

// SendImage 向slice的好友依次发送图片消息
func (f Friends) SendImage(file io.Reader, delays ...time.Duration) error {
Expand Down