This commit is contained in:
Alan Mosko 2023-09-06 16:11:59 -03:00 committed by GitHub
parent 5bc33ac654
commit d47cc5d5f4
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
3 changed files with 4 additions and 6 deletions

View File

@ -11,7 +11,7 @@ let io: SocketIO;
const cors = configService.get<Cors>('CORS').ORIGIN;
export const initIO = (httpServer: Server) => {
if (configService.get<Websocket>('WEBSOCKET').ENABLED) {
if (configService.get<Websocket>('WEBSOCKET')?.ENABLED) {
io = new SocketIO(httpServer, {
cors: {
origin: cors,

View File

@ -89,7 +89,7 @@ function bootstrap() {
initIO(server);
if (configService.get<Rabbitmq>('RABBITMQ').ENABLED) initAMQP();
if (configService.get<Rabbitmq>('RABBITMQ')?.ENABLED) initAMQP();
onUnexpectedError();
}

View File

@ -637,7 +637,7 @@ export class WAStartupService {
}
}
if (this.configService.get<Websocket>('WEBSOCKET').ENABLED && this.localWebsocket.enabled) {
if (this.configService.get<Websocket>('WEBSOCKET')?.ENABLED && this.localWebsocket.enabled) {
this.logger.verbose('Sending data to websocket on channel: ' + this.instance.name);
if (Array.isArray(websocketLocal) && websocketLocal.includes(we)) {
this.logger.verbose('Sending data to websocket on event: ' + event);
@ -1844,8 +1844,7 @@ export class WAStartupService {
private async sendMessageWithTyping<T = proto.IMessage>(number: string, message: T, options?: Options) {
this.logger.verbose('Sending message with typing');
const numberWA = await this.whatsappNumber({ numbers: [number] });
const isWA = numberWA[0];
const isWA = (await this.whatsappNumber({ numbers: [number] }))?.shift();
if (!isWA.exists && !isJidGroup(isWA.jid) && !isWA.jid.includes('@broadcast')) {
throw new BadRequestException(isWA);
@ -1911,7 +1910,6 @@ export class WAStartupService {
const jid = this.createJid(mention);
if (isJidGroup(jid)) {
return null;
// throw new BadRequestException('Mentions must be a number');
}
return jid;
});