mirror of
https://github.com/EvolutionAPI/evolution-api.git
synced 2025-12-18 19:32:21 -06:00
fix: Added group membership validation before sending message to groups
This commit is contained in:
@@ -5,7 +5,6 @@ import {
|
||||
SendAudioDto,
|
||||
SendButtonDto,
|
||||
SendContactDto,
|
||||
SendLinkPreviewDto,
|
||||
SendListDto,
|
||||
SendLocationDto,
|
||||
SendMediaDto,
|
||||
|
||||
@@ -1434,6 +1434,12 @@ export class WAStartupService {
|
||||
let mentions: string[];
|
||||
if (isJidGroup(sender)) {
|
||||
try {
|
||||
const groupMetadata = await this.client.groupMetadata(sender);
|
||||
|
||||
if (!groupMetadata) {
|
||||
throw new NotFoundException('Group not found');
|
||||
}
|
||||
|
||||
if (options?.mentions) {
|
||||
this.logger.verbose('Mentions defined');
|
||||
|
||||
@@ -1448,7 +1454,6 @@ export class WAStartupService {
|
||||
this.logger.verbose('Mentions everyone');
|
||||
|
||||
this.logger.verbose('Getting group metadata');
|
||||
const groupMetadata = await this.client.groupMetadata(sender);
|
||||
mentions = groupMetadata.participants.map((participant) => participant.id);
|
||||
this.logger.verbose('Getting group metadata for mentions');
|
||||
} else {
|
||||
|
||||
Reference in New Issue
Block a user