├── trash └── none ├── welcome.json ├── Procfile ├── images.jpeg ├── .gitignore ├── config.json ├── install.sh ├── utils └── index.js ├── commands ├── welcome.js ├── ping.js ├── math.js ├── renungan.js ├── stiker.js ├── sticker.js ├── owner.js ├── help.js ├── covid19.js ├── simi.js ├── igvid.js ├── igfot.js ├── txtblackpink.js ├── txtporn.js ├── toimg.js └── info.js ├── package.json ├── README.md ├── index.js └── LICENSE /trash/none: -------------------------------------------------------------------------------- 1 | -------------------------------------------------------------------------------- /welcome.json: -------------------------------------------------------------------------------- 1 | [] -------------------------------------------------------------------------------- /Procfile: -------------------------------------------------------------------------------- 1 | worker: node index.js -------------------------------------------------------------------------------- /images.jpeg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/ZefianAlfian/zzbott/HEAD/images.jpeg -------------------------------------------------------------------------------- /.gitignore: -------------------------------------------------------------------------------- 1 | # modules directory 2 | node_modules/ 3 | 4 | # session files 5 | session-zefian.json 6 | 7 | # image files 8 | *.jpg 9 | *.png 10 | *.jpeg 11 | *.webp 12 | 13 | # lock files 14 | *-lock.json 15 | -------------------------------------------------------------------------------- /config.json: -------------------------------------------------------------------------------- 1 | { 2 | "prefix": "/", 3 | "apiMank": "", 4 | "apiNaufal": "", 5 | "abaikan-ini": { 6 | "Kalian-Bisa-Dapat-ApiKey-Dari": "kosong", 7 | "apiMank": "https://mhankbarbar.tech/", 8 | "apiNaufal": "https://naufalhoster.xyz/" 9 | } 10 | } 11 | -------------------------------------------------------------------------------- /install.sh: -------------------------------------------------------------------------------- 1 | #!/usr/bin/bash 2 | 3 | apt install curl 4 | curl -sL https://deb.nodesource.com/setup_12.x -o nodesource_setup.sh 5 | bash nodesource_setup.sh 6 | apt install nodejs 7 | apt install ffmpeg 8 | apt install imagemagick 9 | apt install webp 10 | npm i -g cwebp 11 | npm i 12 | npm start 13 | echo "[*] All dependencies have been install, please run the command \"npm start\" to immediately start the script" -------------------------------------------------------------------------------- /utils/index.js: -------------------------------------------------------------------------------- 1 | // Message Filter / Message Cooldowns 2 | const usedCommandRecently = new Set() 3 | 4 | const isFiltered = (from) => { 5 | return !!usedCommandRecently.has(from) 6 | } 7 | 8 | const addFilter = (from) => { 9 | usedCommandRecently.add(from) 10 | setTimeout(() => { 11 | return usedCommandRecently.delete(from) 12 | }, 5000) // 5sec is delay before processing next command 13 | } 14 | -------------------------------------------------------------------------------- /commands/welcome.js: -------------------------------------------------------------------------------- 1 | const { MessageType } = require("@adiwajshing/baileys") 2 | const { text, extendedText, contact, location, liveLocation, image, video, sticker, document, audio, product } = MessageType 3 | 4 | exports.run = async (bot, message, args, from) => { 5 | } 6 | 7 | exports.help = { 8 | name: "Stiker", 9 | description: "Make sticker whatsapp", 10 | usage: "stiker with image", 11 | cooldown: 5, 12 | }; 13 | -------------------------------------------------------------------------------- /commands/ping.js: -------------------------------------------------------------------------------- 1 | const { MessageType } = require("@adiwajshing/baileys") 2 | const { text, extendedText, contact, location, liveLocation, image, video, sticker, document, audio, product } = MessageType 3 | 4 | exports.run = (bot, message, args, from) => { 5 | bot.sendMessage(from, "🏓 PONG!", text, { quoted: message }); 6 | }; 7 | 8 | exports.help = { 9 | name: "Ping", 10 | description: "PING PONG", 11 | usage: "ping", 12 | cooldown: 5 13 | }; 14 | -------------------------------------------------------------------------------- /commands/math.js: -------------------------------------------------------------------------------- 1 | const { evaluate } = require("mathjs"); 2 | 3 | const { MessageType } = require("@adiwajshing/baileys") 4 | const { text, extendedText, contact, location, liveLocation, image, video, sticker, document, audio, product } = MessageType 5 | 6 | exports.run = async (bot, message, args, from) => { 7 | const expressions = args.join` ` 8 | const answer = evaluate(expressions); 9 | bot.sendMessage(from, answer.toString(), text, { quoted: message }); 10 | }; 11 | 12 | exports.help = { 13 | name: "Math", 14 | description: "Calculate something", 15 | usage: "math ", 16 | cooldown: 5, 17 | }; 18 | -------------------------------------------------------------------------------- /commands/renungan.js: -------------------------------------------------------------------------------- 1 | const fetch = require("node-fetch") 2 | 3 | const { MessageType } = require("@adiwajshing/baileys") 4 | const { text, extendedText, contact, location, liveLocation, image, video, sticker, document, audio, product } = MessageType 5 | 6 | exports.run = async (bot, message, args, from) => { 7 | fetch(encodeURI(`https://docs-jojo.herokuapp.com/api/renungan`)) 8 | .then(response => response.json()) 9 | .then(data => { 10 | bot.sendMessage(from, `Renungan\n\nJudul : ${data.judul} \n\nRenungan : ${data.Isi} \n\nPesan : ${data.pesan}`, text, { quoted: message }); 11 | }); 12 | }; 13 | 14 | exports.help = { 15 | name: "renungan", 16 | description: "Cerita untuk renungan", 17 | usage: "renungan", 18 | cooldown: 5, 19 | }; 20 | -------------------------------------------------------------------------------- /commands/stiker.js: -------------------------------------------------------------------------------- 1 | const moment = require("moment-timezone") 2 | const fs = require("fs") 3 | const time = moment().tz('Asia/Jakarta').format("HH:mm") 4 | const { exec } = require("child_process") 5 | const { MessageType } = require("@adiwajshing/baileys") 6 | const { text, extendedText, contact, location, liveLocation, image, video, sticker, document, audio, product } = MessageType 7 | 8 | exports.run = async (bot, message, args, from) => { 9 | const image = await bot.downloadAndSaveMediaMessage(message) 10 | exec('cwebp -q 50 ' + image + ' -o trash/' + time + '.webp', (error, stdout, stderr) => { 11 | let result = fs.readFileSync('trash/' + time + '.webp') 12 | bot.sendMessage(from, result, sticker, { quoted: message }) 13 | }) 14 | }; 15 | 16 | exports.help = { 17 | name: "Stiker", 18 | description: "Make sticker whatsapp", 19 | usage: "stiker with image", 20 | cooldown: 5, 21 | }; 22 | -------------------------------------------------------------------------------- /commands/sticker.js: -------------------------------------------------------------------------------- 1 | const moment = require("moment-timezone") 2 | const fs = require("fs") 3 | const time = moment().tz('Asia/Jakarta').format("HH:mm") 4 | const { exec } = require("child_process") 5 | const { MessageType } = require("@adiwajshing/baileys") 6 | const { text, extendedText, contact, location, liveLocation, image, video, sticker, document, audio, product } = MessageType 7 | 8 | exports.run = async (bot, message, args, from) => { 9 | const image = await bot.downloadAndSaveMediaMessage(message) 10 | exec('cwebp -q 50 ' + image + ' -o trash/' + time + '.webp', (error, stdout, stderr) => { 11 | let result = fs.readFileSync('trash/' + time + '.webp') 12 | bot.sendMessage(from, result, sticker, { quoted: message }) 13 | }) 14 | }; 15 | 16 | exports.help = { 17 | name: "Sticker", 18 | description: "Make sticker whatsapp", 19 | usage: "sticker with image", 20 | cooldown: 5, 21 | }; 22 | -------------------------------------------------------------------------------- /commands/owner.js: -------------------------------------------------------------------------------- 1 | const { MessageType } = require("@adiwajshing/baileys") 2 | const { text, extendedText, contact, location, liveLocation, image, video, sticker, document, audio, product } = MessageType 3 | 4 | exports.run = (bot, message, args, from, id) => { 5 | const vcard = 'BEGIN:VCARD\n' // metadata of the contact card 6 | + 'VERSION:3.0\n' 7 | + 'FN:ZefianAlfian\n' // full name 8 | + 'ORG:ZefianAlfian;\n' // the organization of the contact 9 | + 'TEL;type=CELL;type=VOICE;waid=6289630171792:+62 896 3017 1792\n' // WhatsApp ID + phone number 10 | + 'END:VCARD' 11 | bot.sendMessage(from, {displayname: "Zefian", vcard: vcard}, contact, { quoted: message }) 12 | bot.sendMessage(from, "dia gapunya pacar ambil aja", text) 13 | } 14 | 15 | exports.help = { 16 | name: "Owner", 17 | description: "Show the owner bot's", 18 | usage: "owner", 19 | cooldown: 5, 20 | }; 21 | -------------------------------------------------------------------------------- /package.json: -------------------------------------------------------------------------------- 1 | { 2 | "name": "zzbot", 3 | "version": "1.0.0", 4 | "description": "simple bot whatsapp", 5 | "main": "index.js", 6 | "scripts": { 7 | "start": "node index.js", 8 | "test": "echo \"Error: no test specified\" && exit 1" 9 | }, 10 | "repository": { 11 | "type": "git", 12 | "url": "git+https://github.com/ZefianAlfian/zzbot.git" 13 | }, 14 | "keywords": [ 15 | "whatsapp", 16 | "bot", 17 | "automate", 18 | "baileys" 19 | ], 20 | "dependencies": { 21 | "@adiwajshing/baileys": "^3.3.1", 22 | "axios": "^0.21.1", 23 | "chalk": "^4.1.0", 24 | "colors": "^1.4.0", 25 | "lodash": "^4.17.20", 26 | "mathjs": "^8.1.1", 27 | "moment-timezone": "^0.5.32", 28 | "node-fetch": "^2.6.1", 29 | "qrcode-terminal": "^0.12.0" 30 | }, 31 | "author": "ZefianAlfian", 32 | "license": "ISC", 33 | "bugs": { 34 | "url": "https://github.com/ZefianAlfian/zzbot/issues" 35 | }, 36 | "homepage": "https://github.com/ZefianAlfian/zzbot/#readme" 37 | } 38 | -------------------------------------------------------------------------------- /commands/help.js: -------------------------------------------------------------------------------- 1 | const { readdir } = require('fs') 2 | 3 | const { MessageType } = require("@adiwajshing/baileys") 4 | const { text, extendedText, contact, location, liveLocation, image, video, sticker, document, audio, product } = MessageType 5 | 6 | exports.run = (bot, message, args, from) => { 7 | let tmpFile = {} 8 | readdir(process.cwd() + '/commands', (err, files) => { 9 | if (err) throw err 10 | files.forEach((jsFile) => { 11 | const cmdFile = require(`./${jsFile}`); 12 | tmpFile[jsFile.replace(".js", "")] = {}; 13 | tmpFile[jsFile.replace(".js", "")].name = cmdFile.help.name; 14 | tmpFile[jsFile.replace(".js", "")].description = cmdFile.help.description; 15 | tmpFile[jsFile.replace(".js", "")].usage = cmdFile.help.usage; 16 | }) 17 | if (!args[0]) { 18 | bot.sendMessage(from, `*Available commands:* ${Object.keys(tmpFile).join(", ")}\n\n_You can run *help * to show advanced help._`, text, { quoted: message }) 19 | } else { 20 | const commandName = args[0]; 21 | const { name, description, usage } = require(`./${commandName}.js`).help; 22 | bot.sendMessage(from, `*${name}*\n\nDescription: ${description}\nUsage: \`\`\`${usage}\`\`\``, text, { quoted: message }) 23 | }; 24 | }) 25 | } 26 | 27 | exports.help = { 28 | name: "Help", 29 | description: "Show the bot's commands list", 30 | usage: "help", 31 | cooldown: 5, 32 | }; 33 | -------------------------------------------------------------------------------- /commands/covid19.js: -------------------------------------------------------------------------------- 1 | const fetch = require("node-fetch") 2 | 3 | const { MessageType } = require("@adiwajshing/baileys") 4 | const { text, extendedText, contact, location, liveLocation, image, video, sticker, document, audio, product } = MessageType 5 | 6 | exports.run = async (bot, message, args, from) => { 7 | const mess = { 8 | wait: 'Sedang di Prosess ⌛', 9 | success: 'Berhasil ✔️', 10 | gagal: 'Gagal ❌', 11 | stick: 'Gagal, terjadi kesalahan saat mengkonversi gambar ke sticker ❌', 12 | Iv: 'Link tidak valid ❌', 13 | mt: 'Command Dalam Tahap Perbaikan ❌', 14 | only: { 15 | group: '❌ Perintah ini hanya bisa di gunakan dalam group! ❌', 16 | ownerG: '❌ Perintah ini hanya bisa di gunakan oleh owner group! ❌', 17 | ownerB: '❌ Perintah ini hanya bisa di gunakan oleh owner bot! ❌', 18 | admin: '❌ Perintah ini hanya bisa di gunakan oleh admin group! ❌', 19 | Badmin: '❌ Perintah ini hanya bisa di gunakan ketika bot menjadi admin! ❌' 20 | } 21 | } 22 | const reply = (teks) => { 23 | bot.sendMessage(from, teks, text, {quoted: message}) 24 | } 25 | reply(mess.wait) 26 | fetch(encodeURI(`https://twindev.herokuapp.com/api/v1/covid/indonesia`)) 27 | .then(response => response.json()) 28 | .then(data => { 29 | bot.sendMessage(from, `Covid19 In Indonesia\n\nPositif : ${data.positif} \nSembuh : ${data.sembuh} \nMeninggal : ${data.meninggal}`, text, { quoted: message }); 30 | }); 31 | }; 32 | 33 | exports.help = { 34 | name: "Covid19", 35 | description: "Show Data Covid19 in Indonesia", 36 | usage: "covid19", 37 | cooldown: 5, 38 | }; 39 | -------------------------------------------------------------------------------- /commands/simi.js: -------------------------------------------------------------------------------- 1 | const fs = require("fs") 2 | const fetch = require('node-fetch') 3 | const axios = require('axios') 4 | apiMank = require("../config.json").apiMank 5 | apiNaufal = require("../config.json").apiNaufal 6 | const { MessageType } = require("@adiwajshing/baileys") 7 | const { text, extendedText, contact, location, liveLocation, image, video, sticker, document, audio, product } = MessageType 8 | 9 | exports.run = async (bot, message, args, from) => { 10 | const mess = { 11 | wait: 'Sedang di Prosess ⌛', 12 | success: 'Berhasil ✔️', 13 | gagal: 'Gagal ❌', 14 | stick: 'Gagal, terjadi kesalahan saat mengkonversi gambar ke sticker ❌', 15 | Iv: 'Link tidak valid ❌', 16 | mt: 'Command Dalam Tahap Perbaikan ❌', 17 | only: { 18 | group: '❌ Perintah ini hanya bisa di gunakan dalam group! ❌', 19 | ownerG: '❌ Perintah ini hanya bisa di gunakan oleh owner group! ❌', 20 | ownerB: '❌ Perintah ini hanya bisa di gunakan oleh owner bot! ❌', 21 | admin: '❌ Perintah ini hanya bisa di gunakan oleh admin group! ❌', 22 | Badmin: '❌ Perintah ini hanya bisa di gunakan ketika bot menjadi admin! ❌' 23 | } 24 | } 25 | const reply = (teks) => { 26 | bot.sendMessage(from, teks, text, {quoted: message}) 27 | } 28 | exports.fetchJson = fetchJson = (url, options) => new Promise(async (resolve, reject) => { 29 | fetch(url, options) 30 | .then(response => response.json()) 31 | .then(json => { 32 | // console.log(json) 33 | resolve(json) 34 | }) 35 | .catch((err) => { 36 | reject(err) 37 | }) 38 | }) 39 | if (args.length < 1) return reply('Simi ga tau kak') 40 | teks = body.slice(6) 41 | zeff = await fetchJson(`https://naufalhoster.xyz/tools/simsimi?apikey=${apiNaufal}&pesan=${teks}`, {method: 'get'}) 42 | if (zeff.code == 400) return reply('Simi ga tau kak') 43 | bot.sendMessage(from, zeff.result.response, text, {quoted: message}) 44 | }; 45 | 46 | exports.help = { 47 | name: "simi", 48 | description: "bot setengah manusia", 49 | usage: "simi teks", 50 | cooldown: 5, 51 | }; 52 | -------------------------------------------------------------------------------- /commands/igvid.js: -------------------------------------------------------------------------------- 1 | const fs = require("fs") 2 | const fetch = require('node-fetch') 3 | const axios = require('axios') 4 | apiMank = require("../config.json").apiMank 5 | apiNaufal = require("../config.json").apiNaufal 6 | const { MessageType } = require("@adiwajshing/baileys") 7 | const { text, extendedText, contact, location, liveLocation, image, video, sticker, document, audio, product } = MessageType 8 | 9 | exports.run = async (bot, message, args, from) => { 10 | const mess = { 11 | wait: 'Sedang di Prosess ⌛', 12 | success: 'Berhasil ✔️', 13 | gagal: 'Gagal ❌', 14 | stick: 'Gagal, terjadi kesalahan saat mengkonversi gambar ke sticker ❌', 15 | Iv: 'Link tidak valid ❌', 16 | mt: 'Command Dalam Tahap Perbaikan ❌', 17 | only: { 18 | group: '❌ Perintah ini hanya bisa di gunakan dalam group! ❌', 19 | ownerG: '❌ Perintah ini hanya bisa di gunakan oleh owner group! ❌', 20 | ownerB: '❌ Perintah ini hanya bisa di gunakan oleh owner bot! ❌', 21 | admin: '❌ Perintah ini hanya bisa di gunakan oleh admin group! ❌', 22 | Badmin: '❌ Perintah ini hanya bisa di gunakan ketika bot menjadi admin! ❌' 23 | } 24 | } 25 | const reply = (teks) => { 26 | bot.sendMessage(from, teks, text, {quoted: message}) 27 | } 28 | exports.fetchJson = fetchJson = (url, options) => new Promise(async (resolve, reject) => { 29 | fetch(url, options) 30 | .then(response => response.json()) 31 | .then(json => { 32 | // console.log(json) 33 | resolve(json) 34 | }) 35 | .catch((err) => { 36 | reject(err) 37 | }) 38 | }) 39 | if (args.length < 1) return reply('Where the url?') 40 | if (!isUrl(args[0]) && !args[0].includes('instagram.com')) return reply(mess.Iv) 41 | reply(mess.wait) 42 | febycans = await fetchJson(`https://mhankbarbar.tech/api/ig?url=${args[0]}&apiKey=${apiMank}`, {method: 'get'}) 43 | if (febycans.error) return reply(febycans.error) 44 | divara = await getBuffer(febycans.result) 45 | bot.sendMessage(from, divara, video, {quoted: message, caption: mess.success}) 46 | 47 | }; 48 | 49 | exports.help = { 50 | name: "igvid", 51 | description: "Download Video Instagram", 52 | usage: "igvid link", 53 | cooldown: 5, 54 | }; 55 | -------------------------------------------------------------------------------- /commands/igfot.js: -------------------------------------------------------------------------------- 1 | const fs = require("fs") 2 | const fetch = require('node-fetch') 3 | const axios = require('axios') 4 | apiMank = require("../config.json").apiMank 5 | apiNaufal = require("../config.json").apiNaufal 6 | const { MessageType } = require("@adiwajshing/baileys") 7 | const { text, extendedText, contact, location, liveLocation, image, video, sticker, document, audio, product } = MessageType 8 | 9 | exports.run = async (bot, message, args, from) => { 10 | const mess = { 11 | wait: 'Sedang di Prosess ⌛', 12 | success: 'Berhasil ✔️', 13 | gagal: 'Gagal ❌', 14 | stick: 'Gagal, terjadi kesalahan saat mengkonversi gambar ke sticker ❌', 15 | Iv: 'Link tidak valid ❌', 16 | mt: 'Command Dalam Tahap Perbaikan ❌', 17 | only: { 18 | group: '❌ Perintah ini hanya bisa di gunakan dalam group! ❌', 19 | ownerG: '❌ Perintah ini hanya bisa di gunakan oleh owner group! ❌', 20 | ownerB: '❌ Perintah ini hanya bisa di gunakan oleh owner bot! ❌', 21 | admin: '❌ Perintah ini hanya bisa di gunakan oleh admin group! ❌', 22 | Badmin: '❌ Perintah ini hanya bisa di gunakan ketika bot menjadi admin! ❌' 23 | } 24 | } 25 | const reply = (teks) => { 26 | bot.sendMessage(from, teks, text, {quoted: message}) 27 | } 28 | exports.fetchJson = fetchJson = (url, options) => new Promise(async (resolve, reject) => { 29 | fetch(url, options) 30 | .then(response => response.json()) 31 | .then(json => { 32 | // console.log(json) 33 | resolve(json) 34 | }) 35 | .catch((err) => { 36 | reject(err) 37 | }) 38 | }) 39 | if (args.length < 1) return reply('Where the url?') 40 | if (!isUrl(args[0]) && !args[0].includes('instagram.com')) return reply(mess.Iv) 41 | reply(mess.wait) 42 | rarajelekjahat = await fetchJson(`https://mhankbarbar.tech/api/ig?url=${args[0]}&apiKey=${apiMank}`, {method: 'get'}) 43 | if (rarajelekjahat.error) return reply(rarajelekjahat.error) 44 | rahmababikontol = await getBuffer(rarajelekjahat.result) 45 | bot.sendMessage(from, rahmababikontol, image, {quoted: message, caption: mess.success}) 46 | 47 | 48 | }; 49 | 50 | exports.help = { 51 | name: "igvid", 52 | description: "Download Video Instagram", 53 | usage: "igvid link", 54 | cooldown: 5, 55 | }; 56 | -------------------------------------------------------------------------------- /commands/txtblackpink.js: -------------------------------------------------------------------------------- 1 | const fs = require("fs") 2 | const fetch = require('node-fetch') 3 | const axios = require('axios') 4 | apiMank = require("../config.json").apiMank 5 | apiNaufal = require("../config.json").apiNaufal 6 | const { MessageType } = require("@adiwajshing/baileys") 7 | const { text, extendedText, contact, location, liveLocation, image, video, sticker, document, audio, product } = MessageType 8 | 9 | exports.run = async (bot, message, args, from) => { 10 | const mess = { 11 | wait: 'Sedang di Prosess ⌛', 12 | success: 'Berhasil ✔️', 13 | gagal: 'Gagal ❌', 14 | stick: 'Gagal, terjadi kesalahan saat mengkonversi gambar ke sticker ❌', 15 | Iv: 'Link tidak valid ❌', 16 | mt: 'Command Dalam Tahap Perbaikan ❌', 17 | only: { 18 | group: '❌ Perintah ini hanya bisa di gunakan dalam group! ❌', 19 | ownerG: '❌ Perintah ini hanya bisa di gunakan oleh owner group! ❌', 20 | ownerB: '❌ Perintah ini hanya bisa di gunakan oleh owner bot! ❌', 21 | admin: '❌ Perintah ini hanya bisa di gunakan oleh admin group! ❌', 22 | Badmin: '❌ Perintah ini hanya bisa di gunakan ketika bot menjadi admin! ❌' 23 | } 24 | } 25 | const reply = (teks) => { 26 | bot.sendMessage(from, teks, text, {quoted: message}) 27 | } 28 | const getBuffer = async (url, options) => { 29 | try { 30 | options ? options : {} 31 | const res = await axios({ 32 | method: "get", 33 | url, 34 | headers: { 35 | 'DNT': 1, 36 | 'Upgrade-Insecure-Request': 1 37 | }, 38 | ...options, 39 | responseType: 'arraybuffer' 40 | }) 41 | return res.data 42 | } catch (e) { 43 | console.log(`Error : ${e}`) 44 | } 45 | } 46 | //if (args.length < 1) return reply('Where the text?') 47 | // teks = body.slice(13) 48 | // reply(mess.wait) 49 | // buff = await getBuffer(`https://docs-jojo.herokuapp.com/api/blackpink?text=${teks}`) 50 | // bot.sendMessage(from, buff, image, {quoted: message, caption: "Berhasil"}) 51 | reply(mess.mt) 52 | }; 53 | 54 | exports.help = { 55 | name: "txtblackpink", 56 | description: "Make logo blackpink", 57 | usage: "txtblackpink teks", 58 | cooldown: 5, 59 | }; 60 | -------------------------------------------------------------------------------- /commands/txtporn.js: -------------------------------------------------------------------------------- 1 | const fs = require("fs") 2 | const fetch = require('node-fetch') 3 | const axios = require('axios') 4 | apiMank = require("../config.json").apiMank 5 | apiNaufal = require("../config.json").apiNaufal 6 | const { MessageType } = require("@adiwajshing/baileys") 7 | const { text, extendedText, contact, location, liveLocation, image, video, sticker, document, audio, product } = MessageType 8 | 9 | exports.run = async (bot, message, args, from) => { 10 | const mess = { 11 | wait: 'Sedang di Prosess ⌛', 12 | success: 'Berhasil ✔️', 13 | gagal: 'Gagal ❌', 14 | stick: 'Gagal, terjadi kesalahan saat mengkonversi gambar ke sticker ❌', 15 | Iv: 'Link tidak valid ❌', 16 | mt: 'Command Dalam Tahap Perbaikan ❌', 17 | only: { 18 | group: '❌ Perintah ini hanya bisa di gunakan dalam group! ❌', 19 | ownerG: '❌ Perintah ini hanya bisa di gunakan oleh owner group! ❌', 20 | ownerB: '❌ Perintah ini hanya bisa di gunakan oleh owner bot! ❌', 21 | admin: '❌ Perintah ini hanya bisa di gunakan oleh admin group! ❌', 22 | Badmin: '❌ Perintah ini hanya bisa di gunakan ketika bot menjadi admin! ❌' 23 | } 24 | } 25 | const reply = (teks) => { 26 | bot.sendMessage(from, teks, text, {quoted: message}) 27 | } 28 | const getBuffer = async (url, options) => { 29 | try { 30 | options ? options : {} 31 | const res = await axios({ 32 | method: "get", 33 | url, 34 | headers: { 35 | 'DNT': 1, 36 | 'Upgrade-Insecure-Request': 1 37 | }, 38 | ...options, 39 | responseType: 'arraybuffer' 40 | }) 41 | return res.data 42 | } catch (e) { 43 | console.log(`Error : ${e}`) 44 | } 45 | } 46 | var zefian = body.slice(9) 47 | kita = zefian.split("|")[0]; 48 | putus = zefian.split("|")[1]; 49 | if (args.length < 1) return reply('Where the text?') 50 | reply(mess.wait) 51 | zefgantengbanget = (`https://naufalhoster.xyz/textmaker/pornhub?apikey=${apiNaufal}&text1=${kita}&text2=${putus}`) 52 | buff = await getBuffer(zefgantengbanget) 53 | bot.sendMessage(from, buff, image, {quoted: message, caption: mess.success}) 54 | }; 55 | 56 | exports.help = { 57 | name: "txtporn", 58 | description: "Make logo pornhub", 59 | usage: "txtporn teks", 60 | cooldown: 5, 61 | }; 62 | -------------------------------------------------------------------------------- /README.md: -------------------------------------------------------------------------------- 1 |

