forked from Ilhamskhyi/botv1-Md
-
Notifications
You must be signed in to change notification settings - Fork 0
/
_antilink.js
19 lines (17 loc) · 998 Bytes
/
_antilink.js
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
let handler = m => m
let linkRegex = /chat.whatsapp.com\/(?:invite\/)?([0-9A-Za-z]{20,24})/i
handler.before = async function (m, { isAdmin, isBotAdmin }) {
if (m.isBaileys && m.fromMe) return true
let chat = global.db.data.chats[m.chat];
let ValidLink = (m.text.includes('https://') || m.text.includes('http://'))
if (chat.antiLink && ValidLink && !isAdmin && !m.isBaileys && m.isGroup) {
let thisGroup = isBotAdmin ? `https://chat.whatsapp.com/${await conn.groupInviteCode(m.chat)}` : 0
if (m.text.includes(thisGroup) && thisGroup != 0) throw false // jika link grup itu sendiri gak dikick
await conn.reply(m.chat, `*Link Terdeteksi!*${isBotAdmin ? '' : '\n\nbukan admin jadi gabisa kick t_t'}\n\nKetik *.off antilink* untuk mematikan fitur ini${opts['restrict'] ? '' : '\nketik *.on restrict* supaya bisa kick'}`, '', '', '', m)
if (global.opts['restrict']) {
if (isBotAdmin) this.groupRemove(m.chat, [m.sender])
}
}
return true
}
module.exports = handler