From 06548fb826e481fe0b95acf547efa2579c0e273d Mon Sep 17 00:00:00 2001 From: Haikalbotz <97148397+Haikalbotz@users.noreply.github.com> Date: Thu, 14 Apr 2022 11:27:12 +0700 Subject: [PATCH] Delete lib directory --- lib/Haikal | 1 - lib/color.js | 14 --- lib/fetcher.js | 105 -------------------- lib/functions.js | 249 ----------------------------------------------- lib/ytdl.js | 200 ------------------------------------- 5 files changed, 569 deletions(-) delete mode 100644 lib/Haikal delete mode 100644 lib/color.js delete mode 100644 lib/fetcher.js delete mode 100644 lib/functions.js delete mode 100644 lib/ytdl.js diff --git a/lib/Haikal b/lib/Haikal deleted file mode 100644 index 8b13789..0000000 --- a/lib/Haikal +++ /dev/null @@ -1 +0,0 @@ - diff --git a/lib/color.js b/lib/color.js deleted file mode 100644 index 4f39596..0000000 --- a/lib/color.js +++ /dev/null @@ -1,14 +0,0 @@ -const chalk = require('chalk') - -const color = (text, color) => { - return !color ? chalk.red(text) : chalk.keyword(color)(text) -} - -const bgcolor = (text, bgcolor) => { - return !bgcolor ? chalk.red(text) : chalk.bgKeyword(bgcolor)(text) -} - -module.exports = { - color, - bgcolor -} diff --git a/lib/fetcher.js b/lib/fetcher.js deleted file mode 100644 index 6e47771..0000000 --- a/lib/fetcher.js +++ /dev/null @@ -1,105 +0,0 @@ -const fetch = require('node-fetch') -const fs = require('fs') -const { spawn } = require("child_process") -const ff = require('fluent-ffmpeg') -const { getRandom } = require('./functions') - -exports.getBase64 = getBase64 = async (url) => { - const response = await fetch(url, { headers: { 'User-Agent': 'okhttp/4.5.0' } }); - if (!response.ok) throw new Error(`unexpected response ${response.statusText}`); - const buffer = await response.buffer(); - const videoBase64 = `data:${response.headers.get('content-type')};base64,` + buffer.toString('base64'); - if (buffer) - return videoBase64; -}; - -exports.getBuffer = getBuffer = async (url) => { - const res = await fetch(url, {headers: { 'User-Agent': 'okhttp/4.5.0'}, method: 'GET' }) - const anu = fs.readFileSync('./src/emror.jpg') - if (!res.ok) return { type: 'image/jpeg', result: anu } - const buff = await res.buffer() - if (buff) - return { type: res.headers.get('content-type'), result: buff } -} - -exports.fetchJson = fetchJson = (url, options) => new Promise(async (resolve, reject) => { - fetch(url, options) - .then(response => response.json()) - .then(json => { - // console.log(json) - resolve(json) - }) - .catch((err) => { - reject(err) - }) -}) - - -exports.fetchText = fetchText = (url, options) => new Promise(async (resolve, reject) => { - fetch(url, options) - .then(response => response.text()) - .then(text => { - // console.log(text) - resolve(text) - }) - .catch((err) => { - reject(err) - }) -}) -exports.kyun = (seconds) =>{ - function pad(s) { - return (s < 10 ? '0' : '') + s; - } - var hours = Math.floor(seconds / (60 * 60)); - var minutes = Math.floor(seconds % (60 * 60) / 60); - var seconds = Math.floor(seconds % 60); - - //return pad(hours) + ':' + pad(minutes) + ':' + pad(seconds) - return `${pad(hours)}Jam - ${pad(minutes)}Menit - ${pad(seconds)}Detik\n\n 「 𝗕𝗔𝗜𝗟𝗘𝗬𝗦 𝗦𝗘𝗟𝗙𝗕𝗢𝗧 」` -} -exports.createExif = (pack, auth) =>{ - const code = [0x00,0x00,0x16,0x00,0x00,0x00] - const exif = {"sticker-pack-id": "com.client.tech", "sticker-pack-name": pack, "sticker-pack-publisher": auth, "android-app-store-link": "https://play.google.com/store/apps/details?id=com.termux", "ios-app-store-link": "https://itunes.apple.com/app/sticker-maker-studio/id1443326857"} - let len = JSON.stringify(exif).length - if (len > 256) { - len = len - 256 - code.unshift(0x01) - } else { - code.unshift(0x00) - } - if (len < 16) { - len = len.toString(16) - len = "0" + len - } else { - len = len.toString(16) - } - //len = len < 16 ? `0${len.toString(16)}` : len.toString(16) - const _ = Buffer.from([0x49, 0x49, 0x2A, 0x00, 0x08, 0x00, 0x00, 0x00, 0x01, 0x00, 0x41, 0x57, 0x07, 0x00]); - const __ = Buffer.from(len, "hex") - const ___ = Buffer.from(code) - const ____ = Buffer.from(JSON.stringify(exif)) - fs.writeFileSync('./stik/data.exif', Buffer.concat([_, __, ___, ____]), function (err) { - console.log(err) - if (err) return console.error(err) - return `./stik/data.exif` - }) - -} -exports.modStick = (media, client, mek, from) => { - out = getRandom('.webp') - try { - console.log(media) - spawn('webpmux', ['-set','exif', './stik/data.exif', media, '-o', out]) - .on('exit', () => { - client.sendMessage(from, fs.readFileSync(out), 'stickerMessage', {quoted: mek}) - fs.unlinkSync(out) - fs.unlinkSync(media) - }) - } catch (e) { - console.log(e) - client.sendMessage(from, 'Terjadi keslahan', 'conversation', { quoted: mek }) - fs.unlinkSync(media) - } -} - -//exports.getBase64 = getBase64; diff --git a/lib/functions.js b/lib/functions.js deleted file mode 100644 index 896590e..0000000 --- a/lib/functions.js +++ /dev/null @@ -1,249 +0,0 @@ -const fetch = require('node-fetch') -const axios = require('axios') -const CFonts = require('cfonts') -const spin = require('spinnies') -const Crypto = require('crypto') - -const wait = async (media) => new Promise(async (resolve, reject) => { - const attachmentData = `data:image/jpeg;base64,${media.toString('base64')}` - const response = await fetch("https://trace.moe/api/search",{method: "POST",body: JSON.stringify({ image: attachmentData }),headers: { "Content-Type": "application/json" }}); - if (!response.ok) reject(`Gambar tidak ditemukan!`); - const result = await response.json() - try { - const { is_adult, title, title_chinese, title_romaji, title_english, episode, season, similarity, filename, at, tokenthumb, anilist_id } = result.docs[0] - let belief = () => similarity < 0.89 ? "Saya memiliki keyakinan rendah dalam hal ini : " : "" - let ecch = () => is_adult ? "Iya" : "Tidak" - resolve({video: await getBuffer(`https://media.trace.moe/video/${anilist_id}/${encodeURIComponent(filename)}?t=${at}&token=${tokenthumb}`), teks: `${belief()} -~> Ecchi : *${ecch()}* -~> Judul Jepang : *${title}* -~> Ejaan Judul : *${title_romaji}* -~> Judul Inggris : *${title_english}* -~> Episode : *${episode}* -~> Season : *${season}*`}); - } catch (e) { - console.log(e) - reject(`Saya tidak tau ini anime apa`) - } -}) - -const simih = async (text) => { - try { - const sami = await fetch(`https://simsumi.herokuapp.com/api?text=${text}`, {method: 'GET'}) - const res = await sami.json() - return res.success - } catch { - return 'Simi ga tau apa yang anda ngomong, bahasa alien yah kak?' - } -} - -const h2k = (number) => { - var SI_POSTFIXES = ["", " K", " M", " G", " T", " P", " E"] - var tier = Math.log10(Math.abs(number)) / 3 | 0 - if(tier == 0) return number - var postfix = SI_POSTFIXES[tier] - var scale = Math.pow(10, tier * 3) - var scaled = number / scale - var formatted = scaled.toFixed(1) + '' - if (/\.0$/.test(formatted)) - formatted = formatted.substr(0, formatted.length - 2) - return formatted + postfix -} - -const getBuffer = async (url, options) => { - try { - options ? options : {} - const res = await axios({ - method: "get", - url, - headers: { - 'DNT': 1, - 'Upgrade-Insecure-Request': 1 - }, - ...options, - responseType: 'arraybuffer' - }) - return res.data - } catch (e) { - console.log(`Error : ${e}`) - } -} - -const randomBytes = (length) => { - return Crypto.randomBytes(length) -} - -const generateMessageID = () => { - return randomBytes(10).toString('hex').toUpperCase() -} - -const getGroupAdmins = (participants) => { - admins = [] - for (let i of participants) { - i.isAdmin ? admins.push(i.jid) : '' - } - return admins -} - -const getRandom = (ext) => { - return `${Math.floor(Math.random() * 10000)}${ext}` -} - -const spinner = { - "interval": 120, - "frames": [ - "😀", - "😅", - "😂", - "😘", - "😝", - "😜", - "😛", - "😕", - "😟", - "😠", - "😎", - "😇", - "☕", - "🗿", - "😂", - "😭", - "😗", - "😀", - "👍", - "🚨", - "💮", - "❤️", - "😍", - "☹️", - "🔉", - "😎", - "☯️", - "✋", - "😬", - "⏰", - "♎", - "🌟", - "🙏", - "💆", - "⏰", - "♎", - "🌟", - "🙏", - "💆", - "⏰", - "💮", - "❤️", - "😍", - "☹️", - "🔉", - "😎", - "☯️", - "✋", - "😬", - "⏰", - "♎", - "🌟", - "🙏", - "💆", - "⏰", - "♎", - "🌟", - "🙏", - "💆", - "⏰", - "😎", - "☯️", - "✋","😎", - "☯️", - "✋", - "😬", - "⏰", - "♎", - "🌟", - "🙏", - "💆", - "⏰", - "♎", - "🌟", - "🙏", - "💆", - "⏰", - "😬", - "⏰", - "♎", - "🌟", - "🙏", - "💆", - "⏰", - "♎", - "🌟", - "🙏", - "💆", - "⏰", - "🕕", - "🕡", - "🕛", - "🕧", - "🕜", - "🕒", - "🕟" - ]} - -let globalSpinner; - - -const getGlobalSpinner = (disableSpins = false) => { - if(!globalSpinner) globalSpinner = new spin({ color: 'blue', succeedColor: 'green', spinner, disableSpins}); - return globalSpinner; -} - -spins = getGlobalSpinner(false) -const start = (id, text) => { - spins.add(id, {text: text}) - /*setTimeout(() => { - spins.succeed('load-spin', {text: 'Suksess'}) - }, Number(wait) * 1000)*/ - } -const info = (id, text) => { - spins.update(id, {text: text}) -} -const success = (id, text) => { - spins.succeed(id, {text: text}) - - } - -const close = (id, text) => { - spins.fail(id, {text: text}) -} - -const banner = -CFonts.say('Memuat Script...', { - font: 'console', - align: 'left', - gradient: ['magenta', 'red'] -}) - -CFonts.say('IKAL BASE', { - font: 'simple3d', - color :'system', - align: 'center', - gradient: ['white', 'blue'] -}) - - - -CFonts.say(`WELCOME USER BOT\n━━━━━━━━━━━\n━━━━━━━━━━━\nHALO✋ KAK😸 WELCOME 🌈TO SCRIPT SIMPLE-BOT🐧\n━━━━━━━━━━━\nSEMOGA HARI² KAMU MENYENANGKAN💕😍\━━━━━━━━━━━\nBASE BYE : @MhakBarBar`, { - font: 'console', - align: 'center', - gradient: ['red', 'magenta'] -}) - -const loger = - CFonts.say('=============[ HAI USER ]============\nScript By : Haikal\nBase : MhankBarbar\nServer : Baileys-Termux\n\n NB : DILARANG MENJUAL SCRIPT INI KARENA SCRIPT INI GRATIS BUAT SEMUA ORANG\n==========[ DI AWASI ]==========', { - font: 'console', - align: 'left', - gradient: ['blue', 'blue'] -}) - - -module.exports = { wait, simih, getBuffer, h2k, generateMessageID, banner, loger, getGroupAdmins, getRandom, start, info, success, close } diff --git a/lib/ytdl.js b/lib/ytdl.js deleted file mode 100644 index b211f30..0000000 --- a/lib/ytdl.js +++ /dev/null @@ -1,200 +0,0 @@ -//external modules -const { JSDOM } = require('jsdom') -const fetch = require('node-fetch') -const FormData = require('form-data') -const axios = require("axios") -const cheerio = require("cheerio") -const qs = require('qs') -const { fromBuffer } = require('file-type') - -//varuable -const ytIdRegex = /(?:http(?:s|):\/\/|)(?:(?:www\.|)youtube(?:\-nocookie|)\.com\/(?:watch\?.*(?:|\&)v=|embed\/|v\/)|youtu\.be\/)([-_0-9A-Za-z]{11})/ - -//fucntion -function post(url, formdata) { - console.log(Object.keys(formdata).map(key => `${key}=${encodeURIComponent(formdata[key])}`).join('&')) - return fetch(url, { - method: 'POST', - headers: { - accept: "*/*", - 'accept-language': "en-US,en;q=0.9", - 'content-type': "application/x-www-form-urlencoded; charset=UTF-8" - }, - body: Object.keys(formdata).map(key => `${key}=${encodeURIComponent(formdata[key])}`).join('&') - }) -} - -function yta(url) { - return new Promise((resolve, reject) => { - if (ytIdRegex.test(url)) { - let ytId = ytIdRegex.exec(url) - url = 'https://youtu.be/' + ytId[1] - post('https://www.y2mate.com/mates/en60/analyze/ajax', { - url, - q_auto: 0, - ajax: 1 - }) - .then(res => res.json()) - .then(res => { - let document = (new JSDOM(res.result)).window.document - let type = document.querySelectorAll('td') - let filesize = type[type.length - 10].innerHTML - let id = /var k__id = "(.*?)"/.exec(document.body.innerHTML) || ['', ''] - let thumb = document.querySelector('img').src - let title = document.querySelector('b').innerHTML - - post('https://www.y2mate.com/mates/en60/convert', { - type: 'youtube', - _id: id[1], - v_id: ytId[1], - ajax: '1', - token: '', - ftype: 'mp3', - fquality: 128 - }) - .then(res => res.json()) - .then(res => { - let KB = parseFloat(filesize) * (1000 * /MB$/.test(filesize)) - resolve({ - dl_link: /{ - url_media = url_media.replace("reel", "p") - var url = "https://igram.io/i/" - const requestBody = { - url: url_media.replace("reel", "p"), - lang_code: "en" - } - - const config = { - headers: { - 'User-Agent': 'Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/89.0.4389.114 Safari/537.36 Edg/89.0.774.75', - 'x-requested-with': ' XMLHttpRequest', - 'origin': ' https://igram.io', - 'referer': ' https://igram.io/en/dl/', - 'sec-fetch-dest': ' empty', - 'sec-fetch-mode': ' cors', - 'sec-fetch-site': ' same-origin', - 'Content-Type': 'application/x-www-form-urlencoded', - 'Cookie': '__cfduid=d4c2ddc2229a4d74c28b6ba25cdcd2a181618175605' - }, - } - - axios.post(url, qs.stringify(requestBody), config).then(result => { - let $ = cheerio.load(result.data), ig = [] - //Obter todos os links de videos da pagina carregada - $('[data-mediatype=Video]').each((i, element) => { - let cheerioElement = $(element) - ig.push(cheerioElement.attr("href")) - }) - //Obter todos os links de imagem da pagina carregada - $('div > div.bg-white.border.rounded-sm.max-w-md > img').each((i, element) => { - let cheerioElement = $(element) - ig.push(cheerioElement.attr("src")) - }) - - resolve({ - results_number : ig.length, - url_list: ig - }) - }).catch(err=>{ - console.log(err.response) - reject(err) - }) - }) -} - -function ytv(url) { - return new Promise((resolve, reject) => { - if (ytIdRegex.test(url)) { - let ytId = ytIdRegex.exec(url) - url = 'https://youtu.be/' + ytId[1] - post('https://www.y2mate.com/mates/en60/analyze/ajax', { - url, - q_auto: 0, - ajax: 1 - }) - .then(res => res.json()) - .then(res => { - document = (new JSDOM(res.result)).window.document - yaha = document.querySelectorAll('td') - filesize = yaha[yaha.length - 23].innerHTML - id = /var k__id = "(.*?)"/.exec(document.body.innerHTML) || ['', ''] - thumb = document.querySelector('img').src - title = document.querySelector('b').innerHTML - - post('https://www.y2mate.com/mates/en60/convert', { - type: 'youtube', - _id: id[1], - v_id: ytId[1], - ajax: '1', - token: '', - ftype: 'mp4', - fquality: 360 - }) - .then(res => res.json()) - .then(res => { - let KB = parseFloat(filesize) * (1000 * /MB$/.test(filesize)) - resolve({ - dl_link: / { - try { - let { ext } = await fromBuffer(media) - console.log('Uploading image to server telegra.ph') - let form = new FormData() - form.append('file', media, 'tmp.' + ext) - await fetch('https://telegra.ph/upload', { - method: 'POST', - body: form - }) - .then(res => res.json()) - .then(res => { - if (res.error) return reject(res.error) - resolve('https://telegra.ph' + res[0].src) - }) - .catch(err => reject(err)) - } catch (e) { - return console.log(e) - } -}) -} - -function formatDate(n, locale = 'id') { - let d = new Date(n) - return d.toLocaleDateString(locale, { - weekday: 'long', - day: 'numeric', - month: 'long', - year: 'numeric', - hour: 'numeric', - minute: 'numeric', - second: 'numeric' - }) -} -module.exports.yta = yta -module.exports.ytv = ytv -module.exports.igdl = igdl -module.exports.upload = upload -module.exports.formatDate = formatDate