mirror of
https://github.com/EvolutionAPI/evolution-api.git
synced 2025-07-25 18:08:40 -06:00
feat: add splitMessages and timePerChar support across bot creation, updating, settings, and emit handling
This commit is contained in:
parent
881a139606
commit
d78f35133d
@ -50,7 +50,9 @@ export class EvolutionBotController extends ChatbotController implements Chatbot
|
||||
!data.stopBotFromMe ||
|
||||
!data.keepOpen ||
|
||||
!data.debounceTime ||
|
||||
!data.ignoreJids
|
||||
!data.ignoreJids ||
|
||||
!data.splitMessages ||
|
||||
!data.timePerChar
|
||||
) {
|
||||
const defaultSettingCheck = await this.settingsRepository.findFirst({
|
||||
where: {
|
||||
@ -67,6 +69,8 @@ export class EvolutionBotController extends ChatbotController implements Chatbot
|
||||
if (!data.keepOpen) data.keepOpen = defaultSettingCheck?.keepOpen || false;
|
||||
if (!data.debounceTime) data.debounceTime = defaultSettingCheck?.debounceTime || 0;
|
||||
if (!data.ignoreJids) data.ignoreJids = defaultSettingCheck?.ignoreJids || [];
|
||||
if (!data.splitMessages) data.splitMessages = defaultSettingCheck?.splitMessages || false;
|
||||
if (!data.timePerChar) data.timePerChar = defaultSettingCheck?.timePerChar || 0;
|
||||
|
||||
if (!defaultSettingCheck) {
|
||||
await this.settings(instance, {
|
||||
@ -79,6 +83,8 @@ export class EvolutionBotController extends ChatbotController implements Chatbot
|
||||
keepOpen: data.keepOpen,
|
||||
debounceTime: data.debounceTime,
|
||||
ignoreJids: data.ignoreJids,
|
||||
splitMessages: data.splitMessages,
|
||||
timePerChar: data.timePerChar
|
||||
});
|
||||
}
|
||||
}
|
||||
@ -162,6 +168,8 @@ export class EvolutionBotController extends ChatbotController implements Chatbot
|
||||
triggerOperator: data.triggerOperator,
|
||||
triggerValue: data.triggerValue,
|
||||
ignoreJids: data.ignoreJids,
|
||||
splitMessages: data.splitMessages,
|
||||
timePerChar: data.timePerChar,
|
||||
},
|
||||
});
|
||||
|
||||
@ -335,6 +343,8 @@ export class EvolutionBotController extends ChatbotController implements Chatbot
|
||||
triggerOperator: data.triggerOperator,
|
||||
triggerValue: data.triggerValue,
|
||||
ignoreJids: data.ignoreJids,
|
||||
splitMessages: data.splitMessages,
|
||||
timePerChar: data.timePerChar,
|
||||
},
|
||||
});
|
||||
|
||||
@ -420,6 +430,8 @@ export class EvolutionBotController extends ChatbotController implements Chatbot
|
||||
debounceTime: data.debounceTime,
|
||||
botIdFallback: data.botIdFallback,
|
||||
ignoreJids: data.ignoreJids,
|
||||
splitMessages: data.splitMessages,
|
||||
timePerChar: data.timePerChar,
|
||||
},
|
||||
});
|
||||
|
||||
@ -516,6 +528,8 @@ export class EvolutionBotController extends ChatbotController implements Chatbot
|
||||
ignoreJids: settings.ignoreJids,
|
||||
botIdFallback: settings.botIdFallback,
|
||||
fallback: settings.Fallback,
|
||||
splitMessages: settings.splitMessages,
|
||||
timePerChar: settings.timePerChar,
|
||||
};
|
||||
} catch (error) {
|
||||
this.logger.error(error);
|
||||
@ -735,6 +749,9 @@ export class EvolutionBotController extends ChatbotController implements Chatbot
|
||||
let keepOpen = findBot?.keepOpen;
|
||||
let debounceTime = findBot?.debounceTime;
|
||||
let ignoreJids = findBot?.ignoreJids;
|
||||
let splitMessages = findBot?.splitMessages;
|
||||
let timePerChar = findBot?.timePerChar;
|
||||
|
||||
|
||||
if (!expire) expire = settings.expire;
|
||||
if (!keywordFinish) keywordFinish = settings.keywordFinish;
|
||||
@ -745,6 +762,9 @@ export class EvolutionBotController extends ChatbotController implements Chatbot
|
||||
if (!keepOpen) keepOpen = settings.keepOpen;
|
||||
if (!debounceTime) debounceTime = settings.debounceTime;
|
||||
if (!ignoreJids) ignoreJids = settings.ignoreJids;
|
||||
if (splitMessages === undefined || splitMessages === null) splitMessages = settings?.splitMessages ?? false;
|
||||
if (timePerChar === undefined || timePerChar === null) timePerChar = settings?.timePerChar ?? 0;
|
||||
|
||||
|
||||
const key = msg.key as {
|
||||
id: string;
|
||||
@ -791,6 +811,8 @@ export class EvolutionBotController extends ChatbotController implements Chatbot
|
||||
keepOpen,
|
||||
debounceTime,
|
||||
ignoreJids,
|
||||
splitMessages,
|
||||
timePerChar,
|
||||
},
|
||||
debouncedContent,
|
||||
msg?.pushName,
|
||||
@ -813,6 +835,8 @@ export class EvolutionBotController extends ChatbotController implements Chatbot
|
||||
keepOpen,
|
||||
debounceTime,
|
||||
ignoreJids,
|
||||
splitMessages,
|
||||
timePerChar,
|
||||
},
|
||||
content,
|
||||
msg?.pushName,
|
||||
|
Loading…
Reference in New Issue
Block a user