@@ -974,14 +974,6 @@ export class TypebotController extends ChatbotController implements ChatbotContr
974974
975975 if ( ! instanceData ) throw new Error ( 'Instance not found' ) ;
976976
977- const settings = await this . prismaRepository . typebotSetting . findFirst ( {
978- where : {
979- instanceId : instance . instanceId ,
980- } ,
981- } ) ;
982-
983- if ( this . checkIgnoreJids ( settings ?. ignoreJids , remoteJid ) ) return ;
984-
985977 const session = await this . getSession ( remoteJid , instance ) ;
986978
987979 const content = getConversationMessage ( msg ) ;
@@ -996,6 +988,12 @@ export class TypebotController extends ChatbotController implements ChatbotContr
996988
997989 if ( ! findBot ) return ;
998990
991+ const settings = await this . prismaRepository . typebotSetting . findFirst ( {
992+ where : {
993+ instanceId : instance . instanceId ,
994+ } ,
995+ } ) ;
996+
999997 const url = findBot ?. url ;
1000998 const typebot = findBot ?. typebot ;
1001999 let expire = findBot ?. expire ;
@@ -1006,32 +1004,19 @@ export class TypebotController extends ChatbotController implements ChatbotContr
10061004 let stopBotFromMe = findBot ?. stopBotFromMe ;
10071005 let keepOpen = findBot ?. keepOpen ;
10081006 let debounceTime = findBot ?. debounceTime ;
1009-
1010- if (
1011- ! expire ||
1012- ! keywordFinish ||
1013- ! delayMessage ||
1014- ! unknownMessage ||
1015- ! listeningFromMe ||
1016- ! stopBotFromMe ||
1017- ! keepOpen
1018- ) {
1019- if ( ! expire ) expire = settings . expire ;
1020-
1021- if ( ! keywordFinish ) keywordFinish = settings . keywordFinish ;
1022-
1023- if ( ! delayMessage ) delayMessage = settings . delayMessage ;
1024-
1025- if ( ! unknownMessage ) unknownMessage = settings . unknownMessage ;
1026-
1027- if ( ! listeningFromMe ) listeningFromMe = settings . listeningFromMe ;
1028-
1029- if ( ! stopBotFromMe ) stopBotFromMe = settings . stopBotFromMe ;
1030-
1031- if ( ! keepOpen ) keepOpen = settings . keepOpen ;
1032-
1033- if ( ! debounceTime ) debounceTime = settings . debounceTime ;
1034- }
1007+ let ignoreJids = findBot ?. ignoreJids ;
1008+
1009+ if ( ! expire ) expire = settings . expire ;
1010+ if ( ! keywordFinish ) keywordFinish = settings . keywordFinish ;
1011+ if ( ! delayMessage ) delayMessage = settings . delayMessage ;
1012+ if ( ! unknownMessage ) unknownMessage = settings . unknownMessage ;
1013+ if ( ! listeningFromMe ) listeningFromMe = settings . listeningFromMe ;
1014+ if ( ! stopBotFromMe ) stopBotFromMe = settings . stopBotFromMe ;
1015+ if ( ! keepOpen ) keepOpen = settings . keepOpen ;
1016+ if ( ! debounceTime ) debounceTime = settings . debounceTime ;
1017+ if ( ! ignoreJids ) ignoreJids = settings . ignoreJids ;
1018+
1019+ if ( this . checkIgnoreJids ( ignoreJids , remoteJid ) ) return ;
10351020
10361021 const key = msg . key as {
10371022 id : string ;
0 commit comments