Skip to content
Open
Show file tree
Hide file tree
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
41 changes: 31 additions & 10 deletions group.go
Original file line number Diff line number Diff line change
Expand Up @@ -1052,16 +1052,37 @@ func (cli *Client) SetGroupMemberAddMode(ctx context.Context, jid types.JID, mod

// SetGroupDescription updates the group description.
func (cli *Client) SetGroupDescription(ctx context.Context, jid types.JID, description string) error {
content := waBinary.Node{
Tag: "description",
Content: []waBinary.Node{
{
Tag: "body",
Content: []byte(description),
},
},
attrs := waBinary.Attrs{}
groupInfo, err := cli.getGroupInfo(ctx, jid, false)
if err != nil {
return err
}

_, err := cli.sendGroupIQ(ctx, iqSet, jid, content)
if description != "" {
attrs["id"] = cli.GenerateMessageID()
} else {
attrs["delete"] = "true"
}

prev := groupInfo.TopicID
if prev != "" {
attrs["prev"] = prev
}

var contentNodes []waBinary.Node
if description != "" {
contentNodes = append(contentNodes, waBinary.Node{
Tag: "body",
Content: []byte(description),
})
}

content := waBinary.Node{
Tag: "description",
Attrs: attrs,
Content: contentNodes,
}

_, err = cli.sendGroupIQ(ctx, iqSet, jid, content)
return err
}
}
72 changes: 72 additions & 0 deletions proto/waStatusAttributions/WAWebProtobufsStatusAttributions.proto
Original file line number Diff line number Diff line change
@@ -0,0 +1,72 @@
syntax = "proto2";
package WAWebProtobufsStatusAttributions;
option go_package = "go.mau.fi/whatsmeow/proto/waStatusAttributions";

message StatusAttribution {
enum Type {
RESHARE = 0;
EXTERNAL_SHARE = 1;
MUSIC = 2;
STATUS_MENTION = 3;
GROUP_STATUS = 4;
}

message ExternalShare {
enum Source {
UNKNOWN = 0;
INSTAGRAM = 1;
FACEBOOK = 2;
MESSENGER = 3;
SPOTIFY = 4;
YOUTUBE = 5;
PINTEREST = 6;
}

optional string actionURL = 1;
optional Source source = 2;
optional int32 duration = 3;
optional string actionFallbackURL = 4;
}

message StatusReshare {
enum Source {
UNKNOWN = 0;
INTERNAL_RESHARE = 1;
MENTION_RESHARE = 2;
CHANNEL_RESHARE = 3;
}

message Metadata {
optional int32 duration = 1;
optional string channelJID = 2;
optional int32 channelMessageID = 3;
optional bool hasMultipleReshares = 4;
}

optional Source source = 1;
optional Metadata metadata = 2;
}

message GroupStatus {
optional string authorJID = 1;
}

message Music {
optional string authorName = 1;
optional string songID = 2;
optional string title = 3;
optional string author = 4;
optional string artistAttribution = 5;
optional bool isExplicit = 6;
}

oneof attributionData {
StatusReshare statusReshare = 3;
ExternalShare externalShare = 4;
Music music = 5;
GroupStatus groupStatus = 6;
}

optional Type type = 1;
optional string actionURL = 2;
}
Loading