mirror of
https://github.com/EvolutionAPI/evolution-api.git
synced 2025-12-19 03:42:23 -06:00
fix: new version baileys
This commit is contained in:
@@ -1,4 +1,4 @@
|
||||
import { BufferJSON } from '@whiskeysockets/baileys';
|
||||
import { BufferJSON } from 'baileys';
|
||||
|
||||
import { Logger } from '../../config/logger.config';
|
||||
import { ICache } from '../abstract/abstract.cache';
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
import { WASocket } from '@whiskeysockets/baileys';
|
||||
import axios from 'axios';
|
||||
import { WASocket } from 'baileys';
|
||||
import { execSync } from 'child_process';
|
||||
import { isURL } from 'class-validator';
|
||||
import EventEmitter2 from 'eventemitter2';
|
||||
@@ -38,17 +38,17 @@ import { waMonitor } from '../server.module';
|
||||
import { Events, wa } from '../types/wa.types';
|
||||
import { CacheService } from './cache.service';
|
||||
|
||||
export class WAStartupService {
|
||||
export class ChannelStartupService {
|
||||
constructor(
|
||||
public readonly configService: ConfigService,
|
||||
public readonly eventEmitter: EventEmitter2,
|
||||
public readonly repository: RepositoryBroker,
|
||||
public readonly chatwootCache: CacheService,
|
||||
) {
|
||||
this.logger.verbose('WAStartupService initialized');
|
||||
this.logger.verbose('ChannelStartupService initialized');
|
||||
}
|
||||
|
||||
public readonly logger = new Logger(WAStartupService.name);
|
||||
public readonly logger = new Logger(ChannelStartupService.name);
|
||||
|
||||
public client: WASocket;
|
||||
public readonly instance: wa.Instance = {};
|
||||
@@ -742,7 +742,7 @@ export class WAStartupService {
|
||||
|
||||
if (this.configService.get<Log>('LOG').LEVEL.includes('WEBHOOKS')) {
|
||||
const logData = {
|
||||
local: WAStartupService.name + '.sendData-RabbitMQ',
|
||||
local: ChannelStartupService.name + '.sendData-RabbitMQ',
|
||||
event,
|
||||
instance: this.instance.name,
|
||||
data,
|
||||
@@ -798,7 +798,7 @@ export class WAStartupService {
|
||||
sqs.sendMessage(params, (err, data) => {
|
||||
if (err) {
|
||||
this.logger.error({
|
||||
local: WAStartupService.name + '.sendData-SQS',
|
||||
local: ChannelStartupService.name + '.sendData-SQS',
|
||||
message: err?.message,
|
||||
hostName: err?.hostname,
|
||||
code: err?.code,
|
||||
@@ -810,7 +810,7 @@ export class WAStartupService {
|
||||
} else {
|
||||
if (this.configService.get<Log>('LOG').LEVEL.includes('WEBHOOKS')) {
|
||||
const logData = {
|
||||
local: WAStartupService.name + '.sendData-SQS',
|
||||
local: ChannelStartupService.name + '.sendData-SQS',
|
||||
event,
|
||||
instance: this.instance.name,
|
||||
data,
|
||||
@@ -854,7 +854,7 @@ export class WAStartupService {
|
||||
|
||||
if (this.configService.get<Log>('LOG').LEVEL.includes('WEBHOOKS')) {
|
||||
const logData = {
|
||||
local: WAStartupService.name + '.sendData-WebsocketGlobal',
|
||||
local: ChannelStartupService.name + '.sendData-WebsocketGlobal',
|
||||
event,
|
||||
instance: this.instance.name,
|
||||
data,
|
||||
@@ -884,7 +884,7 @@ export class WAStartupService {
|
||||
|
||||
if (this.configService.get<Log>('LOG').LEVEL.includes('WEBHOOKS')) {
|
||||
const logData = {
|
||||
local: WAStartupService.name + '.sendData-Websocket',
|
||||
local: ChannelStartupService.name + '.sendData-Websocket',
|
||||
event,
|
||||
instance: this.instance.name,
|
||||
data,
|
||||
@@ -918,7 +918,7 @@ export class WAStartupService {
|
||||
|
||||
if (this.configService.get<Log>('LOG').LEVEL.includes('WEBHOOKS')) {
|
||||
const logData = {
|
||||
local: WAStartupService.name + '.sendDataWebhook-local',
|
||||
local: ChannelStartupService.name + '.sendDataWebhook-local',
|
||||
url: baseURL,
|
||||
event,
|
||||
instance: this.instance.name,
|
||||
@@ -958,7 +958,7 @@ export class WAStartupService {
|
||||
}
|
||||
} catch (error) {
|
||||
this.logger.error({
|
||||
local: WAStartupService.name + '.sendDataWebhook-local',
|
||||
local: ChannelStartupService.name + '.sendDataWebhook-local',
|
||||
message: error?.message,
|
||||
hostName: error?.hostname,
|
||||
syscall: error?.syscall,
|
||||
@@ -990,7 +990,7 @@ export class WAStartupService {
|
||||
|
||||
if (this.configService.get<Log>('LOG').LEVEL.includes('WEBHOOKS')) {
|
||||
const logData = {
|
||||
local: WAStartupService.name + '.sendDataWebhook-global',
|
||||
local: ChannelStartupService.name + '.sendDataWebhook-global',
|
||||
url: globalURL,
|
||||
event,
|
||||
instance: this.instance.name,
|
||||
@@ -1029,7 +1029,7 @@ export class WAStartupService {
|
||||
}
|
||||
} catch (error) {
|
||||
this.logger.error({
|
||||
local: WAStartupService.name + '.sendDataWebhook-global',
|
||||
local: ChannelStartupService.name + '.sendDataWebhook-global',
|
||||
message: error?.message,
|
||||
hostName: error?.hostname,
|
||||
syscall: error?.syscall,
|
||||
@@ -1,5 +1,6 @@
|
||||
import ffmpegPath from '@ffmpeg-installer/ffmpeg';
|
||||
import { Boom } from '@hapi/boom';
|
||||
import axios from 'axios';
|
||||
import makeWASocket, {
|
||||
AnyMessageContent,
|
||||
BufferedEventData,
|
||||
@@ -35,10 +36,9 @@ import makeWASocket, {
|
||||
WAMessageUpdate,
|
||||
WAPresence,
|
||||
WASocket,
|
||||
} from '@whiskeysockets/baileys';
|
||||
import { Label } from '@whiskeysockets/baileys/lib/Types/Label';
|
||||
import { LabelAssociation } from '@whiskeysockets/baileys/lib/Types/LabelAssociation';
|
||||
import axios from 'axios';
|
||||
} from 'baileys';
|
||||
import { Label } from 'baileys/lib/Types/Label';
|
||||
import { LabelAssociation } from 'baileys/lib/Types/LabelAssociation';
|
||||
import { exec } from 'child_process';
|
||||
import { arrayUnique, isBase64, isURL } from 'class-validator';
|
||||
import EventEmitter2 from 'eventemitter2';
|
||||
@@ -118,9 +118,9 @@ import { RepositoryBroker } from '../../repository/repository.manager';
|
||||
import { waMonitor } from '../../server.module';
|
||||
import { Events, MessageSubtype, TypeMediaMessage, wa } from '../../types/wa.types';
|
||||
import { CacheService } from './../cache.service';
|
||||
import { WAStartupService } from './../whatsapp.service';
|
||||
import { ChannelStartupService } from './../channel.service';
|
||||
|
||||
export class BaileysStartupService extends WAStartupService {
|
||||
export class BaileysStartupService extends ChannelStartupService {
|
||||
constructor(
|
||||
public readonly configService: ConfigService,
|
||||
public readonly eventEmitter: EventEmitter2,
|
||||
@@ -26,9 +26,9 @@ import { ContactRaw, MessageRaw, MessageUpdateRaw, SettingsRaw } from '../../mod
|
||||
import { RepositoryBroker } from '../../repository/repository.manager';
|
||||
import { Events, wa } from '../../types/wa.types';
|
||||
import { CacheService } from './../cache.service';
|
||||
import { WAStartupService } from './../whatsapp.service';
|
||||
import { ChannelStartupService } from './../channel.service';
|
||||
|
||||
export class BusinessStartupService extends WAStartupService {
|
||||
export class BusinessStartupService extends ChannelStartupService {
|
||||
constructor(
|
||||
public readonly configService: ConfigService,
|
||||
public readonly eventEmitter: EventEmitter2,
|
||||
@@ -25,8 +25,8 @@ import {
|
||||
import { RepositoryBroker } from '../repository/repository.manager';
|
||||
import { Integration } from '../types/wa.types';
|
||||
import { CacheService } from './cache.service';
|
||||
import { BaileysStartupService } from './whatsapp/whatsapp.baileys.service';
|
||||
import { BusinessStartupService } from './whatsapp/whatsapp.business.service';
|
||||
import { BaileysStartupService } from './channels/whatsapp.baileys.service';
|
||||
import { BusinessStartupService } from './channels/whatsapp.business.service';
|
||||
|
||||
export class WAMonitoringService {
|
||||
constructor(
|
||||
|
||||
Reference in New Issue
Block a user