Skip to content

Commit 8fccf69

Browse files
committed
Merge branch 'develop' of github.com:EvolutionAPI/evolution-api into develop
2 parents adc8833 + ecbf90d commit 8fccf69

3 files changed

Lines changed: 9 additions & 9 deletions

File tree

src/libs/socket.server.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,7 @@ let io: SocketIO;
1111
const cors = configService.get<Cors>('CORS').ORIGIN;
1212

1313
export const initIO = (httpServer: Server) => {
14-
if (configService.get<Websocket>('WEBSOCKET').ENABLED) {
14+
if (configService.get<Websocket>('WEBSOCKET')?.ENABLED) {
1515
io = new SocketIO(httpServer, {
1616
cors: {
1717
origin: cors,

src/main.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -125,7 +125,7 @@ function bootstrap() {
125125

126126
initIO(server);
127127

128-
if (configService.get<Rabbitmq>('RABBITMQ').ENABLED) initAMQP();
128+
if (configService.get<Rabbitmq>('RABBITMQ')?.ENABLED) initAMQP();
129129

130130
onUnexpectedError();
131131
}

src/whatsapp/services/whatsapp.service.ts

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -711,7 +711,7 @@ export class WAStartupService {
711711
}
712712
}
713713

714-
if (this.configService.get<Websocket>('WEBSOCKET').ENABLED && this.localWebsocket.enabled) {
714+
if (this.configService.get<Websocket>('WEBSOCKET')?.ENABLED && this.localWebsocket.enabled) {
715715
this.logger.verbose('Sending data to websocket on channel: ' + this.instance.name);
716716
if (Array.isArray(websocketLocal) && websocketLocal.includes(we)) {
717717
this.logger.verbose('Sending data to websocket on event: ' + event);
@@ -1954,9 +1954,10 @@ export class WAStartupService {
19541954
private async sendMessageWithTyping<T = proto.IMessage>(number: string, message: T, options?: Options) {
19551955
this.logger.verbose('Sending message with typing');
19561956

1957-
const numberWA = await this.whatsappNumber({ numbers: [number] });
1958-
const isWA = numberWA[0];
1957+
this.logger.verbose(`Check if number "${number}" is WhatsApp`);
1958+
const isWA = (await this.whatsappNumber({ numbers: [number] }))?.shift();
19591959

1960+
this.logger.verbose(`Exists: "${isWA.exists}" | jid: ${isWA.jid}`);
19601961
if (!isWA.exists && !isJidGroup(isWA.jid) && !isWA.jid.includes('@broadcast')) {
19611962
throw new BadRequestException(isWA);
19621963
}
@@ -2000,9 +2001,9 @@ export class WAStartupService {
20002001
let mentions: string[];
20012002
if (isJidGroup(sender)) {
20022003
try {
2003-
const groupMetadata = await this.client.groupMetadata(sender);
2004+
const group = await this.findGroup({ groupJid: sender }, 'inner');
20042005

2005-
if (!groupMetadata) {
2006+
if (!group) {
20062007
throw new NotFoundException('Group not found');
20072008
}
20082009

@@ -2013,15 +2014,14 @@ export class WAStartupService {
20132014
this.logger.verbose('Mentions everyone');
20142015

20152016
this.logger.verbose('Getting group metadata');
2016-
mentions = groupMetadata.participants.map((participant) => participant.id);
2017+
mentions = group.participants.map((participant) => participant.id);
20172018
this.logger.verbose('Getting group metadata for mentions');
20182019
} else if (options.mentions?.mentioned?.length) {
20192020
this.logger.verbose('Mentions manually defined');
20202021
mentions = options.mentions.mentioned.map((mention) => {
20212022
const jid = this.createJid(mention);
20222023
if (isJidGroup(jid)) {
20232024
return null;
2024-
// throw new BadRequestException('Mentions must be a number');
20252025
}
20262026
return jid;
20272027
});

0 commit comments

Comments
 (0)