mirror of
https://github.com/EvolutionAPI/evolution-api.git
synced 2025-07-14 01:41:24 -06:00
fix: Added group membership validation before sending message to groups
This commit is contained in:
parent
b9eb8d45b2
commit
c00f132145
@ -7,6 +7,7 @@
|
||||
* Fixed in the postman collection the webhookByEvent parameter by webhook_by_events
|
||||
* Now it's getting the API URL directly in the request, no longer need the variable in the env file
|
||||
* Removed link preview endpoint, now it's done automatically from sending conventional text
|
||||
* Added group membership validation before sending message to groups
|
||||
|
||||
# 1.2.2 (2023-07-15 09:36)
|
||||
|
||||
|
@ -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 {
|
||||
|
Loading…
Reference in New Issue
Block a user