projek1 / plugins /_antilink.js
devstok's picture
Upload folder using huggingface_hub
d8a4b7b verified
let handler = m => m
let linkRegex = /chat.whatsapp.com\/([0-9A-Za-z]{20,24})/i
handler.before = async function (m, { user, isBotAdmin, isAdmin }) {
if ((m.isBaileys && m.fromMe) || m.fromMe || !m.isGroup) return true
let chat = global.db.data.chats[m.chat]
let isGroupLink = linkRegex.exec(m.text)
if (chat.antiLink && isGroupLink) {
await m.reply(`*γ€Œ ANTI LINK 」*\n\nDetected *${await conn.getName(m.sender)}* you have sent the group link!\n\nSorry you will be kicked from this group byee!`)
if (isAdmin) return m.reply('*Eh sorry you admins, you will not be kicked. hehe..*')
if (!isBotAdmin) return m.reply('*Bots are not admins, how can they kick people _-*')
let linkGC = ('https://chat.whatsapp.com/' + await conn.groupInviteCode(m.chat))
let isLinkconnGc = new RegExp(linkGC, 'i')
let isgclink = isLinkconnGc.test(m.text)
if (isgclink) return m.reply('*γ€Œ ANTI LINK 」*\n\nOrder denied, bot will not kick you.\nBecause the group link itself')
await conn.sendMessage(m.chat, { delete: m.key })
await conn.groupParticipantsUpdate(m.chat, [m.sender], "remove")
}
return true
}
module.exports = handler