├── .dockerignore ├── .eslintrc.js ├── .gitattributes ├── .github ├── FUNDING.yml └── workflows │ └── label.yml ├── .gitignore ├── HandleMsg.js ├── LICENSE ├── README.md ├── halo.java ├── index.js ├── lib ├── cekResi.js ├── data │ └── group.json ├── images.js ├── index.js ├── kataKotor.js ├── location.js ├── meme.js ├── menu.js ├── nekopoi.js ├── resep.js ├── rugaApi.js ├── shortener.js └── translate.js ├── media └── tts.mp3 ├── package-lock.json ├── package.json ├── settings ├── api.json ├── banned.json ├── ngegas.json ├── setting.json └── simi.json └── utils ├── fetcher.js ├── imageProcessing.js ├── index.js ├── options.js └── stat.json /.dockerignore: -------------------------------------------------------------------------------- 1 | node_modules 2 | -------------------------------------------------------------------------------- /.eslintrc.js: -------------------------------------------------------------------------------- 1 | module.exports = { 2 | env: { 3 | commonjs: true, 4 | es6: true, 5 | node: true 6 | }, 7 | extends: 'standard', 8 | globals: { 9 | Atomics: 'readonly', 10 | SharedArrayBuffer: 'readonly' 11 | }, 12 | parserOptions: { 13 | ecmaVersion: 2018 14 | }, 15 | rules: { 16 | eqeqeq: 0, 17 | indent: [2, 4], 18 | camelcase: 1, 19 | 'no-var': 2, 20 | 'no-unused-vars': 1, 21 | 'no-unused-expressions': 0, 22 | 'no-self-assign': 0, 23 | 'no-undef': 0, 24 | 'no-case-declarations': 0, 25 | 'prefer-promise-reject-errors': 1, 26 | 'object-property-newline': 0, 27 | 'no-useless-escape': 0, 28 | 'prefer-regex-literals': 0 29 | } 30 | } 31 | -------------------------------------------------------------------------------- /.gitattributes: -------------------------------------------------------------------------------- 1 | # Auto detect text files and perform LF normalization 2 | * text=auto 3 | -------------------------------------------------------------------------------- /.github/FUNDING.yml: -------------------------------------------------------------------------------- 1 | # These are supported funding model platforms 2 | 3 | github: # Replace with up to 4 GitHub Sponsors-enabled usernames e.g., [user1, user2] 4 | patreon: # Replace with a single Patreon username 5 | open_collective: # Replace with a single Open Collective username 6 | ko_fi: # Replace with a single Ko-fi username 7 | tidelift: # Replace with a single Tidelift platform-name/package-name e.g., npm/babel 8 | community_bridge: # Replace with a single Community Bridge project-name e.g., cloud-foundry 9 | liberapay: # Replace with a single Liberapay username 10 | issuehunt: # Replace with a single IssueHunt username 11 | otechie: # Replace with a single Otechie username 12 | custom: ['https://paypal.me/arugaz','https://trakteer.id/arugabot','https://instagram.com/ini.arga'] 13 | -------------------------------------------------------------------------------- /.github/workflows/label.yml: -------------------------------------------------------------------------------- 1 | name: Labeler 2 | on: [pull_request] 3 | 4 | jobs: 5 | label: 6 | 7 | runs-on: ubuntu-latest 8 | 9 | steps: 10 | - uses: actions/labeler@v2 11 | with: 12 | repo-token: "${{ secrets.GITHUB_TOKEN }}" 13 | -------------------------------------------------------------------------------- /.gitignore: -------------------------------------------------------------------------------- 1 | # Logs 2 | logs 3 | *.log 4 | npm-debug.log* 5 | yarn-debug.log* 6 | yarn-error.log* 7 | lerna-debug.log* 8 | 9 | # Diagnostic reports (https://nodejs.org/api/report.html) 10 | report.[0-9]*.[0-9]*.[0-9]*.[0-9]*.json 11 | 12 | # Runtime data 13 | pids 14 | *.pid 15 | *.seed 16 | *.pid.lock 17 | 18 | # Directory for instrumented libs generated by jscoverage/JSCover 19 | lib-cov 20 | 21 | # Coverage directory used by tools like istanbul 22 | coverage 23 | *.lcov 24 | 25 | # nyc test coverage 26 | .nyc_output 27 | 28 | # Grunt intermediate storage (https://gruntjs.com/creating-plugins#storing-task-files) 29 | .grunt 30 | 31 | # Bower dependency directory (https://bower.io/) 32 | bower_components 33 | 34 | # node-waf configuration 35 | .lock-wscript 36 | 37 | # Compiled binary addons (https://nodejs.org/api/addons.html) 38 | build/Release 39 | 40 | # Dependency directories 41 | node_modules/ 42 | jspm_packages/ 43 | 44 | # TypeScript v1 declaration files 45 | typings/ 46 | 47 | # TypeScript cache 48 | *.tsbuildinfo 49 | 50 | # Optional npm cache directory 51 | .npm 52 | 53 | # Optional eslint cache 54 | .eslintcache 55 | 56 | # Microbundle cache 57 | .rpt2_cache/ 58 | .rts2_cache_cjs/ 59 | .rts2_cache_es/ 60 | .rts2_cache_umd/ 61 | 62 | # Optional REPL history 63 | .node_repl_history 64 | 65 | # Output of 'npm pack' 66 | *.tgz 67 | 68 | # Yarn Integrity file 69 | .yarn-integrity 70 | 71 | # dotenv environment variables file 72 | .env 73 | .env.test 74 | 75 | # parcel-bundler cache (https://parceljs.org/) 76 | .cache 77 | 78 | # Next.js build output 79 | .next 80 | 81 | # Nuxt.js build / generate output 82 | .nuxt 83 | dist 84 | 85 | # Gatsby files 86 | .cache/ 87 | # Comment in the public line in if your project uses Gatsby and *not* Next.js 88 | # https://nextjs.org/blog/next-9-1#public-directory-support 89 | # public 90 | 91 | # vuepress build output 92 | .vuepress/dist 93 | 94 | # Serverless directories 95 | .serverless/ 96 | 97 | # FuseBox cache 98 | .fusebox/ 99 | 100 | # DynamoDB Local files 101 | .dynamodb/ 102 | 103 | # TernJS port file 104 | .tern-port 105 | -------------------------------------------------------------------------------- /HandleMsg.js: -------------------------------------------------------------------------------- 1 | require('dotenv').config() 2 | const { decryptMedia } = require('@open-wa/wa-automate') 3 | 4 | const moment = require('moment-timezone') 5 | moment.tz.setDefault('Asia/Jakarta').locale('id') 6 | const axios = require('axios') 7 | const fetch = require('node-fetch') 8 | 9 | const appRoot = require('app-root-path') 10 | const low = require('lowdb') 11 | const FileSync = require('lowdb/adapters/FileSync') 12 | const db_group = new FileSync(appRoot+'/lib/data/group.json') 13 | const db = low(db_group) 14 | db.defaults({ group: []}).write() 15 | 16 | const { 17 | removeBackgroundFromImageBase64 18 | } = require('remove.bg') 19 | 20 | const { 21 | exec 22 | } = require('child_process') 23 | 24 | const { 25 | menuId, 26 | cekResi, 27 | urlShortener, 28 | meme, 29 | translate, 30 | getLocationData, 31 | images, 32 | resep, 33 | rugapoi, 34 | rugaapi, 35 | cariKasar 36 | } = require('./lib') 37 | 38 | const { 39 | msgFilter, 40 | color, 41 | processTime, 42 | isUrl 43 | } = require('./utils') 44 | 45 | const { uploadImages } = require('./utils/fetcher') 46 | 47 | const fs = require('fs-extra') 48 | const banned = JSON.parse(fs.readFileSync('./settings/banned.json')) 49 | /* const simi = JSON.parse(fs.readFileSync('./settings/simi.json')) */ 50 | const ngegas = JSON.parse(fs.readFileSync('./settings/ngegas.json')) 51 | const setting = JSON.parse(fs.readFileSync('./settings/setting.json')) 52 | 53 | let { 54 | ownerNumber, 55 | groupLimit, 56 | memberLimit, 57 | prefix 58 | } = setting 59 | 60 | const { 61 | apiNoBg, 62 | /* apiSimi */ 63 | } = JSON.parse(fs.readFileSync('./settings/api.json')) 64 | 65 | function formatin(duit){ 66 | let reverse = duit.toString().split('').reverse().join(''); 67 | let ribuan = reverse.match(/\d{1,3}/g); 68 | ribuan = ribuan.join('.').split('').reverse().join(''); 69 | return ribuan; 70 | } 71 | 72 | const inArray = (needle, haystack) => { 73 | let length = haystack.length; 74 | for(let i = 0; i < length; i++) { 75 | if(haystack[i].id == needle) return i; 76 | } 77 | return false; 78 | } 79 | 80 | module.exports = HandleMsg = async (pakforlay, message) => { 81 | try { 82 | const { type, id, from, t, sender, isGroupMsg, chat, chatId, caption, isMedia, mimetype, quotedMsg, quotedMsgObj, mentionedJidList } = message 83 | let { body } = message 84 | var { name, formattedTitle } = chat 85 | let { pushname, verifiedName, formattedName } = sender 86 | pushname = pushname || verifiedName || formattedName // verifiedName is the name of someone who uses a business account 87 | const botNumber = await pakforlay.getHostNumber() + '@c.us' 88 | const groupId = isGroupMsg ? chat.groupMetadata.id : '' 89 | const groupAdmins = isGroupMsg ? await pakforlay.getGroupAdmins(groupId) : '' 90 | const isGroupAdmins = groupAdmins.includes(sender.id) || false 91 | const chats = (type === 'chat') ? body : (type === 'image' || type === 'video') ? caption : '' 92 | const pengirim = sender.id 93 | const isBotGroupAdmins = groupAdmins.includes(botNumber) || false 94 | 95 | // Bot Prefix 96 | body = (type === 'chat' && body.startsWith(prefix)) ? body : ((type === 'image' && caption || type === 'video' && caption) && caption.startsWith(prefix)) ? caption : '' 97 | const command = body.slice(1).trim().split(/ +/).shift().toLowerCase() 98 | const arg = body.trim().substring(body.indexOf(' ') + 1) 99 | const args = body.trim().split(/ +/).slice(1) 100 | const argx = chats.slice(0).trim().split(/ +/).shift().toLowerCase() 101 | const isCmd = body.startsWith(prefix) 102 | const uaOverride = process.env.UserAgent 103 | const url = args.length !== 0 ? args[0] : '' 104 | const isQuotedImage = quotedMsg && quotedMsg.type === 'image' 105 | const isQuotedVideo = quotedMsg && quotedMsg.type === 'video' 106 | 107 | // [IDENTIFY] 108 | const isOwnerBot = ownerNumber.includes(pengirim) 109 | const isBanned = banned.includes(pengirim) 110 | /* const isSimi = simi.includes(chatId) */ 111 | const isNgegas = ngegas.includes(chatId) 112 | const isKasar = await cariKasar(chats) 113 | 114 | // [BETA] Avoid Spam Message 115 | if (isCmd && msgFilter.isFiltered(from) && !isGroupMsg) { return console.log(color('[SPAM]', 'red'), color(moment(t * 1000).format('DD/MM/YY HH:mm:ss'), 'yellow'), color(`${command} [${args.length}]`), 'from', color(pushname)) } 116 | if (isCmd && msgFilter.isFiltered(from) && isGroupMsg) { return console.log(color('[SPAM]', 'red'), color(moment(t * 1000).format('DD/MM/YY HH:mm:ss'), 'yellow'), color(`${command} [${args.length}]`), 'from', color(pushname), 'in', color(name || formattedTitle)) } 117 | // 118 | if(!isCmd && isKasar && isGroupMsg) { console.log(color('[BADW]', 'orange'), color(moment(t * 1000).format('DD/MM/YY HH:mm:ss'), 'yellow'), color(`${argx}`), 'from', color(pushname), 'in', color(name || formattedTitle)) } 119 | if (isCmd && !isGroupMsg) { console.log(color('[EXEC]'), color(moment(t * 1000).format('DD/MM/YY HH:mm:ss'), 'yellow'), color(`${command} [${args.length}]`), 'from', color(pushname)) } 120 | if (isCmd && isGroupMsg) { console.log(color('[EXEC]'), color(moment(t * 1000).format('DD/MM/YY HH:mm:ss'), 'yellow'), color(`${command} [${args.length}]`), 'from', color(pushname), 'in', color(name || formattedTitle)) } 121 | 122 | // [BETA] Avoid Spam Message 123 | msgFilter.addFilter(from) 124 | 125 | // Filter Banned People 126 | if (isBanned) { 127 | return console.log(color('[BAN]', 'red'), color(moment(t * 1000).format('DD/MM/YY HH:mm:ss'), 'yellow'), color(`${command} [${args.length}]`), 'from', color(pushname)) 128 | } 129 | 130 | switch (command) { 131 | // Menu and TnC 132 | case 'speed': 133 | case 'ping': 134 | await pakforlay.sendText(from, `Pong!!!!\nSpeed: ${processTime(t, moment())} _Second_`) 135 | break 136 | case 'tnc': 137 | await pakforlay.sendText(from, menuId.textTnC()) 138 | break 139 | case 'menu': 140 | case 'help': 141 | await pakforlay.sendText(from, menuId.textMenu(pushname)) 142 | .then(() => ((isGroupMsg) && (isGroupAdmins)) ? pakforlay.sendText(from, `Menu Admin Grup: *${prefix}menuadmin*`) : null) 143 | break 144 | case 'menuadmin': 145 | if (!isGroupMsg) return pakforlay.reply(from, 'Maaf, perintah ini hanya dapat dipakai didalam grup!', id) 146 | if (!isGroupAdmins) return pakforlay.reply(from, 'Gagal, perintah ini hanya dapat digunakan oleh admin grup!', id) 147 | await pakforlay.sendText(from, menuId.textAdmin()) 148 | break 149 | case 'donate': 150 | case 'donasi': 151 | await pakforlay.sendText(from, menuId.textDonasi()) 152 | break 153 | case 'ownerbot': 154 | await pakforlay.sendContact(from, ownerNumber) 155 | .then(() => pakforlay.sendText(from, 'Jika kalian ingin request fitur silahkan chat nomor owner!')) 156 | break 157 | case 'join': 158 | if (args.length == 0) return pakforlay.reply(from, `Jika kalian ingin mengundang bot kegroup silahkan invite atau dengan\nketik ${prefix}join [link group]`, id) 159 | let linkgrup = body.slice(6) 160 | let islink = linkgrup.match(/(https:\/\/chat.whatsapp.com)/gi) 161 | let chekgrup = await pakforlay.inviteInfo(linkgrup) 162 | if (!islink) return pakforlay.reply(from, 'Maaf link group-nya salah! silahkan kirim link yang benar', id) 163 | if (isOwnerBot) { 164 | await pakforlay.joinGroupViaLink(linkgrup) 165 | .then(async () => { 166 | await pakforlay.sendText(from, 'Berhasil join grup via link!') 167 | await pakforlay.sendText(chekgrup.id, `Hai minna~, Im PakForlay BOT. To find out the commands on this bot type ${prefix}menu`) 168 | }) 169 | } else { 170 | let cgrup = await pakforlay.getAllGroups() 171 | if (cgrup.length > groupLimit) return pakforlay.reply(from, `Sorry, the group on this bot is full\nMax Group is: ${groupLimit}`, id) 172 | if (cgrup.size < memberLimit) return pakforlay.reply(from, `Sorry, BOT wil not join if the group members do not exceed ${memberLimit} people`, id) 173 | await pakforlay.joinGroupViaLink(linkgrup) 174 | .then(async () =>{ 175 | await pakforlay.reply(from, 'Berhasil join grup via link!', id) 176 | }) 177 | .catch(() => { 178 | pakforlay.reply(from, 'Gagal!', id) 179 | }) 180 | } 181 | break 182 | case 'botstat': { 183 | const loadedMsg = await pakforlay.getAmountOfLoadedMessages() 184 | const chatIds = await pakforlay.getAllChatIds() 185 | const groups = await pakforlay.getAllGroups() 186 | pakforlay.sendText(from, `Status :\n- *${loadedMsg}* Loaded Messages\n- *${groups.length}* Group Chats\n- *${chatIds.length - groups.length}* Personal Chats\n- *${chatIds.length}* Total Chats`) 187 | break 188 | } 189 | 190 | // Sticker Creator 191 | case 'sticker': 192 | case 'stiker': 193 | if ((isMedia || isQuotedImage) && args.length === 0) { 194 | const encryptMedia = isQuotedImage ? quotedMsg : message 195 | const _mimetype = isQuotedImage ? quotedMsg.mimetype : mimetype 196 | const mediaData = await decryptMedia(encryptMedia, uaOverride) 197 | const imageBase64 = `data:${_mimetype};base64,${mediaData.toString('base64')}` 198 | pakforlay.sendImageAsSticker(from, imageBase64) 199 | .then(() => { 200 | pakforlay.reply(from, 'Here\'s your sticker') 201 | console.log(`Sticker Processed for ${processTime(t, moment())} Second`) 202 | }) 203 | } else if (args[0] === 'nobg') { 204 | if (isMedia || isQuotedImage) { 205 | try { 206 | var mediaData = await decryptMedia(message, uaOverride) 207 | var imageBase64 = `data:${mimetype};base64,${mediaData.toString('base64')}` 208 | var base64img = imageBase64 209 | var outFile = './media/noBg.png' 210 | // kamu dapat mengambil api key dari website remove.bg dan ubahnya difolder settings/api.json 211 | var result = await removeBackgroundFromImageBase64({ base64img, apiKey: apiNoBg, size: 'auto', type: 'auto', outFile }) 212 | await fs.writeFile(outFile, result.base64img) 213 | await pakforlay.sendImageAsSticker(from, `data:${mimetype};base64,${result.base64img}`) 214 | } catch(err) { 215 | console.log(err) 216 | await pakforlay.reply(from, 'Maaf batas penggunaan hari ini sudah mencapai maksimal', id) 217 | } 218 | } 219 | } else if (args.length === 1) { 220 | if (!isUrl(url)) { await pakforlay.reply(from, 'Maaf, link yang kamu kirim tidak valid.', id) } 221 | pakforlay.sendStickerfromUrl(from, url).then((r) => (!r && r !== undefined) 222 | ? pakforlay.sendText(from, 'Maaf, link yang kamu kirim tidak memuat gambar.') 223 | : pakforlay.reply(from, 'Here\'s your sticker')).then(() => console.log(`Sticker Processed for ${processTime(t, moment())} Second`)) 224 | } else { 225 | await pakforlay.reply(from, `Tidak ada gambar! Untuk menggunakan ${prefix}sticker\n\n\nKirim gambar dengan caption\n${prefix}sticker \n${prefix}sticker nobg \n\natau Kirim pesan dengan\n${prefix}sticker `, id) 226 | } 227 | break 228 | case 'stickergif': 229 | case 'stikergif': 230 | if (isMedia || isQuotedVideo) { 231 | if (mimetype === 'video/mp4' && message.duration < 10 || mimetype === 'image/gif' && message.duration < 10) { 232 | var mediaData = await decryptMedia(message, uaOverride) 233 | pakforlay.reply(from, '[WAIT] Sedang di proses⏳ silahkan tunggu ± 1 min!', id) 234 | var filename = `./media/stickergif.${mimetype.split('/')[1]}` 235 | await fs.writeFileSync(filename, mediaData) 236 | await exec(`gify ${filename} ./media/stickergf.gif --fps=30 --scale=240:240`, async function (error, stdout, stderr) { 237 | var gif = await fs.readFileSync('./media/stickergf.gif', { encoding: "base64" }) 238 | await pakforlay.sendImageAsSticker(from, `data:image/gif;base64,${gif.toString('base64')}`) 239 | .catch(() => { 240 | pakforlay.reply(from, 'Maaf filenya terlalu besar!', id) 241 | }) 242 | }) 243 | } else { 244 | pakforlay.reply(from, `[❗] Kirim gif dengan caption *${prefix}stickergif* max 10 sec!`, id) 245 | } 246 | } else { 247 | pakforlay.reply(from, `[❗] Kirim gif dengan caption *${prefix}stickergif*`, id) 248 | } 249 | break 250 | case 'stikergiphy': 251 | case 'stickergiphy': 252 | if (args.length !== 1) return pakforlay.reply(from, `Maaf, format pesan salah.\nKetik pesan dengan ${prefix}stickergiphy `, id) 253 | const isGiphy = url.match(new RegExp(/https?:\/\/(www\.)?giphy.com/, 'gi')) 254 | const isMediaGiphy = url.match(new RegExp(/https?:\/\/media.giphy.com\/media/, 'gi')) 255 | if (isGiphy) { 256 | const getGiphyCode = url.match(new RegExp(/(\/|\-)(?:.(?!(\/|\-)))+$/, 'gi')) 257 | if (!getGiphyCode) { return pakforlay.reply(from, 'Gagal mengambil kode giphy', id) } 258 | const giphyCode = getGiphyCode[0].replace(/[-\/]/gi, '') 259 | const smallGifUrl = 'https://media.giphy.com/media/' + giphyCode + '/giphy-downsized.gif' 260 | pakforlay.sendGiphyAsSticker(from, smallGifUrl).then(() => { 261 | pakforlay.reply(from, 'Here\'s your sticker') 262 | console.log(`Sticker Processed for ${processTime(t, moment())} Second`) 263 | }).catch((err) => console.log(err)) 264 | } else if (isMediaGiphy) { 265 | const gifUrl = url.match(new RegExp(/(giphy|source).(gif|mp4)/, 'gi')) 266 | if (!gifUrl) { return pakforlay.reply(from, 'Gagal mengambil kode giphy', id) } 267 | const smallGifUrl = url.replace(gifUrl[0], 'giphy-downsized.gif') 268 | pakforlay.sendGiphyAsSticker(from, smallGifUrl) 269 | .then(() => { 270 | pakforlay.reply(from, 'Here\'s your sticker') 271 | console.log(`Sticker Processed for ${processTime(t, moment())} Second`) 272 | }) 273 | .catch(() => { 274 | pakforlay.reply(from, `Ada yang error!`, id) 275 | }) 276 | } else { 277 | await pakforlay.reply(from, 'Maaf, command sticker giphy hanya bisa menggunakan link dari giphy. [Giphy Only]', id) 278 | } 279 | break 280 | case 'meme': 281 | if ((isMedia || isQuotedImage) && args.length >= 2) { 282 | const top = arg.split('|')[0] 283 | const bottom = arg.split('|')[1] 284 | const encryptMedia = isQuotedImage ? quotedMsg : message 285 | const mediaData = await decryptMedia(encryptMedia, uaOverride) 286 | const getUrl = await uploadImages(mediaData, false) 287 | const ImageBase64 = await meme.custom(getUrl, top, bottom) 288 | pakforlay.sendFile(from, ImageBase64, 'image.png', '', null, true) 289 | .then(() => { 290 | pakforlay.reply(from, 'Ini makasih!',id) 291 | }) 292 | .catch(() => { 293 | pakforlay.reply(from, 'Ada yang error!') 294 | }) 295 | } else { 296 | await pakforlay.reply(from, `Tidak ada gambar! Silahkan kirim gambar dengan caption ${prefix}meme | \ncontoh: ${prefix}meme teks atas | teks bawah`, id) 297 | } 298 | break 299 | case 'quotemaker': 300 | const qmaker = body.trim().split('|') 301 | if (qmaker.length >= 3) { 302 | const quotes = qmaker[1] 303 | const author = qmaker[2] 304 | const theme = qmaker[3] 305 | pakforlay.reply(from, 'Proses kak..', id) 306 | try { 307 | const hasilqmaker = await images.quote(quotes, author, theme) 308 | pakforlay.sendFileFromUrl(from, `${hasilqmaker}`, '', 'Ini kak..', id) 309 | } catch { 310 | pakforlay.reply('Yahh proses gagal, kakak isinya sudah benar belum?..', id) 311 | } 312 | } else { 313 | pakforlay.reply(from, `Pemakaian ${prefix}quotemaker |isi quote|author|theme\n\ncontoh: ${prefix}quotemaker |aku sayang kamu|-pakforlay|random\n\nuntuk theme nya pakai random ya kak..`) 314 | } 315 | break 316 | case 'nulis': 317 | if (args.length == 0) return pakforlay.reply(from, `Membuat bot menulis teks yang dikirim menjadi gambar\nPemakaian: ${prefix}nulis [teks]\n\ncontoh: ${prefix}nulis i love you 3000`, id) 318 | const nulisq = body.slice(7) 319 | const nulisp = await rugaapi.tulis(nulisq) 320 | await pakforlay.sendImage(from, `${nulisp}`, '', 'Nih...', id) 321 | .catch(() => { 322 | pakforlay.reply(from, 'Ada yang Error!', id) 323 | }) 324 | break 325 | 326 | //Islam Command 327 | case 'listsurah': 328 | try { 329 | axios.get('https://raw.githubusercontent.com/ArugaZ/grabbed-results/main/islam/surah.json') 330 | .then((response) => { 331 | let hehex = '╔══✪〘 List Surah 〙✪══\n' 332 | for (let i = 0; i < response.data.data.length; i++) { 333 | hehex += '╠➥ ' 334 | hehex += response.data.data[i].name.transliteration.id.toLowerCase() + '\n' 335 | } 336 | hehex += '╚═〘 *Yaelahdo B O T* 〙' 337 | pakforlay.reply(from, hehex, id) 338 | }) 339 | } catch(err) { 340 | pakforlay.reply(from, err, id) 341 | } 342 | break 343 | case 'infosurah': 344 | if (args.length == 0) return pakforlay.reply(from, `*_${prefix}infosurah _*\nMenampilkan informasi lengkap mengenai surah tertentu. Contoh penggunan: ${prefix}infosurah al-baqarah`, message.id) 345 | var responseh = await axios.get('https://raw.githubusercontent.com/ArugaZ/grabbed-results/main/islam/surah.json') 346 | var { data } = responseh.data 347 | var idx = data.findIndex(function(post, index) { 348 | if((post.name.transliteration.id.toLowerCase() == args[0].toLowerCase())||(post.name.transliteration.en.toLowerCase() == args[0].toLowerCase())) 349 | return true; 350 | }); 351 | var pesan = "" 352 | pesan = pesan + "Nama : "+ data[idx].name.transliteration.id + "\n" + "Asma : " +data[idx].name.short+"\n"+"Arti : "+data[idx].name.translation.id+"\n"+"Jumlah ayat : "+data[idx].numberOfVerses+"\n"+"Nomor surah : "+data[idx].number+"\n"+"Jenis : "+data[idx].revelation.id+"\n"+"Keterangan : "+data[idx].tafsir.id 353 | pakforlay.reply(from, pesan, message.id) 354 | break 355 | case 'surah': 356 | if (args.length == 0) return pakforlay.reply(from, `*_${prefix}surah _*\nMenampilkan ayat Al-Quran tertentu beserta terjemahannya dalam bahasa Indonesia. Contoh penggunaan : ${prefix}surah al-baqarah 1\n\n*_${prefix}surah en/id_*\nMenampilkan ayat Al-Quran tertentu beserta terjemahannya dalam bahasa Inggris / Indonesia. Contoh penggunaan : ${prefix}surah al-baqarah 1 id`, message.id) 357 | var responseh = await axios.get('https://raw.githubusercontent.com/ArugaZ/grabbed-results/main/islam/surah.json') 358 | var { data } = responseh.data 359 | var idx = data.findIndex(function(post, index) { 360 | if((post.name.transliteration.id.toLowerCase() == args[0].toLowerCase())||(post.name.transliteration.en.toLowerCase() == args[0].toLowerCase())) 361 | return true; 362 | }); 363 | nmr = data[idx].number 364 | if(!isNaN(nmr)) { 365 | var responseh2 = await axios.get('https://api.quran.sutanlab.id/surah/'+nmr+"/"+args[1]) 366 | var {data} = responseh2.data 367 | var last = function last(array, n) { 368 | if (array == null) return void 0; 369 | if (n == null) return array[array.length - 1]; 370 | return array.slice(Math.max(array.length - n, 0)); 371 | }; 372 | bhs = last(args) 373 | pesan = "" 374 | pesan = pesan + data.text.arab + "\n\n" 375 | if(bhs == "en") { 376 | pesan = pesan + data.translation.en 377 | } else { 378 | pesan = pesan + data.translation.id 379 | } 380 | pesan = pesan + "\n\n(Q.S. "+data.surah.name.transliteration.id+":"+args[1]+")" 381 | pakforlay.reply(from, pesan, message.id) 382 | } 383 | break 384 | case 'tafsir': 385 | if (args.length == 0) return pakforlay.reply(from, `*_${prefix}tafsir _*\nMenampilkan ayat Al-Quran tertentu beserta terjemahan dan tafsirnya dalam bahasa Indonesia. Contoh penggunaan : ${prefix}tafsir al-baqarah 1`, message.id) 386 | var responsh = await axios.get('https://raw.githubusercontent.com/ArugaZ/grabbed-results/main/islam/surah.json') 387 | var {data} = responsh.data 388 | var idx = data.findIndex(function(post, index) { 389 | if((post.name.transliteration.id.toLowerCase() == args[0].toLowerCase())||(post.name.transliteration.en.toLowerCase() == args[0].toLowerCase())) 390 | return true; 391 | }); 392 | nmr = data[idx].number 393 | if(!isNaN(nmr)) { 394 | var responsih = await axios.get('https://api.quran.sutanlab.id/surah/'+nmr+"/"+args[1]) 395 | var {data} = responsih.data 396 | pesan = "" 397 | pesan = pesan + "Tafsir Q.S. "+data.surah.name.transliteration.id+":"+args[1]+"\n\n" 398 | pesan = pesan + data.text.arab + "\n\n" 399 | pesan = pesan + "_" + data.translation.id + "_" + "\n\n" +data.tafsir.id.long 400 | pakforlay.reply(from, pesan, message.id) 401 | } 402 | break 403 | case 'alaudio': 404 | if (args.length == 0) return pakforlay.reply(from, `*_${prefix}ALaudio _*\nMenampilkan tautan dari audio surah tertentu. Contoh penggunaan : ${prefix}ALaudio al-fatihah\n\n*_${prefix}ALaudio _*\nMengirim audio surah dan ayat tertentu beserta terjemahannya dalam bahasa Indonesia. Contoh penggunaan : ${prefix}ALaudio al-fatihah 1\n\n*_${prefix}ALaudio en_*\nMengirim audio surah dan ayat tertentu beserta terjemahannya dalam bahasa Inggris. Contoh penggunaan : ${prefix}ALaudio al-fatihah 1 en`, message.id) 405 | ayat = "ayat" 406 | bhs = "" 407 | var responseh = await axios.get('https://raw.githubusercontent.com/ArugaZ/grabbed-results/main/islam/surah.json') 408 | var surah = responseh.data 409 | var idx = surah.data.findIndex(function(post, index) { 410 | if((post.name.transliteration.id.toLowerCase() == args[0].toLowerCase())||(post.name.transliteration.en.toLowerCase() == args[0].toLowerCase())) 411 | return true; 412 | }); 413 | nmr = surah.data[idx].number 414 | if(!isNaN(nmr)) { 415 | if(args.length > 2) { 416 | ayat = args[1] 417 | } 418 | if (args.length == 2) { 419 | var last = function last(array, n) { 420 | if (array == null) return void 0; 421 | if (n == null) return array[array.length - 1]; 422 | return array.slice(Math.max(array.length - n, 0)); 423 | }; 424 | ayat = last(args) 425 | } 426 | pesan = "" 427 | if(isNaN(ayat)) { 428 | var responsih2 = await axios.get('https://raw.githubusercontent.com/ArugaZ/grabbed-results/main/islam/surah/'+nmr+'.json') 429 | var {name, name_translations, number_of_ayah, number_of_surah, recitations} = responsih2.data 430 | pesan = pesan + "Audio Quran Surah ke-"+number_of_surah+" "+name+" ("+name_translations.ar+") "+ "dengan jumlah "+ number_of_ayah+" ayat\n" 431 | pesan = pesan + "Dilantunkan oleh "+recitations[0].name+" : "+recitations[0].audio_url+"\n" 432 | pesan = pesan + "Dilantunkan oleh "+recitations[1].name+" : "+recitations[1].audio_url+"\n" 433 | pesan = pesan + "Dilantunkan oleh "+recitations[2].name+" : "+recitations[2].audio_url+"\n" 434 | pakforlay.reply(from, pesan, message.id) 435 | } else { 436 | var responsih2 = await axios.get('https://api.quran.sutanlab.id/surah/'+nmr+"/"+ayat) 437 | var {data} = responsih2.data 438 | var last = function last(array, n) { 439 | if (array == null) return void 0; 440 | if (n == null) return array[array.length - 1]; 441 | return array.slice(Math.max(array.length - n, 0)); 442 | }; 443 | bhs = last(args) 444 | pesan = "" 445 | pesan = pesan + data.text.arab + "\n\n" 446 | if(bhs == "en") { 447 | pesan = pesan + data.translation.en 448 | } else { 449 | pesan = pesan + data.translation.id 450 | } 451 | pesan = pesan + "\n\n(Q.S. "+data.surah.name.transliteration.id+":"+args[1]+")" 452 | await pakforlay.sendFileFromUrl(from, data.audio.secondary[0]) 453 | await pakforlay.reply(from, pesan, message.id) 454 | } 455 | } 456 | break 457 | case 'jsolat': 458 | if (args.length == 0) return pakforlay.reply(from, `Untuk melihat jadwal solat dari setiap daerah yang ada\nketik: ${prefix}jsolat [daerah]\n\nuntuk list daerah yang ada\nketik: ${prefix}daerah`, id) 459 | const solatx = body.slice(8) 460 | const solatj = await rugaapi.jadwaldaerah(solatx) 461 | await pakforlay.reply(from, solatj, id) 462 | .catch(() => { 463 | pakforlay.reply(from, 'Sudah input daerah yang ada dilist?', id) 464 | }) 465 | break 466 | case 'daerah': 467 | const daerahq = await rugaapi.daerah() 468 | await pakforlay.reply(from, daerahq, id) 469 | .catch(() => { 470 | pakforlay.reply(from, 'Ada yang Error!', id) 471 | }) 472 | break 473 | //Media 474 | case 'twimg': 475 | if (args.length == 0) return pakforlay.reply(from, `Untuk mendownload gambar dari twitter\nketik: ${prefix}twimg [link_twitter]`, id) 476 | const twimg = await rugaapi.twitimg(args[0]) 477 | await pakforlay.sendFileFromUrl(from, twimg, 'Sukses mengunduh Foto Twitter Menggunakan Bot WhatsApp PakForlay', '', id) 478 | .catch(() => { 479 | pakforlay.reply(from, 'Ada yang Error!', id) 480 | }) 481 | case 'twvid': 482 | if (args.length == 0) return pakforlay.reply(from, `Untuk mendownload video dari twitter\nketik: ${prefix}twvid [link_twitter]`, id) 483 | await pakforlay.reply(from, `_Tunggu, sedang memproses perintah_`, id) 484 | const twvid = await rugaapi.twitvid(args[0]) 485 | await pakforlay.sendFileFromUrl(from, twvid, 'Sukses mengunduh Video Twitter Menggunakan Bot WhatsApp PakForlay', '', id) 486 | .catch(() => { 487 | pakforlay.reply(from, 'Ada yang Error!', id) 488 | }) 489 | case 'insta': 490 | case 'ig': 491 | if (args.length == 0) return pakforlay.reply(from, `Untuk mendownload gambar atau video dari instagram\nketik: ${prefix}insta [link_ig]`, id) 492 | await pakforlay.reply(from, `_Tunggu, sedang memproses perintah_`, id) 493 | const instag = await rugaapi.insta(args[0]) 494 | await pakforlay.sendFileFromUrl(from, instag, 'Sukses mengunduh Foto/Video Instagram Menggunakan Bot WhatsApp PakForlay', '', id) 495 | .catch(() => { 496 | pakforlay.reply(from, 'Ada yang Error!', id) 497 | }) 498 | break 499 | case 'tiktok': 500 | if (args.length == 0) return pakforlay.reply(from, `Untuk mendownload video tiktok\nketik: ${prefix}tiktok [link_tik]`, id) 501 | await pakforlay.reply(from, `_Tunggu, sedang memproses perintah_`, id) 502 | const vidTiktok = await rugaapi.tiktok(args[0]) 503 | const infoTiktok = await rugaapi.tiktokInfo(args[0]) 504 | await pakforlay.sendFileFromUrl(from, vidTiktok, '', '', id) 505 | await pakforlay.sendText(from, infoTiktok, '', '', id) 506 | .catch(() => { 507 | pakforlay.reply(from, 'Ada yang Error!', id) 508 | }) 509 | break 510 | case 'ytmus': 511 | if (args.length == 0) return pakforlay.reply(from, `Untuk mendownload video youtube\nketik: ${prefix}ytmus [link_youtube]`, id) 512 | await pakforlay.reply(from, `_Tunggu, sedang memproses perintah_`, id) 513 | const ytmus = await rugaapi.ytmp3(args[0]) 514 | await pakforlay.sendFileFromUrl(from, ytmus, '', '', id) 515 | await pakforlay.reply(from, `_Sukses Mengunduh Audio Dari Youtube._`, id) 516 | .catch(() => { 517 | pakforlay.reply(from, 'Ada yang Error!', id) 518 | }) 519 | break 520 | case 'ytvid': 521 | if (args.length == 0) return pakforlay.reply(from, `Untuk mendownload video youtube\nketik: ${prefix}ytvid [link_youtube]`, id) 522 | await pakforlay.reply(from, `_Tunggu, sedang memproses perintah_`, id) 523 | const youtube = await rugaapi.ytvid(args[0]) 524 | await pakforlay.sendFileFromUrl(from, youtube, `Sukses mengunduh Video Youtube Menggunakan Bot WhatsApp PakForlay`, id) 525 | .catch(() => { 526 | pakforlay.reply(from, 'Ada yang Error!, mungkin bisa kirim ulang perintah.', id) 527 | }) 528 | break 529 | 530 | //Primbon Menu 531 | case 'artinama': 532 | if (args.length == 0) return pakforlay.reply(from, `Untuk mengetahui arti nama seseorang\nketik ${prefix}artinama Namanya`, id) 533 | rugaapi.artinama(body.slice(10)) 534 | .then(async(res) => { 535 | await pakforlay.reply(from, `Arti : ${res}`, id) 536 | }) 537 | break 538 | case 'cekjodoh': 539 | if (args.length !== 2) return pakforlay.reply(from, `Untuk mengecek jodoh melalui nama\nketik: ${prefix}cekjodoh nama pasangan\n\ncontoh: ${prefix}cekjodoh aku kamu\n\nhanya bisa pakai nama panggilan (satu kata)`) 540 | rugaapi.cekjodoh(args[0],args[1]) 541 | .then(async(res) => { 542 | await pakforlay.sendFileFromUrl(from, `${res.link}`, '', `${res.text}`, id) 543 | }) 544 | break 545 | 546 | // Random Kata 547 | case 'fakta': 548 | fetch('https://raw.githubusercontent.com/ArugaZ/grabbed-results/main/random/faktaunix.txt') 549 | .then(res => res.text()) 550 | .then(body => { 551 | let splitnix = body.split('\n') 552 | let randomnix = splitnix[Math.floor(Math.random() * splitnix.length)] 553 | pakforlay.reply(from, randomnix, id) 554 | }) 555 | .catch(() => { 556 | pakforlay.reply(from, 'Ada yang Error!', id) 557 | }) 558 | break 559 | case 'katabijak': 560 | fetch('https://raw.githubusercontent.com/ArugaZ/grabbed-results/main/random/katabijax.txt') 561 | .then(res => res.text()) 562 | .then(body => { 563 | let splitbijak = body.split('\n') 564 | let randombijak = splitbijak[Math.floor(Math.random() * splitbijak.length)] 565 | pakforlay.reply(from, randombijak, id) 566 | }) 567 | .catch(() => { 568 | pakforlay.reply(from, 'Ada yang Error!', id) 569 | }) 570 | break 571 | case 'pantun': 572 | fetch('https://raw.githubusercontent.com/ArugaZ/grabbed-results/main/random/pantun.txt') 573 | .then(res => res.text()) 574 | .then(body => { 575 | let splitpantun = body.split('\n') 576 | let randompantun = splitpantun[Math.floor(Math.random() * splitpantun.length)] 577 | pakforlay.reply(from, randompantun.replace(/aruga-line/g,"\n"), id) 578 | }) 579 | .catch(() => { 580 | pakforlay.reply(from, 'Ada yang Error!', id) 581 | }) 582 | break 583 | case 'quote': 584 | const quotex = await rugaapi.quote() 585 | await pakforlay.reply(from, quotex, id) 586 | .catch(() => { 587 | pakforlay.reply(from, 'Ada yang Error!', id) 588 | }) 589 | break 590 | 591 | //Random Images 592 | case 'anime': 593 | if (args.length == 0) return pakforlay.reply(from, `Untuk menggunakan ${prefix}anime\nSilahkan ketik: ${prefix}anime [query]\nContoh: ${prefix}anime random\n\nquery yang tersedia:\nrandom, waifu, husbu, neko`, id) 594 | if (args[0] == 'random' || args[0] == 'waifu' || args[0] == 'husbu' || args[0] == 'neko') { 595 | fetch('https://raw.githubusercontent.com/ArugaZ/grabbed-results/main/random/anime/' + args[0] + '.txt') 596 | .then(res => res.text()) 597 | .then(body => { 598 | let randomnime = body.split('\n') 599 | let randomnimex = randomnime[Math.floor(Math.random() * randomnime.length)] 600 | pakforlay.sendFileFromUrl(from, randomnimex, '', 'Nee..', id) 601 | }) 602 | .catch(() => { 603 | pakforlay.reply(from, 'Ada yang Error!', id) 604 | }) 605 | } else { 606 | pakforlay.reply(from, `Maaf query tidak tersedia. Silahkan ketik ${prefix}anime untuk melihat list query`) 607 | } 608 | break 609 | case 'kpop': 610 | if (args.length == 0) return pakforlay.reply(from, `Untuk menggunakan ${prefix}kpop\nSilahkan ketik: ${prefix}kpop [query]\nContoh: ${prefix}kpop bts\n\nquery yang tersedia:\nblackpink, exo, bts`, id) 611 | if (args[0] == 'blackpink' || args[0] == 'exo' || args[0] == 'bts') { 612 | fetch('https://raw.githubusercontent.com/ArugaZ/grabbed-results/main/random/kpop/' + args[0] + '.txt') 613 | .then(res => res.text()) 614 | .then(body => { 615 | let randomkpop = body.split('\n') 616 | let randomkpopx = randomkpop[Math.floor(Math.random() * randomkpop.length)] 617 | pakforlay.sendFileFromUrl(from, randomkpopx, '', 'Nee..', id) 618 | }) 619 | .catch(() => { 620 | pakforlay.reply(from, 'Ada yang Error!', id) 621 | }) 622 | } else { 623 | pakforlay.reply(from, `Maaf query tidak tersedia. Silahkan ketik ${prefix}kpop untuk melihat list query`) 624 | } 625 | break 626 | case 'memes': 627 | const randmeme = await meme.random() 628 | pakforlay.sendFileFromUrl(from, randmeme, '', '', id) 629 | .catch(() => { 630 | pakforlay.reply(from, 'Ada yang Error!', id) 631 | }) 632 | break 633 | 634 | // Search Any 635 | case 'images': 636 | if (args.length == 0) return pakforlay.reply(from, `Untuk mencari gambar di pinterest\nketik: ${prefix}images [search]\ncontoh: ${prefix}images naruto`, id) 637 | const cariwall = body.slice(8) 638 | const hasilwall = await images.fdci(cariwall) 639 | await pakforlay.sendFileFromUrl(from, hasilwall, '', '', id) 640 | .catch(() => { 641 | pakforlay.reply(from, 'Ada yang Error!', id) 642 | }) 643 | break 644 | case 'sreddit': 645 | if (args.length == 0) return pakforlay.reply(from, `Untuk mencari gambar di sub reddit\nketik: ${prefix}sreddit [search]\ncontoh: ${prefix}sreddit naruto`, id) 646 | const carireddit = body.slice(9) 647 | const hasilreddit = await images.sreddit(carireddit) 648 | await pakforlay.sendFileFromUrl(from, hasilreddit, '', '', id) 649 | .catch(() => { 650 | pakforlay.reply(from, 'Ada yang Error!', id) 651 | }) 652 | break 653 | case 'resep': 654 | if (args.length == 0) return pakforlay.reply(from, `Untuk mencari resep makanan\nCaranya ketik: ${prefix}resep [search]\n\ncontoh: ${prefix}resep tahu`, id) 655 | const cariresep = body.slice(7) 656 | const hasilresep = await resep.resep(cariresep) 657 | await pakforlay.reply(from, hasilresep + '\n\nIni kak resep makanannya..', id) 658 | .catch(() => { 659 | pakforlay.reply(from, 'Ada yang Error!', id) 660 | }) 661 | break 662 | case 'nekopoi': 663 | pakforlay.sendText(from, `Maaf fitur ini sedang dalam perbaikan...`) 664 | /* rugapoi.getLatest() 665 | .then((result) => { 666 | rugapoi.getVideo(result.link) 667 | .then((res) => { 668 | let heheq = '\n' 669 | for (let i = 0; i < res.links.length; i++) { 670 | heheq += `${res.links[i]}\n` 671 | } 672 | pakforlay.reply(from, `Title: ${res.title}\n\nLink:\n${heheq}\nmasih tester bntr :v`) 673 | }) 674 | }) 675 | .catch(() => { 676 | pakforlay.reply(from, 'Ada yang Error!', id) 677 | }) */ 678 | break 679 | /* 680 | case 'stalkig': 681 | if (args.length == 0) return pakforlay.reply(from, `Untuk men-stalk akun instagram seseorang\nketik ${prefix}stalkig [username]\ncontoh: ${prefix}stalkig ini.arga`, id) 682 | const igstalk = await rugaapi.stalkig(args[0]) 683 | const igstalkpict = await rugaapi.stalkigpict(args[0]) 684 | await pakforlay.sendFileFromUrl(from, igstalkpict, '', igstalk, id) 685 | .catch(() => { 686 | pakforlay.reply(from, 'Ada yang Error!', id) 687 | }) 688 | break 689 | */ 690 | case 'wiki': 691 | if (args.length == 0) return pakforlay.reply(from, `Untuk mencari suatu kata dari wikipedia\nketik: ${prefix}wiki [kata]`, id) 692 | const wikip = body.slice(6) 693 | const wikis = await rugaapi.wiki(wikip) 694 | await pakforlay.reply(from, wikis, id) 695 | .catch(() => { 696 | pakforlay.reply(from, 'Ada yang Error!', id) 697 | }) 698 | break 699 | case 'cuaca': 700 | if (args.length == 0) return pakforlay.reply(from, `Untuk melihat cuaca pada suatu daerah\nketik: ${prefix}cuaca [daerah]`, id) 701 | const cuacaq = body.slice(7) 702 | const cuacap = await rugaapi.cuaca(cuacaq) 703 | await pakforlay.reply(from, cuacap, id) 704 | .catch(() => { 705 | pakforlay.reply(from, 'Ada yang Error!', id) 706 | }) 707 | break 708 | case 'lirik': 709 | if (args.length == 0) return pakforlay.reply(from, `Untuk mencari lirik dari sebuah lagu\bketik: ${prefix}chord [judul_lagu]`, id) 710 | rugaapi.lirik(body.slice(7)) 711 | .then(async (res) => { 712 | await pakforlay.reply(from, `Lirik Lagu: ${body.slice(7)}\n\n${res}`, id) 713 | }) 714 | break 715 | case 'chord': 716 | if (args.length == 0) return pakforlay.reply(from, `Untuk mencari lirik dan chord dari sebuah lagu\bketik: ${prefix}chord [judul_lagu]`, id) 717 | const chordq = body.slice(7) 718 | const chordp = await rugaapi.chord(chordq) 719 | await pakforlay.reply(from, chordp, id) 720 | .catch(() => { 721 | pakforlay.reply(from, 'Ada yang Error!', id) 722 | }) 723 | break 724 | case 'ss': //jika error silahkan buka file di folder settings/api.json dan ubah apiSS 'API-KEY' yang kalian dapat dari website https://apiflash.com/ 725 | if (args.length == 0) return pakforlay.reply(from, `Membuat bot men-screenshot sebuah web\n\nPemakaian: ${prefix}ss [url]\n\ncontoh: ${prefix}ss http://google.com`, id) 726 | const scrinshit = await meme.ss(args[0]) 727 | await pakforlay.sendFile(from, scrinshit, 'ss.jpg', 'cekrek', id) 728 | .catch(() => { 729 | pakforlay.reply(from, 'Ada yang Error!', id) 730 | }) 731 | break 732 | case 'play'://silahkan kalian custom sendiri jika ada yang ingin diubah 733 | if (args.length == 0) return pakforlay.reply(from, `Untuk mencari lagu dari youtube\n\nPenggunaan: ${prefix}play judul lagu`, id) 734 | axios.get(`https://arugaytdl.herokuapp.com/search?q=${body.slice(6)}`) 735 | .then(async (res) => { 736 | await pakforlay.sendFileFromUrl(from, `${res.data[0].thumbnail}`, ``, `Lagu ditemukan\n\nJudul: ${res.data[0].title}\nDurasi: ${res.data[0].duration}detik\nUploaded: ${res.data[0].uploadDate}\nView: ${res.data[0].viewCount}\n\nsedang dikirim`, id) 737 | axios.get(`https://arugaz.herokuapp.com/api/yta?url=https://youtu.be/${res.data[0].id}`) 738 | .then(async(rest) => { 739 | if (Number(rest.data.filesize.split(' MB')[0]) >= 10.00) return pakforlay.reply(from, 'Maaf ukuran file terlalu besar!') 740 | await pakforlay.sendPtt(from, `${rest.data.result}`, id) 741 | }) 742 | .catch(() => { 743 | pakforlay.reply(from, 'Ada yang Error!', id) 744 | }) 745 | }) 746 | .catch(() => { 747 | pakforlay.reply(from, 'Ada yang Error!', id) 748 | }) 749 | break 750 | case 'whatanime': 751 | if (isMedia && type === 'image' || quotedMsg && quotedMsg.type === 'image') { 752 | if (isMedia) { 753 | var mediaData = await decryptMedia(message, uaOverride) 754 | } else { 755 | var mediaData = await decryptMedia(quotedMsg, uaOverride) 756 | } 757 | const fetch = require('node-fetch') 758 | const imgBS4 = `data:${mimetype};base64,${mediaData.toString('base64')}` 759 | pakforlay.reply(from, 'Searching....', id) 760 | fetch('https://trace.moe/api/search', { 761 | method: 'POST', 762 | body: JSON.stringify({ image: imgBS4 }), 763 | headers: { "Content-Type": "application/json" } 764 | }) 765 | .then(respon => respon.json()) 766 | .then(resolt => { 767 | if (resolt.docs && resolt.docs.length <= 0) { 768 | pakforlay.reply(from, 'Maaf, saya tidak tau ini anime apa, pastikan gambar yang akan di Search tidak Buram/Kepotong', id) 769 | } 770 | const { is_adult, title, title_chinese, title_romaji, title_english, episode, similarity, filename, at, tokenthumb, anilist_id } = resolt.docs[0] 771 | teks = '' 772 | if (similarity < 0.92) { 773 | teks = '*Saya memiliki keyakinan rendah dalam hal ini* :\n\n' 774 | } 775 | teks += `➸ *Title Japanese* : ${title}\n➸ *Title chinese* : ${title_chinese}\n➸ *Title Romaji* : ${title_romaji}\n➸ *Title English* : ${title_english}\n` 776 | teks += `➸ *R-18?* : ${is_adult}\n` 777 | teks += `➸ *Eps* : ${episode.toString()}\n` 778 | teks += `➸ *Kesamaan* : ${(similarity * 100).toFixed(1)}%\n` 779 | var video = `https://media.trace.moe/video/${anilist_id}/${encodeURIComponent(filename)}?t=${at}&token=${tokenthumb}`; 780 | pakforlay.sendFileFromUrl(from, video, 'anime.mp4', teks, id).catch(() => { 781 | pakforlay.reply(from, teks, id) 782 | }) 783 | }) 784 | .catch(() => { 785 | pakforlay.reply(from, 'Ada yang Error!', id) 786 | }) 787 | } else { 788 | pakforlay.reply(from, `Maaf format salah\n\nSilahkan kirim foto dengan caption ${prefix}whatanime\n\nAtau reply foto dengan caption ${prefix}whatanime`, id) 789 | } 790 | break 791 | 792 | // Other Command 793 | case 'resi': 794 | if (args.length !== 2) return pakforlay.reply(from, `Maaf, format pesan salah.\nSilahkan ketik pesan dengan ${prefix}resi \n\nKurir yang tersedia:\njne, pos, tiki, wahana, jnt, rpx, sap, sicepat, pcp, jet, dse, first, ninja, lion, idl, rex`, id) 795 | const kurirs = ['jne', 'pos', 'tiki', 'wahana', 'jnt', 'rpx', 'sap', 'sicepat', 'pcp', 'jet', 'dse', 'first', 'ninja', 'lion', 'idl', 'rex'] 796 | if (!kurirs.includes(args[0])) return pakforlay.sendText(from, `Maaf, jenis ekspedisi pengiriman tidak didukung layanan ini hanya mendukung ekspedisi pengiriman ${kurirs.join(', ')} Tolong periksa kembali.`) 797 | console.log('Memeriksa No Resi', args[1], 'dengan ekspedisi', args[0]) 798 | cekResi(args[0], args[1]).then((result) => pakforlay.sendText(from, result)) 799 | break 800 | case 'tts': 801 | if (args.length == 0) return pakforlay.reply(from, `Mengubah teks menjadi sound (google voice)\nketik: ${prefix}tts \ncontoh : ${prefix}tts id halo\nuntuk kode bahasa cek disini : https://anotepad.com/note/read/5xqahdy8`) 802 | const ttsGB = require('node-gtts')(args[0]) 803 | const dataText = body.slice(8) 804 | if (dataText === '') return pakforlay.reply(from, 'apa teksnya syg..', id) 805 | try { 806 | ttsGB.save('./media/tts.mp3', dataText, function () { 807 | pakforlay.sendPtt(from, './media/tts.mp3', id) 808 | }) 809 | } catch (err) { 810 | pakforlay.reply(from, err, id) 811 | } 812 | break 813 | case 'translate': 814 | if (args.length != 1) return pakforlay.reply(from, `Maaf, format pesan salah.\nSilahkan reply sebuah pesan dengan caption ${prefix}translate \ncontoh ${prefix}translate id`, id) 815 | if (!quotedMsg) return pakforlay.reply(from, `Maaf, format pesan salah.\nSilahkan reply sebuah pesan dengan caption ${prefix}translate \ncontoh ${prefix}translate id`, id) 816 | const quoteText = quotedMsg.type == 'chat' ? quotedMsg.body : quotedMsg.type == 'image' ? quotedMsg.caption : '' 817 | translate(quoteText, args[0]) 818 | .then((result) => pakforlay.sendText(from, result)) 819 | .catch(() => pakforlay.sendText(from, 'Error, Kode bahasa salah.')) 820 | break 821 | case 'covidindo': 822 | rugaapi.covidindo() 823 | .then(async (res) => { 824 | await pakforlay.reply(from, `${res}`, id) 825 | }) 826 | break 827 | case 'ceklokasi': 828 | if (quotedMsg.type !== 'location') return pakforlay.reply(from, `Maaf, format pesan salah.\nKirimkan lokasi dan reply dengan caption ${prefix}ceklokasi`, id) 829 | console.log(`Request Status Zona Penyebaran Covid-19 (${quotedMsg.lat}, ${quotedMsg.lng}).`) 830 | const zoneStatus = await getLocationData(quotedMsg.lat, quotedMsg.lng) 831 | if (zoneStatus.kode !== 200) pakforlay.sendText(from, 'Maaf, Terjadi error ketika memeriksa lokasi yang anda kirim.') 832 | let datax = '' 833 | for (let i = 0; i < zoneStatus.data.length; i++) { 834 | const { zone, region } = zoneStatus.data[i] 835 | const _zone = zone == 'green' ? 'Hijau* (Aman) \n' : zone == 'yellow' ? 'Kuning* (Waspada) \n' : 'Merah* (Bahaya) \n' 836 | datax += `${i + 1}. Kel. *${region}* Berstatus *Zona ${_zone}` 837 | } 838 | const text = `*CEK LOKASI PENYEBARAN COVID-19*\nHasil pemeriksaan dari lokasi yang anda kirim adalah *${zoneStatus.status}* ${zoneStatus.optional}\n\nInformasi lokasi terdampak disekitar anda:\n${datax}` 839 | pakforlay.sendText(from, text) 840 | break 841 | case 'shortlink': 842 | if (args.length == 0) return pakforlay.reply(from, `ketik ${prefix}shortlink `, id) 843 | if (!isUrl(args[0])) return pakforlay.reply(from, 'Maaf, url yang kamu kirim tidak valid.', id) 844 | const shortlink = await urlShortener(args[0]) 845 | await pakforlay.sendText(from, shortlink) 846 | .catch(() => { 847 | pakforlay.reply(from, 'Ada yang Error!', id) 848 | }) 849 | break 850 | case 'bapakfont': 851 | if (args.length == 0) return pakforlay.reply(from, `Mengubah kalimat menjadi alayyyyy\n\nketik ${prefix}bapakfont kalimat`, id) 852 | rugaapi.bapakfont(body.slice(11)) 853 | .then(async(res) => { 854 | await pakforlay.reply(from, `${res}`, id) 855 | }) 856 | break 857 | 858 | //Fun Menu 859 | case 'klasmen': 860 | if (!isGroupMsg) return pakforlay.reply(from, 'Maaf, perintah ini hanya dapat dipakai didalam grup!', id) 861 | const klasemen = db.get('group').filter({id: groupId}).map('members').value()[0] 862 | let urut = Object.entries(klasemen).map(([key, val]) => ({id: key, ...val})).sort((a, b) => b.denda - a.denda); 863 | let textKlas = "*Klasemen Denda Sementara*\n" 864 | let i = 1; 865 | urut.forEach((klsmn) => { 866 | textKlas += i+". @"+klsmn.id.replace('@c.us', '')+" ➤ Rp"+formatin(klsmn.denda)+"\n" 867 | i++ 868 | }); 869 | await pakforlay.sendTextWithMentions(from, textKlas) 870 | break 871 | 872 | // Group Commands (group admin only) 873 | case 'add': 874 | if (!isGroupMsg) return pakforlay.reply(from, 'Maaf, perintah ini hanya dapat dipakai didalam grup!', id) 875 | if (!isGroupAdmins) return pakforlay.reply(from, 'Gagal, perintah ini hanya dapat digunakan oleh admin grup!', id) 876 | if (!isBotGroupAdmins) return pakforlay.reply(from, 'Gagal, silahkan tambahkan bot sebagai admin grup!', id) 877 | if (args.length !== 1) return pakforlay.reply(from, `Untuk menggunakan ${prefix}add\nPenggunaan: ${prefix}add \ncontoh: ${prefix}add 628xxx`, id) 878 | try { 879 | await pakforlay.addParticipant(from,`${args[0]}@c.us`) 880 | .then(() => pakforlay.reply(from, 'Hai selamat datang', id)) 881 | } catch { 882 | pakforlay.reply(from, 'Tidak dapat menambahkan target', id) 883 | } 884 | break 885 | case 'kick': 886 | if (!isGroupMsg) return pakforlay.reply(from, 'Maaf, perintah ini hanya dapat dipakai didalam grup!', id) 887 | if (!isGroupAdmins) return pakforlay.reply(from, 'Gagal, perintah ini hanya dapat digunakan oleh admin grup!', id) 888 | if (!isBotGroupAdmins) return pakforlay.reply(from, 'Gagal, silahkan tambahkan bot sebagai admin grup!', id) 889 | if (mentionedJidList.length === 0) return pakforlay.reply(from, 'Maaf, format pesan salah.\nSilahkan tag satu atau lebih orang yang akan dikeluarkan', id) 890 | if (mentionedJidList[0] === botNumber) return await pakforlay.reply(from, 'Maaf, format pesan salah.\nTidak dapat mengeluarkan akun bot sendiri', id) 891 | await pakforlay.sendTextWithMentions(from, `Request diterima, mengeluarkan:\n${mentionedJidList.map(x => `@${x.replace('@c.us', '')}`).join('\n')}`) 892 | for (let i = 0; i < mentionedJidList.length; i++) { 893 | if (groupAdmins.includes(mentionedJidList[i])) return await pakforlay.sendText(from, 'Gagal, kamu tidak bisa mengeluarkan admin grup.') 894 | await pakforlay.removeParticipant(groupId, mentionedJidList[i]) 895 | } 896 | break 897 | case 'promote': 898 | if (!isGroupMsg) return pakforlay.reply(from, 'Maaf, perintah ini hanya dapat dipakai didalam grup!', id) 899 | if (!isGroupAdmins) return pakforlay.reply(from, 'Gagal, perintah ini hanya dapat digunakan oleh admin grup!', id) 900 | if (!isBotGroupAdmins) return pakforlay.reply(from, 'Gagal, silahkan tambahkan bot sebagai admin grup!', id) 901 | if (mentionedJidList.length !== 1) return pakforlay.reply(from, 'Maaf, hanya bisa mempromote 1 user', id) 902 | if (groupAdmins.includes(mentionedJidList[0])) return await pakforlay.reply(from, 'Maaf, user tersebut sudah menjadi admin.', id) 903 | if (mentionedJidList[0] === botNumber) return await pakforlay.reply(from, 'Maaf, format pesan salah.\nTidak dapat mempromote akun bot sendiri', id) 904 | await pakforlay.promoteParticipant(groupId, mentionedJidList[0]) 905 | await pakforlay.sendTextWithMentions(from, `Request diterima, menambahkan @${mentionedJidList[0].replace('@c.us', '')} sebagai admin.`) 906 | break 907 | case 'demote': 908 | if (!isGroupMsg) return pakforlay.reply(from, 'Maaf, perintah ini hanya dapat dipakai didalam grup!', id) 909 | if (!isGroupAdmins) return pakforlay.reply(from, 'Gagal, perintah ini hanya dapat digunakan oleh admin grup!', id) 910 | if (!isBotGroupAdmins) return pakforlay.reply(from, 'Gagal, silahkan tambahkan bot sebagai admin grup!', id) 911 | if (mentionedJidList.length !== 1) return pakforlay.reply(from, 'Maaf, hanya bisa mendemote 1 user', id) 912 | if (!groupAdmins.includes(mentionedJidList[0])) return await pakforlay.reply(from, 'Maaf, user tersebut belum menjadi admin.', id) 913 | if (mentionedJidList[0] === botNumber) return await pakforlay.reply(from, 'Maaf, format pesan salah.\nTidak dapat mendemote akun bot sendiri', id) 914 | await pakforlay.demoteParticipant(groupId, mentionedJidList[0]) 915 | await pakforlay.sendTextWithMentions(from, `Request diterima, menghapus jabatan @${mentionedJidList[0].replace('@c.us', '')}.`) 916 | break 917 | case 'bye': 918 | if (!isGroupMsg) return pakforlay.reply(from, 'Maaf, perintah ini hanya dapat dipakai didalam grup!', id) 919 | if (!isGroupAdmins) return pakforlay.reply(from, 'Gagal, perintah ini hanya dapat digunakan oleh admin grup!', id) 920 | pakforlay.sendText(from, 'Good bye... ( ⇀‸↼‶ )').then(() => pakforlay.leaveGroup(groupId)) 921 | break 922 | case 'del': 923 | if (!isGroupAdmins) return pakforlay.reply(from, 'Gagal, perintah ini hanya dapat digunakan oleh admin grup!', id) 924 | if (!quotedMsg) return pakforlay.reply(from, `Maaf, format pesan salah silahkan.\nReply pesan bot dengan caption ${prefix}del`, id) 925 | if (!quotedMsgObj.fromMe) return pakforlay.reply(from, `Maaf, format pesan salah silahkan.\nReply pesan bot dengan caption ${prefix}del`, id) 926 | pakforlay.deleteMessage(quotedMsgObj.chatId, quotedMsgObj.id, false) 927 | break 928 | case 'tagall': 929 | case 'everyone': 930 | if (!isGroupMsg) return pakforlay.reply(from, 'Maaf, perintah ini hanya dapat dipakai didalam grup!', id) 931 | if (!isGroupAdmins) return pakforlay.reply(from, 'Gagal, perintah ini hanya dapat digunakan oleh admin grup!', id) 932 | const groupMem = await pakforlay.getGroupMembers(groupId) 933 | let hehex = '╔══✪〘 Mention All 〙✪══\n' 934 | for (let i = 0; i < groupMem.length; i++) { 935 | hehex += '╠➥' 936 | hehex += ` @${groupMem[i].id.replace(/@c.us/g, '')}\n` 937 | } 938 | hehex += '╚═〘 *Yaelahdo B O T* 〙' 939 | await pakforlay.sendTextWithMentions(from, hehex) 940 | break 941 | /* case 'simisimi': 942 | if (!isGroupMsg) return pakforlay.reply(from, 'Maaf, perintah ini hanya dapat dipakai didalam grup!', id) 943 | pakforlay.reply(from, `Untuk mengaktifkan simi-simi pada Group Chat\n\nPenggunaan\n${prefix}simi on --mengaktifkan\n${prefix}simi off --nonaktifkan\n`, id) 944 | break 945 | case 'simi': 946 | if (!isGroupMsg) return pakforlay.reply(from, 'Maaf, perintah ini hanya dapat dipakai didalam grup!', id) 947 | if (!isGroupAdmins) return pakforlay.reply(from, 'Gagal, perintah ini hanya dapat digunakan oleh admin grup!', id) 948 | if (args.length !== 1) return pakforlay.reply(from, `Untuk mengaktifkan simi-simi pada Group Chat\n\nPenggunaan\n${prefix}simi on --mengaktifkan\n${prefix}simi off --nonaktifkan\n`, id) 949 | if (args[0] == 'on') { 950 | simi.push(chatId) 951 | fs.writeFileSync('./settings/simi.json', JSON.stringify(simi)) 952 | pakforlay.reply(from, 'Mengaktifkan bot simi-simi!', id) 953 | } else if (args[0] == 'off') { 954 | let inxx = simi.indexOf(chatId) 955 | simi.splice(inxx, 1) 956 | fs.writeFileSync('./settings/simi.json', JSON.stringify(simi)) 957 | pakforlay.reply(from, 'Menonaktifkan bot simi-simi!', id) 958 | } else { 959 | pakforlay.reply(from, `Untuk mengaktifkan simi-simi pada Group Chat\n\nPenggunaan\n${prefix}simi on --mengaktifkan\n${prefix}simi off --nonaktifkan\n`, id) 960 | } 961 | break */ 962 | case 'katakasar': 963 | if (!isGroupMsg) return pakforlay.reply(from, 'Maaf, perintah ini hanya dapat dipakai didalam grup!', id) 964 | pakforlay.reply(from, `Untuk mengaktifkan Fitur Kata Kasar pada Group Chat\n\napasih itu? fitur apabila seseorang mengucapkan kata kasar akan mendapatkan denda\n\nPenggunaan\n${prefix}kasar on --mengaktifkan\n${prefix}kasar off --nonaktifkan\n\n${prefix}reset --reset jumlah denda`, id) 965 | break 966 | case 'kasar': 967 | if (!isGroupMsg) return pakforlay.reply(from, 'Maaf, perintah ini hanya dapat dipakai didalam grup!', id) 968 | if (!isGroupAdmins) return pakforlay.reply(from, 'Gagal, perintah ini hanya dapat digunakan oleh admin grup!', id) 969 | if (args.length !== 1) return pakforlay.reply(from, `Untuk mengaktifkan Fitur Kata Kasar pada Group Chat\n\napasih itu? fitur apabila seseorang mengucapkan kata kasar akan mendapatkan denda\n\nPenggunaan\n${prefix}kasar on --mengaktifkan\n${prefix}kasar off --nonaktifkan\n\n${prefix}reset --reset jumlah denda`, id) 970 | if (args[0] == 'on') { 971 | ngegas.push(chatId) 972 | fs.writeFileSync('./settings/ngegas.json', JSON.stringify(ngegas)) 973 | pakforlay.reply(from, 'sukses mengaktifkan fitur anti kata kasar', id) 974 | } else if (args[0] == 'off') { 975 | let nixx = ngegas.indexOf(chatId) 976 | ngegas.splice(nixx, 1) 977 | fs.writeFileSync('./settings/ngegas.json', JSON.stringify(ngegas)) 978 | pakforlay.reply(from, 'sukses menonatifkan fitur anti kata kasar', id) 979 | } else { 980 | pakforlay.reply(from, `Untuk mengaktifkan Fitur Kata Kasar pada Group Chat\n\napasih itu? fitur apabila seseorang mengucapkan kata kasar akan mendapatkan denda\n\nPenggunaan\n${prefix}kasar on --mengaktifkan\n${prefix}kasar off --nonaktifkan\n\n${prefix}reset --reset jumlah denda`, id) 981 | } 982 | break 983 | case 'reset': 984 | if (!isGroupMsg) return pakforlay.reply(from, 'Maaf, perintah ini hanya dapat dipakai didalam grup!', id) 985 | if (!isGroupAdmins) return pakforlay.reply(from, 'Gagal, perintah ini hanya dapat digunakan oleh admin grup!', id) 986 | const reset = db.get('group').find({ id: groupId }).assign({ members: []}).write() 987 | if(reset){ 988 | await pakforlay.sendText(from, "Klasemen telah direset.") 989 | } 990 | break 991 | 992 | //Owner Group 993 | case 'kickall': //mengeluarkan semua member 994 | if (!isGroupMsg) return pakforlay.reply(from, 'Maaf, perintah ini hanya dapat dipakai didalam grup!', id) 995 | let isOwner = chat.groupMetadata.owner == pengirim 996 | if (!isOwner) return pakforlay.reply(from, 'Maaf, perintah ini hanya dapat dipakai oleh owner grup!', id) 997 | if (!isBotGroupAdmins) return pakforlay.reply(from, 'Gagal, silahkan tambahkan bot sebagai admin grup!', id) 998 | const allMem = await pakforlay.getGroupMembers(groupId) 999 | for (let i = 0; i < allMem.length; i++) { 1000 | if (groupAdmins.includes(allMem[i].id)) { 1001 | 1002 | } else { 1003 | await pakforlay.removeParticipant(groupId, allMem[i].id) 1004 | } 1005 | } 1006 | pakforlay.reply(from, 'Success kick all member', id) 1007 | break 1008 | 1009 | //Owner Bot 1010 | case 'ban': 1011 | if (!isOwnerBot) return pakforlay.reply(from, 'Perintah ini hanya untuk Owner bot!', id) 1012 | if (args.length == 0) return pakforlay.reply(from, `Untuk banned seseorang agar tidak bisa menggunakan commands\n\nCaranya ketik: \n${prefix}ban add 628xx --untuk mengaktifkan\n${prefix}ban del 628xx --untuk nonaktifkan\n\ncara cepat ban banyak digrup ketik:\n${prefix}ban @tag @tag @tag`, id) 1013 | if (args[0] == 'add') { 1014 | banned.push(args[1]+'@c.us') 1015 | fs.writeFileSync('./settings/banned.json', JSON.stringify(banned)) 1016 | pakforlay.reply(from, 'Success banned target!') 1017 | } else 1018 | if (args[0] == 'del') { 1019 | let xnxx = banned.indexOf(args[1]+'@c.us') 1020 | banned.splice(xnxx,1) 1021 | fs.writeFileSync('./settings/banned.json', JSON.stringify(banned)) 1022 | pakforlay.reply(from, 'Success unbanned target!') 1023 | } else { 1024 | for (let i = 0; i < mentionedJidList.length; i++) { 1025 | banned.push(mentionedJidList[i]) 1026 | fs.writeFileSync('./settings/banned.json', JSON.stringify(banned)) 1027 | pakforlay.reply(from, 'Success ban target!', id) 1028 | } 1029 | } 1030 | break 1031 | case 'bc': //untuk broadcast atau promosi 1032 | if (!isOwnerBot) return pakforlay.reply(from, 'Perintah ini hanya untuk Owner bot!', id) 1033 | if (args.length == 0) return pakforlay.reply(from, `Untuk broadcast ke semua chat ketik:\n${prefix}bc [isi chat]`) 1034 | let msg = body.slice(4) 1035 | const chatz = await pakforlay.getAllChatIds() 1036 | for (let idk of chatz) { 1037 | var cvk = await pakforlay.getChatById(idk) 1038 | if (!cvk.isReadOnly) pakforlay.sendText(idk, `〘 *Yaelahdo B C* 〙\n\n${msg}`) 1039 | if (cvk.isReadOnly) pakforlay.sendText(idk, `〘 *Yaelahdo B C* 〙\n\n${msg}`) 1040 | } 1041 | pakforlay.reply(from, 'Broadcast Success!', id) 1042 | break 1043 | case 'leaveall': //mengeluarkan bot dari semua group serta menghapus chatnya 1044 | if (!isOwnerBot) return pakforlay.reply(from, 'Perintah ini hanya untuk Owner bot', id) 1045 | const allChatz = await pakforlay.getAllChatIds() 1046 | const allGroupz = await pakforlay.getAllGroups() 1047 | for (let gclist of allGroupz) { 1048 | await pakforlay.sendText(gclist.contact.id, `Maaf bot sedang pembersihan, total chat aktif : ${allChatz.length}`) 1049 | await pakforlay.leaveGroup(gclist.contact.id) 1050 | await pakforlay.deleteChat(gclist.contact.id) 1051 | } 1052 | pakforlay.reply(from, 'Success leave all group!', id) 1053 | break 1054 | case 'clearall': //menghapus seluruh pesan diakun bot 1055 | if (!isOwnerBot) return pakforlay.reply(from, 'Perintah ini hanya untuk Owner bot', id) 1056 | const allChatx = await pakforlay.getAllChats() 1057 | for (let dchat of allChatx) { 1058 | await pakforlay.deleteChat(dchat.id) 1059 | } 1060 | pakforlay.reply(from, 'Success clear all chat!', id) 1061 | break 1062 | default: 1063 | break 1064 | } 1065 | /* 1066 | // Simi-simi function 1067 | if ((!isCmd && isGroupMsg && isSimi) && message.type === 'chat') { 1068 | axios.get(`https://arugaz.herokuapp.com/api/simisimi?kata=${encodeURIComponent(message.body)}&apikey=${apiSimi}`) 1069 | .then((res) => { 1070 | if (res.data.status == 403) return pakforlay.sendText(ownerNumber, `${res.data.result}\n\n${res.data.pesan}`) 1071 | pakforlay.reply(from, `Simi berkata: ${res.data.result}`, id) 1072 | }) 1073 | .catch((err) => { 1074 | pakforlay.reply(from, `${err}`, id) 1075 | }) 1076 | } 1077 | */ 1078 | // Kata kasar function 1079 | if(!isCmd && isGroupMsg && isNgegas) { 1080 | const find = db.get('group').find({ id: groupId }).value() 1081 | if(find && find.id === groupId){ 1082 | const cekuser = db.get('group').filter({id: groupId}).map('members').value()[0] 1083 | const isIn = inArray(pengirim, cekuser) 1084 | if(cekuser && isIn !== false){ 1085 | if(isKasar){ 1086 | const denda = db.get('group').filter({id: groupId}).map('members['+isIn+']').find({ id: pengirim }).update('denda', n => n + 5000).write() 1087 | if(denda){ 1088 | await pakforlay.reply(from, "Jangan badword bodoh\nDenda +5.000\nTotal : Rp"+formatin(denda.denda), id) 1089 | } 1090 | } 1091 | } else { 1092 | const cekMember = db.get('group').filter({id: groupId}).map('members').value()[0] 1093 | if(cekMember.length === 0){ 1094 | if(isKasar){ 1095 | db.get('group').find({ id: groupId }).set('members', [{id: pengirim, denda: 5000}]).write() 1096 | } else { 1097 | db.get('group').find({ id: groupId }).set('members', [{id: pengirim, denda: 0}]).write() 1098 | } 1099 | } else { 1100 | const cekuser = db.get('group').filter({id: groupId}).map('members').value()[0] 1101 | if(isKasar){ 1102 | cekuser.push({id: pengirim, denda: 5000}) 1103 | await pakforlay.reply(from, "Jangan badword bodoh\nDenda +5.000", id) 1104 | } else { 1105 | cekuser.push({id: pengirim, denda: 0}) 1106 | } 1107 | db.get('group').find({ id: groupId }).set('members', cekuser).write() 1108 | } 1109 | } 1110 | } else { 1111 | if(isKasar){ 1112 | db.get('group').push({ id: groupId, members: [{id: pengirim, denda: 5000}] }).write() 1113 | await pakforlay.reply(from, "Jangan badword bodoh\nDenda +5.000\nTotal : Rp5.000", id) 1114 | } else { 1115 | db.get('group').push({ id: groupId, members: [{id: pengirim, denda: 0}] }).write() 1116 | } 1117 | } 1118 | } 1119 | } catch (err) { 1120 | console.log(color('[EROR]', 'red'), err) 1121 | } 1122 | } 1123 | -------------------------------------------------------------------------------- /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 | -------------------------------------------------------------------------------- /README.md: -------------------------------------------------------------------------------- 1 |