2 | 3 |

4 |

5 | 6 |

7 |

8 | 9 |

10 |

11 | 12 | 13 | 14 | 15 |

16 | 17 | # zzbot 18 | Simple WhatsApp Bot 19 | 20 | ### FOR TERMUX USER 21 | ```bash 22 | > pkg update && pkg install wget openssl-tool proot -y && hash -r && wget https://raw.githubusercontent.com/EXALAB/AnLinux-Resources/master/Scripts/Installer/Ubuntu/ubuntu.sh && bash ubuntu.sh 23 | > ./start-ubuntu.sh 24 | > apt install git 25 | > git clone https://github.com/ZefianAlfian/zzbot 26 | > cd zzbot 27 | > bash install.sh 28 | > npm start 29 | ``` 30 | ###### Jika Error / Tidak Bisa silahkan manual 31 | ```bash 32 | > pkg update -y && pkg install curl proot tar -y && curl https://raw.githubusercontent.com/AndronixApp/AndronixOrigin/master/Installer/Ubuntu/ubuntu-xfce.sh | bash 33 | > ./start-ubuntu.sh 34 | > apt update 35 | > apt install git 36 | > git clone https://github.com/ZefianAlfian/zzbot 37 | > cd zzbot 38 | > apt install curl 39 | > curl -sL https://deb.nodesource.com/setup_12.x -o nodesource_setup.sh 40 | > bash nodesource_setup.sh 41 | > apt install nodejs 42 | > apt install ffmpeg 43 | > apt install imagemagick 44 | > apt install webp 45 | > npm i -g cwebp 46 | > npm i 47 | > npm start 48 | ``` 49 | 50 | --------- 51 | 52 | ### FOR WINDOWS/VPS/RDP USER 53 | ```bash 54 | > git clone https://github.com/ZefianAlfian/zzbot 55 | > cd zzbot 56 | > npm install 57 | ``` 58 | ###### Run 59 | ```bash 60 | > node index.js 61 | ``` 62 | ###### Exit / Stop / Close 63 | ```bash 64 | > ctrl + c 65 | > ketik exit 66 | ``` 67 | -------------------------------------------------------------------------------- /commands/toimg.js: -------------------------------------------------------------------------------- 1 | const { spawn } = require('child_process') 2 | const util = require('util') 3 | apiMank = require("../config.json").apiMank 4 | apiNaufal = require("../config.json").apiNaufal 5 | const { MessageType } = require("@adiwajshing/baileys") 6 | const { text, extendedText, contact, location, liveLocation, image, video, sticker, document, audio, product } = MessageType 7 | 8 | exports.run = async (bot, message, args, from) => { 9 | const mess = { 10 | wait: 'Sedang di Prosess ⌛', 11 | success: 'Berhasil ✔️', 12 | gagal: 'Gagal ❌', 13 | stick: 'Gagal, terjadi kesalahan saat mengkonversi gambar ke sticker ❌', 14 | Iv: 'Link tidak valid ❌', 15 | mt: 'Command Dalam Tahap Perbaikan ❌', 16 | only: { 17 | group: '❌ Perintah ini hanya bisa di gunakan dalam group! ❌', 18 | ownerG: '❌ Perintah ini hanya bisa di gunakan oleh owner group! ❌', 19 | ownerB: '❌ Perintah ini hanya bisa di gunakan oleh owner bot! ❌', 20 | admin: '❌ Perintah ini hanya bisa di gunakan oleh admin group! ❌', 21 | Badmin: '❌ Perintah ini hanya bisa di gunakan ketika bot menjadi admin! ❌' 22 | } 23 | } 24 | const reply = (teks) => { 25 | bot.sendMessage(from, teks, text, {quoted: message}) 26 | } 27 | const getBuffer = async (url, options) => { 28 | try { 29 | options ? options : {} 30 | const res = await axios({ 31 | method: "get", 32 | url, 33 | headers: { 34 | 'DNT': 1, 35 | 'Upgrade-Insecure-Request': 1 36 | }, 37 | ...options, 38 | responseType: 'arraybuffer' 39 | }) 40 | return res.data 41 | } catch (e) { 42 | console.log(`Error : ${e}`) 43 | } 44 | } 45 | if (!message.quoted) return reply('Tag stikernya!') 46 | let q = { message: { [message.quoted.mtype]: message.quoted }} 47 | if (/sticker/.test(message.quoted.mtype)) { 48 | let sticker = await bot.downloadM(q) 49 | if (!sticker) throw sticker 50 | let bufs = [] 51 | let im = spawn('convert', ['webp:-', 'jpeg:-']) 52 | im.on('error',e => reply(util.format(e))) 53 | im.stdout.on('data', chunk => bufs.push(chunk)) 54 | im.stdin.write(sticker) 55 | im.stdin.end() 56 | im.on('exit', () => { 57 | bot.sendMessage(from, Buffer.concat(bufs), image, { 58 | quoted: message 59 | }) 60 | }) 61 | } 62 | }; 63 | 64 | exports.help = { 65 | name: "txtporn", 66 | description: "Make logo pornhub", 67 | usage: "txtporn teks", 68 | cooldown: 5, 69 | }; 70 | -------------------------------------------------------------------------------- /commands/info.js: -------------------------------------------------------------------------------- 1 | const fs = require("fs") 2 | const fetch = require('node-fetch') 3 | const axios = require('axios') 4 | apiMank = require("../config.json").apiMank 5 | apiNaufal = require("../config.json").apiNaufal 6 | const { MessageType } = require("@adiwajshing/baileys") 7 | const { text, extendedText, contact, location, liveLocation, image, video, sticker, document, audio, product } = MessageType 8 | 9 | exports.run = (bot, message, args, from) => { 10 | function kyun(seconds){ 11 | function pad(s){ 12 | return (s < 10 ? '0' : '') + s; 13 | } 14 | var hours = Math.floor(seconds / (60*60)); 15 | var minutes = Math.floor(seconds % (60*60) / 60); 16 | var seconds = Math.floor(seconds % 60); 17 | 18 | //return pad(hours) + ':' + pad(minutes) + ':' + pad(seconds) 19 | return `${pad(hours)} Jam ${pad(minutes)} Menit ${pad(seconds)} Detik` 20 | } 21 | const mess = { 22 | wait: 'Sedang di Prosess ⌛', 23 | success: 'Berhasil ✔️', 24 | gagal: 'Gagal ❌', 25 | stick: 'Gagal, terjadi kesalahan saat mengkonversi gambar ke sticker ❌', 26 | Iv: 'Link tidak valid ❌', 27 | mt: 'Command Dalam Tahap Perbaikan ❌', 28 | only: { 29 | group: '❌ Perintah ini hanya bisa di gunakan dalam group! ❌', 30 | ownerG: '❌ Perintah ini hanya bisa di gunakan oleh owner group! ❌', 31 | ownerB: '❌ Perintah ini hanya bisa di gunakan oleh owner bot! ❌', 32 | admin: '❌ Perintah ini hanya bisa di gunakan oleh admin group! ❌', 33 | Badmin: '❌ Perintah ini hanya bisa di gunakan ketika bot menjadi admin! ❌' 34 | } 35 | } 36 | const reply = (teks) => { 37 | bot.sendMessage(from, teks, text, {quoted: message}) 38 | } 39 | const getBuffer = async (url, options) => { 40 | try { 41 | options ? options : {} 42 | const res = await axios({ 43 | method: "get", 44 | url, 45 | headers: { 46 | 'DNT': 1, 47 | 'Upgrade-Insecure-Request': 1 48 | }, 49 | ...options, 50 | responseType: 'arraybuffer' 51 | }) 52 | return res.data 53 | } catch (e) { 54 | console.log(`Error : ${e}`) 55 | } 56 | } 57 | me = bot.user 58 | uptime = process.uptime() 59 | teks = `*Nama bot* : ${me.name}\n*Nomor Bot* : @${me.jid.split('@')[0]}\n*Prefix* : ${prefix}\n*Total Block Contact* : ${blocked.length}\n*The bot is active on* : ${kyun(uptime)}` 60 | //buffer = await getBuffer(me.imgUrl) 61 | //bot.sendMessage(from, buffer, image, {caption: teks, contextInfo:{mentionedJid: [me.jid]}}) 62 | bot.sendMessage(from, teks, text, {quoted: message}) 63 | } 64 | 65 | exports.help = { 66 | name: "info", 67 | description: "information this bot", 68 | usage: "info", 69 | cooldown: 5, 70 | }; 71 | 72 | -------------------------------------------------------------------------------- /index.js: -------------------------------------------------------------------------------- 1 | var moment = require('moment-timezone') 2 | var qrcode = require('qrcode-terminal') 3 | var colors = require('colors/safe') 4 | var fs = require('fs') 5 | var _ = require('lodash') 6 | 7 | const 8 | { 9 | ChatModification, 10 | WAConnection, 11 | MessageType, 12 | Presence, 13 | MessageOptions, 14 | Mimetype, 15 | WALocationMessage, 16 | WA_MESSAGE_STUB_TYPES, 17 | ReconnectMode, 18 | ProxyAgent, 19 | waChatKey, 20 | GroupSettingChange 21 | } = require("@adiwajshing/baileys") 22 | 23 | prefix = require("./config.json").prefix 24 | 25 | const client = new WAConnection() 26 | 27 | const welcome = JSON.parse(fs.readFileSync('./welcome.json')) 28 | 29 | const getGroupAdmins = (participants) => { 30 | admins = [] 31 | for (let i of participants) { 32 | i.isAdmin ? admins.push(i.jid) : '' 33 | } 34 | return admins 35 | } 36 | 37 | 38 | const fetch = require('node-fetch') 39 | const axios = require('axios') 40 | const chalk = require('chalk') 41 | const color = (text, color) => { 42 | return !color ? chalk.green(text) : chalk.keyword(color)(text) 43 | } 44 | const getBuffer = async (url, options) => { 45 | try { 46 | options ? options : {} 47 | const res = await axios({ 48 | method: "get", 49 | url, 50 | headers: { 51 | 'DNT': 1, 52 | 'Upgrade-Insecure-Request': 1 53 | }, 54 | ...options, 55 | responseType: 'arraybuffer' 56 | }) 57 | return res.data 58 | } catch (e) { 59 | console.log(`Error : ${e}`) 60 | } 61 | } 62 | 63 | const availableCommands = new Set(); 64 | 65 | fs.readdir("./commands", (e, files) => { 66 | if (e) return console.error(e); 67 | files.forEach((commandFile) => { 68 | availableCommands.add(commandFile.replace(".js", "")); 69 | }); 70 | }); 71 | 72 | const starts = async riz => { 73 | riz.on('qr', qr => { 74 | qrcode.generate(qr, { small: true }) 75 | console.log(`[ ! ] Scan kode qr dengan whatsapp!`) 76 | }) 77 | 78 | riz.on('credentials-updated', () => { 79 | const authInfo = client.base64EncodedAuthInfo() 80 | console.log(`credentials updated!`) 81 | 82 | fs.writeFileSync('./session-zefian.json', JSON.stringify(authInfo, null, '\t')) 83 | }) 84 | 85 | fs.existsSync('./session-zefian.json') && client.loadAuthInfo('./session-zefian.json') 86 | 87 | riz.connect() 88 | blocked = [] 89 | riz.on('CB:Blocklist', json => { 90 | if (blocked.length > 2) return 91 | for (let i of json[1].blocklist) { 92 | blocked.push(i.replace('c.us','s.whatsapp.net')) 93 | } 94 | }) 95 | riz.on('group-participants-update', async (anu) => { 96 | if (!welcome.includes(anu.jid)) return 97 | try { 98 | const mdata = await riz.groupMetadata(anu.jid) 99 | console.log(anu) 100 | if (anu.action == 'add') { 101 | num = anu.participants[0] 102 | try { 103 | ppimg = await riz.getProfilePicture(`${anu.participants[0].split('@')[0]}@c.us`) 104 | } catch { 105 | ppimg = 'https://i0.wp.com/www.gambarunik.id/wp-content/uploads/2019/06/Top-Gambar-Foto-Profil-Kosong-Lucu-Tergokil-.jpg' 106 | } 107 | teks = `Halo @${num.split('@')[0]}\nSelamat datang di group *${mdata.subject}*` 108 | let buff = await getBuffer(ppimg) 109 | riz.sendMessage(mdata.id, buff, MessageType.image, {caption: teks, contextInfo: {"mentionedJid": [num]}}) 110 | } else if (anu.action == 'remove') { 111 | num = anu.participants[0] 112 | try { 113 | ppimg = await riz.getProfilePicture(`${num.split('@')[0]}@c.us`) 114 | } catch { 115 | ppimg = 'https://i0.wp.com/www.gambarunik.id/wp-content/uploads/2019/06/Top-Gambar-Foto-Profil-Kosong-Lucu-Tergokil-.jpg' 116 | } 117 | teks = `Sayonara @${num.split('@')[0]}👋` 118 | let buff = await getBuffer(ppimg) 119 | riz.sendMessage(mdata.id, buff, MessageType.image, {caption: teks, contextInfo: {"mentionedJid": [num]}}) 120 | } 121 | } catch (e) { 122 | console.log('Error : %s', color(e, 'red')) 123 | } 124 | }) 125 | riz.on('message-new', async message => { 126 | try { 127 | global.prefix; 128 | global.blocked 129 | 130 | const getRandom = (ext) => { 131 | return `${Math.floor(Math.random() * 10000)}${ext}` 132 | } 133 | const from = message.key.remoteJid 134 | const isGroup = from.endsWith('@g.us') 135 | const ttext = message.message.conversation 136 | const type = Object.keys(message.message)[0] 137 | const mess = { 138 | wait: 'Sedang di Prosess ⌛', 139 | success: 'Berhasil ✔️', 140 | gagal: 'Gagal ❌', 141 | stick: 'Gagal, terjadi kesalahan saat mengkonversi gambar ke sticker ❌', 142 | Iv: 'Link tidak valid ❌', 143 | mt: 'Command Dalam Tahap Perbaikan ❌', 144 | only: { 145 | group: '❌ Perintah ini hanya bisa di gunakan dalam group! ❌', 146 | ownerG: '❌ Perintah ini hanya bisa di gunakan oleh owner group! ❌', 147 | ownerB: '❌ Perintah ini hanya bisa di gunakan oleh owner bot! ❌', 148 | admin: '❌ Perintah ini hanya bisa di gunakan oleh admin group! ❌', 149 | Badmin: '❌ Perintah ini hanya bisa di gunakan ketika bot menjadi admin! ❌' 150 | } 151 | } 152 | const reply = (teks) => { 153 | riz.sendMessage(from, teks, text, {quoted: message}) 154 | } 155 | 156 | const id = isGroup ? message.participant : message.key.remoteJid 157 | 158 | const { text, extendedText, contact, location, liveLocation, image, video, sticker, document, audio, product } = MessageType 159 | 160 | body = (type === 'conversation' && message.message.conversation.startsWith(prefix)) ? message.message.conversation : (type == 'imageMessage') && message.message.imageMessage.caption.startsWith(prefix) ? message.message.imageMessage.caption : (type == 'videoMessage') && message.message.videoMessage.caption.startsWith(prefix) ? message.message.videoMessage.caption : (type == 'extendedTextMessage') && message.message.extendedTextMessage.text.startsWith(prefix) ? message.message.extendedTextMessage.text : '' 161 | budy = (type === 'conversation') ? message.message.conversation : (type === 'extendedTextMessage') ? message.message.extendedTextMessage.text : '' 162 | 163 | const argv = body.slice(1).trim().split(/ +/).shift().toLowerCase() 164 | const args = body.trim().split(/ +/).slice(1) 165 | const isCmd = body.startsWith(prefix) 166 | 167 | const isBot = riz.user.jid 168 | const owner = '6289630171792@s.whatsapp.net' // replace owner number 169 | const groupMetadata = isGroup ? await riz.groupMetadata(from) : '' 170 | const groupName = isGroup ? groupMetadata.subject : '' 171 | const groupId = isGroup ? groupMetadata.jid : '' 172 | const groupMembers = isGroup ? groupMetadata.participants : '' 173 | const groupAdmins = isGroup ? getGroupAdmins(groupMembers) : '' 174 | const isBotGroupAdmins = groupAdmins.includes(isBot) || false 175 | const isGroupAdmins = groupAdmins.includes(id) || false 176 | const isWelcome = isGroup ? welcome.includes(from) : false 177 | const isMedia = (type === 'imageMessage' || type === 'videoMessage' || type === 'audioMessage') 178 | 179 | const content = JSON.stringify(message.message) 180 | 181 | const isQuotedImage = type === 'extendedTextMessage' && content.includes('imageMessage') 182 | const isQuotedVideo = type === 'extendedTextMessage' && content.includes('videoMessage') 183 | const isQuotedAudio = type === 'extendedTextMessage' && content.includes('audioMessage') 184 | const isQuotedSticker = type === 'extendedTextMessage' && content.includes('stickerMessage') 185 | const isQuotedMessage = type === 'extendedTextMessage' && content.includes('conversation') 186 | 187 | // if (isGroup && !isMedia) return console.log(`[${colors.bgYellow('GROUP CHAT')}] FROM ${colors.bgMagenta(from)} : ${colors.bgCyan(args.join(' '))}`) 188 | 189 | console.log(availableCommands) 190 | if (ttext.includes('#help')){ 191 | zef.sendMessage(from, "use /help", text, {quoted: message}) 192 | } 193 | if (ttext.includes('/welcome')){ 194 | if (!isGroup) return reply(mess.only.group) 195 | if (!isGroupAdmins) return reply(mess.only.admin) 196 | if (args.length < 1) return reply('Hmmmm') 197 | if (Number(args[0]) === 1) { 198 | if (isWelcome) return reply('Udah aktif um') 199 | welcome.push(from) 200 | fs.writeFileSync('../welcome.json', JSON.stringify(welcome)) 201 | reply('Sukses mengaktifkan fitur welcome di group ini ✔️') 202 | } else if (Number(args[0]) === 0) { 203 | welcome.splice(from, 1) 204 | fs.writeFileSync('../welcome.json', JSON.stringify(welcome)) 205 | reply('Sukses menonaktifkan fitur welcome di group ini ✔️') 206 | } else { 207 | reply('1 untuk mengaktifkan, 0 untuk menonaktifkan') 208 | } 209 | } 210 | if (availableCommands.has(argv)) 211 | require(`./commands/${argv}`).run(riz, message, args, from, getRandom, isMedia, isQuotedImage, isQuotedVideo, isQuotedAudio, isQuotedSticker, isQuotedMessage) 212 | } catch (err) { 213 | throw err 214 | } 215 | }) 216 | } 217 | 218 | ( async () => { 219 | await starts(client) 220 | })() 221 | -------------------------------------------------------------------------------- /LICENSE: -------------------------------------------------------------------------------- 1 | Apache License 2 | Version 2.0, January 2004 3 | http://www.apache.org/licenses/ 4 | 5 | TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION 6 | 7 | 1. Definitions. 8 | 9 | "License" shall mean the terms and conditions for use, reproduction, 10 | and distribution as defined by Sections 1 through 9 of this document. 11 | 12 | "Licensor" shall mean the copyright owner or entity authorized by 13 | the copyright owner that is granting the License. 14 | 15 | "Legal Entity" shall mean the union of the acting entity and all 16 | other entities that control, are controlled by, or are under common 17 | control with that entity. For the purposes of this definition, 18 | "control" means (i) the power, direct or indirect, to cause the 19 | direction or management of such entity, whether by contract or 20 | otherwise, or (ii) ownership of fifty percent (50%) or more of the 21 | outstanding shares, or (iii) beneficial ownership of such entity. 22 | 23 | "You" (or "Your") shall mean an individual or Legal Entity 24 | exercising permissions granted by this License. 25 | 26 | "Source" form shall mean the preferred form for making modifications, 27 | including but not limited to software source code, documentation 28 | source, and configuration files. 29 | 30 | "Object" form shall mean any form resulting from mechanical 31 | transformation or translation of a Source form, including but 32 | not limited to compiled object code, generated documentation, 33 | and conversions to other media types. 34 | 35 | "Work" shall mean the work of authorship, whether in Source or 36 | Object form, made available under the License, as indicated by a 37 | copyright notice that is included in or attached to the work 38 | (an example is provided in the Appendix below). 39 | 40 | "Derivative Works" shall mean any work, whether in Source or Object 41 | form, that is based on (or derived from) the Work and for which the 42 | editorial revisions, annotations, elaborations, or other modifications 43 | represent, as a whole, an original work of authorship. For the purposes 44 | of this License, Derivative Works shall not include works that remain 45 | separable from, or merely link (or bind by name) to the interfaces of, 46 | the Work and Derivative Works thereof. 47 | 48 | "Contribution" shall mean any work of authorship, including 49 | the original version of the Work and any modifications or additions 50 | to that Work or Derivative Works thereof, that is intentionally 51 | submitted to Licensor for inclusion in the Work by the copyright owner 52 | or by an individual or Legal Entity authorized to submit on behalf of 53 | the copyright owner. For the purposes of this definition, "submitted" 54 | means any form of electronic, verbal, or written communication sent 55 | to the Licensor or its representatives, including but not limited to 56 | communication on electronic mailing lists, source code control systems, 57 | and issue tracking systems that are managed by, or on behalf of, the 58 | Licensor for the purpose of discussing and improving the Work, but 59 | excluding communication that is conspicuously marked or otherwise 60 | designated in writing by the copyright owner as "Not a Contribution." 61 | 62 | "Contributor" shall mean Licensor and any individual or Legal Entity 63 | on behalf of whom a Contribution has been received by Licensor and 64 | subsequently incorporated within the Work. 65 | 66 | 2. Grant of Copyright License. Subject to the terms and conditions of 67 | this License, each Contributor hereby grants to You a perpetual, 68 | worldwide, non-exclusive, no-charge, royalty-free, irrevocable 69 | copyright license to reproduce, prepare Derivative Works of, 70 | publicly display, publicly perform, sublicense, and distribute the 71 | Work and such Derivative Works in Source or Object form. 72 | 73 | 3. Grant of Patent License. Subject to the terms and conditions of 74 | this License, each Contributor hereby grants to You a perpetual, 75 | worldwide, non-exclusive, no-charge, royalty-free, irrevocable 76 | (except as stated in this section) patent license to make, have made, 77 | use, offer to sell, sell, import, and otherwise transfer the Work, 78 | where such license applies only to those patent claims licensable 79 | by such Contributor that are necessarily infringed by their 80 | Contribution(s) alone or by combination of their Contribution(s) 81 | with the Work to which such Contribution(s) was submitted. If You 82 | institute patent litigation against any entity (including a 83 | cross-claim or counterclaim in a lawsuit) alleging that the Work 84 | or a Contribution incorporated within the Work constitutes direct 85 | or contributory patent infringement, then any patent licenses 86 | granted to You under this License for that Work shall terminate 87 | as of the date such litigation is filed. 88 | 89 | 4. Redistribution. You may reproduce and distribute copies of the 90 | Work or Derivative Works thereof in any medium, with or without 91 | modifications, and in Source or Object form, provided that You 92 | meet the following conditions: 93 | 94 | (a) You must give any other recipients of the Work or 95 | Derivative Works a copy of this License; and 96 | 97 | (b) You must cause any modified files to carry prominent notices 98 | stating that You changed the files; and 99 | 100 | (c) You must retain, in the Source form of any Derivative Works 101 | that You distribute, all copyright, patent, trademark, and 102 | attribution notices from the Source form of the Work, 103 | excluding those notices that do not pertain to any part of 104 | the Derivative Works; and 105 | 106 | (d) If the Work includes a "NOTICE" text file as part of its 107 | distribution, then any Derivative Works that You distribute must 108 | include a readable copy of the attribution notices contained 109 | within such NOTICE file, excluding those notices that do not 110 | pertain to any part of the Derivative Works, in at least one 111 | of the following places: within a NOTICE text file distributed 112 | as part of the Derivative Works; within the Source form or 113 | documentation, if provided along with the Derivative Works; or, 114 | within a display generated by the Derivative Works, if and 115 | wherever such third-party notices normally appear. The contents 116 | of the NOTICE file are for informational purposes only and 117 | do not modify the License. You may add Your own attribution 118 | notices within Derivative Works that You distribute, alongside 119 | or as an addendum to the NOTICE text from the Work, provided 120 | that such additional attribution notices cannot be construed 121 | as modifying the License. 122 | 123 | You may add Your own copyright statement to Your modifications and 124 | may provide additional or different license terms and conditions 125 | for use, reproduction, or distribution of Your modifications, or 126 | for any such Derivative Works as a whole, provided Your use, 127 | reproduction, and distribution of the Work otherwise complies with 128 | the conditions stated in this License. 129 | 130 | 5. Submission of Contributions. Unless You explicitly state otherwise, 131 | any Contribution intentionally submitted for inclusion in the Work 132 | by You to the Licensor shall be under the terms and conditions of 133 | this License, without any additional terms or conditions. 134 | Notwithstanding the above, nothing herein shall supersede or modify 135 | the terms of any separate license agreement you may have executed 136 | with Licensor regarding such Contributions. 137 | 138 | 6. Trademarks. This License does not grant permission to use the trade 139 | names, trademarks, service marks, or product names of the Licensor, 140 | except as required for reasonable and customary use in describing the 141 | origin of the Work and reproducing the content of the NOTICE file. 142 | 143 | 7. Disclaimer of Warranty. Unless required by applicable law or 144 | agreed to in writing, Licensor provides the Work (and each 145 | Contributor provides its Contributions) on an "AS IS" BASIS, 146 | WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or 147 | implied, including, without limitation, any warranties or conditions 148 | of TITLE, NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A 149 | PARTICULAR PURPOSE. You are solely responsible for determining the 150 | appropriateness of using or redistributing the Work and assume any 151 | risks associated with Your exercise of permissions under this License. 152 | 153 | 8. Limitation of Liability. In no event and under no legal theory, 154 | whether in tort (including negligence), contract, or otherwise, 155 | unless required by applicable law (such as deliberate and grossly 156 | negligent acts) or agreed to in writing, shall any Contributor be 157 | liable to You for damages, including any direct, indirect, special, 158 | incidental, or consequential damages of any character arising as a 159 | result of this License or out of the use or inability to use the 160 | Work (including but not limited to damages for loss of goodwill, 161 | work stoppage, computer failure or malfunction, or any and all 162 | other commercial damages or losses), even if such Contributor 163 | has been advised of the possibility of such damages. 164 | 165 | 9. Accepting Warranty or Additional Liability. While redistributing 166 | the Work or Derivative Works thereof, You may choose to offer, 167 | and charge a fee for, acceptance of support, warranty, indemnity, 168 | or other liability obligations and/or rights consistent with this 169 | License. However, in accepting such obligations, You may act only 170 | on Your own behalf and on Your sole responsibility, not on behalf 171 | of any other Contributor, and only if You agree to indemnify, 172 | defend, and hold each Contributor harmless for any liability 173 | incurred by, or claims asserted against, such Contributor by reason 174 | of your accepting any such warranty or additional liability. 175 | 176 | END OF TERMS AND CONDITIONS 177 | 178 | APPENDIX: How to apply the Apache License to your work. 179 | 180 | To apply the Apache License to your work, attach the following 181 | boilerplate notice, with the fields enclosed by brackets "[]" 182 | replaced with your own identifying information. (Don't include 183 | the brackets!) The text should be enclosed in the appropriate 184 | comment syntax for the file format. We also recommend that a 185 | file or class name and description of purpose be included on the 186 | same "printed page" as the copyright notice for easier 187 | identification within third-party archives. 188 | 189 | Copyright [yyyy] [name of copyright owner] 190 | 191 | Licensed under the Apache License, Version 2.0 (the "License"); 192 | you may not use this file except in compliance with the License. 193 | You may obtain a copy of the License at 194 | 195 | http://www.apache.org/licenses/LICENSE-2.0 196 | 197 | Unless required by applicable law or agreed to in writing, software 198 | distributed under the License is distributed on an "AS IS" BASIS, 199 | WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 200 | See the License for the specific language governing permissions and 201 | limitations under the License. 202 | --------------------------------------------------------------------------------