Skip to content

Commit 93cd62a

Browse files
committed
[WAHA] Provide Participants for Status message
1 parent 55ba9bd commit 93cd62a

File tree

2 files changed

+7
-6
lines changed

2 files changed

+7
-6
lines changed

internals.go

Lines changed: 2 additions & 2 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

send.go

Lines changed: 5 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -140,6 +140,8 @@ type SendRequestExtra struct {
140140
Timeout time.Duration
141141
// When sending media to newsletters, the Handle field returned by the file upload.
142142
MediaHandle string
143+
// When sending status message you can specify the recipients
144+
Participants []types.JID
143145
}
144146

145147
// SendMessage sends the given message.
@@ -294,7 +296,7 @@ func (cli *Client) SendMessage(ctx context.Context, to types.JID, message *waE2E
294296
var data []byte
295297
switch to.Server {
296298
case types.GroupServer, types.BroadcastServer:
297-
phash, data, err = cli.sendGroup(ctx, to, ownID, req.ID, message, &resp.DebugTimings, botNode)
299+
phash, data, err = cli.sendGroup(ctx, to, ownID, req.ID, message, &resp.DebugTimings, botNode, req.Participants)
298300
case types.DefaultUserServer:
299301
if req.Peer {
300302
data, err = cli.sendPeerMessage(to, req.ID, message, &resp.DebugTimings)
@@ -607,16 +609,15 @@ func (cli *Client) sendNewsletter(to types.JID, id types.MessageID, message *waE
607609
return data, nil
608610
}
609611

610-
func (cli *Client) sendGroup(ctx context.Context, to, ownID types.JID, id types.MessageID, message *waE2E.Message, timings *MessageDebugTimings, botNode *waBinary.Node) (string, []byte, error) {
611-
var participants []types.JID
612+
func (cli *Client) sendGroup(ctx context.Context, to, ownID types.JID, id types.MessageID, message *waE2E.Message, timings *MessageDebugTimings, botNode *waBinary.Node, participants []types.JID) (string, []byte, error) {
612613
var err error
613614
start := time.Now()
614615
if to.Server == types.GroupServer {
615616
participants, err = cli.getGroupMembers(ctx, to)
616617
if err != nil {
617618
return "", nil, fmt.Errorf("failed to get group members: %w", err)
618619
}
619-
} else {
620+
} else if len(participants) == 0 {
620621
// TODO use context
621622
participants, err = cli.getBroadcastListParticipants(to)
622623
if err != nil {

0 commit comments

Comments
 (0)