mmm / plugins /function.js
ravenbs1's picture
Upload 140 files
046b271 verified
const { cmd } = require('../command')
const fs = require('fs');
const path = require('path');
const config = require('../config')
// List of bad words to check against
// Replace with actual words
cmd({
on: "body"
},
async (conn,mek, m, { from, body, isGroup, isAdmins, isBotAdmins, reply, sender }) => {
try {
const badWords = ["wtf", "mia", "xxx","fuck","sex","huththa","pakaya","ponnaya","hutto"]
if (!isGroup || isAdmins || !isBotAdmins) return; // Skip if not in group, or sender is admin, or bot is not admin
const lowerCaseMessage = body.toLowerCase();
const containsBadWord = badWords.some(word => lowerCaseMessage.includes(word));
if (containsBadWord & config.ANTI_BAD_WORD === 'true') {
await conn.sendMessage(from, { delete: mek.key }, { quoted: mek });
await conn.sendMessage(from, {
'text': `*βš οΈπ–Ξ±Κ€Ι΄ΞΉΙ΄g 𝐏σʀи,πΞ±βˆ‚ π–ΟƒΚ€βˆ‚,πΟ…βˆ‚Ρ” 𝐏ι’ π€Ι΄βˆ‚.@${sender.split('@')[0]} π•ΞΉβˆ‚Ρ”ΟƒΡ• 𝐍σт π€β„“β„“ΟƒΟ‰Ρ”βˆ‚ π‡Ρ”Κ€Ρ”πŸ“›*`,
'mentions': [sender]
}, { 'quoted': m });
}
} catch (error) {
console.error(error)
reply("An error occurred while processing the message.")
}
})
const linkPatterns = [
/https?:\/\/(?:chat\.whatsapp\.com|wa\.me)\/\S+/gi, // WhatsApp group or chat links
/wa\.me\/\S+/gi, // wa.me links without https
/https?:\/\/(?:t\.me|telegram\.me)\/\S+/gi, // Telegram links
/https?:\/\/(?:www\.)?\.com\/\S+/gi, // channel links
/https?:\/\/(?:www\.)?twitter\.com\/\S+/gi, // Twitter links
/https?:\/\/(?:www\.)?linkedin\.com\/\S+/gi, // LinkedIn links
/https?:\/\/(?:whatsapp\.com|channel\.me)\/\S+/gi, // Snapchat links
/https?:\/\/(?:www\.)?reddit\.com\/\S+/gi, // Reddit links
/https?:\/\/(?:www\.)?discord\.com\/\S+/gi, // Discord links
/https?:\/\/(?:www\.)?twitch\.tv\/\S+/gi, // Twitch links
/https?:\/\/(?:www\.)?vimeo\.com\/\S+/gi, // Vimeo links
/https?:\/\/(?:www\.)?dailymotion\.com\/\S+/gi, // Dailymotion links
/https?:\/\/(?:www\.)?medium\.com\/\S+/gi // Medium links
];
cmd({
on: 'body'
}, async (conn, m, store, {
from,
body,
sender,
isGroup,
isAdmins,
isBotAdmins
}) => {
try {
if (!isGroup || isAdmins || !isBotAdmins) {
return;
}
const containsLink = linkPatterns.some(pattern => pattern.test(body));
if (containsLink && config.DELETE_LINK === 'true') {
await conn.sendMessage(from, { 'delete': m.key }, { 'quoted': m });
await conn.sendMessage(from, {
'text': `*βš οΈπ‹ΞΉΙ΄ΠΊΡ• 𝐀ʀє 𝐍σт π€β„“β„“ΟƒΟ‰Ρ”βˆ‚ 𝐈ɴ 𝐓нιѕ 𝐆ʀσυρ.@${sender.split('@')[0]} 𝐏ℓєαѕє π€Ξ½ΟƒΞΉβˆ‚ π’Ρ”Ι΄βˆ‚ΞΉΠΈg 𝐋ιɴкѕ.πŸ“›*`,
'mentions': [sender]
}, { 'quoted': m });
}
} catch (error) {
console.error(error);
}
});