-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy path_antitoxic.js
28 lines (25 loc) · 1.17 KB
/
_antitoxic.js
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
const toxicRegex = /puto|puta|rata|estupido|imbecil|rctmre|mrd|verga|vrga|maricon/i;
export async function before(m, {isAdmin, isBotAdmin, isOwner}) {
if (m.isBaileys && m.fromMe) {
return !0;
}
if (!m.isGroup) {
return !1;
}
const user = global.db.data.users[m.sender];
const chat = global.db.data.chats[m.chat];
const bot = global.db.data.settings[mconn.conn.user.jid] || {};
const isToxic = toxicRegex.exec(m.text);
if (isToxic && chat.antiToxic && !isOwner && !isAdmin) {
user.warn += 1;
if (!(user.warn >= 5)) await m.reply('*[❗] ' + `${user.warn == 1 ? `Hola @${m.sender.split`@`[0]}` : `@${m.sender.split`@`[0]}`}, decir la palabra "${isToxic}" está prohibido en este grupo. Advertencia: ${user.warn}/5.` + '*', false, {mentions: [m.sender]});
}
if (user.warn >= 5) {
user.warn = 0;
await m.reply(`*[❗] Hola @${m.sender.split`@`[0]}, superaste las 5 advertencias por lo que serás eliminado de este grupo por tu comportamiento.*`, false, {mentions: [m.sender]});
user.banned = true;
await mconn.conn.groupParticipantsUpdate(m.chat, [m.sender], 'remove');
// await this.updateBlockStatus(m.sender, 'block')
}
return !1;
}