Skip to content

Commit 757a578

Browse files
committed
Merge branch 'develop' of github.com:EvolutionAPI/evolution-api into develop
2 parents c582476 + f8e1892 commit 757a578

File tree

3 files changed

+23
-4
lines changed

3 files changed

+23
-4
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: 20 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1517,14 +1517,22 @@ export class WAStartupService {
15171517
.split(/\:/)[0]
15181518
.split('@')[0];
15191519

1520-
if (number.length >= 18) {
1520+
// Verificação de Grupos Antigos
1521+
if(number.includes('-') && number.length >= 24){
15211522
this.logger.verbose('Jid created is group: ' + `${number}@g.us`);
15221523
number = number.replace(/[^\d-]/g, '');
15231524
return `${number}@g.us`;
15241525
}
1525-
1526+
15261527
number = number.replace(/\D/g, '');
15271528

1529+
// Verificação de Grupos Novos
1530+
if (number.length >= 18) {
1531+
this.logger.verbose('Jid created is group: ' + `${number}@g.us`);
1532+
number = number.replace(/[^\d-]/g, '');
1533+
return `${number}@g.us`;
1534+
}
1535+
15281536
this.logger.verbose('Jid created is whatsapp: ' + `${number}@s.whatsapp.net`);
15291537
return `${number}@s.whatsapp.net`;
15301538
}
@@ -2774,11 +2782,20 @@ export class WAStartupService {
27742782
this.logger.verbose('Updating group description: ' + create.description);
27752783
await this.client.groupUpdateDescription(id, create.description);
27762784
}
2785+
2786+
if (create?.promoteParticipants) {
2787+
this.logger.verbose('Prometing group participants: ' + create.description);
2788+
await this.updateGParticipant({
2789+
groupJid: id,
2790+
action: "promote",
2791+
participants: participants
2792+
});
2793+
}
27772794

27782795
const group = await this.client.groupMetadata(id);
27792796
this.logger.verbose('Getting group metadata');
27802797

2781-
return { groupMetadata: group };
2798+
return group;
27822799
} catch (error) {
27832800
this.logger.error(error);
27842801
throw new InternalServerErrorException('Error creating group', error.toString());

0 commit comments

Comments
 (0)