Skip to content

Commit 036a8ed

Browse files
fix: Promote All Participants in Create Group
Promote All Participants in Create Group
2 parents 3d8e6f4 + ef4be6a commit 036a8ed

File tree

3 files changed

+13
-2
lines changed

3 files changed

+13
-2
lines changed

src/validate/validate.schema.ts

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -667,6 +667,7 @@ export const createGroupSchema: JSONSchema7 = {
667667
subject: { type: 'string' },
668668
description: { type: 'string' },
669669
profilePicture: { type: 'string' },
670+
promoteParticipants: { type: 'boolean', enum: [true, false] },
670671
participants: {
671672
type: 'array',
672673
minItems: 1,

src/whatsapp/dto/group.dto.ts

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,8 @@
11
export class CreateGroupDto {
22
subject: string;
3-
description?: string;
43
participants: string[];
4+
description?: string;
5+
promoteParticipants?: boolean;
56
}
67

78
export class GroupPictureDto {

src/whatsapp/services/whatsapp.service.ts

Lines changed: 10 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2774,11 +2774,20 @@ export class WAStartupService {
27742774
this.logger.verbose('Updating group description: ' + create.description);
27752775
await this.client.groupUpdateDescription(id, create.description);
27762776
}
2777+
2778+
if (create?.promoteParticipants) {
2779+
this.logger.verbose('Prometing group participants: ' + create.description);
2780+
await this.updateGParticipant({
2781+
groupJid: id,
2782+
action: "promote",
2783+
participants: participants
2784+
});
2785+
}
27772786

27782787
const group = await this.client.groupMetadata(id);
27792788
this.logger.verbose('Getting group metadata');
27802789

2781-
return { groupMetadata: group };
2790+
return group;
27822791
} catch (error) {
27832792
this.logger.error(error);
27842793
throw new InternalServerErrorException('Error creating group', error.toString());

0 commit comments

Comments
 (0)