mirror of
https://github.com/EvolutionAPI/evolution-api.git
synced 2025-12-10 18:39:38 -06:00
fix: the lint with npm run lint
This commit is contained in:
parent
0116bc4c9f
commit
b9ae40145d
@ -2,6 +2,7 @@ import { IgnoreJidDto } from '@api/dto/chatbot.dto';
|
|||||||
import { InstanceDto } from '@api/dto/instance.dto';
|
import { InstanceDto } from '@api/dto/instance.dto';
|
||||||
import { PrismaRepository } from '@api/repository/repository.service';
|
import { PrismaRepository } from '@api/repository/repository.service';
|
||||||
import { WAMonitoringService } from '@api/services/monitor.service';
|
import { WAMonitoringService } from '@api/services/monitor.service';
|
||||||
|
import { Events } from '@api/types/wa.types';
|
||||||
import { Logger } from '@config/logger.config';
|
import { Logger } from '@config/logger.config';
|
||||||
import { BadRequestException } from '@exceptions';
|
import { BadRequestException } from '@exceptions';
|
||||||
import { TriggerOperator, TriggerType } from '@prisma/client';
|
import { TriggerOperator, TriggerType } from '@prisma/client';
|
||||||
@ -9,7 +10,6 @@ import { getConversationMessage } from '@utils/getConversationMessage';
|
|||||||
|
|
||||||
import { BaseChatbotDto } from './base-chatbot.dto';
|
import { BaseChatbotDto } from './base-chatbot.dto';
|
||||||
import { ChatbotController, ChatbotControllerInterface, EmitData } from './chatbot.controller';
|
import { ChatbotController, ChatbotControllerInterface, EmitData } from './chatbot.controller';
|
||||||
import { Events } from '@api/types/wa.types';
|
|
||||||
|
|
||||||
// Common settings interface for all chatbot integrations
|
// Common settings interface for all chatbot integrations
|
||||||
export interface ChatbotSettings {
|
export interface ChatbotSettings {
|
||||||
@ -59,7 +59,7 @@ export abstract class BaseChatbotController<BotType = any, BotData extends BaseC
|
|||||||
settingsRepository: any;
|
settingsRepository: any;
|
||||||
sessionRepository: any;
|
sessionRepository: any;
|
||||||
userMessageDebounce: { [key: string]: { message: string; timeoutId: NodeJS.Timeout } } = {};
|
userMessageDebounce: { [key: string]: { message: string; timeoutId: NodeJS.Timeout } } = {};
|
||||||
|
|
||||||
// Name of the integration, to be set by the derived class
|
// Name of the integration, to be set by the derived class
|
||||||
protected abstract readonly integrationName: string;
|
protected abstract readonly integrationName: string;
|
||||||
|
|
||||||
@ -446,14 +446,14 @@ export abstract class BaseChatbotController<BotType = any, BotData extends BaseC
|
|||||||
});
|
});
|
||||||
|
|
||||||
const remoteJid = data.remoteJid;
|
const remoteJid = data.remoteJid;
|
||||||
const status = data.status;
|
const status = data.status;
|
||||||
const session = await this.getSession(remoteJid, instance);
|
const session = await this.getSession(remoteJid, instance);
|
||||||
|
|
||||||
if (this.integrationName === 'Typebot') {
|
if (this.integrationName === 'Typebot') {
|
||||||
const typebotData = {
|
const typebotData = {
|
||||||
remoteJid: remoteJid,
|
remoteJid: remoteJid,
|
||||||
status: status,
|
status: status,
|
||||||
session
|
session,
|
||||||
};
|
};
|
||||||
this.waMonitor.waInstances[instance.instanceName].sendDataWebhook(Events.TYPEBOT_CHANGE_STATUS, typebotData);
|
this.waMonitor.waInstances[instance.instanceName].sendDataWebhook(Events.TYPEBOT_CHANGE_STATUS, typebotData);
|
||||||
}
|
}
|
||||||
@ -507,7 +507,7 @@ export abstract class BaseChatbotController<BotType = any, BotData extends BaseC
|
|||||||
status: status,
|
status: status,
|
||||||
session,
|
session,
|
||||||
};
|
};
|
||||||
|
|
||||||
return { bot: { ...instance, bot: botData } };
|
return { bot: { ...instance, bot: botData } };
|
||||||
}
|
}
|
||||||
} catch (error) {
|
} catch (error) {
|
||||||
@ -887,7 +887,7 @@ export abstract class BaseChatbotController<BotType = any, BotData extends BaseC
|
|||||||
};
|
};
|
||||||
this.waMonitor.waInstances[instance.instanceName].sendDataWebhook(Events.TYPEBOT_CHANGE_STATUS, typebotData);
|
this.waMonitor.waInstances[instance.instanceName].sendDataWebhook(Events.TYPEBOT_CHANGE_STATUS, typebotData);
|
||||||
}
|
}
|
||||||
|
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@ -1,5 +1,6 @@
|
|||||||
import { PrismaRepository } from '@api/repository/repository.service';
|
import { PrismaRepository } from '@api/repository/repository.service';
|
||||||
import { WAMonitoringService } from '@api/services/monitor.service';
|
import { WAMonitoringService } from '@api/services/monitor.service';
|
||||||
|
import { Events } from '@api/types/wa.types';
|
||||||
import { Auth, ConfigService, HttpServer, Typebot } from '@config/env.config';
|
import { Auth, ConfigService, HttpServer, Typebot } from '@config/env.config';
|
||||||
import { Instance, IntegrationSession, Message, Typebot as TypebotModel } from '@prisma/client';
|
import { Instance, IntegrationSession, Message, Typebot as TypebotModel } from '@prisma/client';
|
||||||
import { getConversationMessage } from '@utils/getConversationMessage';
|
import { getConversationMessage } from '@utils/getConversationMessage';
|
||||||
@ -8,11 +9,10 @@ import axios from 'axios';
|
|||||||
|
|
||||||
import { BaseChatbotService } from '../../base-chatbot.service';
|
import { BaseChatbotService } from '../../base-chatbot.service';
|
||||||
import { OpenaiService } from '../../openai/services/openai.service';
|
import { OpenaiService } from '../../openai/services/openai.service';
|
||||||
import { Events } from '@api/types/wa.types';
|
|
||||||
|
|
||||||
export class TypebotService extends BaseChatbotService<TypebotModel, any> {
|
export class TypebotService extends BaseChatbotService<TypebotModel, any> {
|
||||||
private openaiService: OpenaiService;
|
private openaiService: OpenaiService;
|
||||||
|
|
||||||
constructor(
|
constructor(
|
||||||
waMonitor: WAMonitoringService,
|
waMonitor: WAMonitoringService,
|
||||||
configService: ConfigService,
|
configService: ConfigService,
|
||||||
@ -20,7 +20,7 @@ export class TypebotService extends BaseChatbotService<TypebotModel, any> {
|
|||||||
openaiService: OpenaiService,
|
openaiService: OpenaiService,
|
||||||
) {
|
) {
|
||||||
super(waMonitor, prismaRepository, 'TypebotService', configService);
|
super(waMonitor, prismaRepository, 'TypebotService', configService);
|
||||||
this.openaiService = openaiService;
|
this.openaiService = openaiService;
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@ -154,11 +154,11 @@ export class TypebotService extends BaseChatbotService<TypebotModel, any> {
|
|||||||
}
|
}
|
||||||
|
|
||||||
const typebotData = {
|
const typebotData = {
|
||||||
remoteJid: data.remoteJid,
|
remoteJid: data.remoteJid,
|
||||||
status: 'opened',
|
status: 'opened',
|
||||||
session,
|
session,
|
||||||
};
|
};
|
||||||
this.waMonitor.waInstances[instance.name].sendDataWebhook(Events.TYPEBOT_CHANGE_STATUS, typebotData);
|
this.waMonitor.waInstances[instance.name].sendDataWebhook(Events.TYPEBOT_CHANGE_STATUS, typebotData);
|
||||||
|
|
||||||
return { ...request.data, session };
|
return { ...request.data, session };
|
||||||
} catch (error) {
|
} catch (error) {
|
||||||
@ -433,7 +433,6 @@ export class TypebotService extends BaseChatbotService<TypebotModel, any> {
|
|||||||
session,
|
session,
|
||||||
};
|
};
|
||||||
instance.sendDataWebhook(Events.TYPEBOT_CHANGE_STATUS, typebotData);
|
instance.sendDataWebhook(Events.TYPEBOT_CHANGE_STATUS, typebotData);
|
||||||
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -677,13 +676,13 @@ export class TypebotService extends BaseChatbotService<TypebotModel, any> {
|
|||||||
},
|
},
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
const typebotData = {
|
const typebotData = {
|
||||||
remoteJid: remoteJid,
|
remoteJid: remoteJid,
|
||||||
status: statusChange,
|
status: statusChange,
|
||||||
session,
|
session,
|
||||||
};
|
};
|
||||||
waInstance.sendDataWebhook(Events.TYPEBOT_CHANGE_STATUS, typebotData);
|
waInstance.sendDataWebhook(Events.TYPEBOT_CHANGE_STATUS, typebotData);
|
||||||
|
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
@ -836,13 +835,13 @@ export class TypebotService extends BaseChatbotService<TypebotModel, any> {
|
|||||||
},
|
},
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
const typebotData = {
|
const typebotData = {
|
||||||
remoteJid: remoteJid,
|
remoteJid: remoteJid,
|
||||||
status: statusChange,
|
status: statusChange,
|
||||||
session,
|
session,
|
||||||
};
|
};
|
||||||
waInstance.sendDataWebhook(Events.TYPEBOT_CHANGE_STATUS, typebotData);
|
waInstance.sendDataWebhook(Events.TYPEBOT_CHANGE_STATUS, typebotData);
|
||||||
|
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
@ -945,7 +944,7 @@ export class TypebotService extends BaseChatbotService<TypebotModel, any> {
|
|||||||
session,
|
session,
|
||||||
};
|
};
|
||||||
|
|
||||||
waInstance.sendDataWebhook(Events.TYPEBOT_CHANGE_STATUS, typebotData);
|
waInstance.sendDataWebhook(Events.TYPEBOT_CHANGE_STATUS, typebotData);
|
||||||
|
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user