mirror of
https://github.com/EvolutionAPI/evolution-api.git
synced 2025-07-23 04:22:02 -06:00
lint
This commit is contained in:
parent
3f9e872e1c
commit
cdf822291f
@ -149,7 +149,7 @@ export type Webhook = { GLOBAL?: GlobalWebhook; EVENTS: EventsWebhook };
|
|||||||
export type ConfigSessionPhone = { CLIENT: string; NAME: string };
|
export type ConfigSessionPhone = { CLIENT: string; NAME: string };
|
||||||
export type QrCode = { LIMIT: number; COLOR: string };
|
export type QrCode = { LIMIT: number; COLOR: string };
|
||||||
export type Typebot = { API_VERSION: string; KEEP_OPEN: boolean };
|
export type Typebot = { API_VERSION: string; KEEP_OPEN: boolean };
|
||||||
export type ChatWoot = { MESSAGE_DELETE: boolean };
|
export type ChatWoot = { MESSAGE_DELETE: boolean };
|
||||||
export type CacheConf = { REDIS: CacheConfRedis; LOCAL: CacheConfLocal };
|
export type CacheConf = { REDIS: CacheConfRedis; LOCAL: CacheConfLocal };
|
||||||
export type Production = boolean;
|
export type Production = boolean;
|
||||||
|
|
||||||
|
@ -45,7 +45,7 @@ const messageSchema = new Schema<MessageRaw>({
|
|||||||
participant: { type: String },
|
participant: { type: String },
|
||||||
messageType: { type: String },
|
messageType: { type: String },
|
||||||
message: { type: Object },
|
message: { type: Object },
|
||||||
source: { type: String, minlength: 3, enum: ['android', 'web', 'ios','unknown','desktop' ] },
|
source: { type: String, minlength: 3, enum: ['android', 'web', 'ios', 'unknown', 'desktop'] },
|
||||||
messageTimestamp: { type: Number, required: true },
|
messageTimestamp: { type: Number, required: true },
|
||||||
owner: { type: String, required: true, minlength: 1 },
|
owner: { type: String, required: true, minlength: 1 },
|
||||||
chatwoot: {
|
chatwoot: {
|
||||||
|
@ -7,7 +7,7 @@ import Jimp from 'jimp';
|
|||||||
import mimeTypes from 'mime-types';
|
import mimeTypes from 'mime-types';
|
||||||
import path from 'path';
|
import path from 'path';
|
||||||
|
|
||||||
import { ConfigService, HttpServer, ChatWoot} from '../../config/env.config';
|
import { ChatWoot, ConfigService, HttpServer } from '../../config/env.config';
|
||||||
import { Logger } from '../../config/logger.config';
|
import { Logger } from '../../config/logger.config';
|
||||||
import i18next from '../../utils/i18n';
|
import i18next from '../../utils/i18n';
|
||||||
import { ICache } from '../abstract/abstract.cache';
|
import { ICache } from '../abstract/abstract.cache';
|
||||||
@ -1895,37 +1895,36 @@ export class ChatwootService {
|
|||||||
}
|
}
|
||||||
|
|
||||||
if (event === Events.MESSAGES_DELETE) {
|
if (event === Events.MESSAGES_DELETE) {
|
||||||
|
const chatwootDelete = this.configService.get<ChatWoot>('CHATWOOT').MESSAGE_DELETE;
|
||||||
const chatwootDelete = this.configService.get<ChatWoot>('CHATWOOT').MESSAGE_DELETE
|
if (chatwootDelete === true) {
|
||||||
if (chatwootDelete === true) {
|
this.logger.verbose('deleting message from instance: ' + instance.instanceName);
|
||||||
this.logger.verbose('deleting message from instance: ' + instance.instanceName);
|
|
||||||
|
|
||||||
if (!body?.key?.id) {
|
if (!body?.key?.id) {
|
||||||
this.logger.warn('message id not found');
|
this.logger.warn('message id not found');
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
const message = await this.getMessageByKeyId(instance, body.key.id);
|
const message = await this.getMessageByKeyId(instance, body.key.id);
|
||||||
if (message?.chatwoot?.messageId && message?.chatwoot?.conversationId) {
|
if (message?.chatwoot?.messageId && message?.chatwoot?.conversationId) {
|
||||||
this.logger.verbose('deleting message in repository. Message id: ' + body.key.id);
|
this.logger.verbose('deleting message in repository. Message id: ' + body.key.id);
|
||||||
this.repository.message.delete({
|
this.repository.message.delete({
|
||||||
where: {
|
where: {
|
||||||
key: {
|
key: {
|
||||||
id: body.key.id,
|
id: body.key.id,
|
||||||
},
|
},
|
||||||
owner: instance.instanceName,
|
owner: instance.instanceName,
|
||||||
},
|
},
|
||||||
});
|
});
|
||||||
|
|
||||||
this.logger.verbose('deleting message in chatwoot. Message id: ' + body.key.id);
|
this.logger.verbose('deleting message in chatwoot. Message id: ' + body.key.id);
|
||||||
return await client.messages.delete({
|
return await client.messages.delete({
|
||||||
accountId: this.provider.account_id,
|
accountId: this.provider.account_id,
|
||||||
conversationId: message.chatwoot.conversationId,
|
conversationId: message.chatwoot.conversationId,
|
||||||
messageId: message.chatwoot.messageId,
|
messageId: message.chatwoot.messageId,
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
if (event === 'messages.read') {
|
if (event === 'messages.read') {
|
||||||
this.logger.verbose('read message from instance: ' + instance.instanceName);
|
this.logger.verbose('read message from instance: ' + instance.instanceName);
|
||||||
|
Loading…
Reference in New Issue
Block a user