arugaz / whatsapp-bot

Whatsapp Bot Multi Device - Node Js - Internationalization
GNU General Public License v3.0
597 stars 785 forks source link

AntiPorn for Links #254

Closed KillovSky closed 3 years ago

KillovSky commented 3 years ago

Antiporn-link berdasarkan server dns. Maaf, saya pemula dalam hal ini, tapi mungkin membantu setidaknya memiliki basis, Brasil mengirim pelukan.


const isPorn = require('is-porn')

// ANTI GROUP && ANTI PORN
        if (isGroupMsg && GroupLinkDetector && !isGroupAdmins && !isOwner){
            if (chats.match(/(https?:\/\/chat.whatsapp.com)/gi)) {
                console.log('Memeriksa tautan grup yang diterima.')
                const check = await aruga.inviteInfo(chats)
                if (check.status == 200) {
                    aruga.removeParticipant(groupId, sender.id) // respons banjir melanggar perintah di sini, tidak lebih
            console.log('Itu adalah tautan asli jadi saya menghapus ' + sender.id)
                } else {
                    console.log('Tautan grup diterima! Tapi itu salah, itu tidak menimbulkan ancaman')
                }
        } else if (chats.match(/\bhttps?:\/\/(www\.)?[-a-zA-Z0-9@:%._\+~#=]{1,256}\.[a-zA-Z0-9()]{1,6}\b([-a-zA-Z0-9()@:%_\+.~#?&//=]*)/gi)) {
            const chatpn = chats.match(/\bhttps?:\/\/(www\.)?[-a-zA-Z0-9@:%._\+~#=]{1,256}\.[a-zA-Z0-9()]{1,6}\b([-a-zA-Z0-9()@:%_\+.~#?&//=]*)/gi)
            const flnrl = new URL(chatpn)
            console.log('Memeriksa porno di tautan yang diterima ...\n' + flnrl)
            isPorn(flnrl.hostname, function(error, status) {
                if (status == true) {
                    aruga.removeParticipant(groupId, sender.id)
                    console.log('Ada pornografi jadi saya menghapus ' + sender.id)
                }
            })
        }
    }
MSI0072 commented 3 years ago

itu gimana pakai nya

KillovSky commented 3 years ago

itu gimana pakai nya Anda harus menyalin dan mengganti kode saat ini dari kelompok anti (hanya pengenalan pesan) dan kemudian menjalankan "npm i is-porn" untuk menginstal modul, melakukan ini Anda dapat menggunakan, jika terjadi format kode yang buruk saat menempelkan, sesuaikan spasi secara manual dan mulailah (Mohon maaf atas kesulitan dalam memahami, saya menggunakan penerjemah google)

MSI0072 commented 3 years ago

itu gimana pakai nya Anda harus menyalin dan mengganti kode saat ini dari kelompok anti (hanya pengenalan pesan) dan kemudian menjalankan "npm i is-porn" untuk menginstal modul, melakukan ini Anda dapat menggunakan, jika terjadi format kode yang buruk saat menempelkan, sesuaikan spasi secara manual dan mulailah (Mohon maaf atas kesulitan dalam memahami, saya menggunakan penerjemah google)

image

ga ke kick bang apa harus makek vpn?

MSI0072 commented 3 years ago

255

thanks

KillovSky commented 3 years ago

itu gimana pakai nya Anda harus menyalin dan mengganti kode saat ini dari kelompok anti (hanya pengenalan pesan) dan kemudian menjalankan "npm i is-porn" untuk menginstal modul, melakukan ini Anda dapat menggunakan, jika terjadi format kode yang buruk saat menempelkan, sesuaikan spasi secara manual dan mulailah (Mohon maaf atas kesulitan dalam memahami, saya menggunakan penerjemah google)

image

ga ke kick bang apa harus makek vpn?

Oh, maaf atas kesalahannya dan tidak sengaja menutup masalah, bagaimanapun, di antiporn lain jika ini:

        } else if (chats.match(/\bhttps?:\/\/(www\.)?[-a-zA-Z0-9@:%._\+~#=]{1,256}\.[a-zA-Z0-9()]{1,6}\b([-a-zA-Z0-9()@:%_\+.~#?&//=]*)/gi)) {

ubah menjadi:

        } else if (chats.match(/https?:\/\/(www\.)?[-a-zA-Z0-9@:%._\+~#=]{1,256}\.[a-zA-Z0-9()]{1,6}\b([-a-zA-Z0-9()@:%_\+.~#?&//=]*)/gi)) {

dan coba, Saya tidak tahu apa yang terjadi di balik a /\b tetapi di sini memperbaiki masalahnya

NaldoMota1 commented 3 years ago

me ajude mano, eu tô usando um outro bot modificado por mim mesmo, e queria adicionar anti link, e esse script que tu disponibilizou é ainda melhor pq tbm é anti porn, porém nunca dá certo, acho que o problema está na estrutura do script do meu bot, me ajude

NaldoMota1 commented 3 years ago

veja se o problema está aqui:

module.exports = msgHandler = async (client, message) => { try { const { type, id, from, t, sender, isGroupMsg, chat, chatId, caption, isMedia, mimetype, quotedMsg, mentionedJidList, author, quotedMsgObj } = message let { body } = message var { name, formattedTitle } = chat let { pushname, verifiedName, formattedName } = sender pushname = pushname || verifiedName || formattedName // verifiedName is the name of someone who uses a business account const prefix = '#' body = (type === 'chat' && body.startsWith(prefix)) ? body : ((type === 'image' && caption || type === 'video' && caption) && caption.startsWith(prefix)) ? caption : '' const command = body.slice(1).trim().split(/ +/).shift().toLowerCase() const args = body.trim().split(/ +/).slice(1) const arg = body.trim().substring(body.indexOf(' ') + 1) const url = args.length !== 0 ? args[0] : '' const isQuotedImage = quotedMsg && quotedMsg.type === 'image' const isQuotedVideo = quotedMsg && quotedMsg.type === 'video' const isCmd = body.startsWith(prefix) const isRule = ruleArr.includes(chat.id) const time = moment(t * 1000).format('DD/MM HH:mm:ss')

    if (isCmd && msgFilter.isFiltered(from) && !isGroupMsg) return console.log(color('[SPAM!]', 'red'), color(time, 'yellow'), color(`${command} [${args.length}]`), 'from', color(pushname))
    if (isCmd && msgFilter.isFiltered(from) && isGroupMsg) return console.log(color('[SPAM!]', 'red'), color(time, 'yellow'), color(`${command} [${args.length}]`), 'from', color(pushname), 'in', color(name))
    if (!isCmd && !isGroupMsg) return console.log('[RECV]', color(time, 'yellow'), 'Message from', color(pushname))
    if (!isCmd && isGroupMsg) return console.log('[RECV]', color(time, 'yellow'), 'Message from', color(pushname), 'in', color(name))
if (isGroupMsg && isRule && (type === 'chat' && message.body.includes('chat.whatsapp.com') && isBotGroupAdmins) && !isGroupAdmins) return await client.removeParticipant(chat.id, author)
    if (isCmd && !isGroupMsg) console.log(color('[EXEC]'), color(time, 'yellow'), color(`${command} [${args.length}]`), 'from', color(pushname))
    if (isCmd && isGroupMsg) console.log(color('[EXEC]'), color(time, 'yellow'), color(`${command} [${args.length}]`), 'from', color(pushname), 'in', color(name))
    const botNumber = await client.getHostNumber()
    const groupId = isGroupMsg ? chat.groupMetadata.id : ''
    const groupAdmins = isGroupMsg ? await client.getGroupAdmins(groupId) : ''
    const isGroupAdmins = isGroupMsg ? groupAdmins.includes(sender.id) : false
            const chats = (type === 'chat') ? body : (type === 'image' || type === 'video') ? caption : ''
    const isBotGroupAdmins = isGroupMsg ? groupAdmins.includes(botNumber + '@c.us') : false
    const isBanned = ban.includes(sender.id)        
    const owners = ['555196102799@c.us'] // eg [9190xxxxxxxx, 49xxxxxxxx] replace my number also 
    const isowner = owners.includes(sender.id)

    msgFilter.addFilter(from)

    const uaOverride = 'WhatsApp/2.2029.4 Mozilla/5.0 (Macintosh; Intel Mac OS X 10_15_5) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/83.0.4103.116 Safari/537.36'
    const isUrl = new RegExp(/https?:\/\/(www\.)?[-a-zA-Z0-9@:%._+~#=]{1,256}\.[a-zA-Z0-9()]{1,6}\b([-a-zA-Z0-9()@:%_+.~#?&/=]*)/gi)
    if (!isBanned) {
KillovSky commented 3 years ago

veja se o problema está aqui:

module.exports = msgHandler = async (client, message) => { try { const { type, id, from, t, sender, isGroupMsg, chat, chatId, caption, isMedia, mimetype, quotedMsg, mentionedJidList, author, quotedMsgObj } = message let { body } = message var { name, formattedTitle } = chat let { pushname, verifiedName, formattedName } = sender pushname = pushname || verifiedName || formattedName // verifiedName is the name of someone who uses a business account const prefix = '#' body = (type === 'chat' && body.startsWith(prefix)) ? body : ((type === 'image' && caption || type === 'video' && caption) && caption.startsWith(prefix)) ? caption : '' const command = body.slice(1).trim().split(/ +/).shift().toLowerCase() const args = body.trim().split(/ +/).slice(1) const arg = body.trim().substring(body.indexOf(' ') + 1) const url = args.length !== 0 ? args[0] : '' const isQuotedImage = quotedMsg && quotedMsg.type === 'image' const isQuotedVideo = quotedMsg && quotedMsg.type === 'video' const isCmd = body.startsWith(prefix) const isRule = ruleArr.includes(chat.id) const time = moment(t * 1000).format('DD/MM HH:mm:ss')

    if (isCmd && msgFilter.isFiltered(from) && !isGroupMsg) return console.log(color('[SPAM!]', 'red'), color(time, 'yellow'), color(`${command} [${args.length}]`), 'from', color(pushname))
    if (isCmd && msgFilter.isFiltered(from) && isGroupMsg) return console.log(color('[SPAM!]', 'red'), color(time, 'yellow'), color(`${command} [${args.length}]`), 'from', color(pushname), 'in', color(name))
    if (!isCmd && !isGroupMsg) return console.log('[RECV]', color(time, 'yellow'), 'Message from', color(pushname))
    if (!isCmd && isGroupMsg) return console.log('[RECV]', color(time, 'yellow'), 'Message from', color(pushname), 'in', color(name))
if (isGroupMsg && isRule && (type === 'chat' && message.body.includes('chat.whatsapp.com') && isBotGroupAdmins) && !isGroupAdmins) return await client.removeParticipant(chat.id, author)
    if (isCmd && !isGroupMsg) console.log(color('[EXEC]'), color(time, 'yellow'), color(`${command} [${args.length}]`), 'from', color(pushname))
    if (isCmd && isGroupMsg) console.log(color('[EXEC]'), color(time, 'yellow'), color(`${command} [${args.length}]`), 'from', color(pushname), 'in', color(name))
    const botNumber = await client.getHostNumber()
    const groupId = isGroupMsg ? chat.groupMetadata.id : ''
    const groupAdmins = isGroupMsg ? await client.getGroupAdmins(groupId) : ''
    const isGroupAdmins = isGroupMsg ? groupAdmins.includes(sender.id) : false
            const chats = (type === 'chat') ? body : (type === 'image' || type === 'video') ? caption : ''
    const isBotGroupAdmins = isGroupMsg ? groupAdmins.includes(botNumber + '@c.us') : false
    const isBanned = ban.includes(sender.id)        
    const owners = ['555196102799@c.us'] // eg [9190xxxxxxxx, 49xxxxxxxx] replace my number also 
    const isowner = owners.includes(sender.id)

    msgFilter.addFilter(from)

    const uaOverride = 'WhatsApp/2.2029.4 Mozilla/5.0 (Macintosh; Intel Mac OS X 10_15_5) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/83.0.4103.116 Safari/537.36'
    const isUrl = new RegExp(/https?:\/\/(www\.)?[-a-zA-Z0-9@:%._+~#=]{1,256}\.[a-zA-Z0-9()]{1,6}\b([-a-zA-Z0-9()@:%_+.~#?&/=]*)/gi)
    if (!isBanned) {

Aparentemente seu bot não possui as condições necessárias(não pelo que eu vi nesse pequeno trecho), poderei ajuda-lo, mas não por aqui, por ser uma pagina de issues sobre o ArugaBot, e por já estar fechada, fale comigo pelo WhatsApp que esta na minha git https://github.com/KillovSky/iris ou você pode usar o bot de Aruga ou a Iris que já tem tais funções implementadas.