From 00996acf37a979d012b7828db1ac8d3514b400c8 Mon Sep 17 00:00:00 2001 From: White Shadow Ofc Date: Fri, 5 Jan 2024 11:53:24 +0530 Subject: [PATCH] =?UTF-8?q?[=20Jessi-md=204.8.1=20=E2=8F=B1=EF=B8=8F=20]?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- plugins/add.js | 50 ++++++++++++++++++++++++++++++++++++++++++ plugins/ig.js | 54 ++++++++++++++++++++++++++++++++++++++++++++++ plugins/ip.js | 44 +++++++++++++++++++++++++++++++++++++ plugins/join.js | 24 +++++++++++++++++++++ plugins/online.js | 27 +++++++++++++++++++++++ plugins/restart.js | 25 +++++++++++++++++++++ plugins/sudo.js | 19 ++++++++++++++++ 7 files changed, 243 insertions(+) create mode 100644 plugins/add.js create mode 100644 plugins/ig.js create mode 100644 plugins/ip.js create mode 100644 plugins/join.js create mode 100644 plugins/online.js create mode 100644 plugins/restart.js create mode 100644 plugins/sudo.js diff --git a/plugins/add.js b/plugins/add.js new file mode 100644 index 00000000..9b003053 --- /dev/null +++ b/plugins/add.js @@ -0,0 +1,50 @@ +let fetch = require('node-fetch') +let handler = async (m, { conn, text, participants, usedPrefix, command }) => { + if (!text) throw `_Masukkan nomor!_ \nContoh:\n\n${usedPrefix + command + ' ' + global.owner[0]}` + let _participants = participants.map(user => user.jid) + let users = (await Promise.all( + text.split(',') + .map(v => v.replace(/[^0-9]/g, '')) + .filter(v => v.length > 4 && v.length < 20 && !_participants.includes(v + '@s.whatsapp.net')) + .map(async v => [ + v, + await conn.isOnWhatsApp(v + '@s.whatsapp.net') + ]) + )).filter(v => v[1]).map(v => v[0] + '@c.us') + let response = await conn.groupAdd(m.chat, users) + if (response[users] == 408) throw `Nomor tersebut telah keluar baruΒ² ini\nHanya bisa masuk melalui ${usedPrefix}link` + let pp = await conn.getProfilePicture(m.chat).catch(_ => false) + let jpegThumbnail = pp ? await (await fetch(pp)).buffer() : false + for (let user of response.participants.filter(user => Object.values(user)[0].code == 403)) { + let [[jid, { + invite_code, + invite_code_exp + }]] = Object.entries(user) + let teks = `Mengundang @${jid.split('@')[0]} menggunakan invite...` + m.reply(teks, null, { + contextInfo: { + mentionedJid: conn.parseMention(teks) + } + }) + await conn.sendGroupV4Invite(m.chat, jid, invite_code, invite_code_exp, false, 'Invitation to join my WhatsApp group', jpegThumbnail ? { + jpegThumbnail + } : {}) + } +} +handler.help = ['add', '+'].map(v => v + ' nomor,nomor') +handler.tags = ['admin'] +handler.command = /^(add|\+)$/i +handler.owner = false +handler.mods = false +handler.premium = false +handler.group = true +handler.private = false + +handler.admin = true +handler.botAdmin = true + +handler.fail = null +handler.limit = true + +module.exports = handler + diff --git a/plugins/ig.js b/plugins/ig.js new file mode 100644 index 00000000..37aec47d --- /dev/null +++ b/plugins/ig.js @@ -0,0 +1,54 @@ +let handler = async (m, { usedPrefix, command, conn, args }) => { + if (!args[0]) throw `Gunakan format: ${usedPrefix}${command} https://www.instagram.com/xxx/xxxx/` + let res = await igdl(args[0]) + if (!res.length) throw 'Not found!' + for (let ress of res) { + let caption = ` + *πŸ’» Url:* ${args[0]} + *🎰 Link:* ${ress.result} + `.trim() + conn.sendFile(m.chat, ress.result, 'ig.mp4', caption, m) + } +} +handler.help = ['ig'].map(v => v + ' ') +handler.tags = ['downloader'] + +handler.command = /^(ig(dl)?)$/i + +module.exports = handler + +const fetch = require('node-fetch') +const cheerio = require('cheerio') +const FormData = require('form-data') +async function igdl(url) { + if (!/^((https|http)?:\/\/(?:www\.)?instagram\.com\/(p|tv|reel|stories)\/([^/?#&]+)).*/i.test(url)) throw 'Url invalid' + let form = new FormData() + form.append('url', encodeURI(url)) + form.append('action', 'post') + let res = await fetch('https://snapinsta.app/action.php', { + method: 'POST', + headers: { + 'content-type': 'multipart/form-data; boundary=----WebKitFormBoundary1kCNm4346FA9yvCN', + 'cookie': 'PHPSESSID=6d7nupv45th6ln9ldhpu62pg8s; _ga=GA1.2.1450546575.1637033620; _gid=GA1.2.1378038975.1637033620; _gat=1; __gads=ID=68a947f8174e0410-22fc6960b3ce005e:T=1637033620:RT=1637033620:S=ALNI_MbXTvxtxuISyAFMevds6-00PecLlw; __atuvc=1%7C46; __atuvs=61932694ba428f79000; __atssc=google%3B1', + 'origin': 'https://snapinsta.app', + 'referer': 'https://snapinsta.app/id', + 'sec-ch-ua': '"Google Chrome";v="95", "Chromium";v="95", ";Not A Brand";v="99"', + 'user-agent': 'Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/95.0.4638.69 Safari/537.36', + ...form.getHeaders() + }, + body: form + }) + let html = await res.text() + const $ = cheerio.load(html) + let results = [] + $('div.col-md-4').each(function () { + let thumbnail = $(this).find('div.download-items > div.download-items__thumb > img').attr('src') + let result = $(this).find('div.download-items > div.download-items__btn > a').attr('href') + if (!/https?:\/\//i.test(result)) result = 'https://snapinsta.app' + result + results.push({ + thumbnail, + result + }) + }) + return results +} \ No newline at end of file diff --git a/plugins/ip.js b/plugins/ip.js new file mode 100644 index 00000000..d989829b --- /dev/null +++ b/plugins/ip.js @@ -0,0 +1,44 @@ +let axios = require("axios"); +let handler = async(m, { conn, text }) => { + + await m.reply('Searching...') + if (!text) return conn.reply(m.chat, 'Masukan Alamat IP yang akan dicek', m) + + axios.get(`https://videfikri.com/api/iplookup/?ip=${text}`).then ((res) => { + +let hasil = ` +*IP CHECKER* + +IP : ${res.data.result.ip} +Negara : ${res.data.result.country} +Kode Negara : ${res.data.result.country_code} +Provinsi : ${res.data.result.region_name} +Kode Provinsi : ${res.data.result.region} +Kota : ${res.data.result.city} +Kordinat : +${res.data.result.latitude}, ${res.data.result.longtitude} +Zona Waktu : ${res.data.result.timezone} +ISP : ${res.data.result.isp} +AS : ${res.data.result.as} +`.trim() + + conn.reply(m.chat, hasil, m) + }) +} +handler.help = ['ip', 'ipcheck', 'ipcek'].map(v => v + ' ') +handler.tags = ['tools'] +handler.command = /^(ip|ipcheck|ipcek)$/i +handler.owner = false +handler.mods = false +handler.premium = false +handler.group = false +handler.private = false + +handler.admin = false +handler.botAdmin = false + +handler.fail = null +handler.exp = 0 +handler.limit = false + +module.exports = handler diff --git a/plugins/join.js b/plugins/join.js new file mode 100644 index 00000000..335203c1 --- /dev/null +++ b/plugins/join.js @@ -0,0 +1,24 @@ +let linkRegex = /chat.whatsapp.com\/([0-9A-Za-z]{20,24})/i + +let handler = async (m, { conn, text, usedPrefix }) => { + let [_, code] = text.match(linkRegex) || [] + if (!code) throw 'Link Salah' + let res = await conn.acceptInvite(code) + m.reply(`Berhasil join grup ${res.gid}`).then(() => { + var jumlahHari = 86400000 * 0.5 + var now = new Date() * 1 + if (now < global.db.data.chats[res.gid].expired) global.db.data.chats[res.gid].expired += jumlahHari + else global.db.data.chats[res.gid].expired = now + jumlahHari + }) + await conn.sendButton(res.gid, ` +*${conn.user.name}* adalah bot whatsapp yang dibangun dengan Nodejs, *${conn.user.name}* diundang oleh @${m.sender.split`@`[0]} + +ketik *${usedPrefix}menu* untuk melihat daftar perintah`.trim(), 'Β© stikerin', 'Menu', `${usedPrefix}?`, m) +} +handler.help = ['join '] +handler.tags = ['tools'] +handler.command = /^join$/i + +handler.premium = false + +module.exports = handler \ No newline at end of file diff --git a/plugins/online.js b/plugins/online.js new file mode 100644 index 00000000..cb2a5b3c --- /dev/null +++ b/plugins/online.js @@ -0,0 +1,27 @@ +let handler = async (m, { conn, args }) => { + let id = args && /\d+\-\d+@g.us/.test(args[0]) ? args[0] : m.chat + try { + let online = [...Object.keys(conn.chats.get(id).presences), conn.user.jid] + conn.reply(m.chat, 'β”Œβ”€γ€” Daftar Online 〕\n' + online.map(v => 'β”œ @' + v.replace(/@.+/, '')).join`\n` + '\n└────', m, { + contextInfo: { mentionedJid: online } + }) + } catch (e) { + m.reply('') + } +} +handler.help = ['here', 'online'] +handler.tags = ['group'] +handler.command = /^(here|(list)?online)$/i +handler.owner = false +handler.mods = false +handler.premium = false +handler.group = false +handler.private = false + +handler.admin = false +handler.botAdmin = false + +handler.fail = null + +module.exports = handler + diff --git a/plugins/restart.js b/plugins/restart.js new file mode 100644 index 00000000..fd61c66d --- /dev/null +++ b/plugins/restart.js @@ -0,0 +1,25 @@ +let { spawn } = require('child_process'); +let handler = async (m, { conn }) => { + if (!process.send) throw 'Dont: node main.js\nDo: node index.js' + if (global.conn.user.jid == conn.user.jid) { + await m.reply('Sedang Mereset Bot...\nMohon tunggu sekitar 1 menit') + await global.db.save() + process.send('reset') + } else throw '_eeeeeiiittsssss..._' +} +handler.help = ['restart'] +handler.tags = ['owner'] +handler.command = /^restart$/i +handler.owner = false +handler.mods = true +handler.premium = false +handler.group = false +handler.private = false + +handler.admin = false +handler.botAdmin = false + +handler.fail = null + +module.exports = handler + diff --git a/plugins/sudo.js b/plugins/sudo.js new file mode 100644 index 00000000..d0cf80f7 --- /dev/null +++ b/plugins/sudo.js @@ -0,0 +1,19 @@ +const { newMessagesDB } = require("@adiwajshing/baileys") + +let handler = async (m, { conn, text }) => { + if (!text) throw false + let who + if (m.isGroup) who = m.mentionedJid[0] + else who = m.chat + if (!who) throw 'Tag salah satu lah' + txt = text.replace('@' + who.split`@`[0], '').trimStart() + conn.emit('chat-update', { + jid: who, + hasNewMessage: true, + messages: newMessagesDB([conn.cMod(m.chat, m, txt, who)]) + }) +} +handler.command = /^sudo$/ +handler.rowner = true + +module.exports = handler