2 | 3 |

4 |
5 |
6 | 🥟 Help me! 7 | 8 | [Saweria](https://saweria.co/pakforlay) 9 | 10 |
11 | 12 | THANKS BANG ARUGAZ ATAS API NYA, DALAM WAKTU SINGKAT INSHAALLAH API SAYA SENDIRI AKAN SAYA UPDATE TERUS 13 |

API ARUGAZ.

14 |

API PakForlay.

15 |
16 | 17 | ## NOMOR WHATSAPP BOT 18 | +6285864456465 19 | 20 | ## CHANGE LOG AT BOTTOM 21 | 22 | ## Getting Started 23 | This project require NodeJS v12. 24 | 25 | ### Install 26 | Clone this project 27 | 28 | ```bash 29 | > git clone https://github.com/pakforlay/whatsapp-botz.git 30 | > cd whatsapp-bot 31 | ``` 32 | 33 | Install the dependencies: 34 | 35 | ```bash 36 | > npm install 37 | > npm install gify-cli -g 38 | ``` 39 | 40 | ### Usage 41 | Run the Whatsapp bot 42 | 43 | ```bash 44 | > npm start 45 | ``` 46 | 47 | after running it you need to scan the qr 48 | 49 | ### Information 50 | - Change ownerNumber on [this section](https://github.com/pakforlay/whatsapp-botz/blob/master/settings/setting.json#L2) 51 | - Change groupLimit on [this section](https://github.com/pakforlay/whatsapp-botz/blob/master/settings/setting.json#L3) 52 | - Change memberLimit on [this section](https://github.com/pakforlay/whatsapp-botz/blob/master/settings/setting.json#L4) 53 | - Change prefix on [this section](https://github.com/pakforlay/whatsapp-botz/blob/master/settings/setting.json#L5) 54 | - Change menu on [this section](https://github.com/pakforlay/whatsapp-botz/blob/master/lib/menu.js#L32) 55 | - Add kata kasar on [this section](https://github.com/pakforlay/whatsapp-botz/blob/master/lib/kataKotor.js#L8) 56 | - Change all apiKey on [this section](https://github.com/pakforlay/whatsapp-botz/blob/master/settings/api.json) 57 | - Get Api NoBackground on [this website](https://www.remove.bg/) 58 | - Get Api ScreenShot on [this website](https://apiflash.com/) 59 | - Get Api Simi-simi on [this website](https://workshop.simsimi.com/en/), masih limit api simi-siminya? [cek ini](https://github.com/pakforlay/whatsapp-bot/issues/38#issuecomment-726981060) 60 | 61 | --- 62 | 63 | ## Features 64 | 65 | | 18+ |Yes| 66 | | ------------- | ------------- | 67 | | Nekopoi |❎| 68 | 69 | | Creator |Yes| 70 | | ------------- | ------------- | 71 | | Respond img to sticker|✅| 72 | | Respond img to sticker no bg|✅| 73 | | Respond url to sticker|✅| 74 | | Respond gif to sticker|✅| 75 | | Respond giphy url to sticker|✅| 76 | | Make a meme from photo|✅| 77 | | Quotes maker result pict|✅| 78 | | Nulis Bot|✅| 79 | 80 | | Islam |Yes| 81 | | ------------- | ------------- | 82 | | List Surah|✅| 83 | | Info Surah|✅| 84 | | Surah|✅| 85 | | Tafsir Alquran|✅| 86 | | Alquran Audio/Voice|✅| 87 | | Jadwal solat|✅| 88 | 89 | | Downloader |Yes| 90 | | ------------- | ------------- | 91 | | Instagram |✅| 92 | | Youtube Music |✅| 93 | | Youtube Video |✅| 94 | | Tiktok No WM |✅| 95 | 96 | | Fun Group! |Yes| 97 | | ------------- | ------------- | 98 | | Simi-simi BOT|✅| 99 | | Anti kata kasar|✅| 100 | 101 | | Primbon |Yes| 102 | | ------------- | ------------- | 103 | | Arti nama |✅| 104 | | Cek Jodoh |✅| 105 | 106 | | Searchs |Yes| 107 | | ------------- | ------------- | 108 | | Images |✅| 109 | | Subreddit |✅| 110 | | Resep makanan |✅| 111 | | Stalk IG |✅| 112 | | Wikipedia |✅| 113 | | Cuaca |✅| 114 | | Chord musik |✅| 115 | | Lirik musik |✅| 116 | | Screen Crot!|✅| 117 | | Play music|✅| 118 | | whats anime?|✅| 119 | 120 | | Random text |Yes| 121 | | ------------- | ------------- | 122 | | Pantun pakboy|✅| 123 | | Fakta Menarik|✅| 124 | | Kata Bijak|✅| 125 | | Quotes|✅| 126 | 127 | | Random image |Yes| 128 | | ------------- | ------------- | 129 | | Anime |✅| 130 | | Kpop |✅| 131 | | Memes |✅| 132 | 133 | 134 | | Others |Yes| 135 | | ------------- | ------------- | 136 | | Teks to Sound/Voice|✅| 137 | | Translate teks|✅| 138 | | Get covid info from map|✅| 139 | | Covid-19 Indo|✅| 140 | | Shortlink|✅| 141 | | Bap4k F0nt|✅| 142 | 143 | | Groups |Yes| 144 | | ------------- | ------------- | 145 | | Admin|| 146 | | Add user|✅| 147 | | Kick user|✅| 148 | | Promote User|✅| 149 | | Demote User|✅| 150 | | Delete bot msg|✅| 151 | | Tagall/mentions all|✅| 152 | | Owner|| 153 | | Kick all members|✅| 154 | 155 | | Owner bot |Yes| 156 | | ------------- | ------------- | 157 | | Broadcast|✅| 158 | | Leave all group|✅| 159 | | Delete all msgs|✅| 160 | | Banned user|✅| 161 | 162 | 163 | ## To-Do 164 | - Add Media Downloader 165 | - Add More Feature 166 | - More refactoring 167 | 168 | --- 169 | 170 | ## Troubleshooting 171 | Make sure all the necessary dependencies are installed: https://github.com/puppeteer/puppeteer/blob/main/docs/troubleshooting.md 172 | 173 | Fix Stuck on linux, install google chrome stable: 174 | ```bash 175 | > wget https://dl.google.com/linux/direct/google-chrome-stable_current_amd64.deb 176 | > sudo apt install ./google-chrome-stable_current_amd64.deb 177 | ``` 178 | 179 | ## Thanks to 180 | - [WA-Automate](https://github.com/open-wa/wa-automate-nodejs) 181 | - [YogaSakti](https://github.com/YogaSakti/imageToSticker) 182 | - [MhankBarBar](https://github.com/MhankBarBar/whatsapp-bot) 183 | - [dandyraka](https://github.com/dandyraka/NoBadWord) 184 | - [ArugaZ](https://github.com/ArugaZ/) 185 | 186 | ## 121/11/2020 187 | 188 | GRAB DATA TIKTOK 189 | DELETE FITURE SIMSIMI 190 | 191 | ## 18/11/2020 192 | 193 | Fix API Tiktok dan Youtube Downloader 194 | Fix ERROR 195 | Fix Typo 196 | 197 | ## 14/11/2020 198 | 199 | UPDATE TIKTOK DOWNLOADER TANPA WATERMARK 200 | -------------------------------------------------------------------------------- /halo.java: -------------------------------------------------------------------------------- 1 | String fun; 2 | -------------------------------------------------------------------------------- /index.js: -------------------------------------------------------------------------------- 1 | const { create, Client } = require('@open-wa/wa-automate') 2 | const figlet = require('figlet') 3 | const options = require('./utils/options') 4 | const { color, messageLog } = require('./utils') 5 | const HandleMsg = require('./HandleMsg') 6 | 7 | const start = (pakforlay = new Client()) => { 8 | console.log(color(figlet.textSync('----------------', { horizontalLayout: 'default' }))) 9 | console.log(color(figlet.textSync('PakForlay BOT', { font: 'Ghost', horizontalLayout: 'default' }))) 10 | console.log(color(figlet.textSync('----------------', { horizontalLayout: 'default' }))) 11 | console.log(color('[DEV]'), color('pakforlay', 'yellow')) 12 | console.log(color('[~>>]'), color('BOT Started!', 'green')) 13 | 14 | // Mempertahankan sesi agar tetap nyala 15 | pakforlay.onStateChanged((state) => { 16 | console.log(color('[~>>]', 'red'), state) 17 | if (state === 'CONFLICT' || state === 'UNLAUNCHED') pakforlay.forceRefocus() 18 | }) 19 | 20 | // ketika bot diinvite ke dalam group 21 | pakforlay.onAddedToGroup(async (chat) => { 22 | const groups = await pakforlay.getAllGroups() 23 | // kondisi ketika batas group bot telah tercapai,ubah di file settings/setting.json 24 | if (groups.length > groupLimit) { 25 | await pakforlay.sendText(chat.id, `Sorry, the group on this bot is full\nMax Group is: ${groupLimit}`).then(() => { 26 | pakforlay.leaveGroup(chat.id) 27 | pakforlay.deleteChat(chat.id) 28 | }) 29 | } else { 30 | // kondisi ketika batas member group belum tercapai, ubah di file settings/setting.json 31 | if (chat.groupMetadata.participants.length < memberLimit) { 32 | await pakforlay.sendText(chat.id, `Sorry, BOT comes out if the group members do not exceed ${memberLimit} people`).then(() => { 33 | pakforlay.leaveGroup(chat.id) 34 | pakforlay.deleteChat(chat.id) 35 | }) 36 | } else { 37 | await pakforlay.simulateTyping(chat.id, true).then(async () => { 38 | await pakforlay.sendText(chat.id, `Hai minna~, Im pakforlay BOT. To find out the commands on this bot type ${prefix}menu`) 39 | }) 40 | } 41 | } 42 | }) 43 | 44 | // ketika seseorang masuk/keluar dari group 45 | pakforlay.onGlobalParicipantsChanged(async (event) => { 46 | const host = await pakforlay.getHostNumber() + '@c.us' 47 | // kondisi ketika seseorang diinvite/join group lewat link 48 | if (event.action === 'add' && event.who !== host) { 49 | await pakforlay.sendTextWithMentions(event.chat, `Hello, Welcome to the group @${event.who.replace('@c.us', '')} \n\nHave fun with us✨`) 50 | } 51 | // kondisi ketika seseorang dikick/keluar dari group 52 | if (event.action === 'remove' && event.who !== host) { 53 | await pakforlay.sendTextWithMentions(event.chat, `Good bye @${event.who.replace('@c.us', '')}, We'll miss you✨`) 54 | } 55 | }) 56 | 57 | pakforlay.onIncomingCall(async (callData) => { 58 | // ketika seseorang menelpon nomor bot akan mengirim pesan 59 | await pakforlay.sendText(callData.peerJid, 'Maaf sedang tidak bisa menerima panggilan.\n\n-bot') 60 | .then(async () => { 61 | // bot akan memblock nomor itu 62 | await pakforlay.contactBlock(callData.peerJid) 63 | }) 64 | }) 65 | 66 | // ketika seseorang mengirim pesan 67 | pakforlay.onMessage(async (message) => { 68 | pakforlay.getAmountOfLoadedMessages() // menghapus pesan cache jika sudah 3000 pesan. 69 | .then((msg) => { 70 | if (msg >= 3000) { 71 | console.log('[pakforlay]', color(`Loaded Message Reach ${msg}, cuting message cache...`, 'yellow')) 72 | pakforlay.cutMsgCache() 73 | } 74 | }) 75 | HandleMsg(pakforlay, message) 76 | 77 | }) 78 | 79 | // Message log for analytic 80 | pakforlay.onAnyMessage((anal) => { 81 | messageLog(anal.fromMe, anal.type) 82 | }) 83 | } 84 | 85 | //create session 86 | create(options(true, start)) 87 | .then((pakforlay) => start(pakforlay)) 88 | .catch((err) => new Error(err)) 89 | -------------------------------------------------------------------------------- /lib/cekResi.js: -------------------------------------------------------------------------------- 1 | const { fetchJson } = require('../utils/fetcher') 2 | 3 | /** 4 | * Get Resi Information 5 | * 6 | * @param {string} ekspedisi - nama ekpedisi 7 | * @param {string} resi - no / kode resi 8 | */ 9 | module.exports = cekResi = (ekspedisi, resi) => new Promise((resolve, reject) => { 10 | fetchJson(`https://api.terhambar.com/resi?resi=${resi}&kurir=${ekspedisi}`) 11 | .then((result) => { 12 | if (result.status.code != 200 && result.status.description != 'OK') return resolve(result.status.description) 13 | // eslint-disable-next-line camelcase 14 | const { result: { summary, details, delivery_status, manifest } } = result 15 | const manifestText = manifest.map(x => `⏰ ${x.manifest_date} ${x.manifest_time}\n └ ${x.manifest_description}`) 16 | const resultText = ` 17 | 📦 Data Ekspedisi 18 | ├ ${summary.courier_name} 19 | ├ Nomor: ${summary.waybill_number} 20 | ├ Service: ${summary.service_code} 21 | └ Dikirim Pada: ${details.waybill_date} ${details.waybill_time} 22 | 23 | 💁🏼‍♂️ Data Pengirim 24 | ├ Nama: ${details.shippper_name} 25 | └ Alamat: ${details.shipper_address1} ${details.shipper_city} 26 | 27 | 🎯 Data Penerima 28 | ├ Nama: ${details.receiver_name} 29 | └ Alamat: ${details.receiver_address1} ${details.receiver_city} 30 | 31 | 📮 Status Pengiriman 32 | └ ${delivery_status.status} 33 | 34 | 🚧 POD Detail\n 35 | ${manifestText.join('\n')}` 36 | resolve(resultText) 37 | }).catch((err) => { 38 | console.error(err) 39 | reject(err) 40 | }) 41 | }) 42 | -------------------------------------------------------------------------------- /lib/data/group.json: -------------------------------------------------------------------------------- 1 | { 2 | "group": [] 3 | } -------------------------------------------------------------------------------- /lib/images.js: -------------------------------------------------------------------------------- 1 | const { resolve, reject } = require('promise') 2 | const { fetchJson } = require('../utils/fetcher') 3 | 4 | /** 5 | * 6 | * @param {String} query 7 | * 8 | */ 9 | 10 | const fdci = async (wall) => new Promise((resolve, reject) => { 11 | fetchJson('http://api.fdci.se/rep.php?gambar=' + wall) 12 | .then((result) => { 13 | const andwall = Math.floor(Math.random() * 41) 14 | resolve(result[andwall]) 15 | }) 16 | .catch((err) => { 17 | reject(err) 18 | }) 19 | }) 20 | 21 | /** 22 | * 23 | * @param {String} 24 | * @param {String} 25 | * @param {String} 26 | * 27 | */ 28 | 29 | const quote = async (quotes, author , type) => new Promise((resolve, reject) => { 30 | const q = quotes.replace(/ /g, '%20').replace('\n','%5Cn') 31 | fetchJson('https://terhambar.com/aw/qts/?kata=' + q + '&author=' + author + '&tipe=' + type + '/') 32 | .then((res) => { 33 | resolve(res.result) 34 | }) 35 | .catch((err) => { 36 | reject(err) 37 | }) 38 | 39 | }) 40 | 41 | /** 42 | * 43 | * @param {String} query 44 | * 45 | */ 46 | 47 | const sreddit = async (reddit) => new Promise((resolve, reject) => { 48 | fetchJson('https://meme-api.herokuapp.com/gimme/' + reddit + '/') 49 | .then((rest) => { 50 | resolve(rest.url) 51 | }) 52 | .catch((errr) => { 53 | reject(errr) 54 | }) 55 | }) 56 | 57 | module.exports = { 58 | fdci, 59 | quote, 60 | sreddit 61 | } 62 | -------------------------------------------------------------------------------- /lib/index.js: -------------------------------------------------------------------------------- 1 | exports.cekResi = require('./cekResi') 2 | exports.meme = require('./meme') 3 | exports.urlShortener = require('./shortener') 4 | exports.translate = require('./translate') 5 | exports.getLocationData = require('./location') 6 | exports.menuId = require('./menu') 7 | exports.images = require('./images') 8 | exports.resep = require('./resep') 9 | exports.rugapoi = require('./nekopoi') 10 | exports.rugaapi = require('./rugaApi') 11 | exports.cariKasar = require('./kataKotor') 12 | -------------------------------------------------------------------------------- /lib/kataKotor.js: -------------------------------------------------------------------------------- 1 | const sastrawi = require('sastrawijs'); 2 | 3 | const kataKasar = [ 4 | 'anjing', 5 | 'kontol', 6 | 'memek', 7 | 'jembut' 8 | //Tambahin Sendiri 9 | ]; 10 | 11 | const inArray = (needle, haystack) => { 12 | let length = haystack.length; 13 | for(let i = 0; i < length; i++) { 14 | if(haystack[i] == needle) return true; 15 | } 16 | return false; 17 | } 18 | 19 | module.exports = cariKasar = (kata) => new Promise((resolve) => { 20 | let sentence = kata; 21 | let stemmer = new sastrawi.Stemmer(); 22 | let tokenizer = new sastrawi.Tokenizer(); 23 | let words = tokenizer.tokenize(sentence); 24 | for (word of words) { 25 | if(inArray(stemmer.stem(word), kataKasar)){ 26 | resolve(true) 27 | } 28 | } 29 | resolve(false) 30 | }) 31 | -------------------------------------------------------------------------------- /lib/location.js: -------------------------------------------------------------------------------- 1 | const { fetchJson } = require('../utils/fetcher') 2 | 3 | async function getZoneStatus (latitude, longitude, userId = '2d8ecc70-8310-11ea-84f8-13de98afc5a4') { 4 | return new Promise((resolve, reject) => { 5 | const options = { 6 | method: 'POST', 7 | headers: { 8 | Authorization: 'Basic dGVsa29tOmRhMWMyNWQ4LTM3YzgtNDFiMS1hZmUyLTQyZGQ0ODI1YmZlYQ== ', 9 | Accept: 'application/json' 10 | }, 11 | body: JSON.stringify({ 12 | latitude: latitude.toString(), 13 | longitude: longitude.toString(), 14 | userId 15 | }) 16 | } 17 | fetchJson('https://api.pedulilindungi.id/zone/v1', options) 18 | .then(json => { 19 | const result = { 20 | kode: json.data.zone, 21 | status: '', 22 | optional: '' 23 | } 24 | 25 | switch (json.data.zone) { 26 | case 'red': 27 | result.status = 'Anda berada di Zona Merah penyebaran COVID-19.' 28 | result.optional = 'Zona Merah adalah area yang sudah terdapat kasus Positif COVID-19.' 29 | break 30 | case 'yellow': 31 | result.status = 'Anda berada di Zona Kuning penyebaran COVID-19.' 32 | result.optional = 'Zona Kuning adalah area yang sudah terdapat kasus ODP atau PDP COVID-19.' 33 | break 34 | case 'green': 35 | result.status = 'Anda berada di Zona Hijau penyebaran COVID-19.' 36 | result.optional = 'Zona Hijau adalah area yang belum terdapat kasus PDP atau Positif COVID-19.' 37 | break 38 | } 39 | 40 | if (!json.success && json.message == 'Anda berada di zona aman.') { 41 | result.kode = 'green' 42 | result.status = 'Anda berada di Zona Hijau penyebaran COVID-19.' 43 | result.optional = 'Zona Hijau adalah area yang belum terdapat kasus PDP atau Positif COVID-19.' 44 | } 45 | resolve(result) 46 | }) 47 | .catch((err) => reject(err)) 48 | }) 49 | } 50 | 51 | async function getArea (latitude, longitude, size = 10) { 52 | return new Promise((resolve, reject) => { 53 | const options = { 54 | method: 'GET', 55 | headers: { 56 | Authorization: ' Basic dGVsa29tOmRhMWMyNWQ4LTM3YzgtNDFiMS1hZmUyLTQyZGQ0ODI1YmZlYQ== ', 57 | 'Content-Type': ' application/json ' 58 | } 59 | } 60 | fetchJson(`https://api.pedulilindungi.id/zone/v1/location/area?latitude=${latitude}&longitude=${longitude}&page=1&size=${size}`, options) 61 | .then(json => { 62 | if (json.success && json.code == 200) resolve(json) 63 | }) 64 | .catch((err) => reject(err)) 65 | }) 66 | }; 67 | 68 | module.exports = getLocationData = async (latitude, longitude) => { 69 | try { 70 | const responses = await Promise.all([getZoneStatus(latitude, longitude), getArea(latitude, longitude)]) 71 | const result = { 72 | kode: 200, 73 | status: responses[0].status, 74 | optional: responses[0].optional, 75 | data: [] 76 | } 77 | responses[1].data.map((x) => result.data.push(x)) 78 | return result 79 | } catch (err) { 80 | console.log(err) 81 | return { kode: 0 } 82 | } 83 | } 84 | -------------------------------------------------------------------------------- /lib/meme.js: -------------------------------------------------------------------------------- 1 | const { fetchJson, fetchBase64 } = require('../utils/fetcher') 2 | const fs = require('fs-extra') 3 | const { 4 | apiSS 5 | } = JSON.parse(fs.readFileSync('./settings/api.json')) 6 | 7 | /** 8 | * Get meme from random subreddit 9 | * 10 | * @param {String} _subreddit 11 | * @return {Promise} Return meme from dankmemes, wholesomeanimemes, wholesomememes, AdviceAnimals, MemeEconomy, memes, terriblefacebookmemes, teenagers, historymemes 12 | */ 13 | const random = async (_subreddit) => new Promise((resolve, reject) => { 14 | const subreddits = ['dankmemes', 'wholesomeanimemes', 'wholesomememes', 'AdviceAnimals', 'MemeEconomy', 'memes', 'terriblefacebookmemes', 'teenagers', 'historymemes', 'okbuddyretard', 'nukedmemes'] 15 | const randSub = subreddits[Math.random() * subreddits.length | 0] 16 | console.log('looking for memes on ' + randSub) 17 | fetchJson('https://meme-api.herokuapp.com/gimme/' + randSub) 18 | .then((result) => resolve(result.url)) 19 | .catch((err) => { 20 | console.error(err) 21 | reject(err) 22 | }) 23 | }) 24 | 25 | /** 26 | * create custom meme 27 | * @param {String} imageUrl 28 | * @param {String} topText 29 | * @param {String} bottomText 30 | */ 31 | const custom = async (imageUrl, top, bottom) => new Promise((resolve, reject) => { 32 | topText = top.trim().replace(/\s/g, '_').replace(/\?/g, '~q').replace(/\%/g, '~p').replace(/\#/g, '~h').replace(/\//g, '~s') 33 | bottomText = bottom.trim().replace(/\s/g, '_').replace(/\?/g, '~q').replace(/\%/g, '~p').replace(/\#/g, '~h').replace(/\//g, '~s') 34 | fetchBase64(`https://api.memegen.link/images/custom/${topText}/${bottomText}.png?background=${imageUrl}`, 'image/png') 35 | .then((result) => resolve(result)) 36 | .catch((err) => { 37 | console.error(err) 38 | reject(err) 39 | }) 40 | }) 41 | 42 | const ss = async (url) => new Promise((resolve, reject) => { 43 | fetchBase64(`https://api.apiflash.com/v1/urltoimage?access_key=${apiSS}&url=${url}`) 44 | .then((res) => { 45 | resolve(res) 46 | }) 47 | .catch((err) => { 48 | reject(err) 49 | }) 50 | }) 51 | 52 | module.exports = { 53 | random, 54 | custom, 55 | ss 56 | } 57 | -------------------------------------------------------------------------------- /lib/menu.js: -------------------------------------------------------------------------------- 1 | const fs = require('fs-extra') 2 | const { 3 | prefix 4 | } = JSON.parse(fs.readFileSync('./settings/setting.json')) 5 | 6 | /* 7 | 8 | Dimohon untuk tidak menghapus link github saya, butuh support dari kalian! makasih. 9 | 10 | */ 11 | 12 | exports.textTnC = () => { 13 | return ` 14 | Source code / bot ini merupakan program open-source (gratis) yang ditulis menggunakan Javascript, kamu dapat menggunakan, menyalin, memodifikasi, menggabungkan, menerbitkan, mendistribusikan, mensublisensikan, dan atau menjual salinan dengan tanpa menghapus author utama dari source code / bot ini. 15 | 16 | Dengan menggunakan source code / bot ini maka anda setuju dengan Syarat dan Kondisi sebagai berikut: 17 | - Source code / bot tidak menyimpan data anda di server kami. 18 | - Source code / bot tidak bertanggung jawab atas perintah anda kepada bot ini. 19 | - Source code / bot anda bisa lihat di https://github.com/pakforlay/whatsapp-botz 20 | 21 | Instagram: https://instagram.com/yaelahdo/ 22 | 23 | Best regards, yaelahdo.` 24 | } 25 | 26 | /* 27 | 28 | Dimohon untuk tidak menghapus link github saya, butuh support dari kalian! makasih. 29 | 30 | */ 31 | 32 | exports.textMenu = (pushname) => { 33 | return ` 34 | Hi, ${pushname}! 👋️ 35 | Sebelum make, bot nya siapa tau kakak pengen donasi. 36 | Bisa lewat 37 | https://saweria.co/pakforlay 38 | atau 39 | OVO : *087880001337* 40 | DANA : *081271613908* 41 | BCA : *8995300213* 42 | A/N ALDO PRATAMA 43 | 44 | PERATURAN BOT. 45 | DILARANG KERAS TELFON/VC ATAU KAKAK DIBLOKIR, KARNA BOT NYA UDAH DI PROGRAM OTOMATIS. 46 | 47 | Berikut adalah beberapa fitur yang ada pada bot ini!✨ 48 | 49 | Creator: 50 | -❥ *${prefix}sticker* 51 | -❥ *${prefix}stickergif* 52 | -❥ *${prefix}stickergiphy* 53 | -❥ *${prefix}meme* 54 | -❥ *${prefix}quotemaker* 55 | -❥ *${prefix}nulis* 56 | 57 | Islam: 58 | -❥ *${prefix}infosurah* 59 | -❥ *${prefix}surah* 60 | -❥ *${prefix}tafsir* 61 | -❥ *${prefix}ALaudio* 62 | -❥ *${prefix}jsolat* 63 | 64 | 65 | Fun Menu (Group): 66 | -❥ *${prefix}katakasar* 67 | ┷-❥ *${prefix}klasmen* 68 | 69 | Download: 70 | -❥ *${prefix}tiktok* 71 | └Mendownload Video Tiktok Tanpa Watermark 72 | -❥ *${prefix}insta* 73 | └Mendownload Video dan Images Instagram 74 | -❥ *${prefix}ytmus* 75 | └Mendownload Audio dari Youtube 76 | -❥ *${prefix}ytvid* 77 | └Mendownload Video dari Youtube 78 | -❥ *${prefix}twimg* 79 | └Mengunduh Photo dari twitter 80 | -❥ *${prefix}twvid* 81 | Mengunduh Video dari twitter 82 | (tolong untuk fiture twitter jangan dipake download yg aneh - aneh) 83 | 84 | Primbon: 85 | -❥ *${prefix}artinama* 86 | -❥ *${prefix}cekjodoh* 87 | 88 | Search Any: 89 | -❥ *${prefix}images* 90 | -❥ *${prefix}sreddit* 91 | -❥ *${prefix}resep* 92 | -❥ *${prefix}wiki* 93 | -❥ *${prefix}cuaca* 94 | -❥ *${prefix}chord* 95 | -❥ *${prefix}lirik* 96 | -❥ *${prefix}ss* 97 | -❥ *${prefix}play* 98 | -❥ *${prefix}whatanime* 99 | 100 | Random Teks: 101 | -❥ *${prefix}fakta* 102 | -❥ *${prefix}pantun* 103 | -❥ *${prefix}katabijak* 104 | -❥ *${prefix}quote* 105 | 106 | Random Images: 107 | -❥ *${prefix}anime* 108 | -❥ *${prefix}kpop* 109 | -❥ *${prefix}memes* 110 | 111 | Lain-lain: 112 | -❥ *${prefix}tts* 113 | -❥ *${prefix}translate* 114 | -❥ *${prefix}resi* 115 | -❥ *${prefix}covidindo* 116 | -❥ *${prefix}ceklokasi* 117 | -❥ *${prefix}shortlink* 118 | -❥ *${prefix}bapakfont* 119 | 120 | Tentang Bot: 121 | -❥ *${prefix}tnc* 122 | -❥ *${prefix}donasi* 123 | -❥ *${prefix}botstat* 124 | -❥ *${prefix}ownerbot* 125 | -❥ *${prefix}join* 126 | 127 | _-_-_-_-_-_-_-_-_-_-_-_-_-_ 128 | 129 | Owner Bot: 130 | -❥ *${prefix}ban* - banned 131 | -❥ *${prefix}bc* - promosi 132 | -❥ *${prefix}leaveall* - keluar semua grup 133 | -❥ *${prefix}clearall* - hapus semua chat 134 | 135 | Hope you have a great day!✨` 136 | } 137 | 138 | /* 139 | 140 | Dimohon untuk tidak menghapus link github saya, butuh support dari kalian! makasih. 141 | 142 | */ 143 | 144 | exports.textAdmin = () => { 145 | return ` 146 | ⚠ [ *Admin Group Only* ] ⚠ 147 | Berikut adalah fitur admin grup yang ada pada bot ini! 148 | 149 | -❥ *${prefix}add* 150 | -❥ *${prefix}kick* @tag 151 | -❥ *${prefix}promote* @tag 152 | -❥ *${prefix}demote* @tag 153 | -❥ *${prefix}tagall* 154 | -❥ *${prefix}del* 155 | 156 | _-_-_-_-_-_-_-_-_-_-_-_-_-_ 157 | 158 | ⚠ [ *Owner Group Only* ] ⚠ 159 | Berikut adalah fitur owner grup yang ada pada bot ini! 160 | -❥ *${prefix}kickall* 161 | *Owner Group adalah pembuat grup.* 162 | ` 163 | } 164 | 165 | /* 166 | 167 | Dimohon untuk tidak menghapus link github saya, butuh support dari kalian! makasih. 168 | 169 | */ 170 | 171 | exports.textDonasi = () => { 172 | return ` 173 | Hai, terimakasih telah menggunakan bot ini, untuk mendukung bot ini kamu dapat membantu dengan berdonasi dengan cara: 174 | 175 | https://saweria.co/pakforlay 176 | atau 177 | OVO : *087880001337* 178 | DANA : *081271613908* 179 | BCA : *8895300213* 180 | A/N ALDO PRATAMA 181 | 182 | Doakan agar project bot ini bisa terus berkembang 183 | Doakan agar author bot ini dapat ide-ide yang kreatif lagi 184 | 185 | Donasi akan digunakan untuk pengembangan dan pengoperasian bot ini. 186 | 187 | Terimakasih. -yaelahdo` 188 | } 189 | -------------------------------------------------------------------------------- /lib/nekopoi.js: -------------------------------------------------------------------------------- 1 | /** 2 | * @author Aruga 3 | * @license MIT 4 | */ 5 | 6 | "use strict" 7 | const axios = require('axios') 8 | const cheerio = require('cheerio') 9 | 10 | function getLatest() { 11 | return new Promise(function (resolve, reject) { // 12 | const url = 'http://nekopoi.care' 13 | axios.get(url) 14 | .then(req => { 15 | const title = [] 16 | const link = [] 17 | const image = [] 18 | const data = {} 19 | const soup = cheerio.load(req.data) 20 | soup('div.eropost').each(function (i, e) { 21 | soup(e).find('h2').each(function (j, s) { 22 | title.push(url + soup(s).find('a').text().trim()) 23 | link.push(url + soup(s).find('a').attr('href')) 24 | }) 25 | image.push(url + soup(e).find('img').attr('src')) 26 | }) 27 | if (data == undefined) { 28 | reject('No Result:(') 29 | } else { 30 | let i = Math.floor(Math.random() * title.length) 31 | let hehe = { 32 | "title": title[i], 33 | "image": image[i], 34 | "link": link[i] 35 | } 36 | resolve(hehe) 37 | } 38 | }) 39 | }) 40 | } 41 | 42 | /** 43 | * @author Aruga 44 | * @license MIT 45 | */ 46 | 47 | function getVideo(url) { 48 | return new Promise(function (resolve, reject) { // 49 | axios.get(url) 50 | .then(req => { 51 | try { 52 | const links = [] 53 | let soup = cheerio.load(req.data) 54 | let title = soup("title").text() 55 | soup('div.liner').each(function (i, e) { 56 | soup(e).find('div.listlink').each(function (j, s) { 57 | soup(s).find('a').each(function (p, q) { 58 | links.push(soup(q).attr('href')) 59 | }) 60 | }) 61 | }) 62 | const data = { 63 | "title": title, 64 | "links": links 65 | } 66 | resolve(data) 67 | } catch (err) { 68 | reject('Error : ' + err) 69 | } 70 | }) 71 | }) 72 | } 73 | 74 | module.exports = { 75 | getLatest, 76 | getVideo 77 | } 78 | -------------------------------------------------------------------------------- /lib/resep.js: -------------------------------------------------------------------------------- 1 | const axios = require('axios') 2 | const { resolve, reject } = require('promise') 3 | 4 | const resep = async (menu) => new Promise((resolve, reject) => { 5 | axios.get('https://masak-apa.tomorisakura.vercel.app/api/search/?q=' + menu) 6 | .then(async (res) => { 7 | const { results } = await res.data 8 | const random = Math.floor(Math.random() * 16) 9 | axios.get('https://masak-apa.tomorisakura.vercel.app/api/recipe/' + results[random].key) 10 | .then(async (result) => { 11 | const { results } = await result.data 12 | const bahannya = await `${results.ingredient}` 13 | const bahan = bahannya.replace(/,/g,'\n') 14 | const tutornya = await `${results.step}` 15 | const tutornih = tutornya.replace(/,/g,'\n') 16 | const tutor = tutornih.replace(/.,/g,'\n') 17 | const hasil = `*Judul:* ${results.title}\n*Penulis:* ${results.author.user}\n*Rilis:* ${results.author.datePublished}\n*Level:* ${results.dificulty}\n*Waktu:* ${results.times}\n*Porsi:* ${results.servings}\n\n*Bahan-bahan:*\n${bahan}\n\n*Step-by-step:*\n${tutor}` 18 | resolve(hasil) 19 | }) 20 | }) 21 | .catch((err) => { 22 | console.log(err) 23 | reject(err) 24 | }) 25 | }) 26 | 27 | module.exports = { 28 | resep 29 | } 30 | -------------------------------------------------------------------------------- /lib/rugaApi.js: -------------------------------------------------------------------------------- 1 | const axios = require('axios') 2 | const link = 'https://arugaz.herokuapp.com' 3 | const links = 'https://yaelahdo.herokuapp.com' 4 | const fileyt = 'https://raw.githubusercontent.com/ArugaZ/scraper-results/main/20201111_230923.jpg' 5 | const eroryt = 'https://raw.githubusercontent.com/ArugaZ/scraper-results/main/20201111_234624.jpg' 6 | 7 | /* API INSTAGRAM */ 8 | const insta = async (url) => new Promise((resolve, reject) => { 9 | axios.get(`${links}/ig?URL=${url}`) 10 | .then((res) => { 11 | resolve(`${res.data.getData}`) 12 | }) 13 | .catch((err) => { 14 | reject(err) 15 | }) 16 | }) 17 | 18 | /* API TWITTER IMAGES */ 19 | const twitimg = async (url) => new Promise((resolve, reject) => { 20 | axios.get(`${links}/twimg?URL=${url}`) 21 | .then((res) => { 22 | resolve(`${res.data.images}`) 23 | }) 24 | .catch((err) => { 25 | reject(err) 26 | }) 27 | }) 28 | 29 | /* API TWITTER VIDEOS */ 30 | const twitvid = async (url) => new Promise((resolve, reject) => { 31 | axios.get(`${links}/twvid?URL=${url}`) 32 | .then((res) => { 33 | resolve(`${res.data.getVideo}`) 34 | }) 35 | .catch((err) => { 36 | reject(err) 37 | }) 38 | }) 39 | 40 | /* API TIKTOK VIDEO */ 41 | const tiktok = async (url) => new Promise((resolve, reject) => { 42 | axios.get(`${links}/tiktok?URL=${url}`) 43 | .then((res) => { 44 | const grabData = `${res.data.mp4direct}` 45 | resolve(grabData) 46 | }) 47 | .catch((err) => { 48 | reject(err) 49 | }) 50 | }) 51 | 52 | /* API TIKTOK INFO */ 53 | const tiktokInfo = async (url) => new Promise((resolve, reject) => { 54 | axios.get(`${links}/tiktok?URL=${url}`) 55 | .then((res) => { 56 | const grabInfo = ` 57 | ✅Sukses Mengunduh Video Tiktok Tanpa Watermark dengan 58 | └Username : *${res.data.nameInfo}* 59 | └Caption : *${res.data.textInfo}* 60 | └Upload Time : *${res.data.timeInfo}* 61 | Download Menggunakan Bot Whatsapp Yaelahdo 62 | ` 63 | resolve(grabInfo) 64 | }) 65 | .catch((err) => { 66 | reject(err) 67 | }) 68 | }) 69 | 70 | /* API YOUTUBE */ 71 | const ytvid = async (url) => new Promise((resolve, reject) => { 72 | axios.get(`${links}/ytvid?URL=${url}`) 73 | .then((res) => { 74 | resolve(`${res.data.getVideo}`) 75 | }) 76 | .catch((err) => { 77 | reject(err) 78 | }) 79 | }) 80 | 81 | /* API YT MUSIC */ 82 | const ytmp3 = async (url) => new Promise((resolve, reject) => { 83 | axios.get(`${links}/ytmus?URL=${url}`) 84 | .then((res) => { 85 | resolve(`${res.data.getVideo}`) 86 | }) 87 | .catch((err) => { 88 | reject(err) 89 | }) 90 | }) 91 | 92 | /* API YT MUSIC 93 | const ytmp3info = async (url) => new Promise((resolve, reject) => { 94 | axios.get(`${links}/ytmus?URL=${url}`) 95 | .then((res) => { 96 | const grabMusic = `✅Sukses Mengunduh Audio Youtube dengan\n\n*${res.data.titleInfo}*\n\n*${res.data.sizeInfo}*` 97 | resolve(grabMusic) 98 | }) 99 | .catch((err) => { 100 | reject(err) 101 | }) 102 | }) 103 | */ 104 | 105 | /* 106 | const stalkig = async (url) => new Promise((resolve, reject) => { 107 | axios.get(`${link}/api/stalk?username=${url}`) 108 | .then((res) => { 109 | if (res.data.error) resolve(res.data.error) 110 | const text = `User: ${res.data.Username}\nName: ${res.data.Name}\nBio: ${res.data.Biodata}\nFollower: ${res.data.Jumlah_Followers}\nFollowing: ${res.data.Jumlah_Following}\nPost: ${res.data.Jumlah_Post}` 111 | resolve(text) 112 | }) 113 | .catch((err) =>{ 114 | reject(err) 115 | }) 116 | }) 117 | */ 118 | 119 | /* 120 | const stalkigpict = async (url) => new Promise((resolve, reject) => { 121 | axios.get(`${link}/api/stalk?username=${url}`) 122 | .then((res) => { 123 | if (res.data.error) resolve('https://c4.wallpaperflare.com/wallpaper/976/117/318/anime-girls-404-not-found-glowing-eyes-girls-frontline-wallpaper-preview.jpg') 124 | resolve(`${res.data.Profile_pic}`) 125 | }) 126 | .catch((err) =>{ 127 | reject(err) 128 | }) 129 | }) 130 | */ 131 | 132 | const quote = async () => new Promise((resolve, reject) => { 133 | axios.get(`${link}/api/randomquotes`) 134 | .then((res) => { 135 | const text = `Author: ${res.data.author}\n\nQuote: ${res.data.quotes}` 136 | resolve(text) 137 | }) 138 | .catch((err) =>{ 139 | reject(err) 140 | }) 141 | }) 142 | 143 | const wiki = async (url) => new Promise((resolve, reject) => { 144 | axios.get(`${link}/api/wiki?q=${url}`) 145 | .then((res) => { 146 | resolve(res.data.result) 147 | }) 148 | .catch((err) =>{ 149 | reject(err) 150 | }) 151 | }) 152 | 153 | const daerah = async () => new Promise((resolve, reject) => { 154 | axios.get(`${link}/daerah`) 155 | .then((res) => { 156 | resolve(res.data.result) 157 | }) 158 | .catch((err) =>{ 159 | reject(err) 160 | }) 161 | }) 162 | 163 | const jadwaldaerah = async (url) => new Promise((resolve, reject) => { 164 | axios.get(`https://api.haipbis.xyz/jadwalsholat?daerah=${url}`) 165 | .then((res) => { 166 | if (res.data.error) resolve(res.data.error) 167 | const text = `Jadwal Sholat ${url}\n\nImsyak: ${res.data.Imsyak}\nSubuh: ${res.data.Subuh}\nDzuhur: ${res.data.Dzuhur}\nAshar: ${res.data.Ashar}\nMaghrib: ${res.data.Maghrib}\nIsya: ${res.data.Isya}` 168 | resolve(text) 169 | }) 170 | .catch((err) =>{ 171 | reject(err) 172 | }) 173 | }) 174 | 175 | const cuaca = async (url) => new Promise((resolve, reject) => { 176 | axios.get(`https://rest.farzain.com/api/cuaca.php?id=${url}&apikey=O8mUD3YrHIy9KM1fMRjamw8eg`) 177 | .then((res) => { 178 | if (res.data.respon.cuaca == null) resolve('Maaf daerah kamu tidak tersedia') 179 | const text = `Cuaca di: ${res.data.respon.tempat}\n\nCuaca: ${res.data.respon.cuaca}\nAngin: ${res.data.respon.angin}\nDesk: ${res.data.respon.deskripsi}\nKelembapan: ${res.data.respon.kelembapan}\nSuhu: ${res.data.respon.suhu}\nUdara: ${res.data.respon.udara}` 180 | resolve(text) 181 | }) 182 | .catch((err) =>{ 183 | reject(err) 184 | }) 185 | }) 186 | 187 | const chord = async (url) => new Promise((resolve, reject) => { 188 | axios.get(`${link}/api/chord?q=${url}`) 189 | .then((res) => { 190 | if (res.data.error) resolve(res.data.error) 191 | resolve(res.data.result) 192 | }) 193 | .catch((err) =>{ 194 | reject(err) 195 | }) 196 | }) 197 | 198 | const tulis = async (teks) => new Promise((resolve, reject) => { 199 | axios.get(`${link}/api/nulis?text=${encodeURIComponent(teks)}`) 200 | .then((res) => { 201 | resolve(`${res.data.result}`) 202 | }) 203 | .catch((err) => { 204 | reject(err) 205 | }) 206 | }) 207 | 208 | const artinama = async (nama) => new Promise((resolve, reject) => { 209 | axios.get(`${link}/api/artinama?nama=${nama}`) 210 | .then((res) => { 211 | resolve(res.data.result) 212 | }) 213 | .catch((err) => { 214 | reject(err) 215 | }) 216 | }) 217 | 218 | const cekjodoh = async (nama,pasangan) => new Promise((resolve, reject) => { 219 | axios.get(`${link}/api/jodohku?nama=${nama}&pasangan=${pasangan}`) 220 | .then((res) => { 221 | const textc = `Nama : ${res.data.nama}\nPasangan : ${res.data.pasangan}\nPositif: ${res.data.positif}\nNegatif : ${res.data.negatif}` 222 | resolve({link: res.data.gambar, text: textc}) 223 | }) 224 | .catch((err) => { 225 | reject(err) 226 | }) 227 | }) 228 | 229 | const covidindo = async () => new Promise((resolve, reject) => { 230 | axios.get(`${link}/api/coronaindo`) 231 | .then((res) => { 232 | const textv = `Info Covid-19 ${res.data.negara}\n\nKasus Baru: ${res.data.kasus_baru}\nTotal Kasus: ${res.data.kasus_total}\nSembuh: ${res.data.sembuh}\nPenanganan: ${res.data.penanganan}\nMeninggoy: ${res.data.meninggal}\n\nUpdate: ${res.data.terakhir}` 233 | resolve(textv) 234 | }) 235 | .catch((err) => { 236 | reject(err) 237 | }) 238 | }) 239 | 240 | const bapakfont = async (kalimat) => new Promise((resolve, reject) => { 241 | axios.get(`${link}/api/bapakfont?kata=${kalimat}`) 242 | .then((res) => { 243 | resolve(res.data.result) 244 | }) 245 | .catch((err) => { 246 | reject(err) 247 | }) 248 | }) 249 | 250 | const lirik = async (judul) => new Promise((resolve, reject) => { 251 | axios.get(`${link}/api/lirik?judul=${judul}`) 252 | .then((res) => { 253 | resolve(res.data.result) 254 | }) 255 | .catch((err) => { 256 | reject(err) 257 | }) 258 | }) 259 | 260 | module.exports = { 261 | insta, 262 | twitvid, 263 | twitimg, 264 | tiktok, 265 | tiktokInfo, 266 | ytmp3, 267 | ytvid, 268 | quote, 269 | wiki, 270 | daerah, 271 | jadwaldaerah, 272 | cuaca, 273 | chord, 274 | tulis, 275 | artinama, 276 | cekjodoh, 277 | covidindo, 278 | bapakfont, 279 | lirik 280 | } 281 | -------------------------------------------------------------------------------- /lib/shortener.js: -------------------------------------------------------------------------------- 1 | const { fetchText } = require('../utils/fetcher') 2 | 3 | /** 4 | * Create shorturl 5 | * 6 | * @param {String} url 7 | */ 8 | module.exports = shortener = (url) => new Promise((resolve, reject) => { 9 | console.log('Creating short url...') 10 | fetchText(`https://tinyurl.com/api-create.php?url=${url}`) 11 | .then((text) => resolve(text)) 12 | .catch((err) => reject(err)) 13 | }) 14 | -------------------------------------------------------------------------------- /lib/translate.js: -------------------------------------------------------------------------------- 1 | const { default: translate } = require('google-translate-open-api') 2 | 3 | /** 4 | * Translate Text 5 | * @param {String} text 6 | * @param {String} lang 7 | */ 8 | 9 | module.exports = doing = (text, lang) => new Promise((resolve, reject) => { 10 | console.log(`Translate text to ${lang}...`) 11 | translate(text, { tld: 'cn', to: lang }) 12 | .then((text) => resolve(text.data[0])) 13 | .catch((err) => reject(err)) 14 | }) 15 | -------------------------------------------------------------------------------- /media/tts.mp3: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/potaldogg/Whatsapp-Botz/162b07dba8500f0db3d7531b268ed72c6f687dd7/media/tts.mp3 -------------------------------------------------------------------------------- /package.json: -------------------------------------------------------------------------------- 1 | { 2 | "name": "whatsapp-bot", 3 | "version": "2.0.0", 4 | "description": "Whatsapp Bot - Node Js", 5 | "main": "index.js", 6 | "scripts": { 7 | "start": "node index.js" 8 | }, 9 | "author": "ArugaZ", 10 | "repository": { 11 | "type": "git", 12 | "url": "https://github.com/ArugaZ/whatsapp-bot.git" 13 | }, 14 | "bugs": { 15 | "url": "https://github.com/ArugaZ/whatsapp-bot/issues" 16 | }, 17 | "homepage": "https://github.com/ArugaZ/whatsapp-bot", 18 | "license": "ISC", 19 | "dependencies": { 20 | "@open-wa/wa-automate": "^3.0.15", 21 | "app-root-path": "^3.0.0", 22 | "axios": "^0.21.0", 23 | "chalk": "^4.1.0", 24 | "cheerio": "^1.0.0-rc.3", 25 | "dotenv": "^8.2.0", 26 | "figlet": "^1.5.0", 27 | "file-type": "^16.0.1", 28 | "fs-extra": "^9.0.1", 29 | "google-translate-open-api": "^1.3.5", 30 | "lowdb": "^1.0.0", 31 | "moment-timezone": "^0.5.31", 32 | "node-fetch": "^2.6.1", 33 | "node-gtts": "^2.0.2", 34 | "promise": "^8.1.0", 35 | "remove.bg": "^1.3.0", 36 | "sastrawijs": "^1.0.3", 37 | "sharp": "^0.26.1" 38 | }, 39 | "devDependencies": { 40 | "babel-eslint": "^10.1.0", 41 | "eslint": "^7.12.1", 42 | "eslint-config-standard": "^16.0.1", 43 | "eslint-plugin-import": "^2.22.1", 44 | "eslint-plugin-node": "^11.1.0", 45 | "eslint-plugin-promise": "^4.2.1", 46 | "eslint-plugin-standard": "^4.0.2" 47 | } 48 | } 49 | -------------------------------------------------------------------------------- /settings/api.json: -------------------------------------------------------------------------------- 1 | { 2 | "apiNoBg": "APIKEY", 3 | "apiSS": "APIKEY", 4 | "apiSimi": "APIKEY" 5 | } 6 | -------------------------------------------------------------------------------- /settings/banned.json: -------------------------------------------------------------------------------- 1 | [] 2 | -------------------------------------------------------------------------------- /settings/ngegas.json: -------------------------------------------------------------------------------- 1 | [] 2 | -------------------------------------------------------------------------------- /settings/setting.json: -------------------------------------------------------------------------------- 1 | { 2 | "ownerNumber": "628xxxxxxxxxx@c.us", 3 | "memberLimit": 5, 4 | "groupLimit": 5, 5 | "prefix": "#" 6 | } 7 | -------------------------------------------------------------------------------- /settings/simi.json: -------------------------------------------------------------------------------- 1 | [] 2 | -------------------------------------------------------------------------------- /utils/fetcher.js: -------------------------------------------------------------------------------- 1 | const fetch = require('node-fetch') 2 | const FormData = require('form-data') 3 | const fs = require('fs') 4 | const { fromBuffer } = require('file-type') 5 | const resizeImage = require('./imageProcessing') 6 | 7 | /** 8 | *Fetch Json from Url 9 | * 10 | *@param {String} url 11 | *@param {Object} options 12 | */ 13 | 14 | const fetchJson = (url, options) => 15 | new Promise((resolve, reject) => 16 | fetch(url, options) 17 | .then(response => response.json()) 18 | .then(json => resolve(json)) 19 | .catch(err => { 20 | console.error(err) 21 | reject(err) 22 | }) 23 | ) 24 | 25 | /** 26 | * Fetch Text from Url 27 | * 28 | * @param {String} url 29 | * @param {Object} options 30 | */ 31 | 32 | const fetchText = (url, options) => { 33 | return new Promise((resolve, reject) => { 34 | return fetch(url, options) 35 | .then(response => response.text()) 36 | .then(text => resolve(text)) 37 | .catch(err => { 38 | console.error(err) 39 | reject(err) 40 | }) 41 | }) 42 | } 43 | 44 | /** 45 | * Fetch base64 from url 46 | * @param {String} url 47 | */ 48 | 49 | const fetchBase64 = (url, mimetype) => { 50 | return new Promise((resolve, reject) => { 51 | console.log('Get base64 from:', url) 52 | return fetch(url) 53 | .then((res) => { 54 | const _mimetype = mimetype || res.headers.get('content-type') 55 | res.buffer() 56 | .then((result) => resolve(`data:${_mimetype};base64,` + result.toString('base64'))) 57 | }) 58 | .catch((err) => { 59 | console.error(err) 60 | reject(err) 61 | }) 62 | }) 63 | } 64 | 65 | /** 66 | * Upload Image to Telegra.ph 67 | * 68 | * @param {String} base64 image buffer 69 | * @param {Boolean} resize 70 | */ 71 | 72 | const uploadImages = (buffData, type) => { 73 | // eslint-disable-next-line no-async-promise-executor 74 | return new Promise(async (resolve, reject) => { 75 | const { ext } = await fromBuffer(buffData) 76 | const filePath = 'utils/tmp.' + ext 77 | const _buffData = type ? await resizeImage(buffData, false) : buffData 78 | fs.writeFile(filePath, _buffData, { encoding: 'base64' }, (err) => { 79 | if (err) return reject(err) 80 | console.log('Uploading image to telegra.ph server...') 81 | const fileData = fs.readFileSync(filePath) 82 | const form = new FormData() 83 | form.append('file', fileData, 'tmp.' + ext) 84 | fetch('https://telegra.ph/upload', { 85 | method: 'POST', 86 | body: form 87 | }) 88 | .then(res => res.json()) 89 | .then(res => { 90 | if (res.error) return reject(res.error) 91 | resolve('https://telegra.ph' + res[0].src) 92 | }) 93 | .then(() => fs.unlinkSync(filePath)) 94 | .catch(err => reject(err)) 95 | }) 96 | }) 97 | } 98 | 99 | module.exports = { 100 | fetchJson, 101 | fetchText, 102 | fetchBase64, 103 | uploadImages 104 | } 105 | -------------------------------------------------------------------------------- /utils/imageProcessing.js: -------------------------------------------------------------------------------- 1 | const sharp = require('sharp') 2 | const { fromBuffer } = require('file-type') 3 | 4 | /** 5 | * Resize image to buffer or base64 6 | * @param {Buffer} bufferdata 7 | * @param {Boolean} encode 8 | * @param {String} mimType 9 | */ 10 | // eslint-disable-next-line no-async-promise-executor 11 | module.exports = resizeImage = (buff, encode) => new Promise(async (resolve, reject) => { 12 | console.log('Resizeing image...') 13 | const { mime } = await fromBuffer(buff) 14 | sharp(buff, { failOnError: false }) 15 | .resize(512, 512) 16 | .toBuffer() 17 | .then(resizedImageBuffer => { 18 | if (!encode) return resolve(resizedImageBuffer) 19 | console.log('Create base64 from resizedImageBuffer...') 20 | const resizedImageData = resizedImageBuffer.toString('base64') 21 | const resizedBase64 = `data:${mime};base64,${resizedImageData}` 22 | resolve(resizedBase64) 23 | }) 24 | .catch(error => reject(error)) 25 | }) 26 | -------------------------------------------------------------------------------- /utils/index.js: -------------------------------------------------------------------------------- 1 | const chalk = require('chalk') 2 | const moment = require('moment-timezone') 3 | moment.tz.setDefault('Asia/Jakarta').locale('id') 4 | 5 | /** 6 | * Get text with color 7 | * @param {String} text 8 | * @param {String} color 9 | * @return {String} Return text with color 10 | */ 11 | const color = (text, color) => { 12 | return !color ? chalk.blueBright(text) : chalk.keyword(color)(text) 13 | } 14 | 15 | // Message type Log 16 | const messageLog = (fromMe, type) => updateJson('utils/stat.json', (data) => { 17 | (fromMe) ? (data.sent[type]) ? data.sent[type] += 1 : data.sent[type] = 1 : (data.receive[type]) ? data.receive[type] += 1 : data.receive[type] = 1 18 | return data 19 | }) 20 | 21 | /** 22 | * Get Time duration 23 | * @param {Date} timestamp 24 | * @param {Date} now 25 | */ 26 | const processTime = (timestamp, now) => { 27 | // timestamp => timestamp when message was received 28 | return moment.duration(now - moment(timestamp * 1000)).asSeconds() 29 | } 30 | 31 | /** 32 | * is it url? 33 | * @param {String} url 34 | */ 35 | const isUrl = (url) => { 36 | return url.match(new RegExp(/https?:\/\/(www\.)?[-a-zA-Z0-9@:%._+~#=]{1,256}\.[a-zA-Z0-9()]{1,6}\b([-a-zA-Z0-9()@:%_+.~#?&/=]*)/gi)) 37 | } 38 | 39 | // Message Filter / Message Cooldowns 40 | const usedCommandRecently = new Set() 41 | 42 | /** 43 | * Check is number filtered 44 | * @param {String} from 45 | */ 46 | const isFiltered = (from) => { 47 | return !!usedCommandRecently.has(from) 48 | } 49 | 50 | /** 51 | * Add number to filter 52 | * @param {String} from 53 | */ 54 | const addFilter = (from) => { 55 | usedCommandRecently.add(from) 56 | setTimeout(() => { 57 | return usedCommandRecently.delete(from) 58 | }, 5000) // 5sec is delay before processing next command 59 | } 60 | 61 | module.exports = { 62 | msgFilter: { 63 | isFiltered, 64 | addFilter 65 | }, 66 | processTime, 67 | isUrl, 68 | color, 69 | messageLog 70 | } 71 | -------------------------------------------------------------------------------- /utils/options.js: -------------------------------------------------------------------------------- 1 | /** 2 | * Get Client Options 3 | * @param {Function} start function 4 | * @param {Boolean} headless 5 | */ 6 | 7 | module.exports = options = (headless, start) => { 8 | const options = { 9 | sessionId: 'PAKFORLAY', 10 | headless: headless, 11 | qrTimeout: 0, 12 | authTimeout: 0, 13 | restartOnCrash: start, 14 | cacheEnabled: false, 15 | useChrome: true, 16 | killProcessOnBrowserClose: true, 17 | throwErrorOnTosBlock: false, 18 | chromiumArgs: [ 19 | '--no-sandbox', 20 | '--disable-setuid-sandbox', 21 | '--aggressive-cache-discard', 22 | '--disable-cache', 23 | '--disable-application-cache', 24 | '--disable-offline-load-stale-cache', 25 | '--disk-cache-size=0' 26 | ] 27 | } 28 | return options 29 | } 30 | -------------------------------------------------------------------------------- /utils/stat.json: -------------------------------------------------------------------------------- 1 | { 2 | "sent": { 3 | 4 | }, 5 | "receive": { 6 | 7 | } 8 | } 9 | --------------------------------------------------------------------------------