mirror of
https://github.com/EvolutionAPI/evolution-api.git
synced 2025-12-24 22:27:46 -06:00
fix: ajuste na validacao dos bots e pausar sessao
This commit is contained in:
@@ -1,16 +1,20 @@
|
||||
import { advancedOperatorsSearch } from './advancedOperatorsSearch';
|
||||
|
||||
export const findBotByTrigger = async (botRepository: any, content: string, instanceId: string) => {
|
||||
// Check for triggerType 'all'
|
||||
const findTriggerAll = await botRepository.findFirst({
|
||||
// Check for triggerType 'all' or 'none' (both should match any message)
|
||||
const findTriggerAllOrNone = await botRepository.findFirst({
|
||||
where: {
|
||||
enabled: true,
|
||||
triggerType: 'all',
|
||||
triggerType: {
|
||||
in: ['all', 'none'],
|
||||
},
|
||||
instanceId: instanceId,
|
||||
},
|
||||
});
|
||||
|
||||
if (findTriggerAll) return findTriggerAll;
|
||||
if (findTriggerAllOrNone) {
|
||||
return findTriggerAllOrNone;
|
||||
}
|
||||
|
||||
const findTriggerAdvanced = await botRepository.findMany({
|
||||
where: {
|
||||
@@ -36,7 +40,9 @@ export const findBotByTrigger = async (botRepository: any, content: string, inst
|
||||
},
|
||||
});
|
||||
|
||||
if (findTriggerEquals) return findTriggerEquals;
|
||||
if (findTriggerEquals) {
|
||||
return findTriggerEquals;
|
||||
}
|
||||
|
||||
// Check for regex match
|
||||
const findRegex = await botRepository.findMany({
|
||||
|
||||
Reference in New Issue
Block a user