safety-safe
Version:
Firewall cerdas untuk Bot WhatsApp untuk mendeteksi dan memfilter pesan bug/crash/spam (Baileys).
23 lines (20 loc) • 601 B
JavaScript
function checkCharacterFlood(message, config) {
const interactive = message.interactiveMessage;
const textsToCheck = [
interactive?.body?.text,
interactive?.header?.title,
interactive?.nativeFlowMessage?.messageParamsJson
];
for (const text of textsToCheck) {
if (text && text.length > config.maxCharacterFlood) {
return {
isMalicious: true,
reason: `Character Flood Detected (${text.length})`,
severity: 'HIGH',
threatType: 'CRASH'
};
}
}
return { isMalicious: false, reason: null };
}
export default checkCharacterFlood;