Skip to content

Commit

Permalink
修复超40人拉入群聊报错的问题 (#406)
Browse files Browse the repository at this point in the history
  • Loading branch information
757368663 authored Sep 25, 2023
1 parent 00c5599 commit 8771ebf
Show file tree
Hide file tree
Showing 3 changed files with 5 additions and 1 deletion.
2 changes: 2 additions & 0 deletions caller.go
Original file line number Diff line number Diff line change
Expand Up @@ -460,6 +460,7 @@ type CallerAddFriendIntoChatRoomOptions struct {
BaseRequest *BaseRequest
LoginInfo *LoginInfo
Group *Group
GroupLength int
Friends []*Friend
}

Expand All @@ -476,6 +477,7 @@ func (c *Caller) AddFriendIntoChatRoom(ctx context.Context, opt *CallerAddFriend
BaseRequest: opt.BaseRequest,
LoginInfo: opt.LoginInfo,
Group: opt.Group.UserName,
GroupLength: opt.GroupLength,
InviteMemberList: inviteMemberList,
}
resp, err := c.Client.AddMemberIntoChatRoom(ctx, clientAddMemberIntoChatRoomOption)
Expand Down
3 changes: 2 additions & 1 deletion client.go
Original file line number Diff line number Diff line change
Expand Up @@ -824,14 +824,15 @@ func (c *Client) Logout(ctx context.Context, info *LoginInfo) (*http.Response, e

type ClientAddMemberIntoChatRoomOption struct {
Group string
GroupLength int
InviteMemberList []string
BaseRequest *BaseRequest
LoginInfo *LoginInfo
}

// AddMemberIntoChatRoom 添加用户进群聊
func (c *Client) AddMemberIntoChatRoom(ctx context.Context, opt *ClientAddMemberIntoChatRoomOption) (*http.Response, error) {
if len(opt.InviteMemberList) >= 40 {
if opt.GroupLength >= 40 {
return c.InviteMemberIntoChatRoom(ctx, opt)
}
return c.addMemberIntoChatRoom(ctx, opt)
Expand Down
1 change: 1 addition & 0 deletions user.go
Original file line number Diff line number Diff line change
Expand Up @@ -509,6 +509,7 @@ func (s *Self) AddFriendsIntoGroup(group *Group, friends ...*Friend) error {
BaseRequest: s.bot.Storage.Request,
LoginInfo: s.bot.Storage.LoginInfo,
Group: group,
GroupLength: groupMembers.Count(),
Friends: friends,
}
return s.bot.Caller.AddFriendIntoChatRoom(s.Bot().Context(), opt)
Expand Down

0 comments on commit 8771ebf

Please sign in to comment.