├── .github └── workflows │ ├── codeql-analysis.yml │ ├── node.js.yml │ └── prettier-byrzky.yml ├── .gitignore ├── .prettierignore ├── .prettierrc.json ├── .replit ├── CHANGELOG.md ├── Dockerfile ├── LICENSE ├── Procfile ├── README.md ├── SECURITY.md ├── command ├── converter │ ├── sticker.js │ ├── toimg.js │ └── tomp4.js ├── downloader │ ├── downloaderall.js │ ├── igdownload.js │ ├── nhentaiDL.js │ └── youtube.js ├── fun │ └── emojimix.js ├── game │ └── tebakbendera.js ├── group │ ├── add.js │ ├── antidelete.js │ ├── antilink.js │ ├── demote.js │ ├── hidetag.js │ ├── kick.js │ ├── left.js │ ├── promote.js │ ├── setleft.js │ ├── setnamegc.js │ ├── setwelcome.js │ └── welcome.js ├── info │ ├── botstats.js │ ├── cekprem.js │ ├── dashboard.js │ ├── infochat.js │ ├── limit.js │ ├── listprem.js │ ├── me.js │ ├── owner.js │ ├── ping.js │ ├── runtime.js │ └── scriptbot.js ├── other │ ├── buyglimit.js │ ├── buylimit.js │ ├── inspect.js │ └── join.js ├── owner │ ├── addprem.js │ ├── bcgc.js │ ├── delprem.js │ ├── eval.js │ ├── exec.js │ ├── lockcmd.js │ ├── react.js │ ├── resetlimit.js │ ├── savefitur.js │ ├── self.js │ └── unlockcmd.js ├── random │ ├── loli.js │ ├── meme.js │ └── quotes.js ├── search │ ├── chordlist.js │ ├── getChord.js │ ├── pinterest.js │ ├── whatmusic.js │ └── wikipedia.js ├── tools │ ├── getquoted.js │ ├── imgtopdf.js │ ├── setlanguage.js │ └── toUrl.js └── umum │ ├── changelog.js │ └── help.js ├── config.json ├── database ├── antidelete.json ├── antilink.json ├── balance.json ├── dashboard.json ├── glimit.json ├── language.json ├── left.json ├── limit.json ├── mess.json ├── premium.json └── welcome.json ├── doom.flf ├── global.js ├── handler.js ├── index.js ├── lib ├── Database.js ├── Event.js ├── Proto.js ├── antilink.js ├── convert.js ├── converter.js ├── exif.js ├── exif2.js ├── game.js ├── imgtopdf.js ├── index.js ├── limit.js ├── nhentaidl.js ├── optiongame.js ├── pdfSize.json ├── premium.js ├── response.json ├── serialize.js ├── topdf.js ├── webp2.js ├── welcome.js └── y2mate.js ├── main.js ├── package.json ├── replit.nix ├── res └── EmitEvent.js ├── temp └── media ├── test.js └── utils ├── index.js └── parseOptions.js /.github/workflows/codeql-analysis.yml: -------------------------------------------------------------------------------- 1 | # For most projects, this workflow file will not need changing; you simply need 2 | # to commit it to your repository. 3 | # 4 | # You may wish to alter this file to override the set of languages analyzed, 5 | # or to provide custom queries or build logic. 6 | # 7 | # ******** NOTE ******** 8 | # We have attempted to detect the languages in your repository. Please check 9 | # the `language` matrix defined below to confirm you have the correct set of 10 | # supported CodeQL languages. 11 | # 12 | name: "CodeQL" 13 | 14 | on: 15 | push: 16 | branches: [ main ] 17 | pull_request: 18 | # The branches below must be a subset of the branches above 19 | branches: [ main ] 20 | schedule: 21 | - cron: '36 21 * * 4' 22 | 23 | jobs: 24 | analyze: 25 | name: Analyze 26 | runs-on: ubuntu-latest 27 | permissions: 28 | actions: read 29 | contents: read 30 | security-events: write 31 | 32 | strategy: 33 | fail-fast: false 34 | matrix: 35 | language: [ 'javascript' ] 36 | # CodeQL supports [ 'cpp', 'csharp', 'go', 'java', 'javascript', 'python', 'ruby' ] 37 | # Learn more about CodeQL language support at https://git.io/codeql-language-support 38 | 39 | steps: 40 | - name: Checkout repository 41 | uses: actions/checkout@v3 42 | 43 | # Initializes the CodeQL tools for scanning. 44 | - name: Initialize CodeQL 45 | uses: github/codeql-action/init@v2 46 | with: 47 | languages: ${{ matrix.language }} 48 | # If you wish to specify custom queries, you can do so here or in a config file. 49 | # By default, queries listed here will override any specified in a config file. 50 | # Prefix the list here with "+" to use these queries and those in the config file. 51 | # queries: ./path/to/local/query, your-org/your-repo/queries@main 52 | 53 | # Autobuild attempts to build any compiled languages (C/C++, C#, or Java). 54 | # If this step fails, then you should remove it and run the build manually (see below) 55 | - name: Autobuild 56 | uses: github/codeql-action/autobuild@v2 57 | 58 | # ℹ️ Command-line programs to run using the OS shell. 59 | # 📚 https://git.io/JvXDl 60 | 61 | # ✏️ If the Autobuild fails above, remove it and uncomment the following three lines 62 | # and modify them (or add more) to build your code if your project 63 | # uses a compiled language 64 | 65 | #- run: | 66 | # make bootstrap 67 | # make release 68 | 69 | - name: Perform CodeQL Analysis 70 | uses: github/codeql-action/analyze@v2 71 | -------------------------------------------------------------------------------- /.github/workflows/node.js.yml: -------------------------------------------------------------------------------- 1 | # This workflow will do a clean install of node dependencies, build the source code and run tests across different versions of node 2 | # For more information see: https://help.github.com/actions/language-and-framework-guides/using-nodejs-with-github-actions 3 | 4 | name: Check Error 5 | 6 | on: 7 | push: 8 | branches: [ main ] 9 | pull_request: 10 | branches: [ main ] 11 | 12 | jobs: 13 | build: 14 | 15 | runs-on: ubuntu-latest 16 | 17 | strategy: 18 | matrix: 19 | node-version: [12.x, 13.x, 14.x, 15.x] 20 | # See supported Node.js release schedule at https://nodejs.org/en/about/releases/ 21 | 22 | steps: 23 | - uses: actions/checkout@v2 24 | - name: Use Node.js ${{ matrix.node-version }} 25 | uses: actions/setup-node@v2 26 | with: 27 | node-version: ${{ matrix.node-version }} 28 | # Because we are only check SyntaxError 29 | # - run: npm i 30 | - run: node test.js 31 | -------------------------------------------------------------------------------- /.github/workflows/prettier-byrzky.yml: -------------------------------------------------------------------------------- 1 | # Gausah hapus creator dek najis huek cuih 2 | name: Prettier By RzkyFdlh 3 | on: 4 | push: 5 | branches: [ main ] 6 | jobs: 7 | format: 8 | runs-on: ubuntu-latest 9 | steps: 10 | - uses: actions/checkout@v2 11 | with: 12 | ref: ${{ github.head_ref }} 13 | - uses: actions/setup-node@v2 14 | with: 15 | node-version: "14.x" 16 | - run: npm i -g prettier 17 | - run: npm run format 18 | - name: Commit changes 19 | uses: stefanzweifel/git-auto-commit-action@v4 20 | with: 21 | commit_message: automatic tidy up code 22 | branch: ${{ github.head_ref }} 23 | -------------------------------------------------------------------------------- /.gitignore: -------------------------------------------------------------------------------- 1 | node_modules 2 | package-lock.json 3 | -------------------------------------------------------------------------------- /.prettierignore: -------------------------------------------------------------------------------- 1 | node_modules 2 | package.json 3 | package-lock.json 4 | global.js 5 | rzkyfdlh-md.json 6 | -------------------------------------------------------------------------------- /.prettierrc.json: -------------------------------------------------------------------------------- 1 | { 2 | "trailingComma": "es5", 3 | "tabWidth": 4, 4 | "semi": true, 5 | "singleQuote": false, 6 | "printWidth": 120, 7 | "useTabs": true 8 | } 9 | -------------------------------------------------------------------------------- /.replit: -------------------------------------------------------------------------------- 1 | language = "bash" 2 | run = "npm start" 3 | -------------------------------------------------------------------------------- /CHANGELOG.md: -------------------------------------------------------------------------------- 1 | ## ChangeLog 2 | 3 | ### [v2.0.4](https://github.com/Rizky878/rzky-multidevice/tree/v2.0.4) (19/04/2022) 4 | 5 | - [922f471](https://github.com/Rizky878/rzky-multidevice/commit/63b7912eb7ba6743ed174699c176bfbf08d5c885)
6 | > Added function so that there are no kill problems in the terminal 7 | 8 | * [390d494](https://github.com/Rizky878/rzky-multidevice/commit/922f471cc3942cde767a9aa9c65803331281c5e0)
9 | > Fixed error "cannot of undefined" if it happens again please report 10 | * [cd990d1](https://github.com/Rizky878/rzky-multidevice/commit/1b1e33b29b47b8b6302bdd2866638204ef13cd0d)
11 | > Added fiture set language all text and no need to customize it anymore 12 | 13 | ### [v2.0.6](https://github.com/Rizky878/rzky-multidevice/tree/v2.0.6) (21/04/2022) 14 | 15 | - [fec99f6](https://github.com/Rizky878/rzky-multidevice/commit/fb15e648ca5b50a9f4bc6d7ca32388d2517220c5) 16 | > Add contextInfo externalAdReply 17 | - [cb27333](https://github.com/Rizky878/rzky-multidevice/commit/5edea8d86e8f23ee40e5a224837d3dde5780db43) 18 | > Add lock command dan unlock command 19 | - [5edea8d](https://github.com/Rizky878/rzky-multidevice/commit/6d08e083f935c20fc5f1949ae263eb11cce13f3e) 20 | > Add options adReply, isTranslate, and withTag, the following options use **Boolean**,
Example: conn.sendMessage(msg.from,{ text: "Hallo" }, { adReply: true })
&
msg.reply("Hallo", { adReply: true }) 21 | 22 | ### [v2.0.9](https://github.com/Rizky878/rzky-multidevice/tree/v2.0.9) (25/04/2022) 23 | 24 | - [1f9650d](https://github.com/Rizky878/rzky-multidevice/commit/9b64ac0684c8271b043fc2c984024139cebf371e) 25 | > Add fiture tourl 26 | - [73b6327](https://github.com/Rizky878/rzky-multidevice/commit/cc7f90679a6bc049a3e17409c4c3d682594cdef0) 27 | > Add function Database, usage:
const Database = require('./lib/Database')
const DB = new Database() 28 | - [86f0979](https://github.com/Rizky878/rzky-multidevice/commit/56761a56d711bfc92e37199b444ce020177d0a13) 29 | > Add Function dashboard and add to database 30 | - [5cae22c](https://github.com/Rizky878/rzky-multidevice/commit/641eecd4389c380ec37082db21f0ccbbcc171a43) 31 | > add fiture dashboard.js 32 | 33 | ### [v2.1.0](https://github.com/Rizky878/rzky-multidevice/tree/v2.0.4) (28/04/2022) 34 | 35 | - [9390253](https://github.com/Rizky878/rzky-multidevice/commit/63e6da9c991ce31bdbe8570b157f64870d0f7377) 36 | > add anti delete, welcome, left, setleft, setwelcome, and some new functions 37 | 38 | ### [v3.0.0](https://github.com/Rizky878/rzky-multidevice/tree/V3.0.0) (11/05/2022) 39 | 40 | - [93892](https://github.com/Rizky878/rzky-multidevice/tree/V3.0.0) 41 | > update all Fiture and fixed all error 42 | 43 |
44 |
45 |
46 | pull request feature in here,
how to pull request: fork this repo, after you finish adding features, click the contribute and pull request button
47 |
48 | -------------------------------------------------------------------------------- /Dockerfile: -------------------------------------------------------------------------------- 1 | FROM node:lts-buster 2 | 3 | RUN apt-get update && \ 4 | apt-get install -y \ 5 | ffmpeg \ 6 | imagemagick \ 7 | webp && \ 8 | apt-get upgrade -y && \ 9 | rm -rf /var/lib/apt/lists/* 10 | 11 | COPY package.json . 12 | 13 | RUN npm install 14 | 15 | COPY . . 16 | 17 | EXPOSE 5000 18 | 19 | CMD ["node", "main.js"] 20 | -------------------------------------------------------------------------------- /LICENSE: -------------------------------------------------------------------------------- 1 | MIT License 2 | 3 | Copyright (c) 2022 Rizky878 4 | 5 | Permission is hereby granted, free of charge, to any person obtaining a copy 6 | of this software and associated documentation files (the "Software"), to deal 7 | in the Software without restriction, including without limitation the rights 8 | to use, copy, modify, merge, publish, distribute, sublicense, and/or sell 9 | copies of the Software, and to permit persons to whom the Software is 10 | furnished to do so, subject to the following conditions: 11 | 12 | The above copyright notice and this permission notice shall be included in all 13 | copies or substantial portions of the Software. 14 | 15 | THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 16 | IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 17 | FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 18 | AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 19 | LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 20 | OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE 21 | SOFTWARE. 22 | -------------------------------------------------------------------------------- /Procfile: -------------------------------------------------------------------------------- 1 | worker: node test.js && npm start 2 | -------------------------------------------------------------------------------- /README.md: -------------------------------------------------------------------------------- 1 |

Welcome

2 |

Rzky Multi Device

3 |
4 | PFFP 5 | 6 |
Gunakan dengan risiko Anda sendiri! 7 | 8 | [![Check Error](https://github.com/Rizky878/rzky-multidevice/actions/workflows/node.js.yml/badge.svg)](https://github.com/Rizky878/rzky-multidevice/actions/workflows/node.js.yml) 9 | 10 | [![JavaScript](https://img.shields.io/badge/JavaScript-d6cc0f?style=for-the-badge&logo=javascript&logoColor=white)](https://javascript.com) [![NodeJS](https://img.shields.io/badge/Node.js-43853D?style=for-the-badge&logo=node.js&logoColor=white)](https://nodejs.org/) 11 | 12 | support 13 | 14 | > Dibuat dengan Baileys dan Map() ( sebagai command handler )
15 | 16 | [![Deploy](https://www.herokucdn.com/deploy/button.svg)](https://heroku.com/deploy?template=https://github.com/Rizky878/rzky-multidevice) 17 | 18 | | Build Pack | Link | 19 | | ----------- | --------------------------------------------------------------------- | 20 | | **FFMPEG** | [HERE](https://github.com/jonathanong/heroku-buildpack-ffmpeg-latest) | 21 | | **LIBWEBP** | [HERE](https://github.com/clhuang/heroku-buildpack-webp-binaries.git) | 22 | 23 |

24 |
25 | 26 | ## Options 27 | 28 | Options pada command, yang akan mempermudah kamu untuk membuat/menambahkan fitur
29 | 30 | ```js 31 | module.exports = { 32 | name: , // Ex: "menu" 33 | alias: , // Ex: ["cmd","help"] 34 | desc: , // Ex: "Menu adalah command" 35 | use: , // Ex: "" 36 | category: , // Ex: "umum" 37 | type: , // Ex: "changelog" 38 | wait: , // Ex: true 39 | isOwner: , // Ex: false 40 | isAdmin: , // Ex: false 41 | isQuoted: , // Ex: false 42 | isGroup: , // Ex: false 43 | isBotAdmin: , // Ex: false 44 | query: , // Ex: "Tunggu Sebentar" / true 45 | isPrivate: , // Ex: false 46 | isSpam: , // Ex: true 47 | isLimit: , // Ex: true 48 | isLimitGame: , // Ex: false 49 | noPrefix: , // Ex: true 50 | isPremium: , // Ex: false 51 | isMedia: { 52 | isQVideo: , // Ex: false 53 | isQAudio: , // Ex: false 54 | isQImage: , // Ex: false 55 | isQSticker: , // Ex: false 56 | isQDocument: , // Ex: false 57 | } 58 | isUrl: // Ex: false 59 | } 60 | ``` 61 | 62 | ## Contoh Options 63 | 64 | Contoh Command : [`./command/umum/help.js`](https://github.com/Rizky878/rzky-multidevice/blob/main/command/umum/help.js)
65 | 66 | ```js 67 | { 68 | name: "help", 69 | alias: ["h","menu","cmd"], 70 | desc: "menampilkan menu", 71 | category: "umum", 72 | wait: true 73 | } 74 | ``` 75 | 76 | ## Highlights 77 | 78 | - [x] Simple Penggunaan, 79 | - [x] Mudah digunakan, 80 | - [x] Mudah untuk dirawat/diperbaiki, 81 | - [x] Dan ringan 82 | 83 | ## Config 84 | 85 | Isi semua yang dibutuhkan di file [`config.json`](https://github.com/Rizky878/rzky-multidevice/blob/main/config.json)
86 | 87 | ## Request atau report bug 88 | 89 | Untuk request atau report bug bisa chat saya disini [Whatsapp](https://wa.me/6282387804410) 90 | 91 | ## Instalasi 92 | 93 | ## Instalasi On Termux 94 | 95 | ### Clone Repo 96 | 97 | ```bash 98 | > pkg install 99 | > pkg upgrade 100 | > pkg install git ffmpeg libwebp nodejs 101 | > git clone --depth=1 https://github.com/Rizky878/rzky-multidevice/ 102 | > cd rzky-multidevice 103 | > npm install --arch=x64 --platform=linux sharp 104 | > npm start 105 | # Scan QR 106 | ``` 107 | 108 | ### Dibutuhkan 109 | 110 | 1. [Nodejs](https://nodejs.org/en/download) 16x/17x 111 | 2. [FFmpeg](https://ffmpeg.org) 112 | 3. [libWebP](https://developers.google.com/speed/webp/download) 113 | 114 | ### Install Ffmpeg 115 | 116 | - Untuk pengguna Windows, kamu bisa lihat tutorial disini [WikiHow](https://www.wikihow.com/Install-Ffmpeg-on-Windows)
117 | - Untuk pengguna Linux, kamu bisa pakai manager paket kamu sendiri. Contohnya; 118 | 119 | ```bash 120 | # apt (Ubuntu) 121 | apt install ffmpeg -y 122 | 123 | # pacman (Arch Linux) 124 | pacman -S ffmpeg 125 | ``` 126 | 127 | ### Install libWebP 128 | 129 | - Untuk pengguna Windows, 130 | 131 | 1. Unduh libWebP untuk Windows dari [sini](https://developers.google.com/speed/webp/download) 132 | 2. Ekstrak ke C:\ 133 | 3. Ganti nama folder yang diekstrak ke `libwebp` 134 | 4. Buka PowerShell dan jalankan perintah berikut; 135 | 136 | ```cmd 137 | setx /m PATH "C:\libwebp\bin;%PATH%" 138 | ``` 139 | 140 | > Bila sukses terinstal dengan baik, silahkan check dengan perintah berikut di Command Prompt 141 | 142 | ```cmd 143 | webpmux -version 144 | ``` 145 | 146 | - Untuk pengguna Linux, kamu bisa pakai manager paket kamu. Contohnya; 147 | 148 | ```bash 149 | # apt (Ubuntu) 150 | apt install libwebp-dev -y 151 | 152 | # pacman (Arch Linux) 153 | pacman -S libwebp 154 | ``` 155 | 156 | ### Clone Repo 157 | 158 | ```bash 159 | # clone repo 160 | git clone --depth=1 https://github.com/Rizky878/rzky-multidevice 161 | 162 | # ubah posisi direktori kamu 163 | cd rzky-multidevice 164 | 165 | # install semua module 166 | npm install 167 | # atau 168 | yarn install 169 | 170 | # bila libray @adiwajshing/baileys error, jalan kan kode yg ada dibawah ini 171 | 172 | cd ./node_modules/@adiwajshing/baileys 173 | npm install -g typescript 174 | npm run build:tsc 175 | ``` 176 | 177 | ### Start Bot 178 | 179 | Start and Scan QR
180 | 181 | ```bash 182 | npm start 183 | ``` 184 | 185 | # Thanks To 186 | 187 | - [`Faiz Bastomi`](https://github.com/FaizBastomi) 188 | - [`Dehante`](https://github.com/Dehanjing) 189 | - [`RzkyFdlh`](https://github.com/Rizky878) 190 | -------------------------------------------------------------------------------- /SECURITY.md: -------------------------------------------------------------------------------- 1 | # Security Policy 2 | 3 | ## Supported Versions 4 | 5 | Use this section to tell people about which versions of your project are 6 | currently being supported with security updates. 7 | 8 | | Version | Supported | 9 | | ------- | ------------------ | 10 | | 5.1.x | :white_check_mark: | 11 | | 5.0.x | :x: | 12 | | 4.0.x | :white_check_mark: | 13 | | < 4.0 | :x: | 14 | 15 | ## Reporting a Vulnerability 16 | 17 | Use this section to tell people how to report a vulnerability. 18 | 19 | Tell them where to go, how often they can expect to get an update on a 20 | reported vulnerability, what to expect if the vulnerability is accepted or 21 | declined, etc. 22 | -------------------------------------------------------------------------------- /command/converter/sticker.js: -------------------------------------------------------------------------------- 1 | const { sticker } = require("../../lib/convert"); 2 | const { modStick, createExif } = require("../../lib/exif2"); 3 | const fs = require("fs"); 4 | 5 | module.exports = { 6 | name: "sticker", 7 | alias: [ 8 | "s", 9 | "stick", 10 | "stik", 11 | "stiker", 12 | "take", 13 | "swm", 14 | "stickerwm", 15 | "wm", 16 | "stickergif", 17 | "stikergif", 18 | "gifstiker", 19 | "gifsticker", 20 | ], 21 | category: "converter", 22 | desc: "Create a sticker from image or video", 23 | async run({ msg, conn }, { q }) { 24 | const { quoted, from, type } = msg; 25 | 26 | const content = JSON.stringify(quoted); 27 | const isMedia = type === "imageMessage" || type === "videoMessage"; 28 | const isQImg = type === "extendedTextMessage" && content.includes("imageMessage"); 29 | const isQVid = type === "extendedTextMessage" && content.includes("videoMessage"); 30 | const isQDoc = type === "extendedTextMessage" && content.includes("documentMessage"); 31 | const isQStic = type === "extendedTextMessage" && content.includes("stickerMessage"); 32 | q = q.split("|"); 33 | const packInfo = { 34 | packname: q[0] ? q[0] : config.packInfo.packname, 35 | author: q[1] ? q[1] : config.packInfo.author, 36 | }; 37 | 38 | let buffer, stickerBuff; 39 | try { 40 | if (isQStic) { 41 | buffer = await quoted.download(); 42 | filename = "./temp/" + Date.now() + ".webp"; 43 | fs.writeFileSync(filename, buffer); 44 | await createExif(q[0] ? q[0] : config.packInfo.packname, q[1] ? q[1] : config.packInfo.author); 45 | await modStick(filename, conn, msg, msg.from); 46 | /*stickerBuff = await sticker(buffer, { isSticker: true, withPackInfo: true, packInfo, cmdType: "1" }); 47 | await conn.sendMessage(from, { sticker: stickerBuff }, { quoted: msg });*/ 48 | } else if ((isMedia && !msg.message.videoMessage) || isQImg) { 49 | buffer = isQImg ? await quoted.download() : await msg.download(); 50 | stickerBuff = await sticker(buffer, { isImage: true, withPackInfo: true, packInfo, cmdType: "1" }); 51 | await conn.sendMessage(from, { sticker: stickerBuff }, { quoted: msg }); 52 | } else if ( 53 | (isMedia && msg.message.videoMessage.fileLength < 2 << 20) || 54 | (isQVid && quoted.message.videoMessage.fileLength < 2 << 20) 55 | ) { 56 | buffer = isQVid ? await quoted.download() : await msg.download(); 57 | stickerBuff = await sticker(buffer, { isVideo: true, withPackInfo: true, packInfo, cmdType: "1" }); 58 | await conn.sendMessage(from, { sticker: stickerBuff }, { quoted: msg }); 59 | } else if ( 60 | isQDoc && 61 | (/image/.test(quoted.message.documentMessage.mimetype) || 62 | (/video/.test(quoted.message.documentMessage.mimetype) && 63 | quoted.message.documentMessage.fileLength < 2 << 20)) 64 | ) { 65 | let ext = /image/.test(quoted.message.documentMessage.mimetype) 66 | ? { isImage: true } 67 | : /video/.test(quoted.message.documentMessage.mimetype) 68 | ? { isVideo: true } 69 | : null; 70 | if (!ext) return await msg.reply("Document mimetype unknown"); 71 | buffer = await quoted.download(); 72 | stickerBuff = await sticker(buffer, { ...ext, withPackInfo: true, packInfo, cmdType: "1" }); 73 | await conn.sendMessage(from, { sticker: stickerBuff }, { quoted: msg }); 74 | } else { 75 | await msg.reply(`reply sticker`); 76 | } 77 | (buffer = null), (stickerBuff = null); 78 | } catch (e) { 79 | console.log(e); 80 | await msg.reply("Error while creating sticker"); 81 | } 82 | }, 83 | }; 84 | -------------------------------------------------------------------------------- /command/converter/toimg.js: -------------------------------------------------------------------------------- 1 | let { webp2png } = require("../../lib/webp2"); 2 | 3 | module.exports = { 4 | name: "toimg", 5 | category: "converter", 6 | desc: "Convert a sticker to image", 7 | wait: true, 8 | async run({ msg, conn }, { q }) { 9 | const { quoted, from, type } = msg; 10 | const content = JSON.stringify(quoted); 11 | const isQStic = type === "extendedTextMessage" && content.includes("stickerMessage"); 12 | try { 13 | if (isQStic) { 14 | let media = await quoted.download(); 15 | out = await webp2png(media); 16 | await conn.sendFile(msg.from, out, "image.jpeg", "Success", msg); 17 | } else { 18 | await msg.reply(`Reply sticker`); 19 | } 20 | } catch (e) { 21 | console.log(e); 22 | await msg.reply("Error while convert sticker"); 23 | } 24 | }, 25 | }; 26 | -------------------------------------------------------------------------------- /command/converter/tomp4.js: -------------------------------------------------------------------------------- 1 | let { webp2mp4 } = require("../../lib/webp2"); 2 | 3 | module.exports = { 4 | name: "togif", 5 | alias: ["tomp4"], 6 | category: "converter", 7 | desc: "Convert a sticker to gif", 8 | wait: true, 9 | async run({ msg, conn }, { q }) { 10 | const { quoted, from, type } = msg; 11 | const content = JSON.stringify(quoted); 12 | const isQStic = type === "extendedTextMessage" && content.includes("stickerMessage"); 13 | 14 | try { 15 | if (isQStic) { 16 | let media = await quoted.download(); 17 | out = await webp2mp4(media); 18 | await conn.sendFile(msg.from, out, "video.mp4", "Success", msg); 19 | } else { 20 | await msg.reply(`Reply sticker`); 21 | } 22 | } catch (e) { 23 | console.log(e); 24 | await msg.reply("Error while convert sticker"); 25 | } 26 | }, 27 | }; 28 | -------------------------------------------------------------------------------- /command/downloader/downloaderall.js: -------------------------------------------------------------------------------- 1 | const axios = require("axios"); 2 | const expand = async (url) => { 3 | let axs = await axios.get("https://caliph.my.id/api/expandurl.php?url=" + url); 4 | return axs.data.result; 5 | }; 6 | 7 | module.exports = { 8 | name: "downloaderall", 9 | alias: ["pinterest", "pindl", "tiktokaudio", "tiktok", "fbdl", "fb", "soundcloud", "facebook"], 10 | use: "", 11 | category: "downloader", 12 | desc: "Download audio/video from Facebook, Imgur, SoundCloud, Pinterest, Dan Tiktok", 13 | wait: true, 14 | isUrl: true, 15 | isSpam: true, 16 | async run({ msg, conn }, { q, map, args }) { 17 | var pilih = msg.body.split(/ +/)[0].slice(1); 18 | var teks = args[0]; 19 | let tiktok; 20 | if (pilih == "tiktok" || pilih == "tiktokaudio") tiktok = await rzky.downloader.tiktok(teks); 21 | var yt = await rzky.downloader.downloaderAll(teks); 22 | if (pilih == "downloaderall") return msg.reply("Silahkan Pilih Downloader: tiktok,soundcloud,facebook"); 23 | var mp3 = yt.mp3[yt.mp3.length - 1]; 24 | var mp4 = yt.mp4[yt.mp4.length - 1]; 25 | var img = yt.image; 26 | let resu; 27 | if (pilih == "tiktok" || pilih == "tiktokaudio") resu = tiktok.result; 28 | yt.size_audio = mp3 ? mp3.formattedSize : ""; 29 | if (pilih == "tiktok" || pilih == "tiktokaudio") tiktok.size = resu.video.nowm.size; 30 | if (pilih == "tiktok" || pilih == "tiktokaudio") tiktok.audio_name = resu.audio.audio_name; 31 | yt.size_video = mp4 ? mp4.formattedSize : ""; 32 | delete yt.image; 33 | delete yt.mp4; 34 | delete yt.mp3; 35 | delete yt.status; 36 | if (pilih == "tiktok" || pilih == "tiktokaudio") delete tiktok.result; 37 | var result = await rzky.tools.parseResult(yt, { 38 | title: "Downloader", 39 | }); 40 | try { 41 | switch (pilih) { 42 | case "facebook": 43 | case "fb": 44 | case "fbdl": 45 | await conn.sendMessage( 46 | msg.from, 47 | { 48 | video: { 49 | url: mp4.url, 50 | }, 51 | mimetype: "video/mp4", 52 | caption: result.replace(/downloader_from/gi, "Downloader From"), 53 | fileName: "facebook.mp4", 54 | }, 55 | { 56 | quoted: msg, 57 | } 58 | ); 59 | break; 60 | case "pindl": 61 | case "pinterest": 62 | await conn.sendMessage( 63 | msg.from, 64 | { 65 | video: { 66 | url: mp4.url, 67 | }, 68 | mimetype: "video/mp4", 69 | caption: result.replace(/downloader_from/gi, "Downloader From"), 70 | fileName: "pinterest.mp4", 71 | }, 72 | { 73 | quoted: msg, 74 | } 75 | ); 76 | break; 77 | case "soundcloud": 78 | await conn.sendFile( 79 | msg.from, 80 | img, 81 | "yt.jpg", 82 | result.replace(/downloader_from/gi, "Downloader From"), 83 | msg 84 | ); 85 | await conn.sendMessage( 86 | msg.from, 87 | { 88 | audio: { 89 | url: mp3.url, 90 | }, 91 | mimetype: "audio/mpeg", 92 | fileName: yt.title + ".mp3", 93 | }, 94 | { 95 | quoted: msg, 96 | } 97 | ); 98 | break; 99 | case "tiktok": 100 | await conn.sendMessage( 101 | msg.from, 102 | { 103 | video: { 104 | url: await resu.video.nowm.video_url, 105 | }, 106 | caption: await rzky.tools.parseResult(tiktok, { title: "Tiktok Download" }), 107 | mimetype: "video/mp4", 108 | fileName: tiktok.desc.substr(0, 19) + ".mp4", 109 | templateButtons: [ 110 | { urlButton: { displayText: "Source", url: q } }, 111 | { urlButton: { displayText: "Downloader", url: "https://down.rzkyfdlh.tech" } }, 112 | { quickReplyButton: { displayText: "Audio🎶", id: "#tiktokaudio " + q } }, 113 | ], 114 | }, 115 | { 116 | quoted: msg, 117 | } 118 | ); 119 | break; 120 | case "tiktokaudio": 121 | await conn.sendMessage( 122 | msg.from, 123 | { 124 | image: { url: await tiktok.thumbnail }, 125 | fileName: "tiktok.jpg", 126 | caption: await rzky.tools.parseResult(tiktok, { title: "Tiktok Download" }), 127 | }, 128 | { quoted: msg } 129 | ); 130 | await conn.sendFile(msg.from, await resu.audio.audio_url, tiktok.author + ".mp3", "", msg); 131 | break; 132 | } 133 | } catch (err) { 134 | console.log(err); 135 | await msg.reply(response.error.api); 136 | } 137 | }, 138 | }; 139 | -------------------------------------------------------------------------------- /command/downloader/igdownload.js: -------------------------------------------------------------------------------- 1 | const { isUrl } = require("../../lib/index"); 2 | 3 | module.exports = { 4 | name: "instagram", 5 | alias: ["ig", "igdl", "igstory", "instagramdl", "instagramstory"], 6 | category: "downloader", 7 | use: "", 8 | desc: "download video and photo from instagram", 9 | query: `Options:\n1. #igdl - Download Video Or Photo From Post\n\n2. #igstory - Download Video or photo from story\n\nExample: \n1. #igdl https://www.instagram.com/p/CbxLLgKJXOa/?utm_source=ig_web_copy_link\n2. #igstory petanikode`, 10 | wait: true, 11 | isSpam: true, 12 | async run({ msg, conn }, { q }) { 13 | var command = msg.body.split(/ +/)[0].slice(1); 14 | if (command == "ig" || command == "instagram") 15 | return msg.reply( 16 | `Pilihan:\n1. #igdl - Mendownload Video Atau Foto Dari postingan\n\n2. #igstory - Mendownload Video atau foto dari story\n\nExample: \n1. #igdl https://www.instagram.com/p/CbxLLgKJXOa/?utm_source=ig_web_copy_link\n2. #igstory petanikode` 17 | ); 18 | var ig; 19 | if (command == "igstory" || (command == "instagramstory" && !isUrl(q))) { 20 | ig = await rzky.downloader.igStory(q); 21 | } else { 22 | if (!isUrl(q) && !q.includes("instagram.com")) return msg.reply(`Invalid Url`); 23 | ig = await rzky.downloader.igdl(q); 24 | } 25 | var img = ig.user.profilePicUrl; 26 | var result = ig.medias; 27 | delete ig.user.profilePicUrl; 28 | delete ig.medias; 29 | var parse = await rzky.tools.parseResult(ig.user, { title: "Instagram Download" }); 30 | await conn.sendFile(msg.from, img, "ig.jpg", parse, msg); 31 | for (let i of result) { 32 | await conn.sendFile(msg.from, i.url, ig.user.username + i.fileType, "From " + ig.user.fullName, msg); 33 | } 34 | }, 35 | }; 36 | -------------------------------------------------------------------------------- /command/downloader/nhentaiDL.js: -------------------------------------------------------------------------------- 1 | const { NhentaiDL } = require("../../lib/nhentaidl"); 2 | 3 | module.exports = { 4 | name: "nhentai", 5 | alias: ["nh"], 6 | category: "downloader", 7 | desc: "downloader nhentai", 8 | query: "enter nhentai code!", 9 | isPrivate: true, 10 | isSpam: true, 11 | async run({ msg, conn }, { args }) { 12 | await NhentaiDL(msg, args, conn); 13 | }, 14 | }; 15 | -------------------------------------------------------------------------------- /command/downloader/youtube.js: -------------------------------------------------------------------------------- 1 | const yts = require("yt-search"), 2 | { y2mateV, y2mateA } = require("../../lib/y2mate"); 3 | 4 | module.exports = { 5 | name: "youtube", 6 | alias: ["play", "ytmp4", "ytmp3"], 7 | use: "", 8 | category: "downloader", 9 | desc: "Download audio/video from YouTube", 10 | wait: true, 11 | query: true, 12 | isLimit: true, 13 | isSpam: true, 14 | async run({ msg, conn }, { q, map, args }) { 15 | var pilih = msg.body.split(/ +/)[0].slice(1); 16 | var teks = q.replace(/ --doc/gi, ""); 17 | if (pilih == "play" || pilih == "youtube") { 18 | yets = await yts(teks); 19 | var results = await yets.all.filter((s) => s.type == "video"); 20 | var vid = results.find((video) => video.seconds < 3600); 21 | teks = vid.url; 22 | } 23 | let yt, mp3, mp4; 24 | try { 25 | yt = await y2mateV(teks, "480"); 26 | if (yt[0].link == "https://app.y2mate.com/download") yt = await y2mateV(teks, "360"); 27 | if (yt[0].link == "https://app.y2mate.com/download") yt = await y2mateV(teks, "144"); 28 | if (pilih == "play" || pilih == "ytmp3" || pilih == "youtube") { 29 | yt = await y2mateA(teks, "256"); 30 | } 31 | } catch { 32 | yt = await rzky.downloader.downloaderAll(teks); 33 | mp3 = yt.mp3[yt.mp3.length - 1]; 34 | mp4 = yt.mp4[yt.mp4.length - 1]; 35 | } 36 | switch (pilih) { 37 | case "play": 38 | await conn.sendMessage(msg.from, { 39 | image: { url: yt[0] ? yt[0].thumb : yt.image }, 40 | caption: await rzky.tools.parseResult(yt[0] || yt, { title: "Youtube", delete: ["mp4", "mp3"] }), 41 | templateButtons: [ 42 | { urlButton: { displayText: "Source", url: teks } }, 43 | { 44 | urlButton: { 45 | displayText: "Short Link", 46 | url: "https://sl.rzkyfdlh.tech", 47 | }, 48 | }, 49 | { quickReplyButton: { displayText: "Audio 🎶", id: "#ytmp3 " + teks } }, 50 | { quickReplyButton: { displayText: "Video 🎥", id: "#ytmp4 " + teks } }, 51 | { quickReplyButton: { displayText: "Document Audio 📄", id: "#ytmp3 " + teks + " --doc" } }, 52 | ], 53 | }); 54 | break; 55 | case "ytmp3": 56 | await conn.sendMessage( 57 | msg.from, 58 | { 59 | [q.endsWith("--doc") ? "document" : "audio"]: { 60 | url: yt[0] ? yt[0].link : mp3.url, 61 | }, 62 | mimetype: "audio/mpeg", 63 | fileName: yt[0] ? yt[0].judul + ".mp3" : yt.title + ".mp3", 64 | }, 65 | { 66 | quoted: msg, 67 | } 68 | ); 69 | /* await conn.sendFile( 70 | msg.from, 71 | yt[0] ? yt[0].link : mp3.url, 72 | yt[0] ? yt[0].judul + ".mp3" : yt.title + ".mp3", 73 | "", 74 | msg, 75 | false, 76 | { 77 | asDocument: q.endsWith("--doc"), 78 | } 79 | );*/ 80 | break; 81 | case "ytmp4": 82 | if (q.endsWith("--doc")) { 83 | await conn.sendFile( 84 | msg.from, 85 | yt[0] ? yt[0].link : mp4.url, 86 | yt[0] ? yt[0].judul + ".mp4" : yt.title + ".mp4", 87 | "", 88 | msg, 89 | false, 90 | { 91 | asDocument: true, 92 | } 93 | ); 94 | } else { 95 | try { 96 | await conn.sendMessage( 97 | msg.from, 98 | { 99 | video: { 100 | url: yt[0] ? yt[0].link : mp4.url, 101 | }, 102 | mimetype: "video/mp4", 103 | caption: await rzky.tools.parseResult(yt[0] || yt, { 104 | title: "Youtube", 105 | delete: ["status", "mp3", "mp4"], 106 | }), 107 | fileName: yt[0] ? yt[0].judul : yt.title + ".mp4", 108 | templateButtons: [ 109 | { urlButton: { displayText: "Source", url: teks } }, 110 | { 111 | quickReplyButton: { 112 | displayText: "Document 📄", 113 | id: "#ytmp4 " + teks + " --doc", 114 | }, 115 | }, 116 | ], 117 | }, 118 | { 119 | quoted: msg, 120 | } 121 | ); 122 | } catch { 123 | await msg.reply("Size Terlalu besar, media akan dikirim melalui document"); 124 | await conn.sendFile( 125 | msg.from, 126 | yt[0] ? yt[0].link : mp4.url, 127 | yt[0] ? yt[0].judul + ".mp4" : yt.title + ".mp4", 128 | "", 129 | msg, 130 | false, 131 | { 132 | asDocument: true, 133 | } 134 | ); 135 | } 136 | } 137 | break; 138 | } 139 | }, 140 | }; 141 | -------------------------------------------------------------------------------- /command/fun/emojimix.js: -------------------------------------------------------------------------------- 1 | const { sticker } = require("../../lib/convert"); 2 | 3 | function isEmoji(str) { 4 | var ranges = [ 5 | "(?:[\u2700-\u27bf]|(?:\ud83c[\udde6-\uddff]){2}|[\ud800-\udbff][\udc00-\udfff]|[\u0023-\u0039]\ufe0f?\u20e3|\u3299|\u3297|\u303d|\u3030|\u24c2|\ud83c[\udd70-\udd71]|\ud83c[\udd7e-\udd7f]|\ud83c\udd8e|\ud83c[\udd91-\udd9a]|\ud83c[\udde6-\uddff]|[\ud83c[\ude01-\ude02]|\ud83c\ude1a|\ud83c\ude2f|[\ud83c[\ude32-\ude3a]|[\ud83c[\ude50-\ude51]|\u203c|\u2049|[\u25aa-\u25ab]|\u25b6|\u25c0|[\u25fb-\u25fe]|\u00a9|\u00ae|\u2122|\u2139|\ud83c\udc04|[\u2600-\u26FF]|\u2b05|\u2b06|\u2b07|\u2b1b|\u2b1c|\u2b50|\u2b55|\u231a|\u231b|\u2328|\u23cf|[\u23e9-\u23f3]|[\u23f8-\u23fa]|\ud83c\udccf|\u2934|\u2935|[\u2190-\u21ff])", // U+1F680 to U+1F6FF 6 | ]; 7 | if (str.match(ranges.join("|"))) { 8 | return true; 9 | } else { 10 | return false; 11 | } 12 | } 13 | const getBuffer = async (url, options) => { 14 | try { 15 | options ? options : {}; 16 | const res = await require("axios")({ 17 | method: "get", 18 | url, 19 | headers: { 20 | DNT: 1, 21 | "Upgrade-Insecure-Request": 1, 22 | }, 23 | ...options, 24 | responseType: "arraybuffer", 25 | }); 26 | return res.data; 27 | } catch (e) { 28 | console.log(`Error : ${e}`); 29 | } 30 | }; 31 | 32 | module.exports = { 33 | name: "emojimix", 34 | use: "", 35 | category: "fun", 36 | desc: "Sending Emoji stickers plus other emojis", 37 | wait: true, 38 | query: "Enter Emoji\nExample: #emojimix 😅+😅", 39 | isSpam: true, 40 | async run({ msg, conn }, { q, map, args }) { 41 | try { 42 | const [teks1, teks2, teks3] = q; 43 | if (!q) 44 | throw "Enter Emojis Correctly, \ntype\n• #emojimix 👻\n- if you want to show some stickers\n• #emojimix 😅+😅\n- if you want to bring up a special sticker"; 45 | const result = teks3 ? await rzky.fun.emojimix(teks1, teks3) : await rzky.fun.emojimix(teks1); 46 | if (result.status == 404) throw "Emojis not found"; 47 | for (let i of result) { 48 | stickerBuff = await sticker(await getBuffer(i.url), { 49 | isImage: true, 50 | cmdType: "1", 51 | withPackInfo: true, 52 | packInfo: config.packInfo, 53 | }); 54 | await conn.sendMessage(msg.from, { sticker: stickerBuff }, { quoted: msg }); 55 | } 56 | } catch (e) { 57 | console.log(e); 58 | await msg.reply(String(e)); 59 | } 60 | }, 61 | }; 62 | -------------------------------------------------------------------------------- /command/game/tebakbendera.js: -------------------------------------------------------------------------------- 1 | const { cekStatus, addSesi } = require("../../lib/optiongame"); 2 | 3 | module.exports = { 4 | name: "tebakbendera", 5 | alias: ["gamebendera"], 6 | category: "game", 7 | desc: "Play games, guess the country flag", 8 | isSpam: true, 9 | isGroup: true, 10 | isLimitGame: true, 11 | async run({ msg, conn }, { q, map }) { 12 | if (cekStatus(msg.from, map, "tebakbendera")) throw "Group Ini masih dalam sesi permainan"; 13 | let waktugame = 60; 14 | let tebakbendera = await rzky.game.tebakbendera(); 15 | if (tebakbendera) { 16 | const { key } = await msg.reply( 17 | `*Game Tebak Bendera*\n\nBendera: ${tebakbendera.bendera}\nHint: ${tebakbendera.pertanyaan}\n\nAnswered Immediately, Time only 1 minute!\n\n*Happy Answering!*` 18 | ); 19 | addSesi(msg.from, key.id, tebakbendera.jawaban, waktugame, map, "tebakbendera"); 20 | conn.game[key.id] = { status: false }; 21 | } else msg.reply("Error"); 22 | }, 23 | }; 24 | -------------------------------------------------------------------------------- /command/group/add.js: -------------------------------------------------------------------------------- 1 | module.exports = { 2 | name: "add", 3 | use: "", 4 | category: "group", 5 | desc: "add members to group", 6 | wait: true, 7 | isGroup: true, 8 | isBotAdmin: true, 9 | isAdmin: true, 10 | isSpam: true, 11 | async run({ msg, conn }, { q, prefix }) { 12 | add = q ? q : msg.quoted ? msg.quoted : false; 13 | if (!add) return msg.reply("Example: " + prefix + "add 62728288"); 14 | q = msg.quoted ? msg.quoted.sender.split("@")[0] : q; 15 | let prk = q.replace(/[^a-zA-Z0-9 ]/g, "").split(" "); 16 | let chunk = []; 17 | for (let i of prk) { 18 | i == " " ? "" : chunk.push(i + "@s.whatsapp.net"); 19 | } 20 | let participant = await conn.groupParticipantsUpdate(msg.from, chunk, "add"); 21 | await require("delay")(5000); 22 | const cek = await conn.groupMetadata(msg.from); 23 | if (global.statParticipant == true) { 24 | global.statParticipant = false; 25 | return; 26 | } 27 | for (let i of participant) { 28 | if (!global.statParticipant && !cek.participants.includes(i)) { 29 | const code = await conn.groupInviteCode(msg.from); 30 | await msg.reply(" The number @" + i.split("@")[0] + " you added is private, inviting the user...", { 31 | withTag: true, 32 | }); 33 | await conn.sendGroupV4Invite(msg.from, i, code, "", cek.subject); 34 | } 35 | } 36 | }, 37 | }; 38 | -------------------------------------------------------------------------------- /command/group/antidelete.js: -------------------------------------------------------------------------------- 1 | const getPosition = (name, _dir) => { 2 | let position = null; 3 | Object.keys(_dir).forEach((i) => { 4 | if (_dir[i].id === name) { 5 | position = i; 6 | } 7 | }); 8 | if (position !== null) { 9 | return position; 10 | } 11 | }; 12 | 13 | module.exports = { 14 | name: "antidelete", 15 | desc: "activate anti delete messages in the group", 16 | use: "<1 / 0>", 17 | category: "group", 18 | query: "enter options\n1 = aktif\n0 = nonaktif", 19 | isAdmin: true, 20 | isSpam: true, 21 | async run({ msg, conn }, { args, prefix }) { 22 | let data = JSON.parse(require("fs").readFileSync("./database/antidelete.json")); 23 | let data2 = db.cekDatabase("antidelete", "id", msg.from); 24 | if (args[0] == 1) { 25 | if (data2) throw "been active before"; 26 | db.modified("antidelete", { id: msg.from }); 27 | await msg.reply(`Antidelete turned on successfully`); 28 | } else if (args[0] == 0) { 29 | if (!data2) throw "not active before"; 30 | data.splice(getPosition(msg.from, data), 1); 31 | require("fs").writeFileSync("./database/antidelete.json", JSON.stringify(data, null, 2)); 32 | await msg.reply("successfully delete session anti delete in this group"); 33 | } 34 | }, 35 | }; 36 | -------------------------------------------------------------------------------- /command/group/antilink.js: -------------------------------------------------------------------------------- 1 | module.exports = { 2 | name: "antilink", 3 | desc: "activate the anti link group", 4 | use: "<1 / 0>", 5 | category: "group", 6 | query: "enter options\n1 = aktif\n0 = nonaktif", 7 | isGroup: true, 8 | isAdmin: true, 9 | isSpam: true, 10 | async run({ msg, conn }, { args, prefix }) { 11 | let data = JSON.parse(require("fs").readFileSync("./database/antilink.json")); 12 | let data2 = data.includes(msg.from); 13 | if (args[0] == 1) { 14 | if (data2) throw "been active before"; 15 | db.modified("antilink", msg.from); 16 | await msg.reply(`Anti Link turned on successfully`); 17 | } else if (args[0] == 0) { 18 | if (!data2) throw "not active before"; 19 | data.splice(data.indexOf(msg.from), 1); 20 | require("fs").writeFileSync("./database/antilink.json", JSON.stringify(data, null, 2)); 21 | await msg.reply("successfully delete session Anti Link in this group"); 22 | } 23 | }, 24 | }; 25 | -------------------------------------------------------------------------------- /command/group/demote.js: -------------------------------------------------------------------------------- 1 | module.exports = { 2 | name: "demote", 3 | alias: ["dm"], 4 | category: "group", 5 | desc: "Demote admin group", 6 | use: "", 7 | isGroup: true, 8 | isBotAdmin: true, 9 | isAdmin: true, 10 | async run({ msg, conn }) { 11 | const mm = msg.quoted ? [msg.quoted.sender] : msg.mentions; 12 | for (let i of mm) await conn.groupParticipantsUpdate(msg.from, [i], "demote"); 13 | await msg.reply("Suksess"); 14 | }, 15 | }; 16 | -------------------------------------------------------------------------------- /command/group/hidetag.js: -------------------------------------------------------------------------------- 1 | module.exports = { 2 | name: "hidetag", 3 | alias: ["ht"], 4 | category: "group", 5 | isAdmin: true, 6 | isGroup: true, 7 | desc: "Buat ngasih informasi / bikin 1 gc kesel :v", 8 | use: "", 9 | async run({ msg, conn }, { q }) { 10 | const gc = await conn.groupMetadata(msg.from); 11 | const mem = gc.participants; 12 | let mes = msg.quoted ? await msg.getQuotedObj() : msg; 13 | msg.quoted ? (mes.message[msg.quoted.mtype].caption = q) : ""; 14 | msg.quoted 15 | ? await conn.sendMessage(msg.from, { forward: mes, mentions: mem.map((a) => a.id) }, { quoted: mes }) 16 | : conn.sendMessage(msg.from, { text: `${q}`, mentions: mem.map((a) => a.id) }); 17 | }, 18 | }; 19 | -------------------------------------------------------------------------------- /command/group/kick.js: -------------------------------------------------------------------------------- 1 | module.exports = { 2 | name: "kick", 3 | use: "", 4 | category: "group", 5 | desc: "kick members group", 6 | wait: true, 7 | isGroup: true, 8 | isBotAdmin: true, 9 | isAdmin: true, 10 | isSpam: true, 11 | async run({ msg, conn }, { q, prefix }) { 12 | let participant = msg.mentions[0] 13 | ? msg.mentions[0] 14 | : msg.quoted 15 | ? msg.quoted.sender 16 | : q.replace(/[^0-9]/g, "") + "@s.whatsapp.net"; 17 | await conn 18 | .groupParticipantsUpdate(msg.from, [participant], "remove") 19 | .then((res) => msg.reply("Sukses Kick user")) 20 | .catch((err) => msg.reply(err)); 21 | }, 22 | }; 23 | -------------------------------------------------------------------------------- /command/group/left.js: -------------------------------------------------------------------------------- 1 | const getPosition = (name, _dir) => { 2 | let position = null; 3 | Object.keys(_dir).forEach((i) => { 4 | if (_dir[i].id === name) { 5 | position = i; 6 | } 7 | }); 8 | if (position !== null) { 9 | return position; 10 | } 11 | }; 12 | 13 | module.exports = { 14 | name: "left", 15 | desc: "activate the new member left feature", 16 | use: "<1 / 0>", 17 | category: "group", 18 | query: "enter options\n1 = aktif\n0 = nonaktif", 19 | isAdmin: true, 20 | isSpam: true, 21 | async run({ msg, conn }, { args, prefix }) { 22 | let data = JSON.parse(require("fs").readFileSync("./database/left.json")); 23 | let data2 = db.cekDatabase("left", "id", msg.from); 24 | if (args[0] == 1) { 25 | if (data2) throw "been active before"; 26 | db.modified("left", { id: msg.from, teks: "Sayonara @user", lastUpdate: false }); 27 | await msg.reply( 28 | `Left turned on successfully\n Type\n1. *${prefix}setwelcome text*\n-desc: if you want to change the text on welcome\n2. *${prefix}setleft text*\n-desc: if you want to change the text on left` 29 | ); 30 | } else if (args[0] == 0) { 31 | if (!data2) throw "not active before"; 32 | data.splice(getPosition(msg.from, data), 1); 33 | require("fs").writeFileSync("./database/left.json", JSON.stringify(data, null, 2)); 34 | await msg.reply("successfully delete session left in this group"); 35 | } 36 | }, 37 | }; 38 | -------------------------------------------------------------------------------- /command/group/promote.js: -------------------------------------------------------------------------------- 1 | module.exports = { 2 | name: "promote", 3 | alias: ["pm"], 4 | category: "group", 5 | desc: "Promote jadi admin group", 6 | use: "", 7 | isGroup: true, 8 | isBotAdmin: true, 9 | isAdmin: true, 10 | async run({ msg, conn }) { 11 | const mm = msg.quoted ? [msg.quoted.sender] : msg.mentions; 12 | for (let i of mm) await conn.groupParticipantsUpdate(msg.from, [i], "promote"); 13 | await msg.reply("Suksess"); 14 | }, 15 | }; 16 | -------------------------------------------------------------------------------- /command/group/setleft.js: -------------------------------------------------------------------------------- 1 | module.exports = { 2 | name: "setleft", 3 | desc: "Change Text On Left", 4 | category: "group", 5 | use: "", 6 | query: "enter text\n@subject subject group\n@ownergc owner group\n@user tag participant is left\n@creation when was the group created\n@desc descripdescription", 7 | isAdmin: true, 8 | isSpam: true, 9 | async run({ msg, conn }, { q }) { 10 | let dataNeeded = db.cekDatabase("left", "id", msg.from); 11 | if (!dataNeeded) throw "Left This group is not activated yet,\nActived on command: *#left 1*"; 12 | let data = JSON.parse(require("fs").readFileSync("./database/left.json")); 13 | let da = data.find((a) => a.id == msg.from); 14 | da.teks = q; 15 | da.lastUpdate = Date.now(); 16 | require("fs").writeFileSync("./database/left.json", JSON.stringify(data, null, 2)); 17 | await msg.reply( 18 | "Left successfully changed\n\nOptions:\n@subject subject group\n@ownergc owner group\n@user tag participant is left\n@creation when was the group created\n@desc descripdescription" 19 | ); 20 | }, 21 | }; 22 | -------------------------------------------------------------------------------- /command/group/setnamegc.js: -------------------------------------------------------------------------------- 1 | module.exports = { 2 | name: "setnamegc", 3 | alias: ["sngc"], 4 | category: "group", 5 | desc: "To change name group ", 6 | use: "setname + query", 7 | query: "Masukkan teks", 8 | isGroup: true, 9 | isAdmin: true, 10 | isBotAdmin: true, 11 | async run({ msg, conn }, { q }) { 12 | await conn.groupUpdateSubject(msg.from, q); 13 | await msg.reply("Success change name group"); 14 | }, 15 | }; 16 | -------------------------------------------------------------------------------- /command/group/setwelcome.js: -------------------------------------------------------------------------------- 1 | module.exports = { 2 | name: "setwelcome", 3 | desc: "Change Text On Welcome", 4 | use: "", 5 | category: "group", 6 | query: "enter text\n@subject subject group\n@ownergc owner group\n@user tag participant is left\n@creation when was the group created\n@desc descripdescription", 7 | isAdmin: true, 8 | isSpam: true, 9 | async run({ msg, conn }, { q }) { 10 | let dataNeeded = db.cekDatabase("welcome", "id", msg.from); 11 | if (!dataNeeded) throw "Welcome This group is not activated yet,\nActived On Command: *#welcome 1*"; 12 | let data = JSON.parse(require("fs").readFileSync("./database/welcome.json")); 13 | let da = data.find((a) => a.id == msg.from); 14 | da.teks = q; 15 | da.lastUpdate = Date.now(); 16 | require("fs").writeFileSync("./database/welcome.json", JSON.stringify(data, null, 2)); 17 | await msg.reply( 18 | "Welcome successfully changed\n\nOptions:\n@subject subject group\n@ownergc owner group\n@user tag participant is left\n@creation when was the group created\n@desc descripdescription" 19 | ); 20 | }, 21 | }; 22 | -------------------------------------------------------------------------------- /command/group/welcome.js: -------------------------------------------------------------------------------- 1 | const getPosition = (name, _dir) => { 2 | let position = null; 3 | Object.keys(_dir).forEach((i) => { 4 | if (_dir[i].id === name) { 5 | position = i; 6 | } 7 | }); 8 | if (position !== null) { 9 | return position; 10 | } 11 | }; 12 | 13 | module.exports = { 14 | name: "welcome", 15 | desc: "activate the new member welcome feature", 16 | use: "<1 / 0>", 17 | category: "group", 18 | query: "enter options\n1 = aktif\n0 = nonaktif", 19 | isAdmin: true, 20 | isSpam: true, 21 | async run({ msg, conn }, { args, prefix }) { 22 | let data = JSON.parse(require("fs").readFileSync("./database/welcome.json")); 23 | let data2 = db.cekDatabase("welcome", "id", msg.from); 24 | if (args[0] == 1) { 25 | if (data2) throw "been active before"; 26 | db.modified("welcome", { id: msg.from, teks: "Welcome to @subject good luck @user", lastUpdate: false }); 27 | await msg.reply( 28 | `Welcome turned on successfully\n Type\n1. *${prefix}setwelcome text*\n-desc: if you want to change the text on welcome\n2. *${prefix}setleft text*\n-desc: if you want to change the text on left` 29 | ); 30 | } else if (args[0] == 0) { 31 | if (!data2) throw "not active before"; 32 | data.splice(getPosition(msg.from, data), 1); 33 | require("fs").writeFileSync("./database/welcome.json", JSON.stringify(data, null, 2)); 34 | await msg.reply("successfully delete session welcome in this group"); 35 | } 36 | }, 37 | }; 38 | -------------------------------------------------------------------------------- /command/info/botstats.js: -------------------------------------------------------------------------------- 1 | const os = require("os"); 2 | const { sizeFormatter } = require("human-readable"); 3 | const formatSize = sizeFormatter({ 4 | std: "JEDEC", 5 | decimalPlaces: "2", 6 | keepTrailingZeroes: false, 7 | render: (literal, symbol) => `${literal} ${symbol}B`, 8 | }); 9 | 10 | module.exports = { 11 | name: "stats", 12 | alias: ["status"], 13 | category: "info", 14 | desc: "Bot status", 15 | isSpam: true, 16 | wait: true, 17 | async run({ msg }) { 18 | let text = ""; 19 | text += `HOST:\n- Arch: ${os.arch()}\n- CPU: ${os.cpus()[0].model}${ 20 | os.cpus().length > 1 ? " (" + os.cpus().length + "x)" : "" 21 | }\n- Release: ${os.release()}\n- Version: ${os.version()}\n`; 22 | text += `- Memory: ${formatSize(os.totalmem() - os.freemem())} / ${formatSize(os.totalmem())}\n`; 23 | text += `- Platform: ${os.platform()}`; 24 | await msg.reply(text); 25 | }, 26 | }; 27 | -------------------------------------------------------------------------------- /command/info/cekprem.js: -------------------------------------------------------------------------------- 1 | module.exports = { 2 | name: "cekpremium", 3 | alias: ["cekprem", "cekvip"], 4 | category: "premium", 5 | isSpam: true, 6 | isPremium: true, 7 | async run({ msg, conn }) { 8 | let cekvip = require("parse-ms")((await prem.getPremiumExpired(msg.sender, premium)) - Date.now()); 9 | let premiumnya = `*Expired :* ${cekvip.days} day(s) ${cekvip.hours} hour(s) ${cekvip.minutes} minute(s) ${cekvip.seconds} Second(s)`; 10 | msg.reply(premiumnya); 11 | }, 12 | }; 13 | -------------------------------------------------------------------------------- /command/info/dashboard.js: -------------------------------------------------------------------------------- 1 | module.exports = { 2 | name: "dashboard", 3 | alias: ["db"], 4 | desc: "display " + config.namebot + " bot dashboard info", 5 | category: "info", 6 | isSpam: true, 7 | wait: true, 8 | async run({ msg, conn }, { q, prefix, map }) { 9 | if (q) { 10 | var data = 11 | [...map.command.values()].find((a) => a.name == q.toLowerCase()) || 12 | [...map.command.values()].find((x) => x.alias.find((a) => a == q.toLowerCase())); 13 | if (!data) throw "Feature not found"; 14 | let findData = dashboard.find((a) => a.name == data.name.toLowerCase()); 15 | teks = `*• Dashboard ${config.namebot}*\n\n`; 16 | teks += `*➢ #${findData.name}* : ${findData.success + findData.failed}\n`; 17 | teks += `*⌘ Success:* ${findData.success}\n`; 18 | teks += `*⌘ Failed:* ${findData.failed}\n`; 19 | teks += `*⌘ Last Used:* ${require("moment")(findData.lastUpdate).fromNow()}\n\n`; 20 | await msg.reply(teks, { adReply: true }); 21 | } else { 22 | dashboard = dashboard.sort(function (a, b) { 23 | return b.success - a.success; 24 | }); 25 | let success = dashboard.map((a) => a.success); 26 | let failed = dashboard.map((a) => a.failed); 27 | let jumlah = require("mathjs").evaluate(success.join("+")) + require("mathjs").evaluate(failed.join("+")); 28 | let teks = `*• Dashboard ${config.namebot}*\n\n*➤ Global HIT*\n\n`; 29 | teks += `*➢ HIT*\n`; 30 | teks += `*⌘ Global:* ${jumlah}\n`; 31 | teks += `*⌘ Success:* ${require("mathjs").evaluate(success.join("+"))}\n`; 32 | teks += `*⌘ Failed:* ${require("mathjs").evaluate(failed.join("+"))}\n\n`; 33 | teks += `*➤ Most Command Global*\n\n`; 34 | let dbny = dashboard.length > 5 ? 5 : dashboard.length; 35 | for (let i = 0; i < dbny; i++) { 36 | teks += `*➢ #${dashboard[i].name}* : ${dashboard[i].success + dashboard[i].failed}\n`; 37 | teks += `*⌘ Success:* ${dashboard[i].success}\n`; 38 | teks += `*⌘ Failed:* ${dashboard[i].failed}\n`; 39 | teks += `*⌘ Last Used:* ${require("moment")(dashboard[i].lastUpdate).fromNow()}\n\n`; 40 | } 41 | teks += `Type *${prefix}dashboard * to find out the command data.\nUsage: *${prefix}dashboard help*`; 42 | await msg.reply(teks, { adReply: true }); 43 | } 44 | }, 45 | }; 46 | -------------------------------------------------------------------------------- /command/info/infochat.js: -------------------------------------------------------------------------------- 1 | let baileys = require("@adiwajshing/baileys"); 2 | 3 | module.exports = { 4 | name: "infochat", 5 | alias: ["sider"], 6 | desc: "See Who I am who reads messages", 7 | category: "info", 8 | isQuoted: true, 9 | async run({ msg, conn }) { 10 | let message = await msg.getQuotedObj(); 11 | if (!msg.quoted.isSelf) throw "The message was not sent by a bot!"; 12 | let teks = ""; 13 | for (let i of message.userReceipt) { 14 | let read = i.readTimestamp; 15 | let unread = i.receiptTimestamp; 16 | let waktu = read ? read : unread; 17 | teks += `⭔ @${i.userJid.split("@")[0]}\n`; 18 | teks += ` ┗━⭔ *Time :* ${require("moment-timezone")(waktu * 1000).format("DD/MM/YY HH:mm:ss")}\n`; 19 | teks += `⭔ *Status :* ${read ? "Be read" : "Sent"}\n\n`; 20 | } 21 | await msg.reply(teks, { withTag: true }); 22 | }, 23 | }; 24 | -------------------------------------------------------------------------------- /command/info/limit.js: -------------------------------------------------------------------------------- 1 | module.exports = { 2 | name: "limit", 3 | alias: ["cekglimit", "ceklimit", "glimit"], 4 | category: "info", 5 | desc: "check limit", 6 | isSpam: true, 7 | async run({ msg, conn }, { q, map }) { 8 | prefix = map.prefix; 9 | if (msg.mentions.length !== 0) { 10 | msg.reply( 11 | `Limit : ${ 12 | prem.checkPremiumUser(msg.mentions[0], premium) 13 | ? "Unlimited" 14 | : `${getLimit(msg.mentions[0], limitCount, limit)}/${limitCount}` 15 | }\nLimit Game : ${cekGLimit(msg.mentions[0], gcount, glimit)}/${gcount}\nBalance : $${getBalance( 16 | msg.mentions[0], 17 | balance 18 | )}\n\nYou can buy limit with ${prefix}buylimit and ${prefix}buyglimit to buy game limit` 19 | ); 20 | } else { 21 | msg.reply( 22 | `Limit : ${ 23 | isPremium ? "Unlimited" : `${getLimit(msg.sender, limitCount, limit)}/${limitCount}` 24 | }\nLimit Game : ${cekGLimit(msg.sender, gcount, glimit)}/${gcount}\nBalance : $${getBalance( 25 | msg.sender, 26 | balance 27 | )}\n\nYou can buy limit with ${prefix}buylimit dan ${prefix}buyglimit to buy game limit` 28 | ); 29 | } 30 | }, 31 | }; 32 | -------------------------------------------------------------------------------- /command/info/listprem.js: -------------------------------------------------------------------------------- 1 | module.exports = { 2 | name: "listpremium", 3 | alias: ["listprem", "listvip"], 4 | category: "info", 5 | isSpam: true, 6 | async run({ msg, conn }) { 7 | let txt = `List Prem\nAmount : ${premium.length}\n\n`; 8 | if (premium[0]) { 9 | for (let i of premium) { 10 | let cekvip = require("parse-ms")(i.expired - Date.now()); 11 | txt += `*ID :* @${i.id.split("@")[0]}\n*Expired :* ${cekvip.days} day(s) ${cekvip.hours} hour(s) ${ 12 | cekvip.minutes 13 | } minute(s) ${cekvip.seconds} second(s)\n\n`; 14 | } 15 | } 16 | msg.reply(txt, true); 17 | }, 18 | }; 19 | -------------------------------------------------------------------------------- /command/info/me.js: -------------------------------------------------------------------------------- 1 | const phoneNum = require("awesome-phonenumber"); 2 | 3 | module.exports = { 4 | name: "me", 5 | alias: ["profile"], 6 | desc: "gatau", 7 | wait: true, 8 | isSpam: true, 9 | category: "info", 10 | async run({ msg, conn }) { 11 | var tol = `${msg.sender.split("@")[0]}`; 12 | var bio; 13 | try { 14 | bio = await conn.fetchStatus(msg.sender); 15 | } catch { 16 | bio = "Bio Not found"; 17 | } 18 | try { 19 | var pp = await conn.profilePictureUrl(msg.sender, "image"); 20 | } catch { 21 | var pp = "https://i.ibb.co/Tq7d7TZ/age-hananta-495-photo.png"; 22 | } 23 | var gender = await require("axios").get( 24 | "https://api.genderize.io/?name=" + encodeURIComponent(conn.getName(msg.sender)) 25 | ); 26 | var from = await phoneNum("+" + msg.sender.split("@")[0]).getRegionCode(); 27 | var Country = await require("country-language").getCountry(from); 28 | 29 | txt = `*Profile Ingfo*\n\n`; 30 | txt += `*• Name :* ${conn.getName(msg.sender)}\n`; 31 | txt += `*• Tag :* @${msg.sender.split("@")[0]}\n`; 32 | txt += `*• About :* ${bio.status || bio}\n`; 33 | txt += `*• Number :* ${phoneNum("+" + tol.replace("@s.whatsapp.net", "")).getNumber("international")}\n`; 34 | txt += `*• Jenis kelamin :* ${gender.data.gender || "male" == "male" ? "Laki-Laki" : "Perempuan"}\n`; 35 | txt += `*• From:* ${Country.name}\n`; 36 | txt += `*• Link :* https://wa.me/${msg.sender.split("@")[0]}`; 37 | //msg.reply(txt, {withTag: true}) 38 | conn.sendMessage(msg.from, { 39 | image: { url: pp }, 40 | caption: txt, 41 | mentions: [msg.sender], 42 | }); 43 | }, 44 | }; 45 | -------------------------------------------------------------------------------- /command/info/owner.js: -------------------------------------------------------------------------------- 1 | module.exports = { 2 | name: "owner", 3 | alias: ["pemilik"], 4 | category: "info", 5 | isSpam: true, 6 | async run({ msg, conn }, { q, map, args }) { 7 | var msga = await conn.sendContact(msg.from, config.owner, msg); 8 | await conn.sendMessage(msg.from, { text: `this my owner number, please don't spam` }, {}); 9 | }, 10 | }; 11 | -------------------------------------------------------------------------------- /command/info/ping.js: -------------------------------------------------------------------------------- 1 | const moment = require("moment-timezone"); 2 | 3 | const ping = function (timestamp, now) { 4 | return moment.duration(now - moment(timestamp * 1000)).asSeconds(); 5 | }; 6 | 7 | module.exports = { 8 | name: "ping", 9 | alias: ["p", "speed"], 10 | category: "info", 11 | desc: "Bot response in second.", 12 | isSpam: true, 13 | async run({ msg }) { 14 | await msg.reply(`*_${ping(msg.messageTimestamp, Date.now())} second(s)_*`); 15 | }, 16 | }; 17 | -------------------------------------------------------------------------------- /command/info/runtime.js: -------------------------------------------------------------------------------- 1 | const { convertTime } = require("../../lib"); 2 | 3 | module.exports = { 4 | name: "runtime", 5 | category: "info", 6 | type: "changelog", 7 | desc: "check time run bot", 8 | isSpam: true, 9 | async run({ msg, conn }, { map }) { 10 | await msg.reply(convertTime(map.uptime.getTime())); 11 | }, 12 | }; 13 | -------------------------------------------------------------------------------- /command/info/scriptbot.js: -------------------------------------------------------------------------------- 1 | module.exports = { 2 | name: "scriptbot", 3 | alias: ["script", "sc", "scbot"], 4 | category: "info", 5 | isSpam: true, 6 | async run({ msg, conn }, { q, map, args }) { 7 | await conn.sendMessage( 8 | msg.from, 9 | { 10 | image: { url: config.thumb }, 11 | footer: config.namebot, 12 | // Gausah di ubah kontol najis modal copas sana sini ubah source cih 13 | caption: `Script Bot Is here\ndon't forget fork + star XD`, 14 | templateButtons: [ 15 | { urlButton: { displayText: "Script Bot", url: "https://github.com/Rizky878/rzky-multidevice/" } }, 16 | ], 17 | }, 18 | { quoted: msg } 19 | ); 20 | }, 21 | }; 22 | -------------------------------------------------------------------------------- /command/other/buyglimit.js: -------------------------------------------------------------------------------- 1 | module.exports = { 2 | name: "buyglimit", 3 | category: "other", 4 | isSpam: true, 5 | use: "", 6 | query: "Send an order *#buyglimit* the limit amount you want to buy\n\nPrice for 1 game limit = $150 balance", 7 | async run({ msg, conn }, { q }) { 8 | if (q.includes("-")) throw `Don't use -`; 9 | if (isNaN(q)) throw `Must be a number`; 10 | let ane = Number(Math.floor(q) * 150); 11 | if (getBalance(msg.sender, balance) < ane) throw `Your balance is not sufficient for this purchase`; 12 | kurangBalance(msg.sender, ane, balance); 13 | givegame(msg.sender, Math.floor(q), glimit); 14 | await msg.reply( 15 | `Purchase of game limit of ${q} was successful\n\nRemaining balance : $${getBalance( 16 | msg.sender, 17 | balance 18 | )}\nRemaining Game Limit : ${cekGLimit(msg.sender, gcount, glimit)}/${gcount}` 19 | ); 20 | }, 21 | }; 22 | -------------------------------------------------------------------------------- /command/other/buylimit.js: -------------------------------------------------------------------------------- 1 | module.exports = { 2 | name: "buylimit", 3 | category: "other", 4 | isSpam: true, 5 | use: "", 6 | query: "Send an order *#buylimit* the limit amount you want to buy\n\nPrice 1 limit = $150 balance", 7 | async run({ msg, conn }, { q }) { 8 | if (q.includes("-")) throw `Don't use -`; 9 | if (isNaN(q)) throw `Must be a number`; 10 | let ane = Number(Math.floor(q) * 150); 11 | if (getBalance(msg.sender, balance) < ane) throw `Balance kamu tidak mencukupi untuk pembelian ini`; 12 | kurangBalance(msg.sender, ane, balance); 13 | giveLimit(msg.sender, Math.floor(q), limit); 14 | await msg.reply( 15 | `The limit purchase of ${q} was successful\n\nRemaining Balance : $${getBalance( 16 | msg.sender, 17 | balance 18 | )}\nRemaining Limit : ${getLimit(msg.sender, limitCount, limit)}/${limitCount}` 19 | ); 20 | }, 21 | }; 22 | -------------------------------------------------------------------------------- /command/other/inspect.js: -------------------------------------------------------------------------------- 1 | const { getBinaryNodeChild } = require("@adiwajshing/baileys"); 2 | 3 | module.exports = { 4 | name: "inspect", 5 | alias: ["check", "inspectlink"], 6 | category: "other", 7 | use: "", 8 | query: "No invite url.", 9 | wait: true, 10 | isSpam: true, 11 | async run({ msg, conn }, { q }) { 12 | const rex1 = /chat.whatsapp.com\/([\w\d]*)/g; 13 | const queryInvite = async (code) => { 14 | const results = await conn.query({ 15 | tag: "iq", 16 | attrs: { 17 | type: "get", 18 | xmlns: "w:g2", 19 | to: "@g.us", 20 | }, 21 | content: [{ tag: "invite", attrs: { code } }], 22 | }); 23 | return extractGroupInviteMetadata(results); 24 | }; 25 | let code = q.match(rex1); 26 | if (code === null) return await msg.reply("No invite url detected."); 27 | code = code[0].replace("chat.whatsapp.com/", ""); 28 | const check = await queryInvite(code).catch(async () => { 29 | return msg.reply("Invalid invite url."); 30 | }); 31 | const text = 32 | `Subject: ${check.subject}\nGroupId: ${check.id}${ 33 | check.creator ? `\nCreator: ${check.creator.split("@")[0]}` : "" 34 | }\nCreate At: ${new Date(check.creation * 1000).toLocaleString()}` + 35 | `${check.desc ? `\nDesc: ${check.desc}\nDescId: ${check.descId}` : ""}\n\nJSON\n\`\`\`${JSON.stringify( 36 | check, 37 | null, 38 | 4 39 | )}\`\`\``; 40 | await msg.reply(text); 41 | }, 42 | }; 43 | 44 | const extractGroupInviteMetadata = (content) => { 45 | const group = getBinaryNodeChild(content, "group"); 46 | const descChild = getBinaryNodeChild(group, "description"); 47 | let desc, descId; 48 | if (descChild) { 49 | desc = getBinaryNodeChild(descChild, "body").content.toString(); 50 | descId = descChild.attrs.id; 51 | } 52 | const groupId = group.attrs.id.includes("@") ? group.attrs.id : group.attrs.id + "@g.us"; 53 | const metadata = { 54 | id: groupId, 55 | subject: group.attrs.subject || "Tidak ada", 56 | creator: group.attrs.creator || "Tidak terdeteksi", 57 | creation: group.attrs.creation || "Tidak terdeteksi", 58 | desc, 59 | descId, 60 | }; 61 | return metadata; 62 | }; 63 | -------------------------------------------------------------------------------- /command/other/join.js: -------------------------------------------------------------------------------- 1 | const { getBinaryNodeChild } = require("@adiwajshing/baileys"); 2 | 3 | module.exports = { 4 | name: "join", 5 | alias: ["joingroup", "invite"], 6 | category: "other", 7 | desc: "Join to group using invite url.", 8 | async run({ msg, conn }, { q }) { 9 | // search for invite url 10 | const rex1 = /chat.whatsapp.com\/([\w\d]*)/g; 11 | const queryInvite = async (code) => { 12 | const results = await conn.query({ 13 | tag: "iq", 14 | attrs: { 15 | type: "get", 16 | xmlns: "w:g2", 17 | to: "@g.us", 18 | }, 19 | content: [{ tag: "invite", attrs: { code } }], 20 | }); 21 | const group = getBinaryNodeChild(results, "group"); 22 | return group.attrs; 23 | }; 24 | 25 | let code = q.match(rex1); 26 | if (code === null) return await msg.reply("No invite url detected."); 27 | code = code[0].replace("chat.whatsapp.com/", ""); 28 | // check invite code 29 | try { 30 | const check = await queryInvite(code); 31 | 32 | // 33 | if (check.size >= 257) return await msg.reply("Group Full"); 34 | if (check.size < 80) 35 | return await msg.reply("The minimum requirement for group members must be more than 80 people."); 36 | } catch { 37 | return msg.reply("Invalid invite url."); 38 | } 39 | 40 | // Trying to join group with given invite code 41 | let anu = await conn.groupAcceptInvite(code); 42 | if (!anu) return msg.reply("Looks like the group already full or became invalid when I'm trying to join :/"); 43 | await msg.reply("Success join into your group."); 44 | }, 45 | }; 46 | -------------------------------------------------------------------------------- /command/owner/addprem.js: -------------------------------------------------------------------------------- 1 | module.exports = { 2 | name: "addpremium", 3 | alias: ["addprem", "addvip"], 4 | category: "private", 5 | desc: "Add user premium ke database", 6 | isSpam: true, 7 | isOwner: true, 8 | query: "Penggunaan :\n*#addprem* @tag waktu\n*#addprem* nomor waktu\n\nContoh : #addprem @tag 30d", 9 | use: "@tag 30d", 10 | async run({ msg, conn }, { q, map, args }) { 11 | if (args.length < 2) 12 | return msg.reply( 13 | `Penggunaan :\n*#addprem* @tag waktu\n*#addprem* nomor waktu\n\nContoh : #addprem @tag 30d` 14 | ); 15 | if (msg.mentions.length !== 0) { 16 | for (let i = 0; i < msg.mentions.length; i++) { 17 | prem.addPremiumUser(msg.mentions[0], args[1], premium); 18 | } 19 | msg.reply("Sukses"); 20 | } else { 21 | prem.addPremiumUser(args[1] + "@s.whatsapp.net", args[1], premium); 22 | msg.reply("Sukses"); 23 | } 24 | }, 25 | }; 26 | -------------------------------------------------------------------------------- /command/owner/bcgc.js: -------------------------------------------------------------------------------- 1 | module.exports = { 2 | name: "broadcastgroup", 3 | alias: ["bcgc"], 4 | desc: "Mengirim Chat Ke Group Yang bot punya", 5 | use: "", 6 | category: "private", 7 | isOwner: true, 8 | query: "Masukan text yg ingin di bc", 9 | async run({ msg, conn }, { q }) { 10 | let getGroups = await conn.groupFetchAllParticipating(); 11 | let groups = Object.entries(getGroups) 12 | .slice(0) 13 | .map((entry) => entry[1]); 14 | let anu = groups.map((v) => v.id); 15 | for (let i of anu) { 16 | await require("delay")(3000); 17 | await conn.sendMessage(i, { text: q + "\n\n*Broadcast Message*" }); 18 | } 19 | await msg.reply("Sukses"); 20 | }, 21 | }; 22 | -------------------------------------------------------------------------------- /command/owner/delprem.js: -------------------------------------------------------------------------------- 1 | const fs = require("fs"); 2 | module.exports = { 3 | name: "delpremium", 4 | alias: ["delprem", "delvip"], 5 | category: "private", 6 | use: "@tag / nomor", 7 | query: "Penggunaan :\n*#delprem* @tag\n*#delprem* nomor", 8 | isSpam: true, 9 | isOwner: true, 10 | async run({ msg, conn }, { q, map, args, arg }) { 11 | if (args.length < 1) return reply(`Penggunaan :\n*#delprem* @tag\n*#delprem* nomor`); 12 | if (msg.mentions.length !== 0) { 13 | for (let i = 0; i < msg.mentions.length; i++) { 14 | premium.splice(prem.getPremiumPosition(msg.mentions[i], premium), 1); 15 | fs.writeFileSync("./database/premium.json", JSON.stringify(premium)); 16 | } 17 | msg.reply("Sukses"); 18 | } else { 19 | premium.splice(prem.getPremiumPosition(args[0] + "@s.whatsapp.net", premium), 1); 20 | fs.writeFileSync("./database/premium.json", JSON.stringify(premium)); 21 | msg.reply("sukses"); 22 | } 23 | }, 24 | }; 25 | -------------------------------------------------------------------------------- /command/owner/eval.js: -------------------------------------------------------------------------------- 1 | module.exports = { 2 | name: "eval", 3 | alias: [">>", ">"], 4 | category: "private", 5 | noPrefix: true, 6 | isOwner: true, 7 | desc: "running javascript code via command can also test something code", 8 | use: `">" with await and ">>" live return or immediately show the result`, 9 | query: `Masukan Parameter Code`, 10 | async run({ msg, conn }, { q, map, args, Baileys, arg, prefix, response, chat }) { 11 | let kode = msg.body.trim().split(/ +/)[0]; 12 | let teks; 13 | try { 14 | teks = await eval(`(async () => { ${kode == ">>" ? "return" : ""} ${q}})()`); 15 | } catch (e) { 16 | teks = e; 17 | } finally { 18 | await msg.reply(require("util").format(teks)); 19 | } 20 | }, 21 | }; 22 | -------------------------------------------------------------------------------- /command/owner/exec.js: -------------------------------------------------------------------------------- 1 | let cp = require("child_process"); 2 | let { promisify } = require("util"); 3 | let exec = promisify(cp.exec).bind(cp); 4 | 5 | module.exports = { 6 | name: "$", 7 | alias: ["exec"], 8 | category: "private", 9 | noPrefix: true, 10 | isOwner: true, 11 | async run({ msg, conn }, { q }) { 12 | await msg.reply("Executing..."); 13 | let o; 14 | try { 15 | o = await exec(q); 16 | } catch (e) { 17 | o = e; 18 | } finally { 19 | let { stdout, stderr } = o; 20 | if (stdout.trim()) msg.reply(stdout); 21 | if (stderr.trim()) msg.reply(stderr); 22 | } 23 | }, 24 | }; 25 | -------------------------------------------------------------------------------- /command/owner/lockcmd.js: -------------------------------------------------------------------------------- 1 | module.exports = { 2 | name: "lockcmd", 3 | category: "private", 4 | isOwner: true, 5 | desc: "menoaktifkan fitur ", 6 | use: ``, 7 | query: `Masukan Parameter Nama Command dan alasan, example: #lockcmd help | off`, 8 | async run({ msg, conn }, { q, map, args, arg }) { 9 | if (!args[2]) throw "Masukan alasan, example: #lockcmd play | tidur"; 10 | var data = [...map.command.keys()]; 11 | [...map.command.values()] 12 | .map((x) => x.alias) 13 | .join(" ") 14 | .replace(/ +/gi, ",") 15 | .split(",") 16 | .map((a) => data.push(a)); 17 | if (!data.includes(q.split("|")[0].trim())) throw "Command tidak ditemukan"; 18 | if (map.lockcmd.has(q.split("|")[0].trim())) throw "Command ini sudah di lock sebelumnya"; 19 | map.lockcmd.set(q.split("|")[0].trim(), q.split("|")[1].trim()); 20 | await msg.reply(`Succes Lock Command "${q.split("|")[0].trim()}" dengan alasan "${q.split("|")[1].trim()}"`); 21 | }, 22 | }; 23 | -------------------------------------------------------------------------------- /command/owner/react.js: -------------------------------------------------------------------------------- 1 | module.exports = { 2 | name: "react", 3 | alias: ["re"], 4 | category: "private", 5 | isOwner: true, 6 | isSpam: true, 7 | desc: "Reaction message", 8 | use: "", 9 | isQuoted: true, 10 | query: "Masukkan emoji", 11 | async run({ msg, conn }, { q }) { 12 | const reactionMessage = { 13 | react: { 14 | text: `${q}`, 15 | key: msg.quoted.key, 16 | }, 17 | }; 18 | await conn.sendMessage(msg.from, reactionMessage); 19 | }, 20 | }; 21 | -------------------------------------------------------------------------------- /command/owner/resetlimit.js: -------------------------------------------------------------------------------- 1 | module.exports = { 2 | name: "resetlimit", 3 | category: "private", 4 | desc: "Mereset limit", 5 | isSpam: true, 6 | isOwner: true, 7 | async run({ msg }) { 8 | limit.splice("reset"); 9 | require("fs").writeFileSync("./database/limit.json", JSON.stringify(limit)); 10 | await msg.reply(`Reset limit berhasil`); 11 | }, 12 | }; 13 | -------------------------------------------------------------------------------- /command/owner/savefitur.js: -------------------------------------------------------------------------------- 1 | module.exports = { 2 | name: "save", 3 | alias: ["sf"], 4 | category: "private", 5 | desc: "Menyimpan / menambah file", 6 | isOwner: true, 7 | isSpam: true, 8 | query: "Masukkan nama path file,\n example: .sf ./command/other/fitur.js", 9 | use: "", 10 | isQuoted: true, 11 | async run({ msg, conn }, { q, map, args }) { 12 | await require("fs").writeFileSync(q, msg.quoted.text); 13 | await msg.reply(`Saved successfully, and is restarting`); 14 | process.send("reset"); 15 | }, 16 | }; 17 | -------------------------------------------------------------------------------- /command/owner/self.js: -------------------------------------------------------------------------------- 1 | module.exports = { 2 | name: "self", 3 | alias: ["public"], 4 | category: "private", 5 | desc: "Merubah self and public", 6 | isSpam: true, 7 | isOwner: true, 8 | async run({ msg, conn }, { q, map }) { 9 | var command = msg.body.split(/ +/)[0].slice(1); 10 | switch (command) { 11 | case "public": 12 | if (!map.isSelf) throw "Sudah berada dalam mode public"; 13 | map.isSelf = false; 14 | await msg.reply("Sukses mengubah ke mode public"); 15 | break; 16 | case "self": 17 | if (map.isSelf) throw "Sudah berada dalam mode self"; 18 | map.isSelf = true; 19 | config.owner.push(conn.decodeJid(conn.user.id)); 20 | await msg.reply("Sukses mengubah ke mode self"); 21 | } 22 | }, 23 | }; 24 | -------------------------------------------------------------------------------- /command/owner/unlockcmd.js: -------------------------------------------------------------------------------- 1 | module.exports = { 2 | name: "unlockcmd", 3 | alias: ["ulockcmd"], 4 | category: "private", 5 | isOwner: true, 6 | desc: "membuka fitur ", 7 | use: ``, 8 | query: `Masukan Parameter Nama Command`, 9 | async run({ msg, conn }, { q, map, args, arg }) { 10 | var data = [...map.command.keys()]; 11 | [...map.command.values()] 12 | .map((x) => x.alias) 13 | .join(" ") 14 | .replace(/ +/gi, ",") 15 | .split(",") 16 | .map((a) => data.push(a)); 17 | if (!data.includes(q)) throw "Command tidak ditemukan"; 18 | if (!map.lockcmd.has(q)) throw "Command ini belum di lock sebelumnya"; 19 | map.lockcmd.delete(q); 20 | await msg.reply(`Succes Membuka Lock Command "${q}"`); 21 | }, 22 | }; 23 | -------------------------------------------------------------------------------- /command/random/loli.js: -------------------------------------------------------------------------------- 1 | module.exports = { 2 | name: "loli", 3 | alias: ["randomloli", "lolianime"], 4 | category: "random", 5 | isSpam: true, 6 | async run({ msg, conn }) { 7 | await msg.reply(response.wait); 8 | const buttons = [{ buttonId: "#loli", buttonText: { displayText: "Get Again" }, type: 1 }]; 9 | const buttonMessage = { 10 | image: { url: (await rzky.image.loli()).url }, 11 | caption: "Pedo🫵", 12 | buttons: buttons, 13 | headerType: 4, 14 | }; 15 | 16 | await conn.sendMessage(msg.from, buttonMessage); 17 | }, 18 | }; 19 | -------------------------------------------------------------------------------- /command/random/meme.js: -------------------------------------------------------------------------------- 1 | module.exports = { 2 | name: "meme", 3 | alias: ["randommeme", "memeindo"], 4 | category: "random", 5 | isSpam: true, 6 | async run({ msg, conn }) { 7 | await msg.reply(response.wait); 8 | const buttons = [{ buttonId: "#meme", buttonText: { displayText: "Get Again" }, type: 1 }]; 9 | const meme = await rzky.random.meme(); 10 | const buttonMessage = { 11 | image: { url: meme.url }, 12 | caption: `Link Post: ${meme.postLink}\nSubreddit: *${meme.subreddit}*\nTitle: *${meme.title}*\nNsfw: *${meme.nsfw}*\nSpoiler: *${meme.spoiler}*\nAuthor: *${meme.author}*`, 13 | buttons: buttons, 14 | headerType: 4, 15 | }; 16 | 17 | await conn.sendMessage(msg.from, buttonMessage); 18 | }, 19 | }; 20 | -------------------------------------------------------------------------------- /command/random/quotes.js: -------------------------------------------------------------------------------- 1 | module.exports = { 2 | name: "quotesanime", 3 | alias: ["quotes", "animequotes", "quote", "quoteanime"], 4 | category: "random", 5 | isSpam: true, 6 | wait: true, 7 | async run({ msg, conn }, { q, map, args }) { 8 | var animquote = await rzky.random.quotesAnime(); 9 | var animrandom = animquote.result[Math.floor(Math.random() * animquote.result.length)]; 10 | var img = animrandom.img; 11 | delete animrandom.img; 12 | var result = await rzky.tools.parseResult(animrandom, { title: "Quotes Anime" }); 13 | await conn.sendFile( 14 | msg.from, 15 | img, 16 | "quotes.jpg", 17 | result.replace(/Char_name/gi, "Nama Karakter").replace(/Date/gi, "Release Date"), 18 | msg 19 | ); 20 | }, 21 | }; 22 | -------------------------------------------------------------------------------- /command/search/chordlist.js: -------------------------------------------------------------------------------- 1 | const axios = require("axios"); 2 | const clean = (data) => { 3 | let regex = /(<([^>]+)>)/gi; 4 | data = data.replace(/()/gi, " \n"); 5 | return data.replace(regex, ""); 6 | }; 7 | 8 | module.exports = { 9 | name: "chord", 10 | alias: ["chordmusik", "musikchord", "chordmusic", "musicchord"], 11 | use: "", 12 | category: "search", 13 | desc: "Searching for music chords", 14 | wait: true, 15 | query: "Enter song title!", 16 | isSpam: true, 17 | async run({ msg, conn }, { q, map, args }) { 18 | let data = await axios.get("http://app.chordindonesia.com/?json=get_search_results&search=" + q); 19 | let result = data.data; 20 | if (result.count < 0) throw "no chords for this song were found"; 21 | await msg.reply("found " + result.count + " chords for this song"); 22 | text = "*• Chord Music Search*\n\n"; 23 | no = 1; 24 | for (let i of result.posts) { 25 | text += `*• Number:* ${no++}\n`; 26 | text += `*- ID:* ${i.id}\n`; 27 | text += `*- Title:* ${i.title.replace(/[0-9]|[#&;]/gi, "")}\n`; 28 | text += `*- Date:* ${i.date}\n`; 29 | text += `*- Author:* ${i.categories[0].title}\n\n`; 30 | } 31 | await msg.reply(text); 32 | }, 33 | }; 34 | -------------------------------------------------------------------------------- /command/search/getChord.js: -------------------------------------------------------------------------------- 1 | const axios = require("axios"); 2 | const clean = (data) => { 3 | let regex = /(<([^>]+)>)/gi; 4 | data = data.replace(/()/gi, " \n"); 5 | return data.replace(regex, ""); 6 | }; 7 | 8 | module.exports = { 9 | name: "getchord", 10 | alias: ["getchordmusik", "getmusikchord", "getchordmusic", "getmusicchord"], 11 | use: "", 12 | category: "search", 13 | desc: "Searching for music chords", 14 | wait: true, 15 | isQuoted: true, 16 | query: "Enter number!", 17 | isSpam: true, 18 | async run({ msg, conn }, { q }) { 19 | if (!msg.quoted.text.split("*").includes("• Chord Music Search")) 20 | return msg.reply("Pesan bukan dari chord music search!"); 21 | if (isNaN(q)) throw "Enter the correct number"; 22 | let ID = msg.quoted.text.split("*- ID:*")[q].split("*- Title")[0].trim(); 23 | let data = await axios.get("http://app.chordindonesia.com/?json=get_post&id=" + ID); 24 | let result = data.data; 25 | text = "*• Chord Music Found*\n"; 26 | text += `*- Title:* ${result.post.title.replace(/[0-9]|[#&;]/gi, "")}\n\n`; 27 | text += clean(result.post.content); 28 | await msg.reply(text); 29 | }, 30 | }; 31 | -------------------------------------------------------------------------------- /command/search/pinterest.js: -------------------------------------------------------------------------------- 1 | module.exports = { 2 | name: "pinterest", 3 | alias: ["pint", "pin"], 4 | category: "search", 5 | isSpam: true, 6 | query: `Masukan teks yang ingin dicari`, 7 | use: "", 8 | wait: true, 9 | desc: "Searching Images From Pinterest", 10 | async run({ msg, conn }, { q }) { 11 | const buttons = [{ buttonId: "#pinterest " + q, buttonText: { displayText: "Get Again" }, type: 1 }]; 12 | const pin = await rzky.image.pinterest(q); 13 | const pinran = pin.result[Math.floor(Math.random() * pin.result.length)]; 14 | const buttonMessage = { 15 | image: { url: pinran }, 16 | caption: "Result from: " + q, 17 | buttons: buttons, 18 | headerType: 4, 19 | }; 20 | 21 | await conn.sendMessage(msg.from, buttonMessage); 22 | }, 23 | }; 24 | -------------------------------------------------------------------------------- /command/search/whatmusic.js: -------------------------------------------------------------------------------- 1 | module.exports = { 2 | name: "whatmusic", 3 | alias: ["wmusic", "whatmusik", "wmusik"], 4 | category: "search", 5 | use: "", 6 | isSpam: true, 7 | wait: true, 8 | isMedia: { isQVideo: true, isQAudio: true }, 9 | desc: "Search for song titles through music or voice", 10 | async run({ msg, conn }, { q, map, args }) { 11 | //if(!msg.quoted) return msg.reply('Reply Audio') 12 | const content = JSON.stringify(msg.quoted); 13 | const isQAudio = msg.type === "extendedTextMessage" && content.includes("audioMessage"); 14 | //f(!isQAudio) return msg.reply(`Reply Audio`) 15 | var what = await rzky.search.whatmusic(await msg.quoted.download()); 16 | delete what.status; 17 | var result = await rzky.tools.parseResult(what, { title: "What Music" }); 18 | await msg.reply(result); 19 | }, 20 | }; 21 | -------------------------------------------------------------------------------- /command/search/wikipedia.js: -------------------------------------------------------------------------------- 1 | module.exports = { 2 | name: "wikipedia", 3 | alias: ["wikimedia", "wiki", "wikimed"], 4 | category: "search", 5 | isSpam: true, 6 | wait: true, 7 | use: "", 8 | query: `Masukan sesuatu topik yang ingin dicari`, 9 | desc: "Mencari hal hal yang berkaitan di Wikipedia", 10 | async run({ msg, conn }, { q, map, args }) { 11 | var wiki = await rzky.search.wiki(q); 12 | if (wiki.img == "https://telegra.ph/file/1cde98e7bc902331edc90.png") return msg.reply(`Tidak ditemukan`); 13 | var img = wiki.img; 14 | delete wiki.img; 15 | var result = await rzky.tools.parseResult(wiki, { title: "Wikipedia" }); 16 | await conn.sendFile(msg.from, img, "wiki.jpg", result, msg); 17 | }, 18 | }; 19 | -------------------------------------------------------------------------------- /command/tools/getquoted.js: -------------------------------------------------------------------------------- 1 | module.exports = { 2 | name: "getquoted", 3 | alias: ["q"], 4 | category: "tools", 5 | isQuoted: true, 6 | async run({ msg, conn }) { 7 | const { serialize } = require("../../lib/serialize"); 8 | const message = await msg.getQuotedObj(); 9 | if (!message.quoted) throw "The message you replied does not contain a reply"; 10 | conn.sendMessage(msg.from, { forward: await serialize(message.quoted, conn) }); 11 | }, 12 | }; 13 | -------------------------------------------------------------------------------- /command/tools/imgtopdf.js: -------------------------------------------------------------------------------- 1 | function monospace(teks) { 2 | return "```" + teks + "```"; 3 | } 4 | 5 | module.exports = { 6 | name: "imgtopdf", 7 | alias: ["pdf", "topdf"], 8 | category: "tools", 9 | desc: "Mengubah Foto Ke Dokumen PDF", 10 | isSpam: true, 11 | isLimit: true, 12 | query: `Masukan nama file atau nama dokumen PDF kamu`, 13 | isPrivate: true, 14 | async run({ msg, conn }, { q, map }) { 15 | if (map.pdf.has(msg.sender)) throw "Kamu masih dalam sesi Image to pdf"; 16 | var pdf = map.pdf; 17 | pdf.set(msg.sender, { name: q, array: [] }); 18 | await msg.reply(`Silahkan kirim gambar satu persatu 19 | 20 | Dengan cara reply gambar kemudian ketik *add* 21 | untuk menambahkan gambar 22 | 23 | Jika selesai ketik *selesai*, jika ingin membatalkan 24 | ketik *cancel* 25 | 26 | ${monospace(`Image To PDF by RzkyFdlh`)}`); 27 | await conn.sendImage(msg.from, "https://telegra.ph/file/009c083e25041eee7a30e.jpg", msg, { 28 | caption: "Contoh Penggunaan / Usage Example", 29 | }); 30 | }, 31 | }; 32 | -------------------------------------------------------------------------------- /command/tools/setlanguage.js: -------------------------------------------------------------------------------- 1 | const translate = require("@vitalets/google-translate-api"), 2 | { writeFileSync, readFileSync } = require("fs"), 3 | db = JSON.parse(readFileSync("./database/language.json")); 4 | 5 | const getPosition = (userId, _dir) => { 6 | let position = null; 7 | Object.keys(_dir).forEach((i) => { 8 | if (_dir[i].id === userId) { 9 | position = i; 10 | } 11 | }); 12 | return position; 13 | }; 14 | 15 | module.exports = { 16 | name: "setlanguage", 17 | alias: ["setlang"], 18 | category: "tools", 19 | isSpam: true, 20 | use: "", 21 | query: "Enter the Language you want to set", 22 | async run({ msg, conn }, { q }) { 23 | let language = Object.keys(translate.languages).splice(1); 24 | language.push("default"); 25 | if (!language.includes(q)) 26 | throw "Supported language:\n*Default Language:* default\n\n" + JSON.stringify(translate.languages, null, 2); 27 | let user = db.find((x) => x.jid == msg.sender); 28 | if (user) db.splice(getPosition(msg.sender, db), 1); 29 | if (q == "default") db.splice(getPosition(msg.sender, db)); 30 | q == "default" ? "" : db.push({ jid: msg.sender, country: q }); 31 | writeFileSync("./database/language.json", JSON.stringify(db)); 32 | await msg.reply(`Success change language to "${q == "default" ? "default" : translate.languages[q]}"`); 33 | }, 34 | }; 35 | -------------------------------------------------------------------------------- /command/tools/toUrl.js: -------------------------------------------------------------------------------- 1 | // module 2 | const FormData = require("form-data"); 3 | const { default: Axios } = require("axios"); 4 | const fs = require("fs"); 5 | const filetype = require("file-type"); 6 | //end module 7 | 8 | //function upload file 9 | const uploadFile = (path) => 10 | new Promise((resolve, reject) => { 11 | const fd = new FormData(); 12 | fd.append("file", fs.createReadStream(path)); 13 | Axios({ 14 | method: "POST", 15 | url: "https://uploader.caliph.my.id/upload", 16 | data: fd, 17 | headers: { 18 | "user-agent": "MRHRTZ-ZONE :D", 19 | "content-type": `multipart/form-data; boundary=${fd._boundary}`, 20 | }, 21 | }) 22 | .then(({ data }) => resolve(data)) 23 | .catch(reject); 24 | }); 25 | // end function 26 | 27 | module.exports = { 28 | name: "upload", 29 | alias: ["tourl", "tolink"], 30 | desc: "Convert media to url", 31 | use: "reply media message", 32 | isMedia: { 33 | isQVideo: true, 34 | isQAudio: true, 35 | isQDocument: true, 36 | isQSticker: true, 37 | isQImage: true, 38 | }, 39 | category: "tools", 40 | isSpam: true, 41 | isLimit: true, 42 | wait: true, 43 | async run({ msg, conn }, { q }) { 44 | let type = await filetype.fromBuffer(await msg.quoted.download()); 45 | let filename = `./temp/${Date.now()}.${type.ext}`; 46 | fs.writeFileSync(filename, await msg.quoted.download()); 47 | let file = await uploadFile(filename); 48 | await msg.reply(file.result.url); 49 | }, 50 | }; 51 | -------------------------------------------------------------------------------- /command/umum/changelog.js: -------------------------------------------------------------------------------- 1 | module.exports = { 2 | name: "changelog", 3 | category: "umum", 4 | isLimit: true, 5 | async run({ msg, conn }, { q, map, args }) { 6 | if (q) { 7 | const data = []; 8 | const name = q.toLowerCase(); 9 | const { command, prefix } = map; 10 | const cmd = command.get(name) || [...command.values()].find((x) => x.alias.find((x) => x == args[0])); 11 | if (!cmd || cmd.type != "changelog") return await msg.reply("Recent command not found"); 12 | else data.push(`*Name:* ` + cmd.name); 13 | if (cmd.alias) data.push(`*Alias:* ${cmd.alias.join(", ")}`); 14 | if (cmd.desc) data.push(`*Description:* ${cmd.desc}`); 15 | if (cmd.use) 16 | data.push(`*Use:* ${prefix}${cmd.name} ${cmd.use}\n\nNote: [] = optional, | = or, <> = must be filled`); 17 | 18 | return await msg.reply(data.join("\n")); 19 | } else { 20 | const { pushName, sender } = msg; 21 | const { prefix, command } = map; 22 | const cmds = command.keys(); 23 | let category = []; 24 | 25 | for (let cmd of cmds) { 26 | let info = command.get(cmd); 27 | if (!cmd) continue; 28 | if (config.ignore.directory.includes(info.category.toLowerCase())) continue; 29 | cteg = info.category; 30 | if (info.type != "changelog") continue; 31 | if (Object.keys(category).includes(cteg)) category[cteg].push(info); 32 | else { 33 | category[cteg] = []; 34 | category[cteg].push(info); 35 | } 36 | } 37 | let str = 38 | "```" + 39 | config.namebot + 40 | "```\n\n" + 41 | `Hello, ${ 42 | pushName === undefined ? sender.split("@")[0] : pushName 43 | }\n*Here is a list of the latest commands*\n\n===== [ *CHANGE LOG* ] =====\n\n`; 44 | const keys = Object.keys(category); 45 | //var a = 1 46 | for (const key of keys) { 47 | str += `*• ${key.toUpperCase()}*\n${category[key] 48 | .map( 49 | (cmd, index) => 50 | `*${index + 1}.* *${cmd.options.noPrefix ? "" : "#"}${cmd.name}*${ 51 | cmd.alias[0] 52 | ? "\n" + 53 | cmd.alias 54 | .map((a) => (a ? `*▸ ${cmd.options.noPrefix ? "" : "#"}${a}*` : "")) 55 | .join("\n") 56 | : "" 57 | }\n*Usage:* _${cmd.options.noPrefix ? "" : "#"}${cmd.name}${ 58 | cmd.use ? " " + cmd.use : "" 59 | }_\n*Desc:* _${cmd.desc || "Nothing"}_` 60 | ) 61 | .join("\n\n")}\n\n`; 62 | } 63 | str += `typing *${prefix}changelog runtime* for get the details and example use`; 64 | await conn.sendMessage( 65 | msg.from, 66 | { 67 | video: await conn.getBuffer(config.thumbvideo), 68 | gifPlayback: true, 69 | caption: str, 70 | footer: config.namebot + " • " + config.ownername, 71 | templateButtons: [ 72 | { urlButton: { displayText: "Shortlink", url: "https://sl.rzkyfdlh.tech" } }, 73 | { urlButton: { displayText: "Downloader", url: "https://downloader.rzkyfdlh.tech" } }, 74 | { quickReplyButton: { displayText: "Script Bot📑", id: "#script" } }, 75 | { quickReplyButton: { displayText: "Owner👥", id: "#owner" } }, 76 | { quickReplyButton: { displayText: "Dashboard📊", id: "#db" } }, 77 | ], 78 | }, 79 | { quoted: msg } 80 | ); 81 | } 82 | }, 83 | }; 84 | -------------------------------------------------------------------------------- /command/umum/help.js: -------------------------------------------------------------------------------- 1 | const hari = moment.tz(config.timezone).format("a"); 2 | const ucapanWaktu = hari.charAt(0).toUpperCase() + hari.slice(1); 3 | const processTime = (timestamp, now) => { 4 | return moment.duration(now - moment(timestamp * 1000)).asSeconds(); 5 | }; 6 | 7 | module.exports = { 8 | name: "help", 9 | alias: ["h", "cmd", "menu"], 10 | category: "umum", 11 | isLimit: true, 12 | async run({ msg, conn }, { q, owner, map, args }) { 13 | if (q) { 14 | const data = []; 15 | const name = q.toLowerCase(); 16 | const { command, prefix } = map; 17 | const cmd = command.get(name) || [...command.values()].find((x) => x.alias.find((x) => x == args[0])); 18 | if (!cmd || (cmd.category === "hidden" && !config.owner.includes(msg.sender))) 19 | return await msg.reply("Command not found"); 20 | else data.push(`*Name:* ` + cmd.name); 21 | if (cmd.alias) data.push(`*Alias:* ${cmd.alias.join(", ")}`); 22 | if (cmd.desc) data.push(`*Deskripsi:* ${cmd.desc}`); 23 | if (cmd.use) 24 | data.push(`*Use:* ${prefix}${cmd.name} ${cmd.use}\n\nNote: [] = optional, | = or, <> = must be filled`); 25 | 26 | return await msg.reply(data.join("\n")); 27 | } else { 28 | const { pushName, sender } = msg; 29 | const { prefix, command } = map; 30 | const cmds = command.keys(); 31 | let category = []; 32 | const xes = require("parse-ms")(prem.getPremiumExpired(msg.sender, premium) - Date.now()); 33 | dashboard = dashboard.sort(function (a, b) { 34 | return b.success - a.success; 35 | }); 36 | 37 | for (let cmd of cmds) { 38 | let info = command.get(cmd); 39 | if (!cmd) continue; 40 | if (config.ignore.directory.includes(info.category.toLowerCase())) continue; 41 | cteg = info.category || "No Category"; 42 | if (info.type == "changelog") continue; 43 | if (cteg == "hidden") continue; 44 | if (!cteg || cteg === "private") cteg = "owner command"; 45 | if (Object.keys(category).includes(cteg)) category[cteg].push(info); 46 | else { 47 | category[cteg] = []; 48 | category[cteg].push(info); 49 | } 50 | } 51 | let str = `「 *${config.namebot}* 」 52 | 53 | ◪ *Time* 54 | ❏ ${moment.tz(config.timezone).format("HH:mm:ss")} 55 | 56 | ◪ *Speed* 57 | ❏ ${processTime(msg.messageTimestamp, moment())} _seconds_ 58 | 59 | ◪ *Date* 60 | ❏ ${moment.tz(config.timezone).format("dddd, DD/MM/YYYY")} 61 | 62 | ◪ *INFO USER* 63 | ❏ Nomer: 「 ${msg.sender.split("@")[0]} 」 64 | ❏ Nama: 「 ${conn.getName(msg.sender)} 」 65 | ❏ Status: 「 ${isPremium ? "Premium" : owner ? "Owner" : "Standar"} 」 66 | ${isPremium ? `❏ Expired: 「 ${xes.days} D ${xes.hours} H ${xes.minutes} M 」\n` : ""} 67 | 68 | ◪ *Fitur terpopuler saat ini* 69 | ${ 70 | dashboard[0] 71 | ? `1. *${prefix}${dashboard[0].name}* dipakai sebanyak *${dashboard[0].success + dashboard[0].failed}* kali` 72 | : `` 73 | } 74 | ${ 75 | dashboard[1] 76 | ? `2. *${prefix}${dashboard[1].name}* dipakai sebanyak *${dashboard[1].success + dashboard[1].failed}* kali` 77 | : `` 78 | } 79 | ${ 80 | dashboard[2] 81 | ? `3. *${prefix}${dashboard[2].name}* dipakai sebanyak *${dashboard[2].success + dashboard[2].failed}* kali\n\n` 82 | : `` 83 | }`; 84 | const keys = Object.keys(category); 85 | //var a = 1 86 | for (const key of keys) { 87 | str += `*❏ ${key.toUpperCase()}*\n${category[key] 88 | .map( 89 | (cmd, index) => 90 | `*${index + 1}.* *${cmd.options.noPrefix ? "" : "#"}${cmd.name}* ${ 91 | cmd.category == "private" 92 | ? "" 93 | : cmd.use 94 | ? cmd.use.replace(">", " 」").replace("<", "「 ") 95 | : "" 96 | }` 97 | ) 98 | .join("\n")}\n\n`; 99 | } 100 | str += `typing *${prefix}help sticker* for get the details and example use`; 101 | await conn.sendMessage( 102 | msg.from, 103 | { 104 | video: { url: config.thumbvideo }, 105 | caption: str, 106 | gifPlayback: true, 107 | footer: config.namebot + " • " + config.ownername, 108 | templateButtons: [ 109 | { urlButton: { displayText: "Shortlink", url: "https://sl.rzkyfdlh.tech" } }, 110 | { urlButton: { displayText: "Downloader", url: "https://down.rzkyfdlh.tech" } }, 111 | { quickReplyButton: { displayText: "Script Bot📑", id: "#script" } }, 112 | { quickReplyButton: { displayText: "Changelog📋", id: "#changelog" } }, 113 | { quickReplyButton: { displayText: "Dashboard📊", id: "#db" } }, 114 | ], 115 | }, 116 | { quoted: msg } 117 | ); 118 | } 119 | }, 120 | }; 121 | -------------------------------------------------------------------------------- /config.json: -------------------------------------------------------------------------------- 1 | { 2 | "owner": ["6282387804410@s.whatsapp.net"], 3 | "thumbvideo": "https://ffcdn-srv-1e2mf2sh6.filezone.cf/file/gYtRTi~E~o8308fagkVr.mp4", 4 | "thumb": "https://telegra.ph/file/d8dba7eee759ff82b35be.jpg", 5 | "session": "rzkyfdlh-md", 6 | "ownername": "Rizky", 7 | "self": false, 8 | "server": false, 9 | "comment_server": "change 'server' with 'true', if you run in replit!", 10 | "limit": { "limitUser": 30, "gameLimitUser": 10, "gameLimitPremium": 30 }, 11 | "packInfo": { "packname": "@rizkyfadilah8", "author": "6282387804410" }, 12 | "namebot": "KurumiBot", 13 | "timezone": "Asia/Jakarta", 14 | "email": "admin@rzkyfdlh.tech", 15 | "instagram": "https://instagram.com/rizkyfadilah8_", 16 | "locale": "id", 17 | "ignore": { 18 | "directory": ["umum"] 19 | } 20 | } 21 | -------------------------------------------------------------------------------- /database/antidelete.json: -------------------------------------------------------------------------------- 1 | [] 2 | -------------------------------------------------------------------------------- /database/antilink.json: -------------------------------------------------------------------------------- 1 | [] 2 | -------------------------------------------------------------------------------- /database/balance.json: -------------------------------------------------------------------------------- 1 | [] 2 | -------------------------------------------------------------------------------- /database/dashboard.json: -------------------------------------------------------------------------------- 1 | [] 2 | -------------------------------------------------------------------------------- /database/glimit.json: -------------------------------------------------------------------------------- 1 | [] 2 | -------------------------------------------------------------------------------- /database/language.json: -------------------------------------------------------------------------------- 1 | [] 2 | -------------------------------------------------------------------------------- /database/left.json: -------------------------------------------------------------------------------- 1 | [] 2 | -------------------------------------------------------------------------------- /database/limit.json: -------------------------------------------------------------------------------- 1 | [] 2 | -------------------------------------------------------------------------------- /database/mess.json: -------------------------------------------------------------------------------- 1 | [] 2 | -------------------------------------------------------------------------------- /database/premium.json: -------------------------------------------------------------------------------- 1 | [] 2 | -------------------------------------------------------------------------------- /database/welcome.json: -------------------------------------------------------------------------------- 1 | [] 2 | -------------------------------------------------------------------------------- /doom.flf: -------------------------------------------------------------------------------- 1 | flf2a$ 8 6 14 15 16 2 | DOOM by Frans P. de Vries 18 Jun 1996 3 | based on Big by Glenn Chappell 4/93 -- based on Standard 4 | figlet release 2.1 -- 12 Aug 1994 5 | Permission is hereby given to modify this font, as long as the 6 | modifier's name is placed on a comment line. 7 | 8 | Explanation of first line: 9 | flf2 - "magic number" for file identification 10 | a - should always be `a', for now 11 | $ - the "hardblank" -- prints as a blank, but can't be smushed 12 | 8 - height of a character 13 | 6 - height of a character, not including descenders 14 | 14 - max line length (excluding comment lines) + a fudge factor 15 | 15 - default smushmode for this font 16 | 16 - number of comment lines 17 | 18 | $@ 19 | $@ 20 | $@ 21 | $@ 22 | $@ 23 | $@ 24 | $@ 25 | $@@ 26 | _ @ 27 | | |@ 28 | | |@ 29 | | |@ 30 | |_|@ 31 | (_)@ 32 | @ 33 | @@ 34 | _ _ @ 35 | ( | )@ 36 | V V @ 37 | $ @ 38 | $ @ 39 | $ @ 40 | @ 41 | @@ 42 | _ _ @ 43 | _| || |_ @ 44 | |_ __ _|@ 45 | _| || |_ @ 46 | |_ __ _|@ 47 | |_||_| @ 48 | @ 49 | @@ 50 | _ @ 51 | | | @ 52 | / __)@ 53 | \__ \@ 54 | ( /@ 55 | |_| @ 56 | @ 57 | @@ 58 | _ __@ 59 | (_) / /@ 60 | / / @ 61 | / / @ 62 | / / _ @ 63 | /_/ (_)@ 64 | @ 65 | @@ 66 | @ 67 | ___ @ 68 | ( _ ) @ 69 | / _ \/\@ 70 | | (_> <@ 71 | \___/\/@ 72 | @ 73 | @@ 74 | _ @ 75 | ( )@ 76 | |/ @ 77 | $ @ 78 | $ @ 79 | $ @ 80 | @ 81 | @@ 82 | __@ 83 | / /@ 84 | | | @ 85 | | | @ 86 | | | @ 87 | | | @ 88 | \_\@ 89 | @@ 90 | __ @ 91 | \ \ @ 92 | | |@ 93 | | |@ 94 | | |@ 95 | | |@ 96 | /_/ @ 97 | @@ 98 | _ @ 99 | /\| |/\ @ 100 | \ ` ' / @ 101 | |_ _|@ 102 | / , . \ @ 103 | \/|_|\/ @ 104 | @ 105 | @@ 106 | @ 107 | _ @ 108 | _| |_ @ 109 | |_ _|@ 110 | |_| @ 111 | $ @ 112 | @ 113 | @@ 114 | @ 115 | @ 116 | @ 117 | @ 118 | _ @ 119 | ( )@ 120 | |/ @ 121 | @@ 122 | @ 123 | @ 124 | ______ @ 125 | |______|@ 126 | $ @ 127 | $ @ 128 | @ 129 | @@ 130 | @ 131 | @ 132 | @ 133 | @ 134 | _ @ 135 | (_)@ 136 | @ 137 | @@ 138 | __@ 139 | / /@ 140 | / / @ 141 | / / @ 142 | / / @ 143 | /_/ @ 144 | @ 145 | @@ 146 | _____ @ 147 | | _ |@ 148 | | |/' |@ 149 | | /| |@ 150 | \ |_/ /@ 151 | \___/ @ 152 | @ 153 | @@ 154 | __ @ 155 | / | @ 156 | `| | @ 157 | | | @ 158 | _| |_@ 159 | \___/@ 160 | @ 161 | @@ 162 | _____ @ 163 | / __ \@ 164 | `' / /'@ 165 | / / @ 166 | ./ /___@ 167 | \_____/@ 168 | @ 169 | @@ 170 | _____ @ 171 | |____ |@ 172 | / /@ 173 | $ \ \@ 174 | .___/ /@ 175 | \____/ @ 176 | @ 177 | @@ 178 | ___ @ 179 | / |@ 180 | / /| |@ 181 | / /_| |@ 182 | \___ |@ 183 | |_/@ 184 | @ 185 | @@ 186 | _____ @ 187 | | ___|@ 188 | |___ \ @ 189 | \ \@ 190 | /\__/ /@ 191 | \____/ @ 192 | @ 193 | @@ 194 | ____ @ 195 | / ___|@ 196 | / /___ @ 197 | | ___ \@ 198 | | \_/ |@ 199 | \_____/@ 200 | @ 201 | @@ 202 | ______@ 203 | |___ /@ 204 | $/ / @ 205 | / / @ 206 | ./ / @ 207 | \_/ @ 208 | @ 209 | @@ 210 | _____ @ 211 | | _ |@ 212 | \ V / @ 213 | / _ \ @ 214 | | |_| |@ 215 | \_____/@ 216 | @ 217 | @@ 218 | _____ @ 219 | | _ |@ 220 | | |_| |@ 221 | \____ |@ 222 | .___/ /@ 223 | \____/ @ 224 | @ 225 | @@ 226 | @ 227 | _ @ 228 | (_)@ 229 | $ @ 230 | _ @ 231 | (_)@ 232 | @ 233 | @@ 234 | @ 235 | _ @ 236 | (_)@ 237 | $ @ 238 | _ @ 239 | ( )@ 240 | |/ @ 241 | @@ 242 | __@ 243 | / /@ 244 | / / @ 245 | < < @ 246 | \ \ @ 247 | \_\@ 248 | @ 249 | @@ 250 | @ 251 | ______ @ 252 | |______|@ 253 | ______ @ 254 | |______|@ 255 | @ 256 | @ 257 | @@ 258 | __ @ 259 | \ \ @ 260 | \ \ @ 261 | > >@ 262 | / / @ 263 | /_/ @ 264 | @ 265 | @@ 266 | ___ @ 267 | |__ \ @ 268 | ) |@ 269 | / / @ 270 | |_| @ 271 | (_) @ 272 | @ 273 | @@ 274 | @ 275 | ____ @ 276 | / __ \ @ 277 | / / _` |@ 278 | | | (_| |@ 279 | \ \__,_|@ 280 | \____/ @ 281 | @@ 282 | ___ @ 283 | / _ \ @ 284 | / /_\ \@ 285 | | _ |@ 286 | | | | |@ 287 | \_| |_/@ 288 | @ 289 | @@ 290 | ______ @ 291 | | ___ \@ 292 | | |_/ /@ 293 | | ___ \@ 294 | | |_/ /@ 295 | \____/ @ 296 | @ 297 | @@ 298 | _____ @ 299 | / __ \@ 300 | | / \/@ 301 | | | @ 302 | | \__/\@ 303 | \____/@ 304 | @ 305 | @@ 306 | ______ @ 307 | | _ \@ 308 | | | | |@ 309 | | | | |@ 310 | | |/ / @ 311 | |___/ @ 312 | @ 313 | @@ 314 | _____ @ 315 | | ___|@ 316 | | |__ @ 317 | | __| @ 318 | | |___ @ 319 | \____/ @ 320 | @ 321 | @@ 322 | ______ @ 323 | | ___|@ 324 | | |_ @ 325 | | _| @ 326 | | | @ 327 | \_| @ 328 | @ 329 | @@ 330 | _____ @ 331 | | __ \@ 332 | | | \/@ 333 | | | __ @ 334 | | |_\ \@ 335 | \____/@ 336 | @ 337 | @@ 338 | _ _ @ 339 | | | | |@ 340 | | |_| |@ 341 | | _ |@ 342 | | | | |@ 343 | \_| |_/@ 344 | @ 345 | @@ 346 | _____ @ 347 | |_ _|@ 348 | | | @ 349 | | | @ 350 | _| |_ @ 351 | \___/ @ 352 | @ 353 | @@ 354 | ___ @ 355 | |_ |@ 356 | $ | |@ 357 | | |@ 358 | /\__/ /@ 359 | \____/ @ 360 | @ 361 | @@ 362 | _ __@ 363 | | | / /@ 364 | | |/ / @ 365 | | \ @ 366 | | |\ \@ 367 | \_| \_/@ 368 | @ 369 | @@ 370 | _ @ 371 | | | $ @ 372 | | | $ @ 373 | | | @ 374 | | |____@ 375 | \_____/@ 376 | @ 377 | @@ 378 | ___ ___@ 379 | | \/ |@ 380 | | . . |@ 381 | | |\/| |@ 382 | | | | |@ 383 | \_| |_/@ 384 | @ 385 | @@ 386 | _ _ @ 387 | | \ | |@ 388 | | \| |@ 389 | | . ` |@ 390 | | |\ |@ 391 | \_| \_/@ 392 | @ 393 | @@ 394 | _____ @ 395 | | _ |@ 396 | | | | |@ 397 | | | | |@ 398 | \ \_/ /@ 399 | \___/ @ 400 | @ 401 | @@ 402 | ______ @ 403 | | ___ \@ 404 | | |_/ /@ 405 | | __/ @ 406 | | | @ 407 | \_| @ 408 | @ 409 | @@ 410 | _____ @ 411 | | _ |@ 412 | | | | |@ 413 | | | | |@ 414 | \ \/' /@ 415 | \_/\_\@ 416 | @ 417 | @@ 418 | ______ @ 419 | | ___ \@ 420 | | |_/ /@ 421 | | / @ 422 | | |\ \ @ 423 | \_| \_|@ 424 | @ 425 | @@ 426 | _____ @ 427 | / ___|@ 428 | \ `--. @ 429 | `--. \@ 430 | /\__/ /@ 431 | \____/ @ 432 | @ 433 | @@ 434 | _____ @ 435 | |_ _|@ 436 | | | @ 437 | | | @ 438 | | | @ 439 | \_/ @ 440 | @ 441 | @@ 442 | _ _ @ 443 | | | | |@ 444 | | | | |@ 445 | | | | |@ 446 | | |_| |@ 447 | \___/ @ 448 | @ 449 | @@ 450 | _ _ @ 451 | | | | |@ 452 | | | | |@ 453 | | | | |@ 454 | \ \_/ /@ 455 | \___/ @ 456 | @ 457 | @@ 458 | _ _ @ 459 | | | | |@ 460 | | | | |@ 461 | | |/\| |@ 462 | \ /\ /@ 463 | \/ \/ @ 464 | @ 465 | @@ 466 | __ __@ 467 | \ \ / /@ 468 | \ V / @ 469 | / \ @ 470 | / /^\ \@ 471 | \/ \/@ 472 | @ 473 | @@ 474 | __ __@ 475 | \ \ / /@ 476 | \ V / @ 477 | \ / @ 478 | | | @ 479 | \_/ @ 480 | @ 481 | @@ 482 | ______@ 483 | |___ /@ 484 | $/ / @ 485 | / / @ 486 | ./ /___@ 487 | \_____/@ 488 | @ 489 | @@ 490 | ___ @ 491 | | _|@ 492 | | | @ 493 | | | @ 494 | | | @ 495 | | |_ @ 496 | |___|@ 497 | @@ 498 | __ @ 499 | \ \ @ 500 | \ \ @ 501 | \ \ @ 502 | \ \ @ 503 | \_\@ 504 | @ 505 | @@ 506 | ___ @ 507 | |_ |@ 508 | | |@ 509 | | |@ 510 | | |@ 511 | _| |@ 512 | |___|@ 513 | @@ 514 | /\ @ 515 | |/\|@ 516 | $ @ 517 | $ @ 518 | $ @ 519 | $ @ 520 | @ 521 | @@ 522 | @ 523 | @ 524 | @ 525 | @ 526 | @ 527 | $ @ 528 | ______ @ 529 | |______|@@ 530 | _ @ 531 | ( )@ 532 | \|@ 533 | $ @ 534 | $ @ 535 | $ @ 536 | @ 537 | @@ 538 | @ 539 | @ 540 | __ _ @ 541 | / _` |@ 542 | | (_| |@ 543 | \__,_|@ 544 | @ 545 | @@ 546 | _ @ 547 | | | @ 548 | | |__ @ 549 | | '_ \ @ 550 | | |_) |@ 551 | |_.__/ @ 552 | @ 553 | @@ 554 | @ 555 | @ 556 | ___ @ 557 | / __|@ 558 | | (__ @ 559 | \___|@ 560 | @ 561 | @@ 562 | _ @ 563 | | |@ 564 | __| |@ 565 | / _` |@ 566 | | (_| |@ 567 | \__,_|@ 568 | @ 569 | @@ 570 | @ 571 | @ 572 | ___ @ 573 | / _ \@ 574 | | __/@ 575 | \___|@ 576 | @ 577 | @@ 578 | __ @ 579 | / _|@ 580 | | |_ @ 581 | | _|@ 582 | | | @ 583 | |_| @ 584 | @ 585 | @@ 586 | @ 587 | @ 588 | __ _ @ 589 | / _` |@ 590 | | (_| |@ 591 | \__, |@ 592 | __/ |@ 593 | |___/ @@ 594 | _ @ 595 | | | @ 596 | | |__ @ 597 | | '_ \ @ 598 | | | | |@ 599 | |_| |_|@ 600 | @ 601 | @@ 602 | _ @ 603 | (_)@ 604 | _ @ 605 | | |@ 606 | | |@ 607 | |_|@ 608 | @ 609 | @@ 610 | _ @ 611 | (_)@ 612 | _ @ 613 | | |@ 614 | | |@ 615 | | |@ 616 | _/ |@ 617 | |__/ @@ 618 | _ @ 619 | | | @ 620 | | | __@ 621 | | |/ /@ 622 | | < @ 623 | |_|\_\@ 624 | @ 625 | @@ 626 | _ @ 627 | | |@ 628 | | |@ 629 | | |@ 630 | | |@ 631 | |_|@ 632 | @ 633 | @@ 634 | @ 635 | @ 636 | _ __ ___ @ 637 | | '_ ` _ \ @ 638 | | | | | | |@ 639 | |_| |_| |_|@ 640 | @ 641 | @@ 642 | @ 643 | @ 644 | _ __ @ 645 | | '_ \ @ 646 | | | | |@ 647 | |_| |_|@ 648 | @ 649 | @@ 650 | @ 651 | @ 652 | ___ @ 653 | / _ \ @ 654 | | (_) |@ 655 | \___/ @ 656 | @ 657 | @@ 658 | @ 659 | @ 660 | _ __ @ 661 | | '_ \ @ 662 | | |_) |@ 663 | | .__/ @ 664 | | | @ 665 | |_| @@ 666 | @ 667 | @ 668 | __ _ @ 669 | / _` |@ 670 | | (_| |@ 671 | \__, |@ 672 | | |@ 673 | |_|@@ 674 | @ 675 | @ 676 | _ __ @ 677 | | '__|@ 678 | | | @ 679 | |_| @ 680 | @ 681 | @@ 682 | @ 683 | @ 684 | ___ @ 685 | / __|@ 686 | \__ \@ 687 | |___/@ 688 | @ 689 | @@ 690 | _ @ 691 | | | @ 692 | | |_ @ 693 | | __|@ 694 | | |_ @ 695 | \__|@ 696 | @ 697 | @@ 698 | @ 699 | @ 700 | _ _ @ 701 | | | | |@ 702 | | |_| |@ 703 | \__,_|@ 704 | @ 705 | @@ 706 | @ 707 | @ 708 | __ __@ 709 | \ \ / /@ 710 | \ V / @ 711 | \_/ @ 712 | @ 713 | @@ 714 | @ 715 | @ 716 | __ __@ 717 | \ \ /\ / /@ 718 | \ V V / @ 719 | \_/\_/ @ 720 | @ 721 | @@ 722 | @ 723 | @ 724 | __ __@ 725 | \ \/ /@ 726 | > < @ 727 | /_/\_\@ 728 | @ 729 | @@ 730 | @ 731 | @ 732 | _ _ @ 733 | | | | |@ 734 | | |_| |@ 735 | \__, |@ 736 | __/ |@ 737 | |___/ @@ 738 | @ 739 | @ 740 | ____@ 741 | |_ /@ 742 | / / @ 743 | /___|@ 744 | @ 745 | @@ 746 | __@ 747 | / /@ 748 | | | @ 749 | / / @ 750 | \ \ @ 751 | | | @ 752 | \_\@ 753 | @@ 754 | _ @ 755 | | |@ 756 | | |@ 757 | | |@ 758 | | |@ 759 | | |@ 760 | | |@ 761 | |_|@@ 762 | __ @ 763 | \ \ @ 764 | | | @ 765 | \ \@ 766 | / /@ 767 | | | @ 768 | /_/ @ 769 | @@ 770 | /\/|@ 771 | |/\/ @ 772 | $ @ 773 | $ @ 774 | $ @ 775 | $ @ 776 | @ 777 | @@ 778 | _ _ @ 779 | (_)_(_)@ 780 | / _ \ @ 781 | / /_\ \@ 782 | | _ |@ 783 | \_| |_/@ 784 | @ 785 | @@ 786 | _ _ @ 787 | (_)_(_)@ 788 | | _ |@ 789 | | | | |@ 790 | \ \_/ /@ 791 | \___/ @ 792 | @ 793 | @@ 794 | _ _ @ 795 | (_) (_)@ 796 | | | | |@ 797 | | | | |@ 798 | | |_| |@ 799 | \___/ @ 800 | @ 801 | @@ 802 | _ _ @ 803 | (_) (_)@ 804 | __ _ @ 805 | / _` |@ 806 | | (_| |@ 807 | \__,_|@ 808 | @ 809 | @@ 810 | _ _ @ 811 | (_) (_)@ 812 | ___ @ 813 | / _ \ @ 814 | | (_) |@ 815 | \___/ @ 816 | @ 817 | @@ 818 | _ _ @ 819 | (_) (_)@ 820 | _ _ @ 821 | | | | |@ 822 | | |_| |@ 823 | \__,_|@ 824 | @ 825 | @@ 826 | ___ @ 827 | / _ \ @ 828 | | | ) |@ 829 | | |< < @ 830 | | | ) |@ 831 | | ||_/ @ 832 | \_| @ 833 | @@ 834 | -------------------------------------------------------------------------------- /global.js: -------------------------------------------------------------------------------- 1 | const fs = require('fs'); 2 | global.reloadFile = (file, options = {}) => { 3 | nocache(file, module => { 4 | console.log(`File "${file}" has updated!\nRestarting!`) 5 | process.send("reset") 6 | }) 7 | } 8 | const{isLimit:isLimit,limitAdd:limitAdd,getLimit:getLimit,giveLimit:giveLimit,addBalance:addBalance,kurangBalance:kurangBalance,getBalance:getBalance,isGame:isGame,gameAdd:gameAdd,givegame:givegame,cekGLimit:cekGLimit}=require("./lib/limit");global.prem=require("./lib/premium"),global.limit=JSON.parse(fs.readFileSync("./database/limit.json")),global.glimit=JSON.parse(fs.readFileSync("./database/glimit.json")),global.balance=JSON.parse(fs.readFileSync("./database/balance.json")),global.premium=JSON.parse(fs.readFileSync("./database/premium.json")),global.isLimit=isLimit,global.limitAdd=limitAdd,global.getLimit=getLimit,global.giveLimit=giveLimit,global.addBalance=addBalance,global.kurangBalance=kurangBalance,global.getBalance=getBalance,global.isGame=isGame,global.gameAdd=gameAdd,global.givegame=givegame,global.cekGLimit=cekGLimit; 9 | const IkyyClient = require("ikyy"); 10 | const { ikyEvent } = require("./lib/Event") 11 | global.ikyEvent = ikyEvent 12 | global.rzky = new IkyyClient(); 13 | global.response = require("./lib/response.json"); 14 | global.config = require("./config.json"); 15 | const Database = require('./lib/Database') 16 | global.db = new Database() 17 | 18 | function nocache(module, cb = () => {}) { 19 | fs.watchFile(require.resolve(module), async () => { 20 | await uncache(require.resolve(module)) 21 | cb(module) 22 | }) 23 | } 24 | 25 | function uncache(module = '.') { 26 | return new Promise((resolve, reject) => { 27 | try { 28 | delete require.cache[require.resolve(module)] 29 | resolve() 30 | } catch (e) { 31 | reject(e) 32 | } 33 | }) 34 | } 35 | -------------------------------------------------------------------------------- /handler.js: -------------------------------------------------------------------------------- 1 | require("./global.js"); 2 | require("./lib/Proto"); 3 | const { getBinaryNodeChild } = require("@adiwajshing/baileys"); 4 | const Baileys = require("@adiwajshing/baileys"); 5 | const { logger } = Baileys.DEFAULT_CONNECTION_CONFIG; 6 | const { serialize } = require("./lib/serialize"); 7 | const fs = require("fs"); 8 | const { color, getAdmin, isUrl } = require("./lib"); 9 | const cooldown = new Map(); 10 | const prefix = "#"; 11 | const multi_pref = new RegExp("^[" + "!#%&?/;:,.~-+=".replace(/[|\\{}()[\]^$+*?.\-\^]/g, "\\$&") + "]"); 12 | const owner = config.owner; 13 | function printSpam(conn, isGc, sender, groupName) { 14 | if (isGc) { 15 | return conn.logger.warn("Detect SPAM", color(sender.split("@")[0], "lime"), "in", color(groupName, "lime")); 16 | } 17 | if (!isGc) { 18 | return conn.logger.warn("Detect SPAM", color(sender.split("@")[0], "lime")); 19 | } 20 | } 21 | 22 | function printLog(isCmd, sender, msg, body, groupName, isGc) { 23 | addBalance(msg.sender, Math.floor(Math.random() * 20), balance); 24 | if (isCmd && isGc) { 25 | return console.log( 26 | color("[ COMMAND GC ]", "aqua"), 27 | color(sender.split("@")[0], "lime"), 28 | color(body, "aqua"), 29 | "in", 30 | color(groupName, "lime") 31 | ); 32 | } 33 | if (isCmd && !isGc) { 34 | return console.log(color("[ COMMAND PC ]", "aqua"), color(sender.split("@")[0], "lime"), color(body, "aqua")); 35 | } 36 | } 37 | module.exports = handler = async (m, conn, map) => { 38 | try { 39 | if (m.type !== "notify") return; 40 | let ms = m.messages[0]; 41 | ms.message = 42 | Object.keys(ms.message)[0] === "ephemeralMessage" ? ms.message.ephemeralMessage.message : ms.message; 43 | let msg = await serialize(JSON.parse(JSON.stringify(ms)), conn); 44 | if (!msg.message) return; 45 | 46 | //self 47 | if (map.isSelf) { 48 | if (!msg.isSelf) return; 49 | } 50 | 51 | //detect msg type senderKey and delete in order to be able to respond 52 | if (Object.keys(msg.message)[0] == "senderKeyDistributionMessage") 53 | delete msg.message.senderKeyDistributionMessage; 54 | if (Object.keys(msg.message)[0] == "messageContextInfo") delete msg.message.messageContextInfo; 55 | if (msg.key && msg.key.remoteJid === "status@broadcast") return; 56 | if ( 57 | msg.type === "protocolMessage" || 58 | msg.type === "senderKeyDistributionMessage" || 59 | !msg.type || 60 | msg.type === "" 61 | ) 62 | return; 63 | 64 | let { body, type } = msg; 65 | global.dashboard = JSON.parse(fs.readFileSync("./database/dashboard.json")); 66 | global.customLanguage = JSON.parse(fs.readFileSync("./database/language.json")); 67 | const { isGroup, sender, from } = msg; 68 | const groupMetadata = isGroup ? await conn.groupMetadata(from) : ""; 69 | const groupName = isGroup ? groupMetadata.subject : ""; 70 | const isAdmin = isGroup ? (await getAdmin(conn, msg)).includes(sender) : false; 71 | const isPrivate = msg.from.endsWith("@s.whatsapp.net"); 72 | const botAdmin = isGroup ? (await getAdmin(conn, msg)).includes(conn.decodeJid(conn.user.id)) : false; 73 | const isOwner = owner.includes(sender); 74 | 75 | let temp_pref = multi_pref.test(body) ? body.split("").shift() : "#"; 76 | if (body) { 77 | body = body.startsWith(temp_pref) ? body : ""; 78 | } else { 79 | body = ""; 80 | } 81 | 82 | const arg = body.substring(body.indexOf(" ") + 1); 83 | const args = body.trim().split(/ +/).slice(1); 84 | const comand = body.trim().split(/ +/)[0]; 85 | let q = body.trim().split(/ +/).slice(1).join(" "); 86 | const isCmd = body.startsWith(temp_pref); 87 | 88 | //type message 89 | const isVideo = type === "videoMessage"; 90 | const isImage = type === "imageMessage"; 91 | const isLocation = type === "locationMessage"; 92 | const contentQ = msg.quoted ? JSON.stringify(msg.quoted) : []; 93 | const isQAudio = type === "extendedTextMessage" && contentQ.includes("audioMessage"); 94 | const isQVideo = type === "extendedTextMessage" && contentQ.includes("videoMessage"); 95 | const isQImage = type === "extendedTextMessage" && contentQ.includes("imageMessage"); 96 | const isQDocument = type === "extendedTextMessage" && contentQ.includes("documentMessage"); 97 | const isQSticker = type === "extendedTextMessage" && contentQ.includes("stickerMessage"); 98 | const isQLocation = type === "extendedTextMessage" && contentQ.includes("locationMessage"); 99 | global.isPremium = prem.checkPremiumUser(msg.sender, premium); 100 | global.gcount = isPremium ? config.limit.gameLimitPremium : config.limit.gameLimitUser; 101 | global.limitCount = config.limit.limitUser; 102 | const Media = (media = {}) => { 103 | list = []; 104 | if (media.isQAudio) { 105 | list.push("audioMessage"); 106 | } 107 | if (media.isQVideo) { 108 | list.push("videoMessage"); 109 | } 110 | if (media.isQImage) { 111 | list.push("imageMessage"); 112 | } 113 | if (media.isQDocument) { 114 | list.push("documentMessage"); 115 | } 116 | if (media.isQSticker) { 117 | list.push("stickerMessage"); 118 | } 119 | return list; 120 | }; 121 | 122 | require("./res/EmitEvent.js")(msg, conn); 123 | 124 | // hayoloh dekk nyari adreply foto gede yahh ups:v 125 | conn.sendMessage = async (jid, content, options = { isTranslate: true }) => { 126 | await conn.presenceSubscribe(jid); 127 | const typeMes = 128 | content.image || content.text || content.video || content.document ? "composing" : "recording"; 129 | await conn.sendPresenceUpdate(typeMes, jid); 130 | const cotent = content.caption || content.text || ""; 131 | if (options.isTranslate) { 132 | const footer = content.footer || false; 133 | const customLang = customLanguage.find((x) => x.jid == msg.sender); 134 | const language = customLang ? customLang.country : false; 135 | if (customLang) { 136 | if (footer) footer = await rzky.tools.translate(footer, language); 137 | translate = await rzky.tools.translate(cotent, language); 138 | if (content.video || content.image) { 139 | content.caption = translate || cotent; 140 | } else { 141 | content.text = translate || cotent; 142 | } 143 | } 144 | } 145 | content.withTag 146 | ? (content.mentions = [...cotent.matchAll(/@([0-9]{5,16}|0)/g)].map((v) => v[1] + "@s.whatsapp.net")) 147 | : ""; 148 | options.adReply 149 | ? (content.contextInfo = { 150 | externalAdReply: { 151 | title: "© " + config.namebot, 152 | mediaType: 1, 153 | //renderLargerThumbnail: true, 154 | showAdAttribution: true, 155 | body: 156 | config.namebot + 157 | " multi-device whatsapp bot using JavaScript and made by " + 158 | config.ownername, 159 | thumbnail: await conn.getBuffer(config.thumb), 160 | sourceUrl: "https://github.com/Rizky878/rzky-multidevice/", 161 | }, 162 | }) 163 | : ""; 164 | if ( 165 | typeof content === "object" && 166 | "disappearingMessagesInChat" in content && 167 | typeof content["disappearingMessagesInChat"] !== "undefined" && 168 | Baileys.isJidGroup(jid) 169 | ) { 170 | const { disappearingMessagesInChat } = content; 171 | const value = 172 | typeof disappearingMessagesInChat === "boolean" 173 | ? disappearingMessagesInChat 174 | ? Baileys.WA_DEFAULT_EPHEMERAL 175 | : 0 176 | : disappearingMessagesInChat; 177 | await conn.groupToggleEphemeral(jid, value); 178 | } else { 179 | const isDeleteMsg = "delete" in content && !!content.delete; 180 | const additionalAttributes = {}; 181 | // required for delete 182 | if (isDeleteMsg) { 183 | additionalAttributes.edit = "7"; 184 | } 185 | const contentMsg = await Baileys.generateWAMessageContent(content, { 186 | logger, 187 | userJid: conn.user.id, 188 | upload: conn.waUploadToServer, 189 | ...options, 190 | }); 191 | options.userJid = conn.user.id; 192 | const fromContent = await Baileys.generateWAMessageFromContent(jid, contentMsg, options); 193 | fromContent.key.id = "RZKY" + require("crypto").randomBytes(13).toString("hex").toUpperCase(); 194 | await conn.relayMessage(jid, fromContent.message, { 195 | messageId: fromContent.key.id, 196 | additionalAttributes, 197 | userJid: conn.user.id, 198 | }); 199 | process.nextTick(() => { 200 | conn.ev.emit("messages.upsert", { 201 | messages: [fromContent], 202 | type: "append", 203 | }); 204 | }); 205 | await conn.sendPresenceUpdate("paused", jid); 206 | return fromContent; 207 | } 208 | }; 209 | 210 | // auto read 211 | await conn.readMessages([msg.key]); 212 | 213 | // topdf 214 | require("./lib/topdf")(msg, conn, map); 215 | 216 | // anti +212 217 | if (!isGroup && require("awesome-phonenumber")("+" + msg.sender.split("@")[0]).getCountryCode() == "212") { 218 | await conn.sendMessage(msg.from, { text: "Sorry i block you, Please read my whatsapp bio" }); 219 | await require("delay")(3000); 220 | await conn.updateBlockStatus(msg.sender, "block"); 221 | await conn.sendMessage(config.owner[0], { 222 | text: "*• Blocked Detected Number +212*\n\nwa.me/" + msg.sender.split("@")[0], 223 | }); 224 | } 225 | if (require("awesome-phonenumber")("+" + msg.sender.split("@")[0]).getCountryCode() == "212") return; 226 | 227 | //Prem expired 228 | prem.expiredCheck(conn, msg, premium); 229 | 230 | // anti link 231 | if (isGroup) { 232 | await require("./lib/antilink")(msg, conn); 233 | } 234 | 235 | // Log 236 | printLog(isCmd, sender, msg, body, groupName, isGroup); 237 | 238 | //waktu 239 | require("./lib/optiongame").cekWaktu(conn, map, "tebakbendera"); 240 | 241 | //game 242 | if (isGroup) { 243 | await require("./lib/game")(msg, conn, map); 244 | } 245 | 246 | const cmdName = body.slice(temp_pref.length).trim().split(/ +/).shift().toLowerCase(); 247 | const cmd = 248 | map.command.get(msg.body.trim().split(/ +/).shift().toLowerCase()) || 249 | [...map.command.values()].find((x) => 250 | x.alias.find((x) => x.toLowerCase() == msg.body.trim().split(/ +/).shift().toLowerCase()) 251 | ) || 252 | map.command.get(cmdName) || 253 | [...map.command.values()].find((x) => x.alias.find((x) => x.toLowerCase() == cmdName)); 254 | if (isCmd && !cmd) { 255 | var data = [...map.command.keys()]; 256 | [...map.command.values()] 257 | .map((x) => x.alias) 258 | .join(" ") 259 | .replace(/ +/gi, ",") 260 | .split(",") 261 | .map((a) => data.push(a)); 262 | var result = rzky.tools.detectTypo(cmdName, data); 263 | if (result.status != 200) return; 264 | teks = `Maybe this is what you mean?\n\n`; 265 | angka = 1; 266 | if (typeof result.result == "object" && typeof result.result != "undefined") { 267 | for (let i of result.result) { 268 | var alias = 269 | [...map.command.values()].find((x) => x.name == i.teks) || 270 | [...map.command.values()].find((x) => x.alias.find((x) => x.toLowerCase() == i.teks)); 271 | teks += `*${angka++}. ${map.prefix}${i.teks}*\n`; 272 | teks += `Alias: *${alias.alias.join(", ")}*\n`; 273 | teks += `Accuracy: *${i.keakuratan}*\n\n`; 274 | } 275 | teks += `If true, please re-command!`; 276 | await msg.reply(teks); 277 | } 278 | } 279 | 280 | if ( 281 | !isCmd && 282 | isUrl(msg.body) && 283 | /tiktok.com|soundcloud.com|imgur.com|pin.it|pinterest.com|youtube.com|youtu.be/i.test(msg.body) 284 | ) { 285 | try { 286 | var bod = isUrl(msg.body); 287 | var link = bod.find( 288 | (a) => 289 | a.includes("tiktok.com") || 290 | a.includes("pin.it") || 291 | a.includes("youtube.com") || 292 | a.includes("youtu.be") || 293 | a.includes("pinterest.com") || 294 | a.includes("imgur.com") || 295 | a.includes("soundcloud.com") 296 | ); 297 | let rz; 298 | await msg.reply("@" + sender.split("@")[0] + "\n" + response.wait, { withTag: true }); 299 | if (link.includes("tiktok.com")) { 300 | rz = await rzky.downloader.tiktok(link); 301 | } else { 302 | rz = await rzky.downloader.downloaderAll(link); 303 | } 304 | if (rz.url) { 305 | var res = rz.mp4[rz.mp4.length - 1] || rz.mp3[rz.mp3.length - 1]; 306 | delete rz.image; 307 | delete rz.status; 308 | delete rz.durasi; 309 | delete rz.mp4; 310 | delete rz.mp3; 311 | var parse = await rzky.tools.parseResult(rz, { title: "Auto Download" }); 312 | await conn.sendFile(msg.from, res.url, Date.now() + "media.mp4", parse, msg); 313 | } else if (link.includes("tiktok.com")) { 314 | var resu = rz.result; 315 | rz.size = resu.video.nowm.size; 316 | rz.audio_name = resu.audio.audio_name; 317 | delete rz.result; 318 | await conn.sendMessage( 319 | msg.from, 320 | { 321 | video: { url: resu.video.nowm.video_url }, 322 | caption: await rzky.tools.parseResult(rz, { title: "Auto Download" }), 323 | templateButtons: [ 324 | { urlButton: { displayText: "Source", url: link } }, 325 | { urlButton: { displayText: "Downloader", url: "https://down.rzkyfdlh.tech" } }, 326 | { quickReplyButton: { displayText: "Audio🎶", id: "#tiktokaudio " + link } }, 327 | ], 328 | }, 329 | { quoted: msg } 330 | ); 331 | } 332 | } catch (e) { 333 | console.log(e); 334 | } 335 | } 336 | 337 | if (!cmd) return; 338 | if (!cooldown.has(from)) { 339 | cooldown.set(from, new Map()); 340 | } 341 | const now = Date.now(); 342 | const timestamps = cooldown.get(from); 343 | const cdAmount = (cmd.options.cooldown || 5) * 1000; 344 | if (timestamps.has(from)) { 345 | const expiration = timestamps.get(from) + cdAmount; 346 | if (now < expiration) { 347 | if (isGroup) { 348 | let timeLeft = (expiration - now) / 1000; 349 | printSpam(conn, isGroup, sender, groupName); 350 | return await conn.sendMessage( 351 | from, 352 | { 353 | text: `This group is on cooldown, please wait another _${timeLeft.toFixed(1)} second(s)_`, 354 | }, 355 | { quoted: msg } 356 | ); 357 | } else if (!isGroup) { 358 | let timeLeft = (expiration - now) / 1000; 359 | printSpam(conn, isGroup, sender); 360 | return await conn.sendMessage( 361 | from, 362 | { 363 | text: `You are on cooldown, please wait another _${timeLeft.toFixed(1)} second(s)_`, 364 | }, 365 | { quoted: msg } 366 | ); 367 | } 368 | } 369 | } 370 | 371 | setTimeout(() => timestamps.delete(from), cdAmount); 372 | let optionsCmd = cmd.options; 373 | if (optionsCmd.noPrefix) { 374 | if (isCmd) return; 375 | q = msg.body.split(" ").splice(1).join(" "); 376 | } else if (!optionsCmd.noPrefix) { 377 | if (!isCmd) return; 378 | } 379 | if (optionsCmd.isSpam) { 380 | timestamps.set(from, now); 381 | } 382 | if (cmd && cmd.category != "private") { 383 | let comand = dashboard.find((command) => command.name == cmd.name); 384 | if (comand) { 385 | comand.success += 1; 386 | comand.lastUpdate = Date.now(); 387 | fs.writeFileSync("./database/dashboard.json", JSON.stringify(dashboard)); 388 | } else { 389 | await db.modified("dashboard", { name: cmd.name, success: 1, failed: 0, lastUpdate: Date.now() }); 390 | } 391 | } 392 | if (optionsCmd.isPremium && !isPremium) { 393 | await conn.sendMessage(msg.from, { text: response.OnlyPrem }, { quoted: msg }); 394 | return true; 395 | } 396 | if (map.lockcmd.has(cmdName)) { 397 | let alasan = map.lockcmd.get(cmdName); 398 | return msg.reply( 399 | `Sorry bro "${conn.getName(sender)}"" command "${cmdName}" has been disabled by owner\nReason: *${ 400 | alasan || "-" 401 | }*` 402 | ); 403 | } 404 | if (optionsCmd.isLimit && !isPremium) { 405 | if (isLimit(msg.sender, isPremium, isOwner, limitCount, limit) && !msg.isSelf) 406 | return msg.reply(`Your limit has run out, please send ${prefix}limit to check the limit`); 407 | limitAdd(msg.sender, limit); 408 | } 409 | if (optionsCmd.isLimitGame) { 410 | if (isGame(msg.sender, isOwner, gcount, glimit) && !msg.iSelf) 411 | return msg.reply(`Your game limit has run out`); 412 | gameAdd(msg.sender, glimit); 413 | } 414 | if (optionsCmd.isAdmin && !isAdmin) { 415 | await conn.sendMessage(msg.from, { text: response.GrupAdmin }, { quoted: msg }); 416 | return true; 417 | } 418 | if (optionsCmd.isQuoted && !msg.quoted) { 419 | await msg.reply(`Please reply message`); 420 | return true; 421 | } 422 | if (optionsCmd.isMedia) { 423 | let medianya = Media(optionsCmd.isMedia ? optionsCmd.isMedia : {}); 424 | if (typeof medianya[0] != "undefined" && !medianya.includes(msg.quoted ? msg.quoted.mtype : [])) 425 | return msg.reply( 426 | `Please reply *${medianya 427 | .map((a) => `${((aa = a.charAt(0).toUpperCase()), aa + a.slice(1).replace(/message/gi, ""))}`) 428 | .join("/")}*` 429 | ); 430 | } 431 | if (optionsCmd.isOwner && !isOwner && !msg.isSelf) { 432 | await conn.sendMessage(msg.from, { text: response.OnlyOwner }, { quoted: msg }); 433 | return true; 434 | } 435 | if (optionsCmd.isGroup && !isGroup) { 436 | await conn.sendMessage(msg.from, { text: response.OnlyGrup }, { quoted: msg }); 437 | return true; 438 | } 439 | if (optionsCmd.isBotAdmin && !botAdmin) { 440 | await conn.sendMessage(msg.from, { text: response.BotAdmin }, { quoted: msg }); 441 | return true; 442 | } 443 | if (optionsCmd.query && !q) { 444 | await msg.reply( 445 | typeof optionsCmd.query == "boolean" && optionsCmd.query ? `Masukan query` : optionsCmd.query 446 | ); 447 | return true; 448 | } 449 | if (optionsCmd.isPrivate && !isPrivate) { 450 | await conn.sendMessage(msg.from, { text: response.OnlyPM }, { quoted: msg }); 451 | return true; 452 | } 453 | if (optionsCmd.isUrl && !isUrl(q ? q : "p")) { 454 | await conn.sendMessage(msg.from, { text: response.error.Iv }, { quoted: msg }); 455 | return true; 456 | } 457 | if (optionsCmd.wait) { 458 | await conn.sendMessage( 459 | msg.from, 460 | { text: typeof optionsCmd.wait == "string" ? optionsCmd.wait : response.wait }, 461 | { quoted: msg } 462 | ); 463 | } 464 | try { 465 | await cmd.run( 466 | { msg, conn }, 467 | { owner: isOwner, q, map, args, arg, Baileys, prefix: temp_pref, response, chat: m, command: comand } 468 | ); 469 | } catch (e) { 470 | if (cmd.category != "private") { 471 | let fail = dashboard.find((command) => command.name == cmd.name); 472 | fail.failed += 1; 473 | fail.success -= 1; 474 | fail.lastUpdate = Date.now(); 475 | fs.writeFileSync("./database/dashboard.json", JSON.stringify(dashboard)); 476 | } 477 | await msg.reply(require("util").format(e), { isTranslate: false }); 478 | } 479 | } catch (e) { 480 | console.log(color("Error", "red"), e.stack); 481 | } 482 | }; 483 | -------------------------------------------------------------------------------- /index.js: -------------------------------------------------------------------------------- 1 | console.log("Starting..."); 2 | let { spawn } = require("child_process"); 3 | let path = require("path"); 4 | let fs = require("fs"); 5 | let package = require("./package.json"); 6 | 7 | var isRunning = false; 8 | /** 9 | * Start a js file 10 | * @param {String} file `path/to/file` 11 | */ 12 | function start(file) { 13 | if (isRunning) return; 14 | isRunning = true; 15 | let args = [path.join(__dirname, file), ...process.argv.slice(2)]; 16 | let p = spawn(process.argv[0], args, { 17 | stdio: ["inherit", "inherit", "inherit", "ipc"], 18 | }); 19 | p.on("message", (data) => { 20 | console.log("[RECEIVED]", data); 21 | switch (data) { 22 | case "reset": 23 | p.kill(); 24 | isRunning = false; 25 | start.apply(this, arguments); 26 | break; 27 | case "uptime": 28 | p.send(process.uptime()); 29 | break; 30 | } 31 | }); 32 | p.on("exit", (code) => { 33 | isRunning = false; 34 | console.error("Exited with code:", code); 35 | if (code === 0) return; 36 | fs.watchFile(args[0], () => { 37 | fs.unwatchFile(args[0]); 38 | start(file); 39 | }); 40 | }); 41 | // console.log(p) 42 | } 43 | 44 | start("main.js"); 45 | -------------------------------------------------------------------------------- /lib/Database.js: -------------------------------------------------------------------------------- 1 | const fs = require("fs"); 2 | const path = require("path"); 3 | const { sizeFormatter } = require("human-readable"); 4 | const formatSize = sizeFormatter({ 5 | std: "JEDEC", 6 | decimalPlaces: "2", 7 | keepTrailingZeroes: false, 8 | render: (literal, symbol) => `${literal} ${symbol}B`, 9 | }); 10 | const moment = require("moment-timezone"); 11 | const getPosition = (name, _dir, option) => { 12 | let position = null; 13 | Object.keys(_dir).forEach((i) => { 14 | if (_dir[i][option] === name) { 15 | position = i; 16 | } 17 | }); 18 | if (position !== null) { 19 | return position; 20 | } 21 | }; 22 | 23 | class Database { 24 | constructor(...args) { 25 | this.path = "database"; 26 | this.addDatabase = function (name) { 27 | if (!name) return "Empty name"; 28 | if (fs.existsSync(path.join(this.path, name + ".json"))) return `File '${name}' already available`; 29 | try { 30 | fs.writeFileSync(path.join(this.path, name + ".json"), "[]"); 31 | return `Writing file "${name}" success`; 32 | } catch (err) { 33 | console.error(err); 34 | return "Error writing file\n" + err; 35 | } 36 | }; 37 | this.rename = function (name, setName) { 38 | if (!name || !setName) return setName || name + "Empty file " + setName || name; 39 | if (!fs.existsSync(path.join(this.path, name + ".json"))) 40 | return `'${name}' file not found, please addDatabase first`; 41 | if (fs.existsSync(path.join(this.path, setName + ".json"))) return `'${setName}' is existed`; 42 | try { 43 | fs.renameSync(path.join(this.path, name + ".json"), path.join(this.path, setName + ".json")); 44 | return `successful rename file "${name}"`; 45 | } catch (err) { 46 | console.error(err); 47 | return "Error when renaming files\n" + err; 48 | } 49 | }; 50 | this.modified = function (name, options = "") { 51 | if (!name) return "empty name"; 52 | if (!options) return "empty options"; 53 | if (!fs.existsSync(path.join(this.path, name + ".json"))) 54 | return `'${name}' file not found, please addDatabe first`; 55 | try { 56 | let data = JSON.parse(fs.readFileSync(path.join(this.path, name + ".json"))); 57 | data.push(options); 58 | fs.writeFileSync(path.join(this.path, name + ".json"), JSON.stringify(data, null, 2)); 59 | return { 60 | message: `success add result\n"${options}"\nto file "${name}"`, 61 | result: JSON.parse(fs.readFileSync(path.join(this.path, name + ".json"))), 62 | }; 63 | } catch (e) { 64 | console.error(e); 65 | return "Error add result to file\n" + e; 66 | } 67 | }; 68 | this.deleteDatabase = function (name) { 69 | if (!name) return "empty name"; 70 | if (!fs.existsSync(path.join(this.path, name + ".json"))) 71 | return `'${name}' file not found, please addDatabase first`; 72 | try { 73 | fs.rmSync(path.join(this.path, name + ".json")); 74 | return `successfully delete file "${name}"`; 75 | } catch (err) { 76 | return `error delete file\n` + err; 77 | } 78 | }; 79 | this.cekDatabase = function (name, variable, data) { 80 | if (!name) return "empty name"; 81 | if (!variable) return `empty variable, if no variable set to "false"`; 82 | if (!data) return "empty data"; 83 | if (!fs.existsSync(path.join(this.path, name + ".json"))) 84 | return `'${name}' file not found, please addDatabase first`; 85 | try { 86 | const dataFind = JSON.parse(fs.readFileSync(path.join(this.path, name + ".json"))); 87 | return dataFind.find((da) => (variable ? da[variable] == data : da == data)) || false; 88 | } catch (err) { 89 | return "failed to retrieve data, " + String(err); 90 | } 91 | }; 92 | this.statDatabase = function (name) { 93 | if (!name) return "empty name"; 94 | if (!fs.existsSync(name)) return `'${name}' file not found, please addDatabase first`; 95 | try { 96 | let stat = fs.statSync(name); 97 | return { 98 | filename: path.basename(name), 99 | path: name, 100 | size: formatSize(stat.size), 101 | createdTime: moment(stat.ctimeMs).format("DD/MM/YY HH:mm:ss"), 102 | }; 103 | } catch (err) { 104 | console.log(err); 105 | return `failed loading file status`; 106 | } 107 | }; 108 | } 109 | } 110 | 111 | module.exports = Database; 112 | -------------------------------------------------------------------------------- /lib/Event.js: -------------------------------------------------------------------------------- 1 | const { EventEmitter } = require("events"); 2 | const ikyEvent = new EventEmitter(); 3 | 4 | module.exports = { ikyEvent }; 5 | -------------------------------------------------------------------------------- /lib/Proto.js: -------------------------------------------------------------------------------- 1 | Array.prototype.random = function () { 2 | const Random = (arr) => arr[Math.floor(Math.random() * arr.length)]; 3 | return Random(this); 4 | }; 5 | -------------------------------------------------------------------------------- /lib/antilink.js: -------------------------------------------------------------------------------- 1 | const { getBinaryNodeChild } = require("@adiwajshing/baileys"); 2 | const { getAdmin } = require("./index"); 3 | const antilink = JSON.parse(require("fs").readFileSync("./database/antilink.json")); 4 | 5 | const cekInvite = async (conn, code) => { 6 | try { 7 | const results = await conn.query({ 8 | tag: "iq", 9 | attrs: { 10 | type: "get", 11 | xmlns: "w:g2", 12 | to: "@g.us", 13 | }, 14 | content: [{ tag: "invite", attrs: { code } }], 15 | }); 16 | return results; 17 | } catch { 18 | return false; 19 | } 20 | }; 21 | 22 | const extractGroupInviteMetadata = (content) => { 23 | const group = getBinaryNodeChild(content, "group"); 24 | const descChild = getBinaryNodeChild(group, "description"); 25 | const Participant = group.content.filter((a) => a.tag == "participant").map((a) => a.attrs); 26 | let desc, descId; 27 | if (descChild) { 28 | try { 29 | desc = getBinaryNodeChild(descChild, "body").content.toString(); 30 | descId = descChild.attrs.id; 31 | } catch { 32 | descId = ""; 33 | desc = "tidak ada"; 34 | } 35 | } 36 | const groupId = group.attrs.id.includes("@") ? group.attrs.id : group.attrs.id + "@g.us"; 37 | const metadata = { 38 | id: groupId, 39 | subject: group.attrs.subject || "Tidak ada", 40 | creator: group.attrs.creator || "Tidak terdeteksi", 41 | creation: group.attrs.creation || "Tidak terdeteksi", 42 | desc, 43 | descId, 44 | participant: Participant, 45 | }; 46 | return metadata; 47 | }; 48 | 49 | module.exports = async function (msg, conn) { 50 | const { body, sender, isGroup, from, reply } = msg; 51 | const regex = /chat.whatsapp.com\/([\w\d]*)/gi; 52 | code = body.match(regex); 53 | const isAdmin = isGroup ? (await getAdmin(conn, msg)).includes(sender) : false; 54 | const antiLink = antilink.includes(from); 55 | const botAdmin = isGroup ? (await getAdmin(conn, msg)).includes(conn.decodeJid(conn.user.id)) : false; 56 | if (antiLink && code && !isAdmin) { 57 | code = code[0].replace("chat.whatsapp.com/", ""); 58 | if (!botAdmin) return reply("Bot is not admin to run anti link group command"); 59 | await reply("Checking Link Invite..."); 60 | const cekInviteGc = await cekInvite(conn, code); 61 | if (!cekInviteGc) return reply("Invalid Link, You Saved from kick"); 62 | const InfoGroup = await extractGroupInviteMetadata(cekInviteGc); 63 | const Cheking = await conn.groupInviteCode(from); 64 | if (code == Cheking) return reply("Oh shit, Remember don't send other group links other than this group"); 65 | const participant = InfoGroup.participant; 66 | teks = `*• Link Group Detected*\n\n`; 67 | teks += `*_Sorry you will be kicked out of this group for breaking the rules!_*\n\n`; 68 | InfoGroup.user = "@" + sender.split("@")[0]; 69 | InfoGroup.creator = "@" + InfoGroup.creator.split("@")[0]; 70 | InfoGroup.creation = require("moment")(InfoGroup.creation * 1000).format("dddd, DD/MM/YYYY"); 71 | delete InfoGroup.participant; 72 | teks += (await rzky.tools.parseResult(InfoGroup, { title: "Inspect Group" })) + "\n\n"; 73 | teks += `=== [ *Members* ] ===\n`; 74 | for (let i of participant) { 75 | teks += `➤ @${i.jid.split("@")[0]} ${i.type ? `*${i.type}*` : ""}\n`; 76 | } 77 | await reply(teks, { withTag: true }); 78 | conn.logger.info("Kicked User " + sender + " Reason: Link Group"); 79 | await require("delay")(3000); 80 | await conn.groupParticipantsUpdate(from, [sender], "remove").then(() => msg.reply("bye")); 81 | } 82 | }; 83 | 84 | global.reloadFile(__dirname); 85 | -------------------------------------------------------------------------------- /lib/convert.js: -------------------------------------------------------------------------------- 1 | const ffmpeg = require("fluent-ffmpeg"); 2 | const fs = require("fs"); 3 | const path = require("path"); 4 | const run = require("child_process").exec; 5 | const Exif = require("./exif"); 6 | const ex = new Exif(); 7 | 8 | function convert(file, ext1, ext2, options = []) { 9 | return new Promise(async (resolve, reject) => { 10 | let temp = path.join(__dirname, "../temp", Date.now() + "." + ext1), 11 | out = temp + "." + ext2; 12 | await fs.promises.writeFile(temp, file); 13 | ffmpeg(temp) 14 | .on("start", (cmd) => { 15 | console.log(cmd); 16 | }) 17 | .on("error", (e) => { 18 | fs.unlinkSync(temp); 19 | reject(e); 20 | }) 21 | .on("end", () => { 22 | console.log("Finish"); 23 | setTimeout(() => { 24 | fs.unlinkSync(temp); 25 | fs.unlinkSync(out); 26 | }, 2000); 27 | resolve(fs.readFileSync(out)); 28 | }) 29 | .addOutputOptions(options) 30 | .toFormat(ext2) 31 | .save(out); 32 | }); 33 | } 34 | 35 | function convert2(file, ext1, ext2, options = []) { 36 | return new Promise(async (resolve, reject) => { 37 | let temp = path.join(__dirname, "../temp", Date.now() + "." + ext1), 38 | out = temp + "." + ext2; 39 | await fs.promises.writeFile(temp, file); 40 | ffmpeg(temp) 41 | .on("start", (cmd) => { 42 | console.log(cmd); 43 | }) 44 | .on("error", (e) => { 45 | fs.unlinkSync(temp); 46 | reject(e); 47 | }) 48 | .on("end", () => { 49 | console.log("Finish"); 50 | setTimeout(() => { 51 | fs.unlinkSync(temp); 52 | fs.unlinkSync(out); 53 | }, 2000); 54 | resolve(fs.readFileSync(out)); 55 | }) 56 | .addOutputOptions(options) 57 | .seekInput("00:00") 58 | .setDuration("00:05") 59 | .toFormat(ext2) 60 | .save(out); 61 | }); 62 | } 63 | 64 | async function WAVideo(file, ext1) { 65 | return convert(file, ext1, "mp4", [ 66 | "-c:a aac", 67 | "-c:v libx264", 68 | "-b:a 128K", 69 | "-ar 44100", 70 | "-crf 28", 71 | "-preset slow", 72 | ]); 73 | } 74 | 75 | async function WAAudio(file, ext1) { 76 | return convert(file, ext1, "mp3", ["-vn", "-b:a 192K", "-ar 44100", "-ac 2"]); 77 | } 78 | 79 | async function WAOpus(file, ext1) { 80 | return convert(file, ext1, "opus", ["-vn", "-c:a libopus", "-b:a 128K", "-vbr on", "-compression_level 10"]); 81 | } 82 | 83 | async function sticker(file, opts) { 84 | if (typeof opts.cmdType === "undefined") opts.cmdType = "1"; 85 | const cmd = { 86 | 1: [ 87 | "-fs 1M", 88 | "-vcodec", 89 | "libwebp", 90 | "-vf", 91 | `scale=512:512:flags=lanczos:force_original_aspect_ratio=decrease,format=rgba,pad=512:512:(ow-iw)/2:(oh-ih)/2:color=#00000000,setsar=1`, 92 | ], 93 | 2: ["-fs 1M", "-vcodec", "libwebp"], 94 | }; 95 | if (opts.withPackInfo) { 96 | if (!opts.packInfo) throw Error("'packInfo' must be filled when using 'withPackInfo'"); 97 | let ext = opts.isImage !== undefined || false ? "jpg" : opts.isVideo !== undefined || false ? "mp4" : null; 98 | return stickerWithExif(file, ext, opts.packInfo, cmd[parseInt(opts.cmdType)]); 99 | } 100 | 101 | if (opts.isImage) { 102 | return convert(file, "jpg", "webp", cmd[parseInt(opts.cmdType)]); 103 | } 104 | if (opts.isSticker) { 105 | return convert(file, "webp", "webp", cmd[parseInt(opts.cmdType)]); 106 | } 107 | if (opts.isVideo) { 108 | return convert2(file, "mp4", "webp", cmd[parseInt(opts.cmdType)]); 109 | } 110 | } 111 | 112 | function stickerWithExif(file, ext, packInfo, cmd) { 113 | return new Promise(async (res, rej) => { 114 | let { packname, author } = packInfo; 115 | const filename = Date.now(); 116 | const stickerBuffer = 117 | ext === "jpg" ? await convert(file, ext, "webp", cmd) : await convert2(file, ext, "webp", cmd); 118 | ex.create( 119 | packname !== undefined || "" ? packname : "Original", 120 | author !== undefined || "" ? author : "Rzky-Bot", 121 | filename 122 | ); 123 | await fs.promises.writeFile(`./temp/${filename}.webp`, stickerBuffer); 124 | run( 125 | `webpmux -set exif ./temp/${filename}.exif ./temp/${filename}.webp -o ./temp/${filename}.webp`, 126 | async (err) => { 127 | if (err) 128 | rej(err) && 129 | (await Promise.all([ 130 | fs.unlink(`./temp/${filename}.webp`), 131 | fs.unlink(`./temp/${filename}.exif`), 132 | ])); 133 | setTimeout(() => { 134 | fs.unlinkSync(`./temp/${filename}.exif`); 135 | fs.unlinkSync(`./temp/${filename}.webp`); 136 | }, 2000); 137 | res(fs.readFileSync(`./temp/${filename}.webp`)); 138 | } 139 | ); 140 | }); 141 | } 142 | 143 | module.exports = { 144 | toVideo: WAVideo, 145 | toAudio: WAAudio, 146 | toOpus: WAOpus, 147 | sticker, 148 | convert, 149 | convert2, 150 | }; 151 | -------------------------------------------------------------------------------- /lib/converter.js: -------------------------------------------------------------------------------- 1 | const fs = require("fs"); 2 | const path = require("path"); 3 | const { spawn } = require("child_process"); 4 | 5 | function ffmpeg(buffer, args = [], ext = "", ext2 = "") { 6 | return new Promise(async (resolve, reject) => { 7 | try { 8 | let tmp = path.join(__dirname, "../temp", +new Date() + "." + ext); 9 | let out = tmp + "." + ext2; 10 | await fs.promises.writeFile(tmp, buffer); 11 | spawn("ffmpeg", ["-y", "-i", tmp, ...args, out]) 12 | .on("error", reject) 13 | .on("close", async (code) => { 14 | try { 15 | await fs.promises.unlink(tmp); 16 | if (code !== 0) return reject(code); 17 | resolve({ data: await fs.promises.readFile(out), filename: out }); 18 | // await fs.promises.unlink(out) 19 | } catch (e) { 20 | reject(e); 21 | } 22 | }); 23 | } catch (e) { 24 | reject(e); 25 | } 26 | }); 27 | } 28 | 29 | /** 30 | * Convert Audio to Playable WhatsApp Audio 31 | * @param {Buffer} buffer Audio Buffer 32 | * @param {String} ext File Extension 33 | */ 34 | function toPTT(buffer, ext) { 35 | return ffmpeg(buffer, ["-vn", "-c:a", "libopus", "-b:a", "128k", "-vbr", "on"], ext, "ogg"); 36 | } 37 | 38 | /** 39 | * Convert Audio to Playable WhatsApp PTT 40 | * @param {Buffer} buffer Audio Buffer 41 | * @param {String} ext File Extension 42 | */ 43 | function toAudio(buffer, ext) { 44 | return ffmpeg( 45 | buffer, 46 | ["-vn", "-c:a", "libopus", "-b:a", "128k", "-vbr", "on", "-compression_level", "10"], 47 | ext, 48 | "opus" 49 | ); 50 | } 51 | 52 | /** 53 | * Convert Audio to Playable WhatsApp Video 54 | * @param {Buffer} buffer Video Buffer 55 | * @param {String} ext File Extension 56 | */ 57 | function toVideo(buffer, ext) { 58 | return ffmpeg( 59 | buffer, 60 | ["-c:v", "libx264", "-c:a", "aac", "-ab", "128k", "-ar", "44100", "-crf", "32", "-preset", "slow"], 61 | ext, 62 | "mp4" 63 | ); 64 | } 65 | 66 | module.exports = { 67 | toAudio, 68 | toPTT, 69 | toVideo, 70 | ffmpeg, 71 | }; 72 | -------------------------------------------------------------------------------- /lib/exif.js: -------------------------------------------------------------------------------- 1 | /* Originally created by cwke 2 | * Reuploaded by Waxaranai 3 | * Recoded by SlavyanDesu 4 | * 5 | * GitHub is an open-source community, so why are you so triggered when someone shared some simple code? 6 | */ 7 | 8 | const fs = require("fs"); 9 | const packID = "com.snowcorp.stickerly.android.stickercontentprovider b5e7275f-f1de-4137-961f-57becfad34f2"; 10 | const playstore = ""; 11 | const itunes = ""; 12 | 13 | /** 14 | * @class Exif 15 | */ 16 | module.exports = class Exif { 17 | constructor() {} 18 | 19 | /** 20 | * Create an EXIF file. 21 | * @param {String} packname 22 | * @param {String} authorname 23 | * @param {String} filename 24 | */ 25 | create(packname, authorname, filename) { 26 | if (!filename) filename = "data"; 27 | const json = { 28 | "sticker-pack-id": packID, 29 | "sticker-pack-name": packname, 30 | "sticker-pack-publisher": authorname, 31 | "android-app-store-link": playstore, 32 | "ios-app-store-link": itunes, 33 | emojis: ["😁"], 34 | }; 35 | let len = new TextEncoder().encode(JSON.stringify(json)).length; 36 | const f = Buffer.from([0x49, 0x49, 0x2a, 0x00, 0x08, 0x00, 0x00, 0x00, 0x01, 0x00, 0x41, 0x57, 0x07, 0x00]); 37 | const code = [0x00, 0x00, 0x16, 0x00, 0x00, 0x00]; 38 | if (len > 256) { 39 | len = len - 256; 40 | code.unshift(0x01); 41 | } else { 42 | code.unshift(0x00); 43 | } 44 | const fff = Buffer.from(code); 45 | const ffff = Buffer.from(JSON.stringify(json)); 46 | if (len < 16) { 47 | len = len.toString(16); 48 | len = "0" + len; 49 | } else { 50 | len = len.toString(16); 51 | } 52 | const ff = Buffer.from(len, "hex"); 53 | const buffer = Buffer.concat([f, ff, fff, ffff]); 54 | fs.writeFile(`./temp/${filename}.exif`, buffer, (err) => { 55 | if (err) return console.error(err); 56 | console.log("Success!"); 57 | }); 58 | } 59 | }; 60 | -------------------------------------------------------------------------------- /lib/exif2.js: -------------------------------------------------------------------------------- 1 | const fs = require("fs"); 2 | const { spawn } = require("child_process"); 3 | const getRandom = (ext) => { 4 | return `${Math.floor(Math.random() * 10000)}${ext}`; 5 | }; 6 | const ff = require("fluent-ffmpeg"); 7 | 8 | exports.createExif = (pack, auth) => { 9 | const code = [0x00, 0x00, 0x16, 0x00, 0x00, 0x00]; 10 | const exif = { 11 | "sticker-pack-id": "com.client.tech", 12 | "sticker-pack-name": pack, 13 | "sticker-pack-publisher": auth, 14 | "android-app-store-link": "https://play.google.com/store/apps/details?id=com.termux", 15 | "ios-app-store-link": "https://itunes.apple.com/app/sticker-maker-studio/id1443326857", 16 | }; 17 | let len = JSON.stringify(exif).length; 18 | if (len > 256) { 19 | len = len - 256; 20 | code.unshift(0x01); 21 | } else { 22 | code.unshift(0x00); 23 | } 24 | if (len < 16) { 25 | len = len.toString(16); 26 | len = "0" + len; 27 | } else { 28 | len = len.toString(16); 29 | } 30 | //len = len < 16 ? `0${len.toString(16)}` : len.toString(16) 31 | const _ = Buffer.from([0x49, 0x49, 0x2a, 0x00, 0x08, 0x00, 0x00, 0x00, 0x01, 0x00, 0x41, 0x57, 0x07, 0x00]); 32 | const __ = Buffer.from(len, "hex"); 33 | const ___ = Buffer.from(code); 34 | const ____ = Buffer.from(JSON.stringify(exif)); 35 | fs.writeFileSync("./temp/data.exif", Buffer.concat([_, __, ___, ____]), function (err) { 36 | console.log(err); 37 | if (err) return console.error(err); 38 | return `./temp/data.exif`; 39 | }); 40 | }; 41 | 42 | exports.modStick = (media, client, mek, from) => { 43 | out = getRandom(".webp"); 44 | try { 45 | console.log(media); 46 | spawn("webpmux", ["-set", "exif", "./temp/data.exif", media, "-o", out]).on("exit", () => { 47 | client.sendMessage(from, { sticker: fs.readFileSync(out) }, { quoted: mek }); 48 | fs.unlinkSync(out); 49 | fs.unlinkSync(media); 50 | }); 51 | } catch (e) { 52 | console.log(e); 53 | client.sendMessage(from, { text: "Terjadi keslahan" }, { quoted: mek.messages.all()[0] }); 54 | fs.unlinkSync(media); 55 | } 56 | }; 57 | 58 | exports.modMedia = (media, client, mek, from, fps) => { 59 | out = getRandom(".webp"); 60 | try { 61 | ff(media) 62 | .on("error", (e) => { 63 | console.log(e); 64 | client.sendMessage(from, { text: "Terjadi kesalahan" }, { quoted: mek }); 65 | fs.unlinkSync(media); 66 | }) 67 | .on("end", () => { 68 | _out = getRandom(".webp"); 69 | spawn("webpmux", ["-set", "exif", "./temp/data.exif", out, "-o", _out]).on("exit", () => { 70 | client.sendMessage(from, { sticker: fs.readFileSync(_out) }, { quoted: mek }); 71 | fs.unlinkSync(out); 72 | fs.unlinkSync(_out); 73 | fs.unlinkSync(media); 74 | }); 75 | }) 76 | .addOutputOptions([ 77 | `-vcodec`, 78 | `libwebp`, 79 | `-vf`, 80 | `scale='min(320,iw)':min'(320,ih)':force_original_aspect_ratio=decrease,fps=${fps}, pad=320:320:-1:-1:color=white@0.0, split [a][b]; [a] palettegen=reserve_transparent=on:transparency_color=ffffff [p]; [b][p] paletteuse`, 81 | ]) 82 | .toFormat("webp") 83 | .save(out); 84 | } catch (e) { 85 | console.log(e); 86 | client.sendMessage(from, { text: "Terjadi kesalahan" }, { quoted: mek }); 87 | fs.unlinkSync(media); 88 | } 89 | }; 90 | -------------------------------------------------------------------------------- /lib/game.js: -------------------------------------------------------------------------------- 1 | const similarity = require("similarity"); 2 | const threshold = 0.72; 3 | 4 | module.exports = async function (msg, conn, map) { 5 | const { sender, body, from, quoted } = msg; 6 | const { AmbilJawaban, cekStatus, cekWaktu, getPosition } = require("./optiongame"); 7 | const { prefix } = map; 8 | 9 | if (msg.quoted) { 10 | const id = quoted.key.id; 11 | const cek = conn.game[id] ? conn.game[id].status : false; 12 | if (!msg.quoted.key.fromMe && !/Happy\sAnswering/i.test(msg.quoted.text)) return !0; 13 | if (cek && id in conn.game) return msg.reply("Soal itu telah berakhir"); 14 | if (cekStatus(from, map, "tebakbendera")) { 15 | const finds = map.tebakbendera.get(from); 16 | if (msg.quoted.key.id == finds.idChat) { 17 | if (body.toLowerCase().includes(AmbilJawaban(from, map, "tebakbendera"))) { 18 | var htgm = Math.floor(Math.random() * 300); 19 | addBalance(sender, htgm, balance); 20 | await msg.reply( 21 | `*Congratulations your answer is correct!*\n*Answer :* ${AmbilJawaban( 22 | from, 23 | map, 24 | "tebakbendera" 25 | )}\n*Present :* $${htgm}\n\nWant to play again? send *${prefix}tebakbendera*` 26 | ); 27 | map.tebakbendera.delete(from); 28 | conn.game[id] = { status: true }; 29 | } else if (similarity(body.toLowerCase(), AmbilJawaban(from, map, "tebakbendera")) >= threshold) 30 | msg.reply(`*Dikit Lagi!*`); 31 | else msg.reply(`*Wrong!*`); 32 | } 33 | } 34 | } 35 | }; 36 | 37 | // Auto Update 38 | global.reloadFile(__dirname); 39 | -------------------------------------------------------------------------------- /lib/imgtopdf.js: -------------------------------------------------------------------------------- 1 | const pdfkit = require("pdfkit"); 2 | const sizes = require("./pdfSize.json"); 3 | const fetch = require("node-fetch"); 4 | 5 | /** 6 | * 7 | * Thanks to Arya-Was 8 | * @param {Array} images array of image 9 | * @param {String} size default A4 10 | * @returns 11 | */ 12 | 13 | function toPDF(images = [], size = "A4") { 14 | return new Promise(async (resolve, reject) => { 15 | if (!Array.isArray(images)) throw new TypeError("images must be an array"); 16 | let _size = sizes[size]; 17 | if (!_size) throw new Error("Size is invalid!"); 18 | let buffs = []; 19 | const doc = new pdfkit({ margin: 0, size: sizes[size] }); 20 | for (let img of images) { 21 | const resp = await fetch(img); 22 | const data = await resp.buffer(); 23 | doc.image(data, 0, 0, { 24 | fit: _size, 25 | align: "center", 26 | valign: "center", 27 | }); 28 | doc.addPage(); 29 | } 30 | doc.on("data", (chunk) => buffs.push(chunk)); 31 | doc.on("end", () => resolve(Buffer.concat(buffs))); 32 | doc.on("error", (err) => reject(err)); 33 | doc.end(); 34 | }); 35 | } 36 | 37 | module.exports = { 38 | toPDF, 39 | }; 40 | -------------------------------------------------------------------------------- /lib/index.js: -------------------------------------------------------------------------------- 1 | const chalk = require("chalk"); 2 | const moment = require("moment"); 3 | require("moment-duration-format")(moment); 4 | 5 | exports.color = (text, color) => { 6 | return !color ? chalk.green(text) : chalk.keyword(color)(text); 7 | }; 8 | 9 | exports.getAdmin = async (conn, msg) => { 10 | var nganu = await conn.groupMetadata(msg.from); 11 | a = []; 12 | for (let i of nganu.participants) { 13 | if (i.admin == null) continue; 14 | a.push(i.id); 15 | } 16 | return a; 17 | }; 18 | 19 | exports.convertTime = function (time) { 20 | return `${moment.duration(Date.now() - time).format("D [hari], H [jam], m [menit], s [detik]")}`; 21 | }; 22 | 23 | exports.isUrl = (url) => { 24 | return url.match( 25 | new RegExp( 26 | /https?:\/\/(www\.)?[-a-zA-Z0-9@:%._+~#=]{1,256}\.[a-zA-Z0-9()]{1,6}\b([-a-zA-Z0-9()@:%_+.~#?&/=]*)/, 27 | "gi" 28 | ) 29 | ); 30 | }; 31 | -------------------------------------------------------------------------------- /lib/limit.js: -------------------------------------------------------------------------------- 1 | const fs = require("fs"); 2 | 3 | exports.isLimit = function (sender, isPremium, isOwner, limitCount, _db) { 4 | if (isOwner) return false; 5 | if (isPremium) return false; 6 | let found = false; 7 | for (let i of _db) { 8 | if (i.id === sender) { 9 | let limits = i.limit; 10 | if (limits >= limitCount) { 11 | found = true; 12 | return true; 13 | } else { 14 | found = true; 15 | return false; 16 | } 17 | } 18 | } 19 | if (found === false) { 20 | const obj = { id: sender, limit: 0 }; 21 | _db.push(obj); 22 | fs.writeFileSync("./database/limit.json", JSON.stringify(_db)); 23 | return false; 24 | } 25 | }; 26 | exports.limitAdd = function (sender, _db) { 27 | let found = false; 28 | Object.keys(_db).forEach((i) => { 29 | if (_db[i].id === sender) { 30 | found = i; 31 | } 32 | }); 33 | if (found !== false) { 34 | _db[found].limit += 1; 35 | fs.writeFileSync("./database/limit.json", JSON.stringify(_db)); 36 | } 37 | }; 38 | exports.getLimit = function (sender, limitCount, _db) { 39 | let found = false; 40 | Object.keys(_db).forEach((i) => { 41 | if (_db[i].id === sender) { 42 | found = i; 43 | } 44 | }); 45 | if (found !== false) { 46 | return limitCount - _db[found].limit; 47 | } else { 48 | return limitCount; 49 | } 50 | }; 51 | exports.giveLimit = function (pemain, duit, _db) { 52 | let position = false; 53 | Object.keys(_db).forEach((i) => { 54 | if (_db[i].id === pemain) { 55 | position = i; 56 | } 57 | }); 58 | if (position !== false) { 59 | _db[position].limit -= duit; 60 | fs.writeFileSync("./database/limit.json", JSON.stringify(_db)); 61 | } else { 62 | const njt = duit - duit - duit; 63 | const bulim = { 64 | id: pemain, 65 | limit: njt, 66 | }; 67 | _db.push(bulim); 68 | fs.writeFileSync("./database/limit.json", JSON.stringify(_db)); 69 | } 70 | }; 71 | exports.addBalance = function (sender, duit, _db) { 72 | let position = false; 73 | Object.keys(_db).forEach((i) => { 74 | if (_db[i].id === sender) { 75 | position = i; 76 | } 77 | }); 78 | if (position !== false) { 79 | _db[position].balance += duit; 80 | fs.writeFileSync("./database/balance.json", JSON.stringify(_db)); 81 | } else { 82 | const bulin = { 83 | id: sender, 84 | balance: duit, 85 | }; 86 | _db.push(bulin); 87 | fs.writeFileSync("./database/balance.json", JSON.stringify(_db)); 88 | } 89 | }; 90 | exports.kurangBalance = function (sender, duit, _db) { 91 | let position = false; 92 | Object.keys(_db).forEach((i) => { 93 | if (_db[i].id === sender) { 94 | position = i; 95 | } 96 | }); 97 | if (position !== false) { 98 | _db[position].balance -= duit; 99 | fs.writeFileSync("./database/balance.json", JSON.stringify(_db)); 100 | } 101 | }; 102 | exports.getBalance = function (sender, _db) { 103 | let position = false; 104 | Object.keys(_db).forEach((i) => { 105 | if (_db[i].id === sender) { 106 | position = i; 107 | } 108 | }); 109 | if (position !== false) { 110 | return _db[position].balance; 111 | } else { 112 | return 0; 113 | } 114 | }; 115 | exports.isGame = function (sender, isOwner, gcount, _db) { 116 | if (isOwner) { 117 | return false; 118 | } 119 | let found = false; 120 | for (let i of _db) { 121 | if (i.id === sender) { 122 | let limits = i.glimit; 123 | if (limits >= gcount) { 124 | found = true; 125 | return true; 126 | } else { 127 | found = true; 128 | return false; 129 | } 130 | } 131 | } 132 | if (found === false) { 133 | let obj = { id: sender, glimit: 0 }; 134 | _db.push(obj); 135 | fs.writeFileSync("./database/glimit.json", JSON.stringify(_db)); 136 | return false; 137 | } 138 | }; 139 | exports.gameAdd = function (sender, _db) { 140 | var found = false; 141 | Object.keys(_db).forEach((i) => { 142 | if (_db[i].id == sender) { 143 | found = i; 144 | } 145 | }); 146 | if (found !== false) { 147 | _db[found].glimit += 1; 148 | fs.writeFileSync("./database/glimit.json", JSON.stringify(_db)); 149 | } 150 | }; 151 | exports.givegame = function (pemain, duit, _db) { 152 | let position = false; 153 | Object.keys(_db).forEach((i) => { 154 | if (_db[i].id === pemain) { 155 | position = i; 156 | } 157 | }); 158 | if (position !== false) { 159 | _db[position].glimit -= duit; 160 | fs.writeFileSync("./database/glimit.json", JSON.stringify(_db)); 161 | } else { 162 | const njti = duit - duit - duit; 163 | const bulimi = { 164 | id: pemain, 165 | glimit: njti, 166 | }; 167 | _db.push(bulimi); 168 | fs.writeFileSync("./database/glimit.json", JSON.stringify(_db)); 169 | } 170 | }; 171 | exports.cekGLimit = function (sender, gcount, _db) { 172 | let position = false; 173 | Object.keys(_db).forEach((i) => { 174 | if (_db[i].id === sender) { 175 | position = i; 176 | } 177 | }); 178 | if (position !== false) { 179 | return gcount - _db[position].glimit; 180 | } else { 181 | return gcount; 182 | } 183 | }; 184 | -------------------------------------------------------------------------------- /lib/nhentaidl.js: -------------------------------------------------------------------------------- 1 | let nhentai = require("nhentai-node-api"); 2 | let topdf = require("image-to-pdf"); 3 | let request = require("request"); 4 | let fs = require("fs-extra"); 5 | 6 | // module 7 | const FormData = require("form-data"); 8 | const { default: Axios } = require("axios"); 9 | const filetype = require("file-type"); 10 | //end module 11 | 12 | //function upload file 13 | const uploadFile = (path) => 14 | new Promise((resolve, reject) => { 15 | const fs = require("fs"); 16 | const fd = new FormData(); 17 | fd.append("file", fs.createReadStream(path)); 18 | Axios({ 19 | method: "POST", 20 | url: "https://uploader.caliph.my.id/upload", 21 | data: fd, 22 | maxContentLength: Infinity, 23 | maxBodyLength: Infinity, 24 | headers: { 25 | "user-agent": "MRHRTZ-ZONE :D", 26 | "content-type": `multipart/form-data; boundary=${fd._boundary}`, 27 | }, 28 | }) 29 | .then(({ data }) => resolve(data)) 30 | .catch(reject); 31 | }); 32 | // end function 33 | exports.toURL = uploadFile; 34 | 35 | exports.NhentaiDL = async (msg, args, conn) => { 36 | if (!args[0]) return msg.reply(`Penggunaan #nhentai 298547`); 37 | if (isNaN(args[0])) return msg.reply("Pake angka"); 38 | await msg.reply("Loading..."); 39 | let count = 0; 40 | let ResultPdf = []; 41 | let doujin = await nhentai.getDoujin(args[0]); 42 | let title = doujin.title.default; 43 | let details = doujin.details; 44 | let parodies = details.parodies.map((v) => v.name); 45 | let characters = details.characters.map((v) => v.name); 46 | let tags = details.tags.map((v) => v.name); 47 | let artists = details.artists.map((v) => v.name); 48 | let groups = details.groups.map((v) => v.name); 49 | let categories = details.categories.map((v) => v.name); 50 | let array_page = doujin.pages.map((a) => a.replace(/(t[0-9]\.nhentai)/, "i.nhentai")); 51 | 52 | await conn.sendFile( 53 | msg.from, 54 | array_page[0], 55 | Date.now() + ".jpg", 56 | `*${title}*\n_${doujin.title.native || ""}_\n• Language: ${doujin.language}\n• Parodies: ${parodies.join( 57 | ", " 58 | )}\n• Groups: ${groups.join(", ")}\n• Artists: ${artists.join(", ")}\n• Tags: ${tags.join( 59 | ", " 60 | )}\n• Categories: ${categories.join(", ")}\n• Pages: ${array_page.length}\n• Favorited: ${ 61 | doujin.favorites 62 | }\n• Link: ${doujin.link}`, 63 | msg 64 | ); 65 | if (array_page.length > 50) return msg.reply("terlalu banyak halaman, Maks Page 50!"); 66 | for (let i = 0; i < array_page.length; i++) { 67 | if (!fs.existsSync("./nhentai")) fs.mkdirSync("./nhentai"); 68 | let image_name = "./nhentai/" + title + i + ".jpg"; 69 | await new Promise((resolve) => 70 | request(array_page[i]).pipe(fs.createWriteStream(image_name)).on("finish", resolve) 71 | ); 72 | console.log(array_page[i]); 73 | ResultPdf.push(image_name); 74 | count++; 75 | } 76 | 77 | await new Promise((resolve) => 78 | topdf(ResultPdf, "A4") 79 | .pipe(fs.createWriteStream("./nhentai/" + title + ".pdf")) 80 | .on("finish", resolve) 81 | ); 82 | 83 | for (let i = 0; i < array_page.length; i++) { 84 | fs.unlink("./nhentai/" + title + i + ".jpg"); 85 | } 86 | 87 | let size = await fs.statSync(`./nhentai/${title}.pdf`).size; 88 | if (size < 10000000) { 89 | await msg.reply("Uploading..."); 90 | let thumbnail = await conn.getBuffer(doujin.cover); 91 | await conn 92 | .sendFile(msg.from, fs.readFileSync(`./nhentai/${title}.pdf`), `${title}.pdf`, "", msg, false, { 93 | asDocument: true, 94 | thumbnail: thumbnail, 95 | }) 96 | .then(() => fs.unlinkSync(`./nhentai/${title}.pdf`)); 97 | } else { 98 | await msg.reply("Uploading to up.rzkyfdlh.tech because file size to large"); 99 | URL = await uploadFile(`./nhentai/${title}.pdf`); 100 | fs.unlinkSync(`./nhentai/${title}.pdf`); 101 | await msg.reply("Link download to file: " + URL.result.url); 102 | } 103 | }; 104 | -------------------------------------------------------------------------------- /lib/optiongame.js: -------------------------------------------------------------------------------- 1 | const toMs = require("ms"); 2 | 3 | const addSesi = (chatId, idChat, jawaban, expired, map, game) => { 4 | addMap(game); 5 | map[game].set(chatId, { id: chatId, idChat, jawaban: jawaban, expired: Date.now() + toMs(`${expired}s`) }); 6 | }; 7 | const AmbilJawaban = (chatId, map, game) => { 8 | let jawab = map[game].get(chatId); 9 | if (jawab) return jawab.jawaban; 10 | return false; 11 | }; 12 | const cekStatus = (chatId, map, game) => { 13 | if (typeof map[game] != "object") return false; 14 | let jawab = map[game].get(chatId); 15 | return jawab ? true : false; 16 | }; 17 | const cekWaktu = (conn, map, game) => { 18 | if (typeof map[game] != "object") return; 19 | setInterval(() => { 20 | let position = null; 21 | Object.keys([...map[game].values()]).forEach((i) => { 22 | if (Date.now() >= [...map[game].values()][i].expired) { 23 | position = i; 24 | } 25 | }); 26 | if (position !== null) { 27 | conn.sendMessage([...map[game].values()][position].id, { 28 | text: `*Time has run out*\n\n*Answer :* ${[...map[game].values()][position].jawaban}`, 29 | }); 30 | map[game].delete([...map[game].values()][position].id); 31 | } 32 | }, 1000); 33 | }; 34 | const getPosition = (chatId, map, game) => { 35 | let position = null; 36 | Object.keys([...map[game].values()]).forEach((i) => { 37 | if ([...map[game].values()][i].id === chatId) { 38 | position = i; 39 | } 40 | }); 41 | if (position !== null) { 42 | return position; 43 | } 44 | }; 45 | module.exports = { addSesi, AmbilJawaban, cekStatus, cekWaktu, getPosition }; 46 | -------------------------------------------------------------------------------- /lib/pdfSize.json: -------------------------------------------------------------------------------- 1 | { 2 | "4A0": [4767.87, 6740.79], 3 | "2A0": [3370.39, 4767.87], 4 | "A0": [2383.94, 3370.39], 5 | "A1": [1683.78, 2383.94], 6 | "A2": [1190.55, 1683.78], 7 | "A3": [841.89, 1190.55], 8 | "A4": [595.28, 841.89], 9 | "A5": [419.53, 595.28], 10 | "A6": [297.64, 419.53], 11 | "A7": [209.76, 297.64], 12 | "A8": [147.4, 209.76], 13 | "A9": [104.88, 147.4], 14 | "A10": [73.7, 104.88], 15 | "B0": [2834.65, 4008.19], 16 | "B1": [2004.09, 2834.65], 17 | "B2": [1417.32, 2004.09], 18 | "B3": [1000.63, 1417.32], 19 | "B4": [708.66, 1000.63], 20 | "B5": [498.9, 708.66], 21 | "B6": [354.33, 498.9], 22 | "B7": [249.45, 354.33], 23 | "B8": [175.75, 249.45], 24 | "B9": [124.72, 175.75], 25 | "B10": [87.87, 124.72], 26 | "C0": [2599.37, 3676.54], 27 | "C1": [1836.85, 2599.37], 28 | "C2": [1298.27, 1836.85], 29 | "C3": [918.43, 1298.27], 30 | "C4": [649.13, 918.43], 31 | "C5": [459.21, 649.13], 32 | "C6": [323.15, 459.21], 33 | "C7": [229.61, 323.15], 34 | "C8": [161.57, 229.61], 35 | "C9": [113.39, 161.57], 36 | "C10": [79.37, 113.39], 37 | "RA0": [2437.8, 3458.27], 38 | "RA1": [1729.13, 2437.8], 39 | "RA2": [1218.9, 1729.13], 40 | "RA3": [864.57, 1218.9], 41 | "RA4": [609.45, 864.57], 42 | "SRA0": [2551.18, 3628.35], 43 | "SRA1": [1814.17, 2551.18], 44 | "SRA2": [1275.59, 1814.17], 45 | "SRA3": [907.09, 1275.59], 46 | "SRA4": [637.8, 907.09], 47 | "EXECUTIVE": [521.86, 756.0], 48 | "FOLIO": [612.0, 936.0], 49 | "LEGAL": [612.0, 1008.0], 50 | "LETTER": [612.0, 792.0], 51 | "TABLOID": [792.0, 1224.0] 52 | } 53 | -------------------------------------------------------------------------------- /lib/premium.js: -------------------------------------------------------------------------------- 1 | const fs = require("fs"); 2 | const toMs = require("ms"); 3 | 4 | /** 5 | * Add premium user. 6 | * @param {String} userId 7 | * @param {String} expired 8 | * @param {Object} _dir 9 | */ 10 | const addPremiumUser = (userId, expired, _dir) => { 11 | const cekUser = premium.find((user) => user.id == userId); 12 | if (cekUser) { 13 | cekUser.expired = cekUser.expired + toMs(expired); 14 | } else { 15 | const obj = { id: userId, expired: Date.now() + toMs(expired) }; 16 | _dir.push(obj); 17 | } 18 | fs.writeFileSync("./database/premium.json", JSON.stringify(_dir)); 19 | }; 20 | 21 | /** 22 | * Get premium user position. 23 | * @param {String} userId 24 | * @param {Object} _dir 25 | * @returns {Number} 26 | */ 27 | const getPremiumPosition = (userId, _dir) => { 28 | let position = null; 29 | Object.keys(_dir).forEach((i) => { 30 | if (_dir[i].id === userId) { 31 | position = i; 32 | } 33 | }); 34 | if (position !== null) { 35 | return position; 36 | } 37 | }; 38 | 39 | /** 40 | * Get premium user expire. 41 | * @param {String} userId 42 | * @param {Object} _dir 43 | * @returns {Number} 44 | */ 45 | const getPremiumExpired = (userId, _dir) => { 46 | let position = null; 47 | Object.keys(_dir).forEach((i) => { 48 | if (_dir[i].id === userId) { 49 | position = i; 50 | } 51 | }); 52 | if (position !== null) { 53 | return _dir[position].expired; 54 | } 55 | }; 56 | 57 | /** 58 | * Check user is premium. 59 | * @param {String} userId 60 | * @param {Object} _dir 61 | * @returns {Boolean} 62 | */ 63 | const checkPremiumUser = (userId, _dir) => { 64 | let status = false; 65 | Object.keys(_dir).forEach((i) => { 66 | if (_dir[i].id === userId) { 67 | status = true; 68 | } 69 | }); 70 | return status; 71 | }; 72 | 73 | /** 74 | * Constantly checking premium. 75 | * @param {Object} _dir 76 | */ 77 | const expiredCheck = (conn, msg, _dir) => { 78 | setInterval(() => { 79 | let position = null; 80 | Object.keys(_dir).forEach((i) => { 81 | if (Date.now() >= _dir[i].expired) { 82 | position = i; 83 | } 84 | }); 85 | if (position !== null) { 86 | idny = _dir[position].id; 87 | console.log(`Premium expired: ${_dir[position].id}`); 88 | _dir.splice(position, 1); 89 | fs.writeFileSync("./database/premium.json", JSON.stringify(_dir)); 90 | idny ? conn.sendMessage(idny, { text: "Your Premium Role has run out" }) : ""; 91 | idny = false; 92 | } 93 | }, 1000); 94 | }; 95 | 96 | /** 97 | * Get all premium user ID. 98 | * @param {Object} _dir 99 | * @returns {String[]} 100 | */ 101 | const getAllPremiumUser = (_dir) => { 102 | const array = []; 103 | Object.keys(_dir).forEach((i) => { 104 | array.push(_dir[i].id); 105 | }); 106 | return array; 107 | }; 108 | 109 | module.exports = { 110 | addPremiumUser, 111 | getPremiumExpired, 112 | getPremiumPosition, 113 | expiredCheck, 114 | checkPremiumUser, 115 | getAllPremiumUser, 116 | }; 117 | -------------------------------------------------------------------------------- /lib/response.json: -------------------------------------------------------------------------------- 1 | { 2 | "wait": "_Wait a minute, data is being processed!_", 3 | "error": { 4 | "Iv": "The link you provided is not valid", 5 | "api": "Sorry an error occurred" 6 | }, 7 | "OnlyGrup": "This command can only be used in groups", 8 | "OnlyPM": "This command can only be used in private messages", 9 | "GrupAdmin": "This command can only be used by Group Admin", 10 | "BotAdmin": "Bot Must be admin", 11 | "OnlyOwner": "This command can only be used by the bot owner", 12 | "OnlyPrem": "This command is only for premium members" 13 | } 14 | -------------------------------------------------------------------------------- /lib/serialize.js: -------------------------------------------------------------------------------- 1 | const { proto, jidDecode, downloadContentFromMessage, getContentType } = require("@adiwajshing/baileys"), 2 | path = require("path"), 3 | fetch = require("node-fetch"), 4 | fs = require("fs"), 5 | chalk = require("chalk"), 6 | moment = require("moment"), 7 | Baileys = require("@adiwajshing/baileys"), 8 | { fromBuffer } = require("file-type"), 9 | { isUrl } = require("./index"), 10 | phonenumber = require("awesome-phonenumber"), 11 | { toOpus, toAudio, convert, convert2 } = require("./convert"), 12 | { toPTT, toAudio: toAudio2 } = require("./converter"), 13 | cmd = { 14 | 1: [ 15 | "-fs 1M", 16 | "-vcodec", 17 | "libwebp", 18 | "-vf", 19 | `scale=512:512:flags=lanczos:force_original_aspect_ratio=decrease,format=rgba,pad=512:512:(ow-iw)/2:(oh-ih)/2:color=#00000000,setsar=1`, 20 | ], 21 | 2: ["-fs 1M", "-vcodec", "libwebp"], 22 | }; 23 | 24 | const downloadMedia = (message, pathFile) => 25 | new Promise(async (resolve, reject) => { 26 | let type = Object.keys(message)[0]; 27 | let mimeMap = { 28 | imageMessage: "image", 29 | videoMessage: "video", 30 | stickerMessage: "sticker", 31 | documentMessage: "document", 32 | audioMessage: "audio", 33 | }; 34 | let mes = message; 35 | if (type == "templateMessage") { 36 | mes = message.templateMessage.hydratedFourRowTemplate; 37 | type = Object.keys(mes)[0]; 38 | } 39 | if (type == "buttonsMessage") { 40 | mes = message.buttonsMessage; 41 | type = Object.keys(mes)[0]; 42 | } 43 | try { 44 | if (pathFile) { 45 | const stream = await downloadContentFromMessage(mes[type], mimeMap[type]); 46 | let buffer = Buffer.from([]); 47 | for await (const chunk of stream) { 48 | buffer = Buffer.concat([buffer, chunk]); 49 | } 50 | await fs.promises.writeFile(pathFile, buffer); 51 | resolve(pathFile); 52 | } else { 53 | const stream = await downloadContentFromMessage(mes[type], mimeMap[type]); 54 | let buffer = Buffer.from([]); 55 | for await (const chunk of stream) { 56 | buffer = Buffer.concat([buffer, chunk]); 57 | } 58 | resolve(buffer); 59 | } 60 | } catch (e) { 61 | reject(e); 62 | } 63 | }); 64 | async function serialize(msg, conn) { 65 | conn.decodeJid = (jid) => { 66 | if (/:\d+@/gi.test(jid)) { 67 | const decode = jidDecode(jid) || {}; 68 | return ((decode.user && decode.server && decode.user + "@" + decode.server) || jid).trim(); 69 | } else return jid; 70 | }; 71 | /** 72 | * getBuffer hehe 73 | * @param {String|Buffer} path 74 | * @param {Boolean} returnFilename 75 | */ 76 | conn.getFile = async (PATH, returnAsFilename) => { 77 | let res, filename; 78 | let data = Buffer.isBuffer(PATH) 79 | ? PATH 80 | : /^data:.*?\/.*?;base64,/i.test(PATH) 81 | ? Buffer.from(PATH.split`,`[1], "base64") 82 | : /^https?:\/\//.test(PATH) 83 | ? await (res = await fetch(PATH)).buffer() 84 | : fs.existsSync(PATH) 85 | ? ((filename = PATH), fs.readFileSync(PATH)) 86 | : typeof PATH === "string" 87 | ? PATH 88 | : Buffer.alloc(0); 89 | if (!Buffer.isBuffer(data)) throw new TypeError("Result is not a buffer"); 90 | let type = (await fromBuffer(data)) || { 91 | mime: "application/octet-stream", 92 | ext: ".bin", 93 | }; 94 | if (data && returnAsFilename && !filename) 95 | (filename = path.join(__dirname, "../temp/" + new Date() * 1 + "." + type.ext)), 96 | await fs.promises.writeFile(filename, data); 97 | return { 98 | res, 99 | filename, 100 | ...type, 101 | data, 102 | }; 103 | }; 104 | 105 | conn.getName = (jid, withoutContact = false) => { 106 | id = conn.decodeJid(jid); 107 | withoutContact = conn.withoutContact || withoutContact; 108 | let v; 109 | if (id.endsWith("@g.us")) 110 | return new Promise(async (resolve) => { 111 | v = store.contacts[id] || {}; 112 | if (!(v.name || v.subject)) v = conn.groupMetadata(id) || {}; 113 | resolve( 114 | v.name || 115 | v.subject || 116 | require("awesome-phonenumber")("+" + id.replace("@s.whatsapp.net", "")).getNumber( 117 | "international" 118 | ) 119 | ); 120 | }); 121 | else 122 | v = 123 | id === "0@s.whatsapp.net" 124 | ? { 125 | id, 126 | name: "WhatsApp", 127 | } 128 | : id === conn.decodeJid(conn.user.id) 129 | ? conn.user 130 | : store.contacts[id] || {}; 131 | return ( 132 | (withoutContact ? "" : v.name) || 133 | v.subject || 134 | v.verifiedName || 135 | require("awesome-phonenumber")("+" + jid.replace("@s.whatsapp.net", "")).getNumber("international") 136 | ); 137 | }; 138 | conn.getBuffer = async (url, options) => { 139 | try { 140 | options ? options : {}; 141 | const res = await require("axios")({ 142 | method: "get", 143 | url, 144 | headers: { 145 | DNT: 1, 146 | "Upgrade-Insecure-Request": 1, 147 | }, 148 | ...options, 149 | responseType: "arraybuffer", 150 | }); 151 | return res.data; 152 | } catch (e) { 153 | console.log(`Error : ${e}`); 154 | } 155 | }; 156 | conn.sendContact = async (jid, contact, quoted = false, opts = {}) => { 157 | let list = []; 158 | for (let i of contact) { 159 | num = typeof i == "number" ? i + "@s.whatsapp.net" : i; 160 | num2 = typeof i == "number" ? i : i.split("@")[0]; 161 | list.push({ 162 | displayName: await conn.getName(num), 163 | vcard: `BEGIN:VCARD\nVERSION:3.0\nFN:${await conn.getName(num)}\nFN:${await conn.getName( 164 | num 165 | )}\nitem1.TEL;waid=${num2}:${num2}\nitem1.X-ABLabel:Ponsel\nitem2.EMAIL;type=INTERNET:${ 166 | config.email 167 | }\nitem2.X-ABLabel:Email\nitem3.URL:${ 168 | config.instagram 169 | }\nitem3.X-ABLabel:Instagram\nitem4.ADR:;;Indonesia;;;;\nitem4.X-ABLabel:Region\nEND:VCARD`, 170 | }); 171 | } 172 | return conn.sendMessage( 173 | jid, 174 | { contacts: { displayName: `${list.length} Kontak`, contacts: list }, ...opts }, 175 | { quoted } 176 | ); 177 | }; 178 | conn.sendSticker = async (jid, url, quoted, option = {}) => { 179 | let ext; 180 | let buf = url; 181 | if (!Buffer.isBuffer(url)) buf = await conn.getBuffer(url); 182 | if (!Buffer.isBuffer(url)) ext = await fromBuffer(buf); 183 | if (Buffer.isBuffer(url)) ext = await fromBuffer(buf); 184 | url = 185 | ext == "mp4" 186 | ? await convert2(buf, ext.ext, "webp", cmd[parseInt(option.cmdType ? option.cmdType : 1)]) 187 | : await convert(buf, ext.ext, "webp", cmd[parseInt(option.cmdType ? option.cmdType : 1)]); 188 | let sticker = { url }; 189 | console.log(url); 190 | return conn.sendMessage(jid, { sticker: url, ...option }, { quoted }); 191 | }; 192 | 193 | conn.logger = { 194 | ...conn.logger, 195 | info(...args) { 196 | console.log( 197 | chalk.bold.rgb( 198 | 57, 199 | 183, 200 | 16 201 | )(`INFO [${chalk.rgb(255, 255, 255)(moment(Date.now()).format(" dddd, DD MMMM YYYY HH:mm:ss "))}]`), 202 | chalk.cyan(...args) 203 | ); 204 | }, 205 | error(...args) { 206 | console.log( 207 | chalk.bold.rgb( 208 | 247, 209 | 38, 210 | 33 211 | )(`ERROR [${chalk.rgb(255, 255, 255)(moment(Date.now()).format(" dddd, DD MMMM YYYY HH:mm:ss "))}]:`), 212 | chalk.rgb(255, 38, 0)(...args) 213 | ); 214 | }, 215 | warn(...args) { 216 | console.log( 217 | chalk.bold.rgb( 218 | 239, 219 | 225, 220 | 3 221 | )(`WARNING [${chalk.rgb(255, 255, 255)(moment(Date.now()).format(" dddd, DD MMMM YYYY HH:mm:ss "))}]:`), 222 | chalk.keyword("orange")(...args) 223 | ); 224 | }, 225 | }; 226 | 227 | conn.sendGroupV4Invite = async ( 228 | jid, 229 | participant, 230 | inviteCode, 231 | inviteExpiration, 232 | groupName = "unknown subject", 233 | jpegThumbnail, 234 | caption = "Invitation to join my WhatsApp group", 235 | options = {} 236 | ) => { 237 | let msg = Baileys.proto.Message.fromObject({ 238 | groupInviteMessage: Baileys.proto.GroupInviteMessage.fromObject({ 239 | inviteCode, 240 | inviteExpiration: inviteExpiration ? parseInt(inviteExpiration) : +new Date(new Date() + 3 * 86400000), 241 | groupJid: jid, 242 | groupName: groupName ? groupName : (await conn.groupMetadata(jid)).subject, 243 | jpegThumbnail, 244 | caption, 245 | }), 246 | }); 247 | const ms = Baileys.generateWAMessageFromContent(participant, msg, options); 248 | await conn.relayMessage(participant, ms.message, { messageId: ms.key.id }); 249 | }; 250 | 251 | conn.sendImage = async (jid, url, quoted, option = {}) => { 252 | let ext; 253 | let buf = url; 254 | if (!Buffer.isBuffer(url)) buf = await conn.getBuffer(url); 255 | if (!Buffer.isBuffer(url)) ext = await fromBuffer(buf); 256 | if (Buffer.isBuffer(url)) ext = await fromBuffer(buf); 257 | let type = /jpg|png|webp/i.test(ext.ext); 258 | if (!type) return ReferenceError(`Format file invalid`); 259 | url = buf; 260 | return conn.sendMessage(jid, { image: url, ...option }, { quoted }); 261 | }; 262 | 263 | conn.sendVideo = async (jid, url, quoted, option = {}) => { 264 | let ext; 265 | let buf = url; 266 | if (!Buffer.isBuffer(url)) buf = await conn.getBuffer(url); 267 | if (!Buffer.isBuffer(url)) ext = await fromBuffer(buf); 268 | if (Buffer.isBuffer(url)) ext = await fromBuffer(buf); 269 | let type = /gif|webm|mp4/i.test(ext.ext); 270 | if (!type) return ReferenceError(`Format file invalid`); 271 | url = 272 | ext.ext !== "mp4" 273 | ? await convert(buf, ext.ext, "mp4", cmd[parseInt(option.cmdType ? option.cmdType : 1)]) 274 | : buf; 275 | return conn.sendMessage(jid, { video: url, ...option, mimetype: ext.mimetype }, { quoted }); 276 | }; 277 | conn.sendAudio = async (jid, url, quoted, ptt = false, option = {}) => { 278 | let ext; 279 | let buf = url; 280 | if (!Buffer.isBuffer(url)) buf = await conn.getBuffer(url); 281 | if (!Buffer.isBuffer(url)) ext = await fromBuffer(buf); 282 | if (Buffer.isBuffer(url)) ext = await fromBuffer(buf); 283 | let type = /mp3|wav|opus|m4a/i.test(ext.ext); 284 | if (!type) return ReferenceError(`Format file invalid`); 285 | url = 286 | ext.ext !== "mp3" 287 | ? await convert(buf, ext.ext, "mp3", cmd[parseInt(option.cmdType ? option.cmdType : 1)]) 288 | : buf; 289 | return conn.sendFile(msg.from, url, Date.now() / 1000 + ext.ext, "", quoted, ptt); 290 | }; 291 | 292 | conn.sendFile = async (jid, path, filename = "", caption = "", quoted, ptt = false, options = {}) => { 293 | let type = await conn.getFile(path, true); 294 | let { res, data: file, filename: pathFile } = type; 295 | if ((res && res.status !== 200) || file.length <= 65536) { 296 | try { 297 | throw { json: JSON.parse(file.toString()) }; 298 | } catch (e) { 299 | if (e.json) throw e.json; 300 | } 301 | } 302 | let opt = { filename }; 303 | if (quoted) opt.quoted = quoted; 304 | if (!type) if (options.asDocument) options.asDocument = true; 305 | let mtype = "", 306 | mimetype = type.mime; 307 | let naem = (a) => "./temp/" + Date.now() + "." + a; 308 | if (/webp/.test(type.mime)) mtype = "sticker"; 309 | else if (/image/.test(type.mime)) mtype = "image"; 310 | else if (/video/.test(type.mime)) mtype = "video"; 311 | else if (/audio/.test(type.mime)) 312 | (ss = await (ptt ? toPTT : toAudio2)(file, type.ext)), 313 | (skk = await require("file-type").fromBuffer(ss.data)), 314 | (ty = naem(skk.ext)), 315 | require("fs").writeFileSync(ty, ss.data), 316 | (pathFile = ty), 317 | (mtype = "audio"), 318 | (mimetype = "audio/mpeg"); 319 | else mtype = "document"; 320 | conn.sendMessage( 321 | jid, 322 | { 323 | ...options, 324 | caption, 325 | ptt, 326 | fileName: filename, 327 | [mtype]: { url: pathFile }, 328 | mimetype, 329 | }, 330 | { 331 | ...opt, 332 | ...options, 333 | } 334 | ).then(() => { 335 | fs.unlinkSync(pathFile); 336 | conn.logger.info("delete file " + pathFile); 337 | }); 338 | }; 339 | if (msg.key) { 340 | msg.id = msg.key.id; 341 | msg.isSelf = msg.key.fromMe; 342 | msg.from = msg.key.remoteJid; 343 | msg.isGroup = msg.from.endsWith("@g.us"); 344 | msg.sender = msg.isGroup 345 | ? conn.decodeJid(msg.key.participant) 346 | : msg.isSelf 347 | ? conn.decodeJid(conn.user.id) 348 | : msg.from; 349 | } 350 | if (msg.message) { 351 | msg.type = getContentType(msg.message); 352 | if (msg.type === "ephemeralMessage") { 353 | msg.message = msg.message[msg.type].message; 354 | const tipe = Object.keys(msg.message)[0]; 355 | msg.type = tipe; 356 | if (tipe === "viewOnceMessage") { 357 | msg.message = msg.message[msg.type].message; 358 | msg.type = getContentType(msg.message); 359 | } 360 | } 361 | if (msg.type === "viewOnceMessage") { 362 | msg.message = msg.message[msg.type].message; 363 | msg.type = getContentType(msg.message); 364 | } 365 | 366 | try { 367 | msg.mentions = msg.message[msg.type].contextInfo 368 | ? msg.message[msg.type].contextInfo.mentionedJid || [] 369 | : []; 370 | } catch { 371 | msg.mentions = []; 372 | } 373 | try { 374 | const quoted = msg.message[msg.type].contextInfo; 375 | if (quoted.quotedMessage["ephemeralMessage"]) { 376 | const tipe = Object.keys(quoted.quotedMessage.ephemeralMessage.message)[0]; 377 | if (tipe === "viewOnceMessage") { 378 | msg.quoted = { 379 | type: "view_once", 380 | stanzaId: quoted.stanzaId, 381 | sender: conn.decodeJid(quoted.participant), 382 | message: quoted.quotedMessage.ephemeralMessage.message.viewOnceMessage.message, 383 | }; 384 | } else { 385 | msg.quoted = { 386 | type: "ephemeral", 387 | stanzaId: quoted.stanzaId, 388 | sender: conn.decodeJid(quoted.participant), 389 | message: quoted.quotedMessage.ephemeralMessage.message, 390 | }; 391 | } 392 | } else if (quoted.quotedMessage["viewOnceMessage"]) { 393 | msg.quoted = { 394 | type: "view_once", 395 | stanzaId: quoted.stanzaId, 396 | sender: conn.decodeJid(quoted.participant), 397 | message: quoted.quotedMessage.viewOnceMessage.message, 398 | }; 399 | } else { 400 | msg.quoted = { 401 | type: "normal", 402 | stanzaId: quoted.stanzaId, 403 | sender: conn.decodeJid(quoted.participant), 404 | message: quoted.quotedMessage, 405 | }; 406 | } 407 | msg.quoted.isSelf = msg.quoted.sender === conn.decodeJid(conn.user.id); 408 | msg.quoted.mtype = Object.keys(msg.quoted.message).filter( 409 | (v) => v.includes("Message") || v.includes("conversation") 410 | )[0]; 411 | msg.quoted.text = 412 | msg.quoted.message[msg.quoted.mtype].text || 413 | msg.quoted.message[msg.quoted.mtype].description || 414 | msg.quoted.message[msg.quoted.mtype].caption || 415 | (msg.quoted.mtype == "templateButtonReplyMessage" && 416 | msg.quoted.message[msg.quoted.mtype].hydratedTemplate["hydratedContentText"]) || 417 | msg.quoted.message[msg.quoted.mtype] || 418 | ""; 419 | msg.quoted.key = { 420 | id: msg.quoted.stanzaId, 421 | fromMe: msg.quoted.isSelf, 422 | remoteJid: msg.from, 423 | }; 424 | msg.quoted.delete = () => conn.sendMessage(msg.from, { delete: msg.quoted.key }); 425 | msg.quoted.download = (pathFile) => downloadMedia(msg.quoted.message, pathFile); 426 | } catch (e) { 427 | msg.quoted = null; 428 | } 429 | try { 430 | msg.body = 431 | msg.message.conversation || 432 | msg.message[msg.type].text || 433 | msg.message[msg.type].caption || 434 | (msg.type === "listResponseMessage" && msg.message[msg.type].singleSelectReply.selectedRowId) || 435 | (msg.type === "buttonsResponseMessage" && 436 | msg.message[msg.type].selectedButtonId && 437 | msg.message[msg.type].selectedButtonId) || 438 | (msg.type === "templateButtonReplyMessage" && msg.message[msg.type].selectedId) || 439 | ""; 440 | } catch { 441 | msg.body = ""; 442 | } 443 | msg.getQuotedObj = msg.getQuotedMessage = async () => { 444 | if (!msg.quoted.stanzaId) return false; 445 | let q = await store.loadMessage(msg.from, msg.quoted.stanzaId, conn); 446 | return serialize(q, conn); 447 | }; 448 | msg.reply = async (text, opt = { isTranslate: true }) => 449 | conn.sendMessage( 450 | msg.from, 451 | { 452 | text: require("util").format(text), 453 | mentions: opt.withTag 454 | ? [...text.matchAll(/@([0-9]{5,16}|0)/g)].map((v) => v[1] + "@s.whatsapp.net") 455 | : [], 456 | ...opt, 457 | }, 458 | { ...opt, quoted: msg } 459 | ); 460 | msg.download = (pathFile) => downloadMedia(msg.message, pathFile); 461 | } 462 | return msg; 463 | } 464 | 465 | module.exports = { serialize, downloadMedia }; 466 | -------------------------------------------------------------------------------- /lib/topdf.js: -------------------------------------------------------------------------------- 1 | module.exports = async function (msg, conn, map) { 2 | const { toPDF } = require("./imgtopdf.js"); 3 | const sizes = require("./pdfSize.json"); 4 | const { sender, type, isGroup, body, from, quoted } = msg; 5 | const cekStat = map.pdf.has(sender); 6 | const sesi = map.pdf; 7 | const content = JSON.stringify(quoted); 8 | const isMedia = type === "imageMessage"; 9 | const isQImg = msg.quoted ? /image/i.test(msg.quoted.mtype) : false; 10 | const size = Object.keys(sizes); 11 | 12 | // Only Private Chat 13 | if (isGroup) return; 14 | 15 | switch (body.toLowerCase()) { 16 | case "add": 17 | if (!cekStat) return; 18 | if (msg.quoted) { 19 | if (!isQImg) return msg.reply("reply photo"); 20 | } else { 21 | if (!isMedia) return msg.reply("reply photo"); 22 | } 23 | let media; 24 | if (isQImg) media = await quoted.download(); 25 | if (isMedia) media = await msg.download(); 26 | var ImageUrl = await rzky.tools.telegraph(media); 27 | sesi.get(sender).array.push(ImageUrl.url); 28 | await msg.reply( 29 | `Sukses Menambahkan Gambar,Kirim *Selesai* Jika Sudah\nJika ingin mencancel ketik *cancel*` 30 | ); 31 | break; 32 | case "cancel": 33 | if (!cekStat) return; 34 | sesi.delete(sender); 35 | await msg.reply(`Sukses menghapus sesi Image To Pdf`); 36 | break; 37 | case "selesai": 38 | if (!cekStat) return; 39 | var result = sesi.get(sender); 40 | if (!result) return msg.reply(`Kamu belum menambahkan foto`); 41 | var angka = 1; 42 | var teks = "Size Lembaran PDF \n\n"; 43 | for (let i of size) { 44 | teks += `*${angka++}*. ${i}\n`; 45 | } 46 | teks += 47 | "\nSilahkan pilih size pdf yang kamu ingin kan, *Size Default _A4_*\n\nReply Pesan ini Dengan Size Yang kamu pilih"; 48 | await msg.reply(teks); 49 | await conn.sendImage(from, "https://telegra.ph/file/2a3251d4089e573e02ebb.jpg", msg, { 50 | caption: "Contoh Penggunaan / Usage examples", 51 | }); 52 | break; 53 | default: 54 | if (size.includes(body.toUpperCase()) && cekStat) { 55 | if (!quoted.text.includes("Size Lembaran PDF")) return; 56 | var result = sesi.get(sender); 57 | var buffer = await toPDF(result.array, body.toUpperCase()); 58 | await msg.reply(`Mengirim PDF, Tunggu Sebentar`); 59 | await conn.sendFile(from, buffer, result.name + ".pdf", "", msg); 60 | await msg.reply(`Sukses mengirim`); 61 | return sesi.delete(sender); 62 | } 63 | } 64 | }; 65 | -------------------------------------------------------------------------------- /lib/webp2.js: -------------------------------------------------------------------------------- 1 | const fetch = require("node-fetch"); 2 | const FormData = require("form-data"); 3 | const { JSDOM } = require("jsdom"); 4 | 5 | async function webp2mp4(source) { 6 | let form = new FormData(); 7 | let isUrl = typeof source === "string" && /https?:\/\//.test(source); 8 | form.append("new-image-url", isUrl ? source : ""); 9 | form.append("new-image", isUrl ? "" : source, "image.webp"); 10 | let res = await fetch("https://ezgif.com/webp-to-mp4", { 11 | method: "POST", 12 | body: form, 13 | }); 14 | let html = await res.text(); 15 | let { document } = new JSDOM(html).window; 16 | let form2 = new FormData(); 17 | let obj = {}; 18 | for (let input of document.querySelectorAll("form input[name]")) { 19 | obj[input.name] = input.value; 20 | form2.append(input.name, input.value); 21 | } 22 | let res2 = await fetch("https://ezgif.com/webp-to-mp4/" + obj.file, { 23 | method: "POST", 24 | body: form2, 25 | }); 26 | let html2 = await res2.text(); 27 | let { document: document2 } = new JSDOM(html2).window; 28 | return new URL(document2.querySelector("div#output > p.outfile > video > source").src, res2.url).toString(); 29 | } 30 | 31 | async function webp2png(source) { 32 | let form = new FormData(); 33 | let isUrl = typeof source === "string" && /https?:\/\//.test(source); 34 | form.append("new-image-url", isUrl ? source : ""); 35 | form.append("new-image", isUrl ? "" : source, "image.webp"); 36 | let res = await fetch("https://ezgif.com/webp-to-png", { 37 | method: "POST", 38 | body: form, 39 | }); 40 | let html = await res.text(); 41 | let { document } = new JSDOM(html).window; 42 | let form2 = new FormData(); 43 | let obj = {}; 44 | for (let input of document.querySelectorAll("form input[name]")) { 45 | obj[input.name] = input.value; 46 | form2.append(input.name, input.value); 47 | } 48 | let res2 = await fetch("https://ezgif.com/webp-to-png/" + obj.file, { 49 | method: "POST", 50 | body: form2, 51 | }); 52 | let html2 = await res2.text(); 53 | let { document: document2 } = new JSDOM(html2).window; 54 | return new URL(document2.querySelector("div#output > p.outfile > img").src, res2.url).toString(); 55 | } 56 | 57 | if (require.main === module) { 58 | // TODO: Test 59 | webp2mp4("https://mathiasbynens.be/demo/animated-webp-supported.webp").then(console.error); 60 | webp2png("https://mathiasbynens.be/demo/animated-webp-supported.webp").then(console.error); 61 | } else { 62 | module.exports = { webp2mp4, webp2png }; 63 | } 64 | -------------------------------------------------------------------------------- /lib/welcome.js: -------------------------------------------------------------------------------- 1 | const fs = require("fs"); 2 | 3 | module.exports = async (conn, msg) => { 4 | require("moment").locale("id"); 5 | let groupData = await conn.groupMetadata(msg.id); 6 | let participant = msg.participants; 7 | let dataLeft = db.cekDatabase("left", "id", msg.id) || { id: "" }; 8 | let dataWelcome = db.cekDatabase("welcome", "id", msg.id) || { id: "" }; 9 | if (msg.action == "add") global.statParticipant = true; 10 | for (let i of participant) { 11 | let ppimg; 12 | try { 13 | ppimg = await conn.profilePictureUrl(i, "image"); 14 | } catch { 15 | ppimg = config.thumb; 16 | } 17 | if (msg.action == "add" && dataWelcome.id.includes(msg.id)) { 18 | await conn.sendMessage(msg.id, { 19 | image: { url: ppimg }, 20 | withTag: true, 21 | caption: 22 | dataWelcome.teks 23 | .replace("@ownergc", `${groupData.owner ? groupData.owner.split("@")[0] : "Tidak Diketahui"}`) 24 | .replace( 25 | "@creation", 26 | require("moment")(new Date(parseInt(groupData.creation) * 1000)).format( 27 | "DD MMM YYYY HH:mm:ss" 28 | ) 29 | ) 30 | .replace("@user", `@${i.split("@")[0]}`) 31 | .replace("@desc", groupData.desc ? groupData.desc.toString() : "no description") 32 | .replace("@subject", groupData.subject) + 33 | `${ 34 | dataWelcome.lastUpdate 35 | ? `\n\n*Last Modified:* ${require("moment")(dataWelcome.lastUpdte).format( 36 | "dddd, DD/MM/YYYY" 37 | )}` 38 | : "" 39 | }`, 40 | }); 41 | } else if (msg.action == "remove" && dataLeft.id.includes(msg.id)) { 42 | await conn.sendMessage(msg.id, { 43 | image: { url: ppimg }, 44 | withTag: true, 45 | caption: 46 | dataLeft.teks 47 | .replace("@ownergc", `${groupData.owner ? groupData.owner.split("@")[0] : "Tidak Diketahui"}`) 48 | .replace( 49 | "@creation", 50 | require("moment")(new Date(parseInt(groupData.creation) * 1000)).format( 51 | "DD MMM YYYY HH:mm:ss" 52 | ) 53 | ) 54 | .replace("@user", `@${i.split("@")[0]}`) 55 | .replace("@desc", groupData.desc ? groupData.desc.toString() : "no description") 56 | .replace("@subject", groupData.subject) + 57 | `${ 58 | dataLeft.lastUpdate 59 | ? `\n\n*Last Modified:* ${require("moment")(dataLeft.lastUpdte).format("dddd, DD/MM/YYYY")}` 60 | : "" 61 | }`, 62 | }); 63 | } 64 | } 65 | }; 66 | -------------------------------------------------------------------------------- /lib/y2mate.js: -------------------------------------------------------------------------------- 1 | const fetch = require("node-fetch"); 2 | const cheerio = require("cheerio"); 3 | 4 | const y2mateV = async (yutub, qualityny) => { 5 | function post(url, formdata) { 6 | return fetch(url, { 7 | method: "POST", 8 | headers: { 9 | accept: "*/*", 10 | "accept-language": "en-US,en;q=0.9", 11 | "content-type": "application/x-www-form-urlencoded; charset=UTF-8", 12 | }, 13 | body: new URLSearchParams(Object.entries(formdata)), 14 | }); 15 | } 16 | const ytIdRegex = 17 | /(?:http(?:s|):\/\/|)(?:(?:www\.|)youtube(?:\-nocookie|)\.com\/(?:watch\?.*(?:|\&)v=|embed\/|v\/)|youtu\.be\/)([-_0-9A-Za-z]{11})/; 18 | let ytId = ytIdRegex.exec(yutub); 19 | url = "https://youtu.be/" + ytId[1]; 20 | let res = await post(`https://www.y2mate.com/mates/en68/analyze/ajax`, { 21 | url, 22 | q_auto: 0, 23 | ajax: 1, 24 | }); 25 | const mela = await res.json(); 26 | const $ = cheerio.load(mela.result); 27 | const hasil = []; 28 | let thumb = $("div").find(".thumbnail.cover > a > img").attr("src"); 29 | let judul = $("div").find(".thumbnail.cover > div > b").text(); 30 | let quality = $("div").find("#mp4 > table > tbody > tr:nth-child(1) > td:nth-child(3) > a").attr("data-fquality"); 31 | let tipe = $("div").find("#mp4 > table > tbody > tr:nth-child(3) > td:nth-child(3) > a").attr("data-ftype"); 32 | let output = `${judul}.` + tipe; 33 | let size = $("div").find("#mp4 > table > tbody > tr:nth-child(1) > td:nth-child(2)").text(); 34 | let id = /var k__id = "(.*?)"/.exec(mela.result)[1]; 35 | let res2 = await post(`https://www.y2mate.com/mates/en68/convert`, { 36 | type: "youtube", 37 | _id: id, 38 | v_id: ytId[1], 39 | ajax: "1", 40 | token: "", 41 | ftype: tipe, 42 | fquality: qualityny, 43 | }); 44 | const meme = await res2.json(); 45 | const supp = cheerio.load(meme.result); 46 | let link = supp("div").find("a").attr("href"); 47 | hasil.push({ thumb, judul, quality, tipe, size, output, link }); 48 | return hasil; 49 | }; 50 | 51 | const y2mateA = async (yutub, qualityny) => { 52 | function post(url, formdata) { 53 | return fetch(url, { 54 | method: "POST", 55 | headers: { 56 | accept: "*/*", 57 | "accept-language": "en-US,en;q=0.9", 58 | "content-type": "application/x-www-form-urlencoded; charset=UTF-8", 59 | }, 60 | body: new URLSearchParams(Object.entries(formdata)), 61 | }); 62 | } 63 | const ytIdRegex = 64 | /(?:http(?:s|):\/\/|)(?:(?:www\.|)youtube(?:\-nocookie|)\.com\/(?:watch\?.*(?:|\&)v=|embed\/|v\/)|youtu\.be\/)([-_0-9A-Za-z]{11})/; 65 | let ytId = ytIdRegex.exec(yutub); 66 | url = "https://youtu.be/" + ytId[1]; 67 | let res = await post(`https://www.y2mate.com/mates/en68/analyze/ajax`, { 68 | url, 69 | q_auto: 0, 70 | ajax: 1, 71 | }); 72 | const mela = await res.json(); 73 | const $ = cheerio.load(mela.result); 74 | const hasil = []; 75 | let thumb = $("div").find(".thumbnail.cover > a > img").attr("src"); 76 | let judul = $("div").find(".thumbnail.cover > div > b").text(); 77 | let size = $("div").find("#mp3 > table > tbody > tr > td:nth-child(2)").text(); 78 | let tipe = $("div").find("#mp3 > table > tbody > tr > td:nth-child(3) > a").attr("data-ftype"); 79 | let output = `${judul}.` + tipe; 80 | let quality = $("div").find("#mp3 > table > tbody > tr > td:nth-child(3) > a").attr("data-fquality"); 81 | let id = /var k__id = "(.*?)"/.exec(mela.result)[1]; 82 | let res2 = await post(`https://www.y2mate.com/mates/en68/convert`, { 83 | type: "youtube", 84 | _id: id, 85 | v_id: ytId[1], 86 | ajax: "1", 87 | token: "", 88 | ftype: tipe, 89 | fquality: qualityny, 90 | }); 91 | const meme = await res2.json(); 92 | const supp = cheerio.load(meme.result); 93 | let link = supp("div").find("a").attr("href"); 94 | hasil.push({ thumb, judul, quality, tipe, size, output, link }); 95 | return hasil; 96 | }; 97 | 98 | module.exports = { y2mateV, y2mateA }; 99 | -------------------------------------------------------------------------------- /main.js: -------------------------------------------------------------------------------- 1 | const { 2 | fetchLatestBaileysVersion, 3 | makeInMemoryStore, 4 | default: Baileys, 5 | useMultiFileAuthState, 6 | jidDecode, 7 | DisconnectReason, 8 | delay, 9 | } = require("@adiwajshing/baileys"); 10 | 11 | const log = (pino = require("pino")); 12 | const attribute = {}; 13 | const fs = require("fs"); 14 | const path = require("path"); 15 | const { Boom } = require("@hapi/boom"); 16 | const { color } = require("./lib"); 17 | const { session } = require("./config.json"); 18 | const handler = require("./handler"); 19 | const WelcomeHandler = require("./lib/welcome"); 20 | const utils = require("./utils"); 21 | const cron = require("node-cron"); 22 | const Spinnies = require("spinnies"); 23 | const spinnies = new Spinnies({ 24 | spinner: { 25 | interval: 200, 26 | frames: ["∙∙∙", "●∙∙", "∙●∙", "∙∙●", "∙∙∙"], 27 | }, 28 | }); 29 | const moment = require("moment"); 30 | const { self } = require("./config.json"); 31 | attribute.prefix = "#"; 32 | 33 | // Set country code 34 | moment.tz.setDefault(config.timezone).locale(config.locale); 35 | global.moment = moment; 36 | 37 | // page anime search 38 | attribute.page = new Map(); 39 | 40 | // uptime 41 | attribute.uptime = new Date(); 42 | 43 | // sesu pdf 44 | attribute.pdf = new Map(); 45 | 46 | // command 47 | attribute.command = new Map(); 48 | 49 | // database game 50 | global.addMap = (x) => { 51 | attribute[x] = new Map(); 52 | }; 53 | 54 | // lock cmd 55 | attribute.lockcmd = new Map(); 56 | 57 | // self 58 | attribute.isSelf = self; 59 | 60 | // store 61 | global.store = makeInMemoryStore({ logger: pino().child({ level: "silent", stream: "store" }) }); 62 | 63 | // Delete database chat 64 | const chatsData = cron.schedule( 65 | "*/10 * * * *", // 10 minutes per delete 66 | () => { 67 | try { 68 | fs.rmSync(path.join(__dirname, "database", "mess.json")); 69 | db.addDatabase("mess", "[]"); 70 | console.log(color("[ INFO ]", "aqua"), "Delete Database Chat, Cache Temp"); 71 | file = fs.readdirSync("./temp").map((a) => "./temp/" + a); 72 | file.map((a) => fs.unlinkSync(a)); 73 | } catch (e) { 74 | console.log(e); 75 | } 76 | }, 77 | { scheduled: true, timezone: config.timezone } 78 | ); 79 | const limitData = cron.schedule( 80 | "0 0 * * *", // 00 hours per delete 81 | () => { 82 | try { 83 | limit.splice("reset"); 84 | fs.writeFileSync("./database/limit.json", JSON.stringify(limit, null, 2)); 85 | console.log(color("[ INFO ]", "aqua"), "Reset Limit all"); 86 | } catch (e) { 87 | console.log(e); 88 | } 89 | }, 90 | { scheduled: true, timezone: config.timezone } 91 | ); 92 | 93 | let data = fs.readFileSync(path.join(__dirname, "doom.flf"), "utf8"); 94 | require("figlet").parseFont("doom", data); 95 | require("figlet").text( 96 | "RZKY MD", 97 | { 98 | font: "doom", 99 | horizontalLayout: "default", 100 | verticalLayout: "default", 101 | width: 80, 102 | whitespaceBreak: true, 103 | }, 104 | function (err, data) { 105 | if (err) { 106 | console.log("Something went wrong..."); 107 | console.dir(err); 108 | return; 109 | } 110 | console.clear(); 111 | console.log(color(data, "cyan")); 112 | } 113 | ); 114 | const ReadFitur = () => { 115 | let pathdir = path.join(__dirname, "./command"); 116 | let fitur = fs.readdirSync(pathdir); 117 | spinnies.add("spinner-1", { text: "Loading commands..", color: "green" }); 118 | fitur.forEach(async (res) => { 119 | const commands = fs.readdirSync(`${pathdir}/${res}`).filter((file) => file.endsWith(".js")); 120 | for (let file of commands) { 121 | const command = require(`${pathdir}/${res}/${file}`); 122 | if (typeof command.run != "function") continue; 123 | const cmdOptions = { 124 | name: "command", 125 | alias: [""], 126 | desc: "", 127 | use: "", 128 | cooldown: 5, 129 | type: "", // default: changelog 130 | category: typeof command.category == "undefined" ? "" : res.toLowerCase(), 131 | wait: false, 132 | isOwner: false, 133 | isAdmin: false, 134 | isQuoted: false, 135 | isGroup: false, 136 | isBotAdmin: false, 137 | query: false, 138 | isPrivate: false, 139 | isLimit: false, 140 | isLimitGame: false, 141 | isSpam: false, 142 | noPrefix: false, 143 | isMedia: { 144 | isQVideo: false, 145 | isQAudio: false, 146 | isQImage: false, 147 | isQSticker: false, 148 | isQDocument: false, 149 | }, 150 | isPremium: false, 151 | disable: false, 152 | isUrl: false, 153 | run: () => {}, 154 | }; 155 | let cmd = utils.parseOptions(cmdOptions, command); 156 | let options = {}; 157 | for (var k in cmd) 158 | typeof cmd[k] == "boolean" 159 | ? (options[k] = cmd[k]) 160 | : k == "query" || k == "isMedia" 161 | ? (options[k] = cmd[k]) 162 | : ""; 163 | let cmdObject = { 164 | name: cmd.name, 165 | alias: cmd.alias, 166 | desc: cmd.desc, 167 | use: cmd.use, 168 | type: cmd.type, 169 | category: cmd.category, 170 | options: options, 171 | run: cmd.run, 172 | }; 173 | attribute.command.set(cmd.name, cmdObject); 174 | require("delay")(100); 175 | global.reloadFile(`./command/${res}/${file}`); 176 | } 177 | }); 178 | spinnies.succeed("spinner-1", { text: "Command loaded successfully", color: "yellow" }); 179 | }; 180 | // cmd 181 | ReadFitur(); 182 | 183 | const connect = async () => { 184 | const { state, saveCreds } = await useMultiFileAuthState( 185 | path.join(__dirname, `./${session}`), 186 | log({ level: "silent" }) 187 | ); 188 | let { version, isLatest } = await fetchLatestBaileysVersion(); 189 | console.log(color(`Using: ${version}, newer: ${isLatest}`, "yellow")); 190 | const conn = Baileys({ 191 | printQRInTerminal: true, 192 | auth: state, 193 | logger: log({ level: "silent" }), 194 | version, 195 | }); 196 | 197 | // start 198 | chatsData.start(); 199 | limitData.start(); 200 | 201 | // game data 202 | conn.game = conn.game ? conn.game : {}; 203 | 204 | const decodeJid = (jid) => { 205 | if (/:\d+@/gi.test(jid)) { 206 | const decode = jidDecode(jid) || {}; 207 | return ((decode.user && decode.server && decode.user + "@" + decode.server) || jid).trim(); 208 | } else return jid; 209 | }; 210 | 211 | const getBuffer = async (url, options) => { 212 | try { 213 | options ? options : {}; 214 | const res = await require("axios")({ 215 | method: "get", 216 | url, 217 | headers: { 218 | DNT: 1, 219 | "Upgrade-Insecure-Request": 1, 220 | }, 221 | ...options, 222 | responseType: "arraybuffer", 223 | }); 224 | return res.data; 225 | } catch (e) { 226 | console.log(`Error : ${e}`); 227 | } 228 | }; 229 | 230 | store.bind(conn.ev); 231 | 232 | ikyEvent.on("viewOnceMessage", async (get) => { 233 | await conn.sendMessage( 234 | get.remoteJid, 235 | { text: `@${get.participant.split("@")[0]} Terdeteksi Mengirim view once...`, withTag: true }, 236 | { quoted: get.message } 237 | ); 238 | await conn.sendMessage(get.remoteJid, { forward: get.message }, { quoted: get.message }); 239 | }); 240 | 241 | conn.ev.on("creds.update", saveCreds); 242 | conn.ev.on("connection.update", async (up) => { 243 | const { lastDisconnect, connection } = up; 244 | if (connection) spinnies.add("spinner-2", { text: "Connecting to the WhatsApp bot...", color: "cyan" }); 245 | if (connection == "connecting") 246 | spinnies.add("spinner-2", { text: "Connecting to the WhatsApp bot...", color: "cyan" }); 247 | if (connection) { 248 | if (connection != "connecting") 249 | spinnies.update("spinner-2", { text: "Connection: " + connection, color: "yellow" }); 250 | } 251 | if (connection == "open") 252 | spinnies.succeed("spinner-2", { text: "Successfully connected to whatsapp", color: "green" }); 253 | 254 | if (connection === "close") { 255 | let reason = new Boom(lastDisconnect.error).output.statusCode; 256 | if (reason === DisconnectReason.badSession) { 257 | console.log(`Bad Session File, Please Delete ${session} and Scan Again`); 258 | conn.logout(); 259 | } else if (reason === DisconnectReason.connectionClosed) { 260 | console.log("Connection closed, reconnecting...."); 261 | connect(); 262 | } else if (reason === DisconnectReason.connectionLost) { 263 | console.log("Connection Lost from Server, reconnecting..."); 264 | connect(); 265 | } else if (reason === DisconnectReason.connectionReplaced) { 266 | console.log("Connection Replaced, Another New Session Opened, Please Close Current Session First"); 267 | conn.logout(); 268 | } else if (reason === DisconnectReason.loggedOut) { 269 | console.log(`Device Logged Out, Please Delete ${session} and Scan Again.`); 270 | conn.logout(); 271 | } else if (reason === DisconnectReason.restartRequired) { 272 | console.log("Restart Required, Restarting..."); 273 | connect(); 274 | } else if (reason === DisconnectReason.timedOut) { 275 | console.log("Connection TimedOut, Reconnecting..."); 276 | connect(); 277 | } else { 278 | conn.end(`Unknown DisconnectReason: ${reason}|${lastDisconnect.error}`); 279 | } 280 | } 281 | }); 282 | 283 | //mager 284 | conn.addMessage = (msg, type) => { 285 | if (type == "protocolMessage") return; 286 | let from = msg.key.remoteJid; 287 | return db.modified("mess", { id: msg.key.id, msg }); 288 | }; 289 | 290 | //anticall 291 | conn.ws.on("CB:call", async (json) => { 292 | if (json.content[0].tag == "offer") { 293 | conn.sendMessage(json.content[0].attrs["call-creator"], { 294 | text: `Terdeteksi Menelpon BOT!\nSilahkan Hubungi Owner Untuk Membuka Block !\n\nNomor Owner: \n${config.owner 295 | .map( 296 | (a) => 297 | `*wa.me/${a.split(`@`)[0]}* | ${ 298 | conn.getName(a).includes("+62") ? "No Detect" : conn.getName(a) 299 | }` 300 | ) 301 | .join("\n")}`, 302 | }); 303 | await require("delay")(8000); 304 | await conn.updateBlockStatus(json.content[0].attrs["call-creator"], "block"); 305 | } 306 | }); 307 | 308 | //contact update 309 | conn.ev.on("contacts.update", (m) => { 310 | for (let kontak of m) { 311 | let jid = decodeJid(kontak.id); 312 | if (store && store.contacts) store.contacts[jid] = { jid, name: kontak.notify }; 313 | } 314 | }); 315 | 316 | // I don't know what's the point hehe 317 | if (!fs.existsSync("./src") || !fs.existsSync("./src/rzky-md.jpg")) { 318 | fs.mkdir("./src", async function (err) { 319 | if (err) { 320 | if (!fs.existsSync("./src/rzky-md.jpg")) { 321 | fs.writeFile("./src/rzky-md.jpg", (await require("axios")(config.thumb)).data, function (err) { 322 | if (err) { 323 | console.log(color("[INFO]", "yellow"), "error writing file", err); 324 | } else { 325 | console.log(color("[INFO]", "yellow"), "writing thumbnail succeeded"); 326 | } 327 | }); 328 | } 329 | fs.existsSync("./src/rzky-md.jpg") 330 | ? console.log(color("[INFO]", "yellow"), "failed to create directory", err) 331 | : ""; 332 | } else { 333 | console.log(color("[INFO]", "yellow"), `Succes create a "src" file`); 334 | fs.writeFile("./src/rzky-md.jpg", (await require("axios")(config.thumb)).data, function (err) { 335 | if (err) { 336 | console.log(color("[INFO]", "yellow"), "error writing file", err); 337 | } else { 338 | console.log(color("[INFO]", "yellow"), "writing thumbnail succeeded"); 339 | } 340 | }); 341 | } 342 | }); 343 | } 344 | 345 | // detect Reaction message 346 | conn.ev.on("messages.reaction", async (m) => { 347 | if (m.reaction.key.id.startsWith("BAE5") && m.reaction.key.id.length === 16) return; 348 | let mesg = await store.loadMessage(m.reaction.key.remoteJid, m.key.id, conn); 349 | let frem = m.reaction.key.remoteJid.endsWith("@g.us") ? m.reaction.key.participant : m.reaction.key.remoteJid; 350 | let frum = m.key.remoteJid.endsWith("@g.us") ? m.key.participant : m.key.remoteJid; 351 | await conn.sendMessage( 352 | m.reaction.key.remoteJid, 353 | { 354 | text: `*【 ${m.operation == "add" ? "ADD" : "DELETE"} REACTION 】*\n\n*_Tagged:_* @${ 355 | (m.reaction.key.fromMe ? decodeJid(conn.user.id) : decodeJid(frem)).split("@")[0] 356 | }\n*_To:_* ${frum ? `@${frum.split("@")[0]}` : `-`}\n*_Emoji:_* ${ 357 | m.operation == "add" ? m.reaction.text : "-" 358 | }`, 359 | withTag: true, 360 | }, 361 | { quoted: mesg } 362 | ); 363 | }); 364 | 365 | // detect group update 366 | conn.ev.on("groups.update", async (json) => { 367 | const res = json[0]; 368 | if (res.announce == true) { 369 | conn.sendMessage(res.id, { 370 | text: `「 Group Settings Change 」\n\nGroup telah ditutup oleh admin, Sekarang hanya admin yang dapat mengirim pesan !`, 371 | }); 372 | } else if (res.announce == false) { 373 | conn.sendMessage(res.id, { 374 | text: `「 Group Settings Change 」\n\nGroup telah dibuka oleh admin, Sekarang peserta dapat mengirim pesan !`, 375 | }); 376 | } else if (res.restrict == true) { 377 | conn.sendMessage(res.id, { 378 | text: `「 Group Settings Change 」\n\nInfo group telah dibatasi, Sekarang hanya admin yang dapat mengedit info group !`, 379 | }); 380 | } else if (res.restrict == false) { 381 | conn.sendMessage(res.id, { 382 | text: `「 Group Settings Change 」\n\nInfo group telah dibuka, Sekarang peserta dapat mengedit info group !`, 383 | }); 384 | } else { 385 | conn.sendMessage(res.id, { 386 | text: `「 Group Settings Change 」\n\nGroup Subject telah diganti menjadi *${res.subject}*`, 387 | }); 388 | } 389 | }); 390 | 391 | // Anti delete dek 392 | conn.ev.on("message.delete", async (m) => { 393 | if (!m) m = {}; 394 | let data2 = db.cekDatabase("antidelete", "id", m.remoteJid || ""); 395 | if (typeof data2 != "object") return; 396 | const dataChat = JSON.parse(fs.readFileSync("./database/mess.json")); 397 | let mess = dataChat.find((a) => a.id == m.id); 398 | let mek = mess.msg; 399 | if (mek.key.id.startsWith("BAE5") && mek.key.id.length === 16) return; 400 | let participant = mek.key.remoteJid.endsWith("@g.us") 401 | ? decodeJid(mek.key.participant) 402 | : decodeJid(mek.key.remoteJid); 403 | let froms = mek.key.remoteJid; 404 | await conn.sendMessage( 405 | froms, 406 | { 407 | text: 408 | "Hayoloh ngapus apaan @" + 409 | participant.split("@")[0] + 410 | `\n\n*➤ Info*\n*• Participant:* ${participant.split("@")[0]}\n*• Delete message:* ${moment( 411 | Date.now() 412 | ).format("dddd, DD/MM/YYYY HH:mm:ss")}\n*• Message send:* ${moment( 413 | mek.messageTimestamp * 1000 414 | ).format("dddd, DD/MM/YYYY HH:mm:ss")}\n*• Type:* ${Object.keys(mek.message)[0]}`, 415 | mentions: [participant], 416 | }, 417 | { quoted: mek } 418 | ); 419 | await conn.relayMessage(froms, mek.message, { messageId: mek.key.id }); 420 | }); 421 | 422 | // welcome 423 | conn.ev.on("group-participants.update", async (msg) => { 424 | WelcomeHandler(conn, msg); 425 | }); 426 | 427 | // messages.upsert 428 | conn.ev.on("messages.upsert", async (m) => { 429 | const msg = m.messages[0]; 430 | if (msg.key.id.startsWith("BAE5") && msg.key.id.length === 16) return; 431 | const type = msg.message ? Object.keys(msg.message)[0] : ""; 432 | let dataCek = db.cekDatabase("antidelete", "id", msg.key.remoteJid); 433 | if (dataCek) conn.addMessage(msg, type); 434 | if (msg && type == "protocolMessage") conn.ev.emit("message.delete", msg.message.protocolMessage.key); 435 | handler(m, conn, attribute); 436 | }); 437 | }; 438 | connect(); 439 | 440 | if (config.server) 441 | require("http") 442 | .createServer((__, res) => res.end("Server Running!")) 443 | .listen(8080); 444 | 445 | process.on("uncaughtException", function (err) { 446 | console.error(err); 447 | }); 448 | -------------------------------------------------------------------------------- /package.json: -------------------------------------------------------------------------------- 1 | { 2 | "name": "rzky-multidevice", 3 | "version": "4.0.0", 4 | "main": "index.js", 5 | "depecrated": false, 6 | "license": "MIT", 7 | "author": "RizkyFadilah", 8 | "scripts": { 9 | "start": "node .", 10 | "format": "prettier --write '**/*.{md,js,json}'" 11 | }, 12 | "dependencies": { 13 | "@adiwajshing/baileys": "github:FatihArridho/Baileys", 14 | "@adiwajshing/keyed-db": "^0.2.4", 15 | "@vitalets/google-translate-api": "^7.0.0", 16 | "assert": "^2.0.0", 17 | "awesome-phonenumber": "^2.70.0", 18 | "axios": "^0.26.1", 19 | "brainly-scraper-v2": "1.1.2", 20 | "chalk": "4.1.2", 21 | "cheerio": "1.0.0-rc.10", 22 | "country-language": "^0.1.7", 23 | "delay": "^5.0.0", 24 | "emoji-from-text": "^1.1.12", 25 | "fake-useragent": "^1.0.1", 26 | "figlet": "^1.5.2", 27 | "file-type": "16.5.3", 28 | "fluent-ffmpeg": "2.1.2", 29 | "form-data": "4.0.0", 30 | "fs": "0.0.1-security", 31 | "fs-extra": "^10.1.0", 32 | "google-it": "^1.6.2", 33 | "human-readable": "0.2.1", 34 | "ikyy": "latest", 35 | "image-to-base64": "^2.2.0", 36 | "image-to-pdf": "^1.0.0", 37 | "jsdom": "^19.0.0", 38 | "mathjs": "latest", 39 | "moment-duration-format": "^2.3.2", 40 | "moment-timezone": "^0.5.32", 41 | "ms": "2.1.3", 42 | "nhentai-api": "^3.4.3", 43 | "nhentai-ikyy": "^2.0.1", 44 | "nhentai-js": "^4.0.0", 45 | "nhentai-node-api": "^1.1.2", 46 | "node-cron": "^3.0.0", 47 | "node-fetch": "^2.0.0", 48 | "parse-ms": "^2.1.0", 49 | "pdfkit": "^0.12.1", 50 | "prettier": "^2.6.2", 51 | "qrcode": "^1.5.0", 52 | "similarity": "^1.2.1", 53 | "spinnies": "^0.5.1", 54 | "string-crypto": "^2.0.2", 55 | "wikijs": "^6.3.3", 56 | "yt-search": "^2.10.3" 57 | }, 58 | "devDependencies": { 59 | "@hapi/boom": "^9.1.4", 60 | "bluebird": "^3.7.2", 61 | "jimp": "^0.16.1", 62 | "pino": "^7.6.5", 63 | "qrcode-terminal": "^0.12.0" 64 | }, 65 | "description": "Bot Whatsapp multi-device using Javascript", 66 | "directories": { 67 | "lib": "lib", 68 | "database": "database", 69 | "command": "command" 70 | }, 71 | "repository": { 72 | "type": "git", 73 | "url": "git+https://github.com/Rizky878/rzky-multidevice.git" 74 | }, 75 | "keywords": [ 76 | "bot-md", 77 | "multi-device", 78 | "adiwajshing", 79 | "baileys", 80 | "baileys-md", 81 | "bot-wa", 82 | "bot-whatsapp", 83 | "WhatsApp" 84 | ], 85 | "bugs": { 86 | "url": "https://github.com/Rizky878/rzky-multidevice/issues" 87 | }, 88 | "homepage": "https://github.com/Rizky878/rzky-multidevice#readme" 89 | } 90 | -------------------------------------------------------------------------------- /replit.nix: -------------------------------------------------------------------------------- 1 | { pkgs }: { 2 | deps = [ 3 | pkgs.nodejs 4 | pkgs.nodePackages.typescript 5 | pkgs.ffmpeg 6 | pkgs.imagemagick 7 | pkgs.git 8 | ]; 9 | } 10 | -------------------------------------------------------------------------------- /res/EmitEvent.js: -------------------------------------------------------------------------------- 1 | module.exports = async (msg, conn) => { 2 | const { from, isGroup, msgType, sender, key, body } = msg; 3 | 4 | if (msgType == "viewOnceMessage") { 5 | messagee = { ...msg }; 6 | messagee.message[Object.keys(msg.message)[0]].viewOnce = false; 7 | const opt = { 8 | remoteJid: key.remoteJid, 9 | participant: sender, 10 | message: messagee, 11 | }; 12 | ikyEvent.emit("viewOnceMessage", opt); 13 | } 14 | }; 15 | -------------------------------------------------------------------------------- /temp/media: -------------------------------------------------------------------------------- 1 | 2 | -------------------------------------------------------------------------------- /test.js: -------------------------------------------------------------------------------- 1 | let fs = require("fs"); 2 | let path = require("path"); 3 | let assert = require("assert"); 4 | let { spawn } = require("child_process"); 5 | let folders = [".", ...Object.keys(require("./package.json").directories)]; 6 | let files = []; 7 | 8 | for (let i of fs.readdirSync(folders[3])) 9 | for (let is of fs.readdirSync(path.join(folders[3], i))) 10 | files.push(path.resolve(path.join(folders[3], i) + "/" + is)); 11 | for (let folder of folders) 12 | for (let file of fs.readdirSync(folder).filter((v) => v.endsWith(".js"))) 13 | files.push(path.resolve(path.join(folder, file))); 14 | for (let file of files) { 15 | if (file == path.join(__dirname, __filename)) continue; 16 | console.error("Checking", file); 17 | spawn(process.argv0, ["-c", file]) 18 | .on("close", () => { 19 | assert.ok(file); 20 | console.log("Done", file); 21 | }) 22 | .stderr.on("data", (chunk) => assert.ok(chunk.length < 1, file + "\n\n" + chunk)); 23 | } 24 | -------------------------------------------------------------------------------- /utils/index.js: -------------------------------------------------------------------------------- 1 | module.exports = { 2 | parseOptions: require("./parseOptions"), 3 | }; 4 | -------------------------------------------------------------------------------- /utils/parseOptions.js: -------------------------------------------------------------------------------- 1 | function or() { 2 | for (let arg of arguments) { 3 | if (arg) return arg; 4 | } 5 | return arguments[arguments.length - 1]; 6 | } 7 | 8 | module.exports = function parseOptions(optionsArgs = {}, args = {}) { 9 | let options = {}; 10 | let entries = Object.entries(optionsArgs); 11 | for (let i = 0; i < Object.keys(optionsArgs).length; i++) { 12 | let [key, val] = entries[i]; 13 | options[key] = or(args[key], val); 14 | } 15 | return options; 16 | }; 17 | --------------------------------------------------------------------------------