├── Procfile ├── requirements.txt ├── src └── image │ ├── default.jpg │ └── thumbnail.jpg ├── run.js ├── .replit ├── .env ├── plugins ├── example │ ├── replyAi.js │ └── custom.js ├── miscs │ ├── price.js │ ├── runtime.js │ ├── feature.js │ ├── owner.js │ ├── cmdstic_list.js │ ├── checkapi.js │ ├── speedtest.js │ ├── server.js │ ├── sc.js │ ├── groups.js │ ├── cmdstic.js │ ├── ping.js │ └── hitstat.js ├── group │ ├── link.js │ ├── wame.js │ ├── afk.js │ ├── delete.js │ ├── q.js │ ├── couple.js │ ├── slander.js │ └── ava.js ├── users │ ├── exp.js │ ├── limit.js │ ├── sn.js │ ├── unreg.js │ └── reg.js ├── owner │ ├── restart.js │ ├── ohidetag.js │ ├── backup.js │ ├── setmenu.js │ ├── setlink.js │ ├── changename.js │ ├── setwm.js │ ├── setmsg.js │ ├── update.js │ ├── restore.js │ ├── system.js │ ├── command.js │ ├── getfile.js │ ├── savefile.js │ ├── prefix.js │ ├── plugin.js │ ├── hide_category.js │ ├── toxic.js │ ├── setpp.js │ └── backupsc.js ├── admin │ ├── hidetag.js │ ├── totag.js │ ├── restrict.js │ ├── tagall.js │ ├── groupset.js │ ├── activation.js │ ├── outsider.js │ └── settext.js ├── random │ ├── benarkah.js │ ├── halah.js │ ├── bisakah.js │ └── how.js ├── _events │ ├── protector │ │ ├── anti_sticker.js │ │ ├── anti_link.js │ │ ├── anti_tagsw.js │ │ ├── anti_virtex.js │ │ ├── anti_porn.js │ │ └── anti_toxic.js │ ├── chatbot.js │ ├── anonymous_ev.js │ ├── clearDB.js │ ├── auto │ │ └── auto_sticker.js │ ├── afk_detector.js │ └── download │ │ ├── autodl_threads.js │ │ ├── autodl_ig.js │ │ ├── autodl_x.js │ │ └── autodl_tt.js ├── primbon │ ├── nomorhoki.js │ ├── shio.js │ ├── artinama.js │ └── artimimpi.js ├── ai │ ├── dokter.js │ ├── copilot.js │ ├── promptgen.js │ ├── mathsolver.js │ ├── openai.js │ ├── code.js │ ├── article.js │ ├── qwen.js │ ├── text2vid.js │ ├── text2img.js │ ├── meta.js │ └── gemini.js ├── internet │ ├── kbbg.js │ ├── brainly.js │ ├── wallpaper.js │ ├── pinterest.js │ ├── gempa.js │ ├── shalat.js │ ├── resi.js │ ├── npm.js │ ├── google.js │ └── chord.js ├── tools │ ├── nulis.js │ ├── shorten.js │ ├── unshortner.js │ ├── webcloner.js │ ├── deobfuscator.js │ ├── upload.js │ ├── obfuscator.js │ ├── fetch.js │ ├── noiseremover.js │ ├── screenshot.js │ ├── translate.js │ ├── calculator.js │ ├── ocr.js │ ├── age.js │ ├── photoexif.js │ ├── topixel.js │ ├── wmremover.js │ ├── tozombie.js │ ├── hdvideo.js │ ├── textremover.js │ ├── recolor.js │ ├── prompter.js │ ├── removebg.js │ ├── tonude.js │ ├── remini.js │ └── toanime.js ├── converter │ ├── emojito.js │ ├── iqc.js │ ├── ttp.js │ ├── attp.js │ ├── tts.js │ ├── take.js │ ├── emojimix.js │ ├── tovideo.js │ ├── toimg.js │ ├── brat.js │ ├── emojis.js │ └── qc.js ├── downloader │ ├── rednote.js │ ├── instagram.js │ ├── xbuddy.js │ ├── threads.js │ ├── douyin.js │ ├── x.js │ ├── ytsearch.js │ ├── pinterest.js │ ├── facebook.js │ ├── igstory.js │ ├── terabox.js │ ├── gdrive.js │ ├── mediafire.js │ ├── capcut.js │ ├── ytmp4.js │ ├── play.js │ └── ytmp3.js ├── _other │ └── anonymous-send_contact.js └── exec.js ├── pm2.config.js ├── Dockerfile ├── install.sh ├── replit.nix ├── server.js ├── .gitignore ├── SECURITY.md ├── test.js ├── config.json ├── README.md ├── LICENSE ├── package.json ├── lib └── system │ ├── config.js │ ├── schema.js │ ├── localdb.js │ ├── init.js │ ├── scraper.js │ └── levelling.js ├── .idx └── dev.nix └── index.js /Procfile: -------------------------------------------------------------------------------- 1 | worker: node index.js -------------------------------------------------------------------------------- /requirements.txt: -------------------------------------------------------------------------------- 1 | flask 2 | gunicorn -------------------------------------------------------------------------------- /src/image/default.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/znanx/moon-bot/HEAD/src/image/default.jpg -------------------------------------------------------------------------------- /src/image/thumbnail.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/znanx/moon-bot/HEAD/src/image/thumbnail.jpg -------------------------------------------------------------------------------- /run.js: -------------------------------------------------------------------------------- 1 | require('child_process').spawn('bash', [], { 2 | stdio: ['inherit', 'inherit', 'inherit', 'ipc'] 3 | }) -------------------------------------------------------------------------------- /.replit: -------------------------------------------------------------------------------- 1 | run = "clear && node index.js" 2 | # run = "clear && pm2 kill && pm2 start index.js && pm2 save && pm2 logs" 3 | 4 | [nix] 5 | channel = "stable-24_11" -------------------------------------------------------------------------------- /.env: -------------------------------------------------------------------------------- 1 | ## Database URI 2 | DATABASE_URL = '' 3 | 4 | ## Apikey 5 | API_ENDPOINT = 'https://api.alyachan.dev/api' 6 | API_KEY = 'yourkey' 7 | 8 | ## Time Zone 9 | TZ = 'Asia/Jakarta' -------------------------------------------------------------------------------- /plugins/example/replyAi.js: -------------------------------------------------------------------------------- 1 | module.exports = { 2 | help: ['replyai'], 3 | tags: 'example', 4 | run: async (m, { 5 | conn 6 | }) => { 7 | conn.replyAI(m.chat, 'Hi!', m) 8 | }, 9 | error: false 10 | } -------------------------------------------------------------------------------- /plugins/miscs/price.js: -------------------------------------------------------------------------------- 1 | module.exports = { 2 | help: ['premium'], 3 | tags: 'miscs', 4 | run: async (m, { 5 | conn, 6 | usedPrefix 7 | }) => { 8 | conn.reply(m.chat, `IDR 10.000 ~ to get 30 Days premium & 2000 Limit`, m) 9 | } 10 | } -------------------------------------------------------------------------------- /plugins/group/link.js: -------------------------------------------------------------------------------- 1 | module.exports = { 2 | help: ['link'], 3 | tags: 'group', 4 | run: async (m, { 5 | conn 6 | }) => { 7 | await conn.reply(m.chat, 'https://chat.whatsapp.com/' + (await conn.groupInviteCode(m.chat)), m) 8 | }, 9 | group: true, 10 | botAdmin: true, 11 | error: false 12 | } -------------------------------------------------------------------------------- /plugins/miscs/runtime.js: -------------------------------------------------------------------------------- 1 | module.exports = { 2 | help: ['runtime'], 3 | aliases: ['run', 'uptime'], 4 | tags: 'miscs', 5 | run: async (m, { 6 | conn, 7 | Func 8 | }) => { 9 | conn.reply(m.chat, Func.texted('bold', `Running for : [ ${Func.toTime(process.uptime() * 1000)} ]`), m) 10 | } 11 | } -------------------------------------------------------------------------------- /pm2.config.js: -------------------------------------------------------------------------------- 1 | module.exports = { 2 | apps: [{ 3 | name: 'moon-bot', 4 | script: './index.js', 5 | node_args: '--max-old-space-size=1024', 6 | env: { 7 | NODE_ENV: 'production' 8 | }, 9 | env_development: { 10 | NODE_ENV: 'development' 11 | } 12 | }] 13 | } 14 | -------------------------------------------------------------------------------- /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", "index.js"] -------------------------------------------------------------------------------- /plugins/miscs/feature.js: -------------------------------------------------------------------------------- 1 | module.exports = { 2 | help: ['feature'], 3 | aliases: ['fitur'], 4 | tags: 'miscs', 5 | run: async (m, { 6 | conn, 7 | plugins, 8 | Func 9 | }) => { 10 | conn.reply(m.chat, Func.texted('bold', 'Total features available : [ ' + Func.formatNumber(plugins.size) + ' ]'), m) 11 | }, 12 | error: false 13 | } -------------------------------------------------------------------------------- /plugins/users/exp.js: -------------------------------------------------------------------------------- 1 | module.exports = { 2 | help: ['exp'], 3 | tags: 'user', 4 | run: async (m, { 5 | conn, 6 | users, 7 | Func 8 | }) => { 9 | if (users.exp < 1) return conn.reply(m.chat, `🚩 Your EXP on using bots is up.`, m) 10 | conn.reply(m.chat, Func.texted('bold', `🍉 EXP : [ ${Func.formatNumber(users.exp)} ]`), m) 11 | } 12 | } -------------------------------------------------------------------------------- /plugins/users/limit.js: -------------------------------------------------------------------------------- 1 | module.exports = { 2 | help: ['limit'], 3 | tags: 'user', 4 | run: async (m, { 5 | conn, 6 | users, 7 | Func 8 | }) => { 9 | if (users.limit < 1) return conn.reply(m.chat, `🚩 Your limit on using bots is up.`, m) 10 | conn.reply(m.chat, Func.texted('bold', `🍉 Limit : [ ${Func.formatNumber(users.limit)} ]`), m) 11 | } 12 | } -------------------------------------------------------------------------------- /plugins/users/sn.js: -------------------------------------------------------------------------------- 1 | const { createHash } = require('crypto') 2 | 3 | module.exports = { 4 | help: ['sn'], 5 | tags: 'user', 6 | run: async (m, { 7 | conn, 8 | usedPrefix, 9 | command, 10 | text, 11 | Func 12 | }) => { 13 | conn.reply(m.chat, createHash('md5').update(m.sender).digest('hex'), m) 14 | }, 15 | private: true, 16 | register: true 17 | } -------------------------------------------------------------------------------- /plugins/owner/restart.js: -------------------------------------------------------------------------------- 1 | module.exports = { 2 | help: ['restart'], 3 | tags: 'owner', 4 | run: async (m, { 5 | conn, 6 | database, 7 | Func 8 | }) => { 9 | await conn.reply(m.chat, Func.texted('bold', 'Restarting . . .'), m).then(async () => { 10 | await database.save(global.db) 11 | process.send('reset') 12 | }) 13 | }, 14 | owner: true 15 | } -------------------------------------------------------------------------------- /install.sh: -------------------------------------------------------------------------------- 1 | apt update && apt upgrade -y 2 | apt install git ffmpeg imagemagick webp curl 3 | curl -o- https://raw.githubusercontent.com/nvm-sh/nvm/v0.39.3/install.sh 4 | curl -o- https://raw.githubusercontent.com/nvm-sh/nvm/v0.39.3/install.sh | bash 5 | source ~/.bashrc 6 | nvm install v22.20.0 7 | nvm alias default v22.20.0 8 | nvm use default 9 | npm install -g pm2 10 | yarn 11 | pm2 start pm2.config.cjs && pm2 logs moon-bot -------------------------------------------------------------------------------- /plugins/group/wame.js: -------------------------------------------------------------------------------- 1 | module.exports = { 2 | help: ['wame'], 3 | tags: 'group', 4 | run: async (m, { 5 | conn, 6 | text 7 | }) => { 8 | let number = m.quoted ? (m.quoted.sender).split`@`[0] : (m.sender).split`@`[0] 9 | let chat = text ? text : 'hai' 10 | conn.reply(m.chat, `https://wa.me/${number}?text=${encodeURI(chat)}`, m) 11 | }, 12 | group: true, 13 | error: false 14 | } -------------------------------------------------------------------------------- /replit.nix: -------------------------------------------------------------------------------- 1 | { pkgs }: { 2 | deps = [ 3 | pkgs.nodejs_20 4 | pkgs.neofetch 5 | pkgs.jellyfin-ffmpeg 6 | pkgs.imagemagick 7 | pkgs.libwebp 8 | pkgs.yarn 9 | pkgs.libuuid 10 | pkgs.nodePackages.nodemon 11 | pkgs.zip 12 | pkgs.libuuid 13 | ]; 14 | env = { 15 | LD_LIBRARY_PATH = pkgs.lib.makeLibraryPath [ 16 | pkgs.libuuid 17 | ]; 18 | }; 19 | } -------------------------------------------------------------------------------- /plugins/owner/ohidetag.js: -------------------------------------------------------------------------------- 1 | module.exports = { 2 | help: ['ohidetag'], 3 | use: 'text', 4 | tags: 'owner', 5 | run: async (m, { 6 | conn, 7 | usedPrefix, 8 | command, 9 | text, 10 | participants, 11 | Func 12 | }) => { 13 | let users = participants.map(u => u.id) 14 | await conn.reply(m.chat, text, null, { 15 | mentions: users 16 | }) 17 | }, 18 | owner: true, 19 | group: true 20 | } -------------------------------------------------------------------------------- /plugins/admin/hidetag.js: -------------------------------------------------------------------------------- 1 | module.exports = { 2 | help: ['hidetag'], 3 | use: 'text', 4 | tags: 'admin', 5 | run: async (m, { 6 | conn, 7 | usedPrefix, 8 | command, 9 | text, 10 | participants, 11 | Func 12 | }) => { 13 | conn.reply(m.chat, m.quoted ? m.quoted.text : text, null, { 14 | mentions: participants.map(v => v.id) 15 | }) 16 | }, 17 | group: true, 18 | admin: true, 19 | error: false 20 | } -------------------------------------------------------------------------------- /plugins/miscs/owner.js: -------------------------------------------------------------------------------- 1 | module.exports = { 2 | help: ['owner'], 3 | aliases: ['creator'], 4 | tags: 'miscs', 5 | run: async (m, { 6 | conn, 7 | env 8 | }) => { 9 | conn.sendContact(m.chat, [{ 10 | name: env.owner_name, 11 | number: env.owner, 12 | about: 'Owner & Creator' 13 | }], m, { 14 | org: 'Moon Support', 15 | website: 'https://api.alyachan.dev', 16 | email: 'contact@moonx.my.id' 17 | }) 18 | } 19 | } -------------------------------------------------------------------------------- /plugins/admin/totag.js: -------------------------------------------------------------------------------- 1 | module.exports = { 2 | help: ['totag'], 3 | use: 'reply chat', 4 | tags: 'admin', 5 | run: async (m, { 6 | conn, 7 | participants, 8 | Func 9 | }) => { 10 | if (!m.quoted) return conn.reply(m.chat, Func.texted('bold', '🚩 Reply chat'), m) 11 | conn.sendMessage(m.chat, { 12 | forward: m.quoted.fakeObj, 13 | mentions: participants.map(v => v.id).filter(v => v !== conn.user.id) 14 | }) 15 | }, 16 | group: true, 17 | admin: true, 18 | error: false 19 | } -------------------------------------------------------------------------------- /plugins/group/afk.js: -------------------------------------------------------------------------------- 1 | module.exports = { 2 | help: ['afk'], 3 | use: 'reason (optional)', 4 | tags: 'group', 5 | run: async (m, { 6 | conn, 7 | text, 8 | users, 9 | Func 10 | }) => { 11 | try { 12 | users.afk = +new Date 13 | users.afkReason = text 14 | users.afkObj = m 15 | return conn.reply(m.chat, `@${m.sender.split`@`[0]} is now AFK!`, m) 16 | } catch { 17 | conn.reply(m.chat, global.status.error, m) 18 | } 19 | }, 20 | group: true, 21 | error: false 22 | } -------------------------------------------------------------------------------- /plugins/group/delete.js: -------------------------------------------------------------------------------- 1 | module.exports = { 2 | help: ['delete'], 3 | aliases: ['del', 'd'], 4 | use: 'reply chat', 5 | tags: 'group', 6 | run: async (m, { 7 | conn, 8 | isBotAdmin 9 | }) => { 10 | if (!m.quoted) return 11 | conn.sendMessage(m.chat, { 12 | delete: { 13 | remoteJid: m.chat, 14 | fromMe: isBotAdmin ? false : true, 15 | id: m.quoted.id, 16 | participant: m.quoted.sender 17 | } 18 | }) 19 | }, 20 | group: true, 21 | error: false 22 | } -------------------------------------------------------------------------------- /plugins/random/benarkah.js: -------------------------------------------------------------------------------- 1 | module.exports = { 2 | help: ['benarkah'], 3 | tags: 'random', 4 | run: async (m, { 5 | conn, 6 | text, 7 | Func 8 | }) => { 9 | if (!text) return m.reply('Apanya yang benar?') 10 | conn.reply(m.chat, `*Pertanyaan:* ${m.text}\n*Jawaban:* ${Func.random(['Iya', 'Sudah pasti', 'Sudah pasti benar', 'Tidak', 'Tentu tidak', 'Sudah pasti tidak'])}`.trim(), m, m.mentionedJid ? { 11 | contextInfo: { 12 | mentionedJid: m.mentionedJid 13 | } 14 | } : {}) 15 | }, 16 | error: false 17 | } -------------------------------------------------------------------------------- /plugins/admin/restrict.js: -------------------------------------------------------------------------------- 1 | module.exports = { 2 | help: ['group'], 3 | use: 'open / close', 4 | tags: 'admin', 5 | run: async (m, { 6 | conn, 7 | args, 8 | Func 9 | }) => { 10 | if (!args || !args[0]) return conn.reply(m.chat, Func.texted('bold', `🚩 Enter argument close or open.`), m) 11 | if (args[0] == 'open') { 12 | await conn.groupSettingUpdate(m.chat, 'not_announcement') 13 | } else if (args[0] == 'close') { 14 | await conn.groupSettingUpdate(m.chat, 'announcement') 15 | } 16 | }, 17 | group: true, 18 | admin: true, 19 | botAdmin: true 20 | } -------------------------------------------------------------------------------- /plugins/random/halah.js: -------------------------------------------------------------------------------- 1 | module.exports = { 2 | help: ['halah', 'huluh', 'hilih', 'heleh', 'holoh'], 3 | use: 'text', 4 | tags: 'random', 5 | run: async (m, { 6 | conn, 7 | command, 8 | text, 9 | Func 10 | }) => { 11 | try { 12 | let ter = command[1].toLowerCase() 13 | let txt = m.quoted ? m.quoted.text ? m.quoted.text : text ? text : m.text : text ? text : m.text 14 | await conn.reply(m.chat, txt.replace(/[aiueo]/g, ter).replace(/[AIUEO]/g, ter.toUpperCase()), m) 15 | } catch (e) { 16 | console.log(e) 17 | } 18 | }, 19 | error: false 20 | } -------------------------------------------------------------------------------- /plugins/random/bisakah.js: -------------------------------------------------------------------------------- 1 | module.exports = { 2 | help: ['bisakah'], 3 | tags: 'random', 4 | run: async (m, { 5 | conn, 6 | text, 7 | Func 8 | }) => { 9 | if (!text) return m.reply(`Apanya yang bisa?`) 10 | conn.reply(m.chat, `*Pertanyaan:* ${m.text}\n*Jawaban:* ${Func.random(['Iya', 'Bisa', 'Tentu saja bisa', 'Tentu bisa', 'Sudah pasti', 'Sudah pasti bisa', 'Tidak', 'Tidak bisa', 'Tentu tidak', 'tentu tidak bisa', 'Sudah pasti tidak'])}`.trim(), m, m.mentionedJid ? { 11 | contextInfo: { 12 | mentionedJid: m.mentionedJid 13 | } 14 | } : {}) 15 | }, 16 | error: false 17 | } -------------------------------------------------------------------------------- /plugins/_events/protector/anti_sticker.js: -------------------------------------------------------------------------------- 1 | module.exports = { 2 | run: async(m, { 3 | conn, 4 | body, 5 | isOwner, 6 | groupSet, 7 | setting, 8 | isBotAdmin, 9 | Func 10 | }) => { 11 | if (m.isGroup && groupSet.antisticker && /stickerMessage/.test(m.mtype)) { 12 | conn.sendMessage(m.chat, { 13 | delete: { 14 | remoteJid: m.chat, 15 | fromMe: isBotAdmin ? false : true, 16 | id: m.key.id, 17 | participant: m.sender 18 | } 19 | }) 20 | } 21 | }, 22 | error: false, 23 | group: true, 24 | error: false 25 | } -------------------------------------------------------------------------------- /server.js: -------------------------------------------------------------------------------- 1 | const { Function: Func } = require('@znan/wabot') 2 | const http = require('http') 3 | const express = require('express') 4 | const app = express() 5 | const PORT = process.env.PORT || 8080 6 | 7 | const server = async () => { 8 | app.get('/', async (req, res) => { 9 | res.status(200).json({ 10 | status: true, 11 | data: { 12 | uptime: Func.toTime(process.uptime() * 1000), 13 | timestamp: new Date().toISOString() 14 | } 15 | }) 16 | }) 17 | const index = http.createServer(app) 18 | index.listen(PORT, () => console.log(`Server is running -- ${PORT}`)) 19 | } 20 | server().catch(() => server()) -------------------------------------------------------------------------------- /.gitignore: -------------------------------------------------------------------------------- 1 | ### AL ### 2 | #Template for AL projects for Dynamics 365 Business Central 3 | #launch.json folder 4 | .vscode/ 5 | #Cache folder 6 | .alcache/ 7 | #Symbols folder 8 | .alpackages/ 9 | #Snapshots folder 10 | .snapshots/ 11 | #Testing Output folder 12 | .output/ 13 | #Extension App-file 14 | *.app 15 | #Rapid Application Development File 16 | rad.json 17 | #Translation Base-file 18 | *.g.xlf 19 | #License-file 20 | *.flf 21 | #Test results file 22 | TestResults.xml 23 | #About Bot 24 | node_modules 25 | session 26 | tmp 27 | database.* 28 | data.* 29 | data.store.* 30 | store.data.* 31 | package-lock.* 32 | yarn.lock 33 | goorm.manifest 34 | backup.zip 35 | stderr.log 36 | .cache -------------------------------------------------------------------------------- /plugins/primbon/nomorhoki.js: -------------------------------------------------------------------------------- 1 | module.exports = { 2 | help: ['nomorhoki'], 3 | use: 'query', 4 | tags: 'primbon', 5 | run: async (m, { 6 | conn, 7 | usedPrefix, 8 | command, 9 | text, 10 | Func 11 | }) => { 12 | try { 13 | if (!text) throw Func.example(usedPrefix, command, 'moon') 14 | conn.sendReact(m.chat, '🕒', m.key) 15 | const json = await Api.get('/nomorhoki', { q: text }) 16 | if (!json.status) throw Func.jsonFormat(json) 17 | m.reply(Func.jsonFormat(json.data)) 18 | } catch (e) { 19 | throw Func.jsonFormat(e) 20 | } 21 | }, 22 | limit: true, 23 | error: false 24 | } -------------------------------------------------------------------------------- /plugins/primbon/shio.js: -------------------------------------------------------------------------------- 1 | module.exports = { 2 | help: ['shio'], 3 | use: 'query', 4 | tags: 'primbon', 5 | run: async (m, { 6 | conn, 7 | usedPrefix, 8 | command, 9 | text, 10 | Func 11 | }) => { 12 | try { 13 | if (!text) throw Func.example(usedPrefix, command, 'moon') 14 | conn.sendReact(m.chat, '🕒', m.key) 15 | const json = await Api.get('/shio', { 16 | q: text 17 | }) 18 | if (!json.status) throw Func.jsonFormat(json) 19 | m.reply(json.data.result) 20 | } catch (e) { 21 | throw Func.jsonFormat(e) 22 | } 23 | }, 24 | limit: true, 25 | error: false 26 | } -------------------------------------------------------------------------------- /plugins/owner/backup.js: -------------------------------------------------------------------------------- 1 | const { writeFileSync, readFileSync } = require('fs') 2 | module.exports = { 3 | help: ['backup'], 4 | tags: 'owner', 5 | run: async (m, { 6 | conn, 7 | database, 8 | env, 9 | Func 10 | }) => { 11 | try { 12 | conn.sendReact(m.chat, '🕒', m.key) 13 | await database.save(global.db) 14 | writeFileSync(env.database + '.json', JSON.stringify(global.db, null, 3), 'utf-8') 15 | await conn.sendFile(m.chat, readFileSync('./' + env.database + '.json'), env.database + '.json', '', m) 16 | } catch (e) { 17 | return conn.reply(m.chat, Func.jsonFormat(e), m) 18 | } 19 | }, 20 | owner: true 21 | } -------------------------------------------------------------------------------- /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 | -------------------------------------------------------------------------------- /plugins/ai/dokter.js: -------------------------------------------------------------------------------- 1 | module.exports = { 2 | help: ['dokter'], 3 | use: 'query', 4 | tags: 'ai', 5 | run: async (m, { 6 | conn, 7 | usedPrefix, 8 | command, 9 | text, 10 | Scraper, 11 | Func 12 | }) => { 13 | try { 14 | if (!text) throw Func.example(usedPrefix, command, 'masuk angin') 15 | conn.sendReact(m.chat, '🕒', m.key) 16 | const json = await Api.get('/ai-dokter', { 17 | text: text 18 | }) 19 | if (!json.status) throw Func.jsonFormat(json) 20 | conn.reply(m.chat, json.data.content, m) 21 | } catch (e) { 22 | throw Func.jsonFormat(e) 23 | } 24 | }, 25 | limit: true, 26 | } -------------------------------------------------------------------------------- /plugins/ai/copilot.js: -------------------------------------------------------------------------------- 1 | module.exports = { 2 | help: ['copilot'], 3 | use: 'query', 4 | tags: 'ai', 5 | run: async (m, { 6 | conn, 7 | text, 8 | usedPrefix, 9 | command, 10 | Func 11 | }) => { 12 | try { 13 | if (!text) throw Func.example(usedPrefix, command, 'apa itu kucing') 14 | conn.sendReact(m.chat, '🕒', m.key) 15 | const json = await Api.get('/ai-copilot', { 16 | q: text 17 | }) 18 | if (!json.status) throw Func.jsonFormat(json) 19 | conn.reply(m.chat, json.data.content, m) 20 | } catch (e) { 21 | throw Func.jsonFormat(e) 22 | } 23 | }, 24 | limit: true, 25 | error: false 26 | } -------------------------------------------------------------------------------- /plugins/internet/kbbg.js: -------------------------------------------------------------------------------- 1 | module.exports = { 2 | help: ['kbbg'], 3 | use: 'text', 4 | tags: 'internet', 5 | run: async (m, { 6 | conn, 7 | usedPrefix, 8 | command, 9 | text, 10 | Scraper, 11 | Func 12 | }) => { 13 | try { 14 | if (!text) throw Func.example(usedPrefix, command, 'alay') 15 | conn.sendReact(m.chat, '🕒', m.key) 16 | const json = await Api.get('/kbbg', { 17 | q: text 18 | }) 19 | if (!json.status) throw Func.jsonFormat(json) 20 | conn.reply(m.chat, json.data.description, m) 21 | } catch (e) { 22 | throw Func.jsonFormat(e) 23 | } 24 | }, 25 | limit: true, 26 | error: false 27 | } -------------------------------------------------------------------------------- /plugins/ai/promptgen.js: -------------------------------------------------------------------------------- 1 | module.exports = { 2 | help: ['promptgen'], 3 | use: 'query', 4 | tags: 'ai', 5 | run: async (m, { 6 | conn, 7 | usedPrefix, 8 | command, 9 | text, 10 | Scraper, 11 | Func 12 | }) => { 13 | try { 14 | if (!text) throw Func.example(usedPrefix, command, 'white cat') 15 | conn.sendReact(m.chat, '🕒', m.key) 16 | const json = await Api.get('/prompt-generator', { 17 | q: text 18 | }) 19 | if (!json.status) throw Func.jsonFormat(json) 20 | conn.reply(m.chat, json.data[0].content.parts[0].text, m) 21 | } catch (e) { 22 | throw Func.jsonFormat(e) 23 | } 24 | }, 25 | limit: true, 26 | } -------------------------------------------------------------------------------- /plugins/primbon/artinama.js: -------------------------------------------------------------------------------- 1 | module.exports = { 2 | help: ['artinama'], 3 | use: 'query', 4 | tags: 'primbon', 5 | run: async (m, { 6 | conn, 7 | usedPrefix, 8 | command, 9 | text, 10 | Func 11 | }) => { 12 | try { 13 | if (!text) throw Func.example(usedPrefix, command, 'moon') 14 | conn.sendReact(m.chat, '🕒', m.key) 15 | const json = await Api.get('/artinama', { q: text }) 16 | if (!json.status) throw Func.jsonFormat(json) 17 | m.reply(`◦ *Nama* : ${text}\n◦ *Arti* : ${json.data.arti}\n◦ *Catatan* : ${json.data.catatan}`) 18 | } catch (e) { 19 | throw Func.jsonFormat(e) 20 | } 21 | }, 22 | limit: true, 23 | error: false 24 | } -------------------------------------------------------------------------------- /plugins/tools/nulis.js: -------------------------------------------------------------------------------- 1 | module.exports = { 2 | help: ['nulis'], 3 | aliases: ['magernulis'], 4 | use: 'text', 5 | tags: 'tools', 6 | run: async (m, { 7 | conn, 8 | usedPrefix, 9 | command, 10 | text, 11 | Scraper, 12 | Func 13 | }) => { 14 | try { 15 | if (!text) throw Func.example(usedPrefix, command, 'moon-bot') 16 | conn.sendReact(m.chat, '🕒', m.key) 17 | const json = await Api.get('/nulis', { 18 | text 19 | }) 20 | if (!json.status) throw Func.jsonFormat(json) 21 | conn.sendFile(m.chat, json.data.url, '', ``, m) 22 | } catch (e) { 23 | throw Func.jsonFormat(e) 24 | } 25 | }, 26 | limit: true, 27 | } -------------------------------------------------------------------------------- /plugins/group/q.js: -------------------------------------------------------------------------------- 1 | module.exports = { 2 | help: ['q'], 3 | aliases: ['quoted'], 4 | use: 'reply chat', 5 | tags: 'group', 6 | run: async (m, { 7 | conn, 8 | store, 9 | Func 10 | }) => { 11 | try { 12 | if (!m.quoted) return conn.reply(m.chat, Func.texted('bold', `🚩 Reply to message that contain quoted.`), m) 13 | const msg = await store.loadMessage(m.chat, m.quoted.id) 14 | if (msg.quoted === null) return conn.reply(m.chat, Func.texted('bold', `🚩 Message does not contain quoted.`), m) 15 | return conn.copyNForward(m.chat, msg.quoted.fakeObj) 16 | } catch (e) { 17 | conn.reply(m.chat, `🚩 Can't load message.`, m) 18 | } 19 | }, 20 | error: false 21 | } -------------------------------------------------------------------------------- /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 | for (let folder of folders) 8 | for (let file of fs.readdirSync(folder).filter(v => v.endsWith('.js'))) 9 | files.push(path.resolve(path.join(folder, file))) 10 | for (let file of files) { 11 | if (file == path.join(__dirname, __filename)) continue 12 | console.error('Checking', file) 13 | spawn(process.argv0, ['-c', file]).on('close', () => { 14 | assert.ok(file) 15 | console.log('Done', file) 16 | }).stderr.on('data', chunk => assert.ok(chunk.length < 1, file + '\n\n' + chunk)) 17 | } -------------------------------------------------------------------------------- /plugins/primbon/artimimpi.js: -------------------------------------------------------------------------------- 1 | module.exports = { 2 | help: ['artimimpi'], 3 | use: 'query', 4 | tags: 'primbon', 5 | run: async (m, { 6 | conn, 7 | usedPrefix, 8 | command, 9 | text, 10 | Func 11 | }) => { 12 | try { 13 | if (!text) throw Func.example(usedPrefix, command, 'Ketiban sapi') 14 | conn.sendReact(m.chat, '🕒', m.key) 15 | const json = await Api.get('/artimimpi', { q: text }) 16 | if (!json.status) throw Func.jsonFormat(json) 17 | m.reply(`◦ *Mimipi* : ${text}\n◦ *Arti* : ${json.data.arti}\n◦ *Solusi* : ${json.data.solusi}`) 18 | } catch (e) { 19 | throw Func.jsonFormat(e) 20 | } 21 | }, 22 | limit: true, 23 | error: false 24 | } -------------------------------------------------------------------------------- /plugins/ai/mathsolver.js: -------------------------------------------------------------------------------- 1 | module.exports = { 2 | help: ['mathsolver'], 3 | aliases: ['mathresolver'], 4 | use: 'expression', 5 | tags: 'ai', 6 | run: async (m, { 7 | conn, 8 | usedPrefix, 9 | command, 10 | text, 11 | Func 12 | }) => { 13 | try { 14 | if (!text) throw Func.example(usedPrefix, command, '1 + 1') 15 | conn.sendReact(m.chat, '🕒', m.key) 16 | const json = await Api.get('/ai-mathsolver', { 17 | q: text 18 | }) 19 | if (!json.status) throw Func.jsonFormat(json) 20 | conn.reply(m.chat, json.data.answer, m) 21 | } catch (e) { 22 | throw Func.jsonFormat(e) 23 | } 24 | }, 25 | limit: true, 26 | error: false 27 | } -------------------------------------------------------------------------------- /plugins/ai/openai.js: -------------------------------------------------------------------------------- 1 | module.exports = { 2 | help: ['openai'], 3 | aliases: ['ai'], 4 | use: 'query', 5 | tags: 'ai', 6 | run: async (m, { 7 | conn, 8 | usedPrefix, 9 | command, 10 | text, 11 | Scraper, 12 | Func 13 | }) => { 14 | try { 15 | if (!text) throw Func.example(usedPrefix, command, 'moonbot') 16 | conn.sendReact(m.chat, '🕒', m.key) 17 | const json = await Api.get('/openai', { 18 | prompt: text 19 | }) 20 | if (!json.status) throw Func.jsonFormat(json) 21 | conn.reply(m.chat, json.data.content, m) 22 | } catch (e) { 23 | throw Func.jsonFormat(e) 24 | } 25 | }, 26 | limit: true, 27 | error: false 28 | } 29 | -------------------------------------------------------------------------------- /plugins/owner/setmenu.js: -------------------------------------------------------------------------------- 1 | module.exports = { 2 | help: ['setmenu'], 3 | use: '(option)', 4 | tags: 'owner', 5 | run: async (m, { 6 | conn, 7 | usedPrefix, 8 | command, 9 | args, 10 | setting, 11 | Func 12 | }) => { 13 | try { 14 | if (!args || !args[0]) return m.reply(Func.example(usedPrefix, command, '2')) 15 | if (!['1', '2', '3'].includes(args[0])) return conn.reply(m.chat, Func.texted('bold', `🚩 Style not available.`), m) 16 | conn.reply(m.chat, `🚩 Bot menu successfully set using style *${args[0]}*.`, m).then(() => setting.style = parseInt(args[0])) 17 | } catch (e) { 18 | conn.reply(m.chat, Func.jsonFormat(e), m) 19 | } 20 | }, 21 | owner: true 22 | } -------------------------------------------------------------------------------- /plugins/tools/shorten.js: -------------------------------------------------------------------------------- 1 | module.exports = { 2 | help: ['shortner'], 3 | aliases: ['shortlink', 'shorten'], 4 | use: 'link', 5 | tags: 'tools', 6 | run: async (m, { 7 | conn, 8 | usedPrefix, 9 | command, 10 | args, 11 | Scraper, 12 | Func 13 | }) => { 14 | try { 15 | if (!args[0]) throw Func.example(usedPrefix, command, 'http://google.com') 16 | conn.sendReact(m.chat, '🕒', m.key) 17 | const json = await Api.get('/shorten', { 18 | url: args[0] 19 | }) 20 | if (!json.status) throw Func.jsonFormat(json) 21 | conn.reply(m.chat, json.data.url, m) 22 | } catch (e) { 23 | throw Func.jsonFormat(e) 24 | } 25 | }, 26 | limit: true 27 | } -------------------------------------------------------------------------------- /plugins/_events/protector/anti_link.js: -------------------------------------------------------------------------------- 1 | module.exports = { 2 | run: async (m, { 3 | conn, 4 | body, 5 | isAdmin, 6 | isBotAdmin, 7 | groupSet 8 | }) => { 9 | if (groupSet.antilink && !isAdmin && body) { 10 | if (body.match(/(chat.whatsapp.com)/gi) && !body.includes(await conn.groupInviteCode(m.chat)) || body.match(/(wa.me)/gi)) return conn.sendMessage(m.chat, { 11 | delete: { 12 | remoteJid: m.chat, 13 | fromMe: false, 14 | id: m.key.id, 15 | participant: m.sender 16 | } 17 | }).then(() => conn.groupParticipantsUpdate(m.chat, [m.sender], 'remove')) 18 | } 19 | }, 20 | group: true, 21 | isBotAdmin: true, 22 | error: false 23 | } -------------------------------------------------------------------------------- /plugins/_events/protector/anti_tagsw.js: -------------------------------------------------------------------------------- 1 | module.exports = { 2 | run: async (m, { 3 | conn, 4 | groupSet, 5 | isAdmin, 6 | Func 7 | }) => { 8 | try { 9 | if (groupSet.antitagsw && !isAdmin && /groupStatusMentionMessage/.test(m.mtype)) return conn.groupParticipantsUpdate(m.chat, [m.sender], 'remove').then(() => conn.sendMessage(m.chat, { 10 | delete: { 11 | remoteJid: m.chat, 12 | fromMe: false, 13 | id: m.key.id, 14 | participant: m.sender 15 | } 16 | })) 17 | } catch (e) { 18 | return conn.reply(m.chat, Func.jsonFormat(e), m) 19 | } 20 | }, 21 | error: false, 22 | group: true, 23 | botAdmin: true, 24 | error: false 25 | } -------------------------------------------------------------------------------- /plugins/ai/code.js: -------------------------------------------------------------------------------- 1 | module.exports = { 2 | help: ['code'], 3 | use: 'query | lang', 4 | tags: 'ai', 5 | run: async (m, { 6 | conn, 7 | usedPrefix, 8 | command, 9 | text, 10 | Func 11 | }) => { 12 | try { 13 | if (!text) throw Func.example(usedPrefix, command, 'How to create delay function | js') 14 | let [code, act] = text.split` | ` 15 | conn.sendReact(m.chat, '🕒', m.key) 16 | const json = await Api.get('/ai-code', { 17 | text: code, action: act 18 | }) 19 | if (!json.status) throw Func.jsonFormat(json) 20 | conn.reply(m.chat, json.data.code, m) 21 | } catch (e) { 22 | throw Func.jsonFormat(e) 23 | } 24 | }, 25 | limit: true, 26 | error: false 27 | } -------------------------------------------------------------------------------- /plugins/owner/setlink.js: -------------------------------------------------------------------------------- 1 | module.exports = { 2 | help: ['setlink'], 3 | use: 'link', 4 | tags: 'owner', 5 | run: async (m, { 6 | conn, 7 | usedPrefix, 8 | command, 9 | text, 10 | Func 11 | }) => { 12 | try { 13 | let setting = global.db.setting 14 | if (!text) return conn.reply(m.chat, Func.example(usedPrefix, command, global.db.setting.link), m) 15 | const isUrl = Func.isUrl(text) 16 | if (!isUrl) return conn.reply(m.chat, Func.texted('bold', `🚩 URL is invalid.`), m) 17 | setting.link = text 18 | conn.reply(m.chat, Func.texted('bold', `🚩 Link successfully set.`), m) 19 | } catch (e) { 20 | conn.reply(m.chat, Func.jsonFormat(e), m) 21 | } 22 | }, 23 | owner: true 24 | } -------------------------------------------------------------------------------- /plugins/tools/unshortner.js: -------------------------------------------------------------------------------- 1 | module.exports = { 2 | help: ['unshortner'], 3 | aliases: ['unshort', 'unshortlink'], 4 | use: 'link', 5 | tags: 'tools', 6 | run: async (m, { 7 | conn, 8 | usedPrefix, 9 | command, 10 | args, 11 | Scraper, 12 | Func 13 | }) => { 14 | try { 15 | if (!args[0]) throw Func.example(usedPrefix, command, 'http://gg.gg/1brt6s') 16 | conn.sendReact(m.chat, '🕒', m.key) 17 | const json = await Api.get('/unshortner', { 18 | url: args[0] 19 | }) 20 | if (!json.status) throw Func.jsonFormat(json) 21 | conn.reply(m.chat, Func.jsonFormat(json.data), m) 22 | } catch (e) { 23 | throw Func.jsonFormat(e) 24 | } 25 | }, 26 | limit: true 27 | } -------------------------------------------------------------------------------- /plugins/example/custom.js: -------------------------------------------------------------------------------- 1 | module.exports = { 2 | help: ['ephemeral', 'customid'], 3 | tags: 'example', 4 | run: async (m, { 5 | conn, 6 | command 7 | }) => { 8 | switch (command) { 9 | case 'ephemeral': { 10 | /** 11 | * 1 * 24 * 60 * 60 ~> 1 Day 12 | * 7 * 24 * 60 * 60 ~> 7 Day 13 | * 90 * 24 * 60 * 60 ~> 90 Day 14 | */ 15 | conn.reply(m.chat, 'Hi!', null, {}, { 16 | ephemeral: 7 * 24 * 60 * 60 // 7days 17 | }) 18 | } 19 | break 20 | case 'customid': { 21 | conn.reply(m.chat, 'Hi!', null, {}, { 22 | isAI: true 23 | }) 24 | } 25 | break 26 | } 27 | }, 28 | error: false 29 | } -------------------------------------------------------------------------------- /plugins/tools/webcloner.js: -------------------------------------------------------------------------------- 1 | module.exports = { 2 | help: ['webcloner'], 3 | use: 'link', 4 | tags: 'tools', 5 | run: async (m, { 6 | conn, 7 | usedPrefix, 8 | command, 9 | args, 10 | Func 11 | }) => { 12 | try { 13 | if (!args[0]) throw Func.example(usedPrefix, command, 'https://google.com') 14 | if (!/^https?:\/\//.test(args[0])) throw global.status.invalid 15 | conn.sendReact(m.chat, '🕒', m.key) 16 | const json = await Api.get('/web-cloner', { 17 | url: args[0] 18 | }) 19 | if (!json.status) throw Func.jsonFormat(json) 20 | conn.sendFile(m.chat, json.data.url, '', '', m) 21 | } catch (e) { 22 | throw Func.jsonFormat(e) 23 | } 24 | }, 25 | limit: true 26 | } -------------------------------------------------------------------------------- /plugins/ai/article.js: -------------------------------------------------------------------------------- 1 | module.exports = { 2 | help: ['article'], 3 | use: 'query | lang', 4 | tags: 'ai', 5 | run: async (m, { 6 | conn, 7 | usedPrefix, 8 | command, 9 | text, 10 | Func 11 | }) => { 12 | try { 13 | if (!text) throw Func.example(usedPrefix, command, 'hujan | Indonesian') 14 | let [teks, iso] = text.split` | ` 15 | conn.sendReact(m.chat, '🕒', m.key) 16 | const json = await Api.get('/ai-article', { 17 | text: teks, lang: iso 18 | }) 19 | if (!json.status) throw Func.jsonFormat(json) 20 | conn.reply(m.chat, json.data.content, m) 21 | } catch (e) { 22 | throw Func.jsonFormat(e) 23 | } 24 | }, 25 | limit: true, 26 | premium: true, 27 | error: false 28 | } -------------------------------------------------------------------------------- /plugins/ai/qwen.js: -------------------------------------------------------------------------------- 1 | module.exports = { 2 | help: ['qwen'], 3 | use: 'query', 4 | tags: 'ai', 5 | run: async (m, { 6 | conn, 7 | usedPrefix, 8 | command, 9 | text, 10 | Scraper, 11 | Func 12 | }) => { 13 | try { 14 | if (!text) throw Func.example(usedPrefix, command, 'mark itu orang atau alien') 15 | conn.sendReact(m.chat, '🕒', m.key) 16 | const json = await Api.get('/qwen', { 17 | msg: text, 18 | model: 'qwen-max-latest', 19 | realtime: true 20 | }) 21 | if (!json.status) throw Func.jsonFormat(json) 22 | conn.reply(m.chat, json.data.choices[0].message.content, m) 23 | } catch (e) { 24 | throw Func.jsonFormat(e) 25 | } 26 | }, 27 | limit: true, 28 | } -------------------------------------------------------------------------------- /plugins/_events/chatbot.js: -------------------------------------------------------------------------------- 1 | module.exports = { 2 | run: async (m, { 3 | conn, 4 | body, 5 | env, 6 | setting, 7 | Func 8 | }) => { 9 | try { 10 | if (setting.chatbot && body && !env.evaluate_chars.some(v => body.startsWith(v))) { 11 | const json = await Api.post('/completions', { 12 | model: 'zai-org/GLM-4.6', 13 | messages: JSON.stringify([{ role: 'system', content: 'Be a helpful assistant' }, { role: 'user', content: `${body}` }]) 14 | }) 15 | if (!json.status) throw new Error(json) 16 | if (!m.fromMe && json.status) return conn.replyAI(m.chat, json.data.choices[0].message.content, m) 17 | } 18 | } catch (e) { 19 | console.log(e) 20 | } 21 | }, 22 | private: true 23 | } -------------------------------------------------------------------------------- /plugins/admin/tagall.js: -------------------------------------------------------------------------------- 1 | module.exports = { 2 | help: ['tagall'], 3 | use: 'text (optional)', 4 | tags: 'admin', 5 | run: async (m, { 6 | conn, 7 | text, 8 | groupMetadata, 9 | participants, 10 | Func 11 | }) => { 12 | try { 13 | let member = participants.map(v => v.id) 14 | let readmore = String.fromCharCode(8206).repeat(4001) 15 | let message = (!text) ? 'Hello everyone, admin mention you in ' + groupMetadata.subject + ' group.' : text 16 | conn.reply(m.chat, `乂 *E V E R Y O N E*\n\n*“${message}”*\n${readmore}\n${member.map(v => '◦ @' + v.replace(/@.+/, '')).join('\n')}`, m) 17 | } catch (e) { 18 | return conn.reply(m.chat, Func.jsonFormat(e), m) 19 | } 20 | }, 21 | group: true, 22 | admin: true, 23 | error: false 24 | } -------------------------------------------------------------------------------- /plugins/owner/changename.js: -------------------------------------------------------------------------------- 1 | module.exports = { 2 | help: ['changename'], 3 | use: 'text', 4 | tags: 'owner', 5 | run: async (m, { 6 | conn, 7 | text, 8 | usedPrefix, 9 | command, 10 | database, 11 | Func 12 | }) => { 13 | try { 14 | if (!text) return conn.reply(m.chat, Func.example(usedPrefix, command, 'moon bot'), m) 15 | if (text.length > 25) return conn.reply(m.chat, `🚩 Text is too long, maximum 25 characters.`, m) 16 | conn.authState.creds.me.name = text 17 | await database.save(global.db) 18 | return conn.reply(m.chat, `🚩 Name successfully changed.`, m) 19 | } catch { 20 | return conn.reply(m.chat, Func.texted('bold', `🚩 Name failed to change.`), m) 21 | } 22 | }, 23 | owner: true, 24 | error: false 25 | } -------------------------------------------------------------------------------- /plugins/owner/setwm.js: -------------------------------------------------------------------------------- 1 | module.exports = { 2 | help: ['setwm'], 3 | use: 'packname | author', 4 | tags: 'owner', 5 | run: async (m, { 6 | conn, 7 | usedPrefix, 8 | command, 9 | text, 10 | Func 11 | }) => { 12 | try { 13 | let setting = global.db.setting 14 | if (!text) return conn.reply(m.chat, Func.example(usedPrefix, command, 'Sticker by | @moon-bot'), m) 15 | let [packname, ...author] = text.split`|` 16 | author = (author || []).join`|` 17 | setting.sk_pack = packname || '' 18 | setting.sk_author = author || '' 19 | conn.reply(m.chat, Func.texted('bold', `🚩 Sticker Watermark successfully set.`), m) 20 | } catch (e) { 21 | conn.reply(m.chat, Func.jsonFormat(e), m) 22 | } 23 | }, 24 | owner: true 25 | } -------------------------------------------------------------------------------- /plugins/random/how.js: -------------------------------------------------------------------------------- 1 | module.exports = { 2 | help: ['howgay', 'howpintar', 'howcantik', 'howganteng', 'howgabut', 'howgila', 'howlesbi', 'howstress', 'howbucin', 'howjones', 'howsadboy'], 3 | use: 'text', 4 | tags: 'random', 5 | run: async (m, { 6 | conn, 7 | command, 8 | text, 9 | Func 10 | }) => { 11 | try { 12 | if (!text) return m.reply(`Siapa yang *${command.replace('how', '').toUpperCase()}*`) 13 | conn.reply(m.chat, `${command} *${text}* is *${Math.floor(Math.random() * 101)}*% ${command.replace('how', '').toUpperCase()}`.trim(), m, m.mentionedJid ? { 14 | contextInfo: { 15 | mentionedJid: m.mentionedJid 16 | } 17 | } : {}) 18 | } catch (e) { 19 | console.log(e) 20 | } 21 | }, 22 | error: false 23 | } -------------------------------------------------------------------------------- /plugins/_events/protector/anti_virtex.js: -------------------------------------------------------------------------------- 1 | module.exports = { 2 | run: async (m, { 3 | conn, 4 | groupSet, 5 | isBotAdmin, 6 | body, 7 | Func 8 | }) => { 9 | try { 10 | if (!m.fromMe && body && (groupSet.antivirtex && body.match(/(৭৭৭৭৭৭৭৭|๒๒๒๒๒๒๒๒|๑๑๑๑๑๑๑๑|ดุท้่เึางืผิดุท้่เึางื)/gi) || groupSet.antivirtex && body.length > 10000)) return conn.sendMessage(m.chat, { 11 | delete: { 12 | remoteJid: m.chat, 13 | fromMe: false, 14 | id: m.key.id, 15 | participant: m.sender 16 | } 17 | }).then(() => conn.groupParticipantsUpdate(m.chat, [m.sender], 'remove')) 18 | } catch (e) { 19 | return conn.reply(m.chat, Func.jsonFormat(e), m) 20 | } 21 | }, 22 | group: true, 23 | botAdmin: true, 24 | error: false 25 | } -------------------------------------------------------------------------------- /config.json: -------------------------------------------------------------------------------- 1 | { 2 | "owner": "6283191036249", 3 | "owner_name": "Contact Support", 4 | "database": "data", 5 | "limit": 10, 6 | "multiplier": 250, 7 | "min_reward": 100000, 8 | "max_reward": 500000, 9 | "ram_limit": "1GB", 10 | "max_upload": 100, 11 | "max_upload_free": 50, 12 | "timer": 180000, 13 | "timeout": 1800000, 14 | "spam": { 15 | "mode": "command", 16 | "limit": 5, 17 | "time_window": 1, 18 | "time_ban": 1800, 19 | "max_ban": 3, 20 | "cooldown": 5 21 | }, 22 | "blocks": ["994", "221", "263", "212"], 23 | "evaluate_chars": ["=>", ">", "$", "~>", "!", "+", "/", "#", "."], 24 | "pairing": { 25 | "state": true, 26 | "number": 6283175395970, 27 | "code": "MOONXBOT", 28 | "browser": ["Ubuntu", "Firefox", "20.0.00"], 29 | "version": [2, 3000, 1029030078] 30 | } 31 | } -------------------------------------------------------------------------------- /plugins/miscs/cmdstic_list.js: -------------------------------------------------------------------------------- 1 | const moment = require('moment-timezone') 2 | 3 | module.exports = { 4 | help: ['cmdstic'], 5 | tags: 'owner', 6 | run: async (m, { 7 | conn, 8 | Func 9 | }) => { 10 | let cmdS = Object.keys(global.db.sticker) 11 | if (cmdS.length == 0) return conn.reply(m.chat, Func.texted('bold', `🚩 No sticker commands.`), m) 12 | let teks = `乂 *C M D - L I S T*\n\n` 13 | for (let i = 0; i < cmdS.length; i++) { 14 | teks += Func.texted('bold', (i + 1) + '.') + ' ' + cmdS[i] + '\n' 15 | teks += ' ◦ ' + Func.texted('bold', 'Text') + ' : ' + global.db.stickerr[cmdS[i]].text + '\n' 16 | teks += ' ◦ ' + Func.texted('bold', 'Created') + ' : ' + moment(global.db.sticker[cmdS[i]].created).format('DD/MM/YY HH:mm:ss') + '\n\n' 17 | } 18 | m.reply(teks + global.footer) 19 | }, 20 | error: false 21 | } -------------------------------------------------------------------------------- /plugins/ai/text2vid.js: -------------------------------------------------------------------------------- 1 | module.exports = { 2 | help: ['txt2vid'], 3 | aliases: ['text2video'], 4 | use: 'prompt | model', 5 | tags: 'ai', 6 | run: async (m, { 7 | conn, 8 | usedPrefix, 9 | command, 10 | text, 11 | Func 12 | }) => { 13 | try { 14 | if (!text) throw Func.example(usedPrefix, command, 'cat') 15 | conn.sendReact(m.chat, '🕒', m.key) 16 | let [prompt, model] = text.split` | `, old = new Date() 17 | const json = await Api.post('/text2vid', { 18 | prompt, model 19 | }) 20 | if (!json.status) throw Func.jsonFormat(json) 21 | conn.sendFile(m.chat, json.data.output[0], '', `🍟 *Process* : ${((new Date - old) * 1)} ms`, m) 22 | } catch (e) { 23 | throw Func.jsonFormat(e) 24 | } 25 | }, 26 | limit: 3, 27 | premium: true, 28 | error: false 29 | } -------------------------------------------------------------------------------- /plugins/converter/emojito.js: -------------------------------------------------------------------------------- 1 | module.exports = { 2 | help: ['emojito'], 3 | use: 'emoji', 4 | tags: 'converter', 5 | run: async (m, { 6 | conn, 7 | usedPrefix, 8 | command, 9 | text, 10 | setting, 11 | Func 12 | }) => { 13 | try { 14 | if (!text) throw Func.example(usedPrefix, command, '😀') 15 | conn.sendReact(m.chat, '🕒', m.key) 16 | const json = await Api.get('/emojito', { 17 | emoji: text 18 | }) 19 | if (!json.status) throw Func.jsonFormat(json) 20 | conn.sendSticker(m.chat, await Func.fetchBuffer(json.data.url), m, { 21 | packname: setting.sk_pack, 22 | author: setting.sk_author 23 | }) 24 | } catch (e) { 25 | throw Func.jsonFormat(e) 26 | } 27 | }, 28 | limit: true, 29 | error: false 30 | } -------------------------------------------------------------------------------- /plugins/tools/deobfuscator.js: -------------------------------------------------------------------------------- 1 | module.exports = { 2 | help: ['deobfuscator'], 3 | use: 'code', 4 | tags: 'tools', 5 | run: async (m, { 6 | conn, 7 | usedPrefix, 8 | command, 9 | text, 10 | Func 11 | }) => { 12 | try { 13 | if (!text && !(m.quoted?.text)) throw Func.example(usedPrefix, command, 'var+_0x5377%3D%5B"Hello+World%21"%5D%3Bvar+a%3D_0x5377%5B0%5D%3Bfunction+MsgBox%28_0x82a8x3%29%7Balert%28_0x82a8x3%29%3B%7D%3BMsgBox%28a%29%3B') 14 | conn.sendReact(m.chat, '🕒', m.key) 15 | const json = await Api.get('/deobfuscator', { 16 | code: text || m.quoted.text 17 | }) 18 | if (!json.status) throw Func.jsonFormat(json) 19 | conn.reply(m.chat, Func.jsonFormat(json.data), m) 20 | } catch (e) { 21 | throw Func.jsonFormat(e) 22 | } 23 | }, 24 | limit: true, 25 | premium: true 26 | } -------------------------------------------------------------------------------- /plugins/converter/iqc.js: -------------------------------------------------------------------------------- 1 | module.exports = { 2 | help: ['iqc'], 3 | use: 'text', 4 | tags: 'converter', 5 | run: async (m, { 6 | conn, 7 | usedPrefix, 8 | command, 9 | text, 10 | Func 11 | }) => { 12 | try { 13 | if (!text) throw Func.example(usedPrefix, command, 'moonbot') 14 | if (text.length > 50) throw Func.texted('bold', '🚩 Text is too long, max 50 characters.') 15 | let old = new Date() 16 | conn.sendReact(m.chat, '🕒', m.key) 17 | const json = await Api.get('/iqc', { 18 | text: text 19 | }) 20 | if (!json.status) throw Func.jsonFormat(json) 21 | conn.sendFile(m.chat, json.data.url, Func.filename('jpg'), `🍟 *Process* : ${((new Date - old) * 1)} ms`, m) 22 | } catch (e) { 23 | throw Func.jsonFormat(e) 24 | } 25 | }, 26 | limit: 1, 27 | error: false 28 | } -------------------------------------------------------------------------------- /plugins/tools/upload.js: -------------------------------------------------------------------------------- 1 | module.exports = { 2 | help: ['upload'], 3 | aliases: ['tourl'], 4 | use: 'reply media', 5 | tags: 'tools', 6 | run: async (m, { 7 | conn, 8 | Scraper, 9 | Func 10 | }) => { 11 | try { 12 | let q = m.quoted ? m.quoted : m 13 | let mime = (q.msg || q).mimetype || '' 14 | if (!mime) throw Func.texted('bold', '🚩 Send or reply to the media you want to upload.') 15 | conn.sendReact(m.chat, '🕒', m.key) 16 | let media = await q.download() 17 | //let isMedia = /image\/(png|jpe?g|gif)|video\/mp4\/webp/.test(mime) 18 | //let json = await (isMedia ? Scraper.imgbb : Scraper.uploader)(media) 19 | let json = await Scraper.tmpfiles(media) 20 | conn.reply(m.chat, json.data.url, m) 21 | } catch (e) { 22 | throw Func.jsonFormat(e) 23 | } 24 | }, 25 | limit: true 26 | } -------------------------------------------------------------------------------- /plugins/converter/ttp.js: -------------------------------------------------------------------------------- 1 | module.exports = { 2 | help: ['ttp'], 3 | use: 'text', 4 | tags: 'converter', 5 | run: async (m, { 6 | conn, 7 | usedPrefix, 8 | command, 9 | text, 10 | setting, 11 | Func 12 | }) => { 13 | try { 14 | if (!text) throw Func.example(usedPrefix, command, 'moon bot') 15 | if (text.length > 10) throw Func.texted('bold', '🚩 Max 10 character') 16 | conn.sendReact(m.chat, '🕒', m.key) 17 | const json = await Api.get('/ttp', { 18 | text: text 19 | }) 20 | if (!json.status) throw Func.jsonFormat(json) 21 | conn.sendSticker(m.chat, json.data.url, m, { 22 | packname: setting.sk_pack, 23 | author: setting.sk_author 24 | }) 25 | } catch (e) { 26 | throw Func.jsonFormat(e) 27 | } 28 | }, 29 | limit: true, 30 | error: false 31 | } -------------------------------------------------------------------------------- /plugins/converter/attp.js: -------------------------------------------------------------------------------- 1 | module.exports = { 2 | help: ['attp'], 3 | use: 'text', 4 | tags: 'converter', 5 | run: async (m, { 6 | conn, 7 | usedPrefix, 8 | command, 9 | text, 10 | setting, 11 | Func 12 | }) => { 13 | try { 14 | if (!text) throw Func.example(usedPrefix, command, 'moon bot') 15 | if (text.length > 10) throw Func.texted('bold', '🚩 Max 10 character') 16 | conn.sendReact(m.chat, '🕒', m.key) 17 | const json = await Api.get('/attp', { 18 | text: text 19 | }) 20 | if (!json.status) throw Func.jsonFormat(json) 21 | conn.sendSticker(m.chat, json.data.url, m, { 22 | packname: setting.sk_pack, 23 | author: setting.sk_author 24 | }) 25 | } catch (e) { 26 | throw Func.jsonFormat(e) 27 | } 28 | }, 29 | limit: true, 30 | error: false 31 | } -------------------------------------------------------------------------------- /plugins/_events/anonymous_ev.js: -------------------------------------------------------------------------------- 1 | module.exports = { 2 | run: async (m, { 3 | conn, 4 | Func 5 | }) => { 6 | if (!m.chat.endsWith('@s.whatsapp.net')) return !0 7 | conn.anonymous = conn.anonymous ? conn.anonymous : {} 8 | let room = Object.values(conn.anonymous).find(room => [room.a, room.b].includes(m.sender) && room.state === 'CHATTING') 9 | if (room) { 10 | if (/^.*(next|leave|start)/.test(m.text)) return 11 | let other = [room.a, room.b].find(user => user !== m.sender) 12 | await Func.delay(1000) 13 | m.copyNForward(other, true, m.quoted && m.quoted.fromMe ? { 14 | contextInfo: { 15 | ...m.msg.contextInfo, 16 | forwardingScore: 1, 17 | isForwarded: true, 18 | participant: other 19 | } 20 | } : {}) 21 | } 22 | }, 23 | private: true, 24 | error: false 25 | } -------------------------------------------------------------------------------- /plugins/tools/obfuscator.js: -------------------------------------------------------------------------------- 1 | module.exports = { 2 | help: ['obfuscator'], 3 | use: 'code', 4 | tags: 'tools', 5 | run: async (m, { 6 | conn, 7 | usedPrefix, 8 | command, 9 | text, 10 | Scraper, 11 | Func 12 | }) => { 13 | try { 14 | if (!text && !(m.quoted?.text)) throw Func.example(usedPrefix, command, async function isUrl(url) { 15 | return url.match(new RegExp(/https?:\/\/(www\.)?[-a-zA-Z0-9@:%.+#=]{1,256}\.[a-zA-Z0-9()]{1,6}\b([-a-zA-Z0-9()@:%+.#?&/=]*)/, 'gi')) 16 | }) 17 | conn.sendReact(m.chat, '🕒', m.key) 18 | const json = await Api.get('/obfuscator', { 19 | code: text || m.quoted.text 20 | }) 21 | if (!json.status) throw Func.jsonFormat(json) 22 | conn.reply(m.chat, json.data, m) 23 | } catch (e) { 24 | throw Func.jsonFormat(e) 25 | } 26 | }, 27 | limit: true 28 | } -------------------------------------------------------------------------------- /plugins/miscs/checkapi.js: -------------------------------------------------------------------------------- 1 | module.exports = { 2 | help: ['checkapi'], 3 | aliases: ['apikey'], 4 | tags: 'miscs', 5 | run: async (m, { 6 | conn, 7 | Func 8 | }) => { 9 | try { 10 | const json = await Api.get('/checkapi') 11 | if (!json.status) return conn.reply(m.chat, Func.jsonFormat(json), m) 12 | let txt = '乂 *A P I K E Y*\n\n' 13 | txt += ` ◦ *Limit* : (${json.data.limit} / ${json.data.total})\n` 14 | txt += ` ◦ *Premium* : ${json.data.premium ? '√' : '×'}\n` 15 | txt += ` ◦ *Expired* : ${new Date(json.data.expired_at).toLocaleDateString('id-ID')}\n` 16 | txt += ` ◦ *Joined* : ${new Date(json.data.joined_at).toLocaleDateString('id-ID')}\n\n` 17 | txt += global.footer 18 | conn.reply(m.chat, txt, m) 19 | } catch (e) { 20 | conn.reply(m.chat, Func.jsonFormat(e), m) 21 | } 22 | }, 23 | error: false 24 | } -------------------------------------------------------------------------------- /plugins/_events/clearDB.js: -------------------------------------------------------------------------------- 1 | module.exports = { 2 | run: async (m, { 3 | conn, 4 | env, 5 | Func 6 | }) => { 7 | try { 8 | setInterval(async () => { 9 | let day = 86400000 * 3, now = new Date() * 1 10 | Object.entries(global.db.users).filter(([jid, user]) => now - user.lastseen > day && !user.premium && !user.banned).forEach(([jid, user]) => { 11 | delete global.db.users[jid] 12 | }) 13 | Object.entries(global.db.chats).filter(([jid, chat]) => now - chat.lastseen > day).forEach(([jid, chat]) => { 14 | delete global.db.chats[jid] 15 | }) 16 | Object.entries(global.db.groups).filter(([jid, group]) => now - group.activity > day).forEach(([jid, group]) => { 17 | delete global.db.groups[jid] 18 | }) 19 | }, 60_000) 20 | } catch (e) { 21 | console.error(e) 22 | } 23 | }, 24 | error: false 25 | } -------------------------------------------------------------------------------- /plugins/internet/brainly.js: -------------------------------------------------------------------------------- 1 | module.exports = { 2 | help: ['brainly'], 3 | use: 'query', 4 | tags: 'internet', 5 | run: async (m, { 6 | conn, 7 | usedPrefix, 8 | command, 9 | text, 10 | Scraper, 11 | Func 12 | }) => { 13 | try { 14 | if (!text) throw Func.example(usedPrefix, command, 'Penemu listrik') 15 | conn.sendReact(m.chat, '🕒', m.key) 16 | const json = await Api.get('/brainly', { 17 | q: text, lang: 'id' 18 | }) 19 | if (!json.status) throw Func.jsonFormat(json) 20 | let txt = `乂 *B R A I N L Y*\n\n` 21 | json.data.map((v, i) => { 22 | txt += `*${(i + 1)}*. ${v.question}\n` 23 | txt += `◦ *Answer* : \n${v.answers}\n\n` 24 | }) 25 | conn.reply(m.chat, txt + global.footer, m) 26 | } catch (e) { 27 | throw Func.jsonFormat(e) 28 | } 29 | }, 30 | limit: true, 31 | error: false 32 | } -------------------------------------------------------------------------------- /plugins/miscs/speedtest.js: -------------------------------------------------------------------------------- 1 | const cp = require('child_process') 2 | const { promisify } = require('util') 3 | const exec = promisify(cp.exec).bind(cp) 4 | 5 | module.exports = { 6 | help: ['speedtest'], 7 | aliases: ['speed'], 8 | tags: 'miscs', 9 | run: async (m, { 10 | conn, 11 | Func 12 | }) => { 13 | conn.reply(m.chat, Func.texted('bold', 'Testing speed...'), m) 14 | let o 15 | try { 16 | o = await exec('python3 speed.py --share --secure') 17 | } catch (e) { 18 | o = e 19 | } finally { 20 | let { stdout, stderr } = o 21 | if (stdout.trim()) { 22 | if (stdout.includes('http')) { 23 | const imageUrl = stdout.match(/http[^\s]+/)[0] 24 | conn.sendFile(m.chat, imageUrl, '', stdout, m) 25 | } else { 26 | m.reply(stdout) 27 | } 28 | } 29 | if (stderr.trim()) m.reply(stderr) 30 | } 31 | }, 32 | error: false 33 | } -------------------------------------------------------------------------------- /plugins/admin/groupset.js: -------------------------------------------------------------------------------- 1 | module.exports = { 2 | help: ['setdesc', 'setname'], 3 | use: 'text', 4 | tags: 'admin', 5 | run: async (m, { 6 | conn, 7 | usedPrefix, 8 | command, 9 | text, 10 | participants, 11 | Func 12 | }) => { 13 | let value = m.quoted ? m.quoted.text : text 14 | if (command == 'setname') { 15 | if (!value) return conn.reply(m.chat, Func.example(usedPrefix, command, 'MOONBOT'), m) 16 | if (value > 25) return conn.reply(m.chat, Func.texted('bold', `🚩 Text is too long, maximum 25 character.`), m) 17 | await conn.groupUpdateSubject(m.chat, value) 18 | } else if (command == 'setdesc') { 19 | if (!value) return conn.reply(m.chat, Func.example(usedPrefix, command, `Follow the rules if you don't want to be kicked.`), m) 20 | await conn.groupUpdateDescription(m.chat, value) 21 | } 22 | }, 23 | group: true, 24 | admin: true, 25 | botAdmin: true, 26 | error: false 27 | } -------------------------------------------------------------------------------- /plugins/group/couple.js: -------------------------------------------------------------------------------- 1 | const moment = require('moment-timezone') 2 | 3 | module.exports = { 4 | help: ['couple'], 5 | tags: 'group', 6 | run: async (m, { 7 | conn, 8 | participants 9 | }) => { 10 | let member = participants.map(u => u.id) 11 | let now = new Date * 1 12 | var tag1 = member[Math.floor(member.length * Math.random())] 13 | var tag2 = member[Math.floor(member.length * Math.random())] 14 | if (tag1 == tag2) { 15 | for (let i = 0; i < 5; i++) { 16 | var tag1 = member[Math.floor(member.length * Math.random())] 17 | var tag2 = member[Math.floor(member.length * Math.random())] 18 | if (tag1 != tag2) { 19 | break 20 | } 21 | } 22 | } 23 | conn.reply(m.chat, `Random Best Couple : @${tag1.replace(/@.+/, '')} 💞 @${tag2.replace(/@.+/, '')}, New couple of the day may be chosen at _${moment(now).format('DD/MM/YYYY HH:mm')}._`) 24 | }, 25 | group: true 26 | } -------------------------------------------------------------------------------- /plugins/owner/setmsg.js: -------------------------------------------------------------------------------- 1 | module.exports = { 2 | help: ['setmsg'], 3 | use: 'text', 4 | tags: 'owner', 5 | run: async (m, { 6 | conn, 7 | usedPrefix, 8 | command, 9 | text, 10 | setting, 11 | Func 12 | }) => { 13 | try { 14 | if (!text) return conn.reply(m.chat, explain(usedPrefix, command), m) 15 | setting.msg = text 16 | conn.reply(m.chat, Func.texted('bold', `🚩 Menu Message successfully set.`), m) 17 | } catch (e) { 18 | conn.reply(m.chat, Func.jsonFormat(e), m) 19 | } 20 | }, 21 | owner: true 22 | } 23 | 24 | const explain = (prefix, command) => { 25 | return `Sorry, can't return without text, and this explanation and how to use : 26 | 27 | *1.* +tag : for mention sender. 28 | *2.* +name : to getting sender name. 29 | *3.* +greeting : to display greetings by time. 30 | *4.* +db : to display database. 31 | 32 | • *Example* : ${prefix + command} Hi +tag +greeting, i'm an automation system` 33 | } -------------------------------------------------------------------------------- /plugins/admin/activation.js: -------------------------------------------------------------------------------- 1 | module.exports = { 2 | help: ['mute'], 3 | use: '0 / 1', 4 | tags: 'admin', 5 | run: async (m, { 6 | conn, 7 | args, 8 | groupSet: gc, 9 | Func 10 | }) => { 11 | let opt = [0, 1] 12 | if (!args || !args[0] || !opt.includes(parseInt(args[0]))) return conn.reply(m.chat, `🚩 *Current status* : [ ${gc.mute ? 'True' : 'False'} ] (Enter *1* or *0*)`, m) 13 | if (parseInt(args[0]) == 1) { 14 | if (gc.mute) return conn.reply(m.chat, Func.texted('bold', `🚩 Previously muted.`), m) 15 | gc.mute = true 16 | conn.reply(m.chat, Func.texted('bold', `🚩 Successfully muted.`), m) 17 | } else if (parseInt(args[0]) == 0) { 18 | if (!gc.mute) return conn.reply(m.chat, Func.texted('bold', `🚩 Previously unmuted.`), m) 19 | gc.mute = false 20 | conn.reply(m.chat, Func.texted('bold', `🚩 Successfully unmuted.`), m) 21 | } 22 | }, 23 | admin: true, 24 | group: true, 25 | error: false 26 | } -------------------------------------------------------------------------------- /plugins/owner/update.js: -------------------------------------------------------------------------------- 1 | const { execSync } = require('child_process') 2 | 3 | module.exports = { 4 | help: ['update'], 5 | tags: 'owner', 6 | run: async (m, { 7 | conn, 8 | usedPrefix, 9 | command, 10 | Func 11 | }) => { 12 | try { 13 | var stdout = execSync('git pull') 14 | var output = stdout.toString() 15 | if (output.match(new RegExp('Already up to date', 'g'))) return conn.reply(m.chat, Func.texted('bold', `🚩 ${output.trim()}`), m) 16 | if (output.match(/stash/g)) { 17 | var stdout = execSync('git stash && git pull') 18 | var output = stdout.toString() 19 | conn.reply(m.chat, `🚩 ${output.trim()}`, m).then(async () => process.send('reset')) 20 | } else return conn.reply(m.chat, `🚩 ${output.trim()}`, m).then(async () => process.send('reset')) 21 | } catch (e) { 22 | return conn.reply(m.chat, Func.jsonFormat(e), m) 23 | } 24 | }, 25 | owner: true, 26 | error: false 27 | } -------------------------------------------------------------------------------- /plugins/downloader/rednote.js: -------------------------------------------------------------------------------- 1 | module.exports = { 2 | help: ['rednote'], 3 | use: 'link', 4 | tags: 'downloader', 5 | run: async (m, { 6 | conn, 7 | args, 8 | usedPrefix, 9 | command, 10 | Func 11 | }) => { 12 | try { 13 | if (!args || !args[0]) throw Func.example(usedPrefix, command, 'https://xhslink.com/a/hlM81D1Yoa63') 14 | if (!args[0].match('xhslink.com')) throw global.status.invalid 15 | conn.sendReact(m.chat, '🕒', m.key) 16 | let old = new Date() 17 | const json = await Api.get('/rednote', { 18 | url: args[0] 19 | }) 20 | if (!json.status) throw Func.jsonFormat(json) 21 | json.data.map(async (v, i) => { 22 | conn.sendFile(m.chat, v.url, '', `🍟 *Process* : ${(new Date() - old) * 1} ms`, m) 23 | await Func.delay(1500) 24 | }) 25 | } catch (e) { 26 | throw Func.jsonFormat(e) 27 | } 28 | }, 29 | limit: true, 30 | error: false 31 | } -------------------------------------------------------------------------------- /plugins/converter/tts.js: -------------------------------------------------------------------------------- 1 | module.exports = { 2 | help: ['tts'], 3 | use: 'iso text', 4 | tags: 'converter', 5 | run: async (m, { 6 | conn, 7 | usedPrefix, 8 | command, 9 | args, 10 | Func 11 | }) => { 12 | const defaultLang = 'id' 13 | try { 14 | if (!args[0]) throw Func.example(usedPrefix, command, 'id hello guys') 15 | let text = args.slice(1).join('') 16 | if ((args[0] || '').length !== 2) { 17 | lang = defaultLang 18 | text = args.join(' ') 19 | } 20 | if (!text && m.quoted && m.quoted.text) text = m.quoted.text 21 | const json = await Api.get('/tts', { 22 | text: text, iso: args[0] 23 | }) 24 | if (!json.status) throw Func.jsonFormat(json) 25 | conn.sendFile(m.chat, json.data.url, 'audio.mp3', '', m) 26 | } catch (e) { 27 | throw Func.texted('bold', `🚩 Language code not supported.`) 28 | } 29 | }, 30 | limit: true, 31 | error: false 32 | } -------------------------------------------------------------------------------- /plugins/converter/take.js: -------------------------------------------------------------------------------- 1 | module.exports = { 2 | help: ['take'], 3 | aliases: ['wm'], 4 | use: 'packname | author', 5 | tags: 'converter', 6 | run: async (m, { 7 | conn, 8 | text, 9 | Func 10 | }) => { 11 | try { 12 | if (!text) throw Func.texted('bold', `🚩 Give a text to make watermark.`) 13 | let [packname, ...author] = text.split`|` 14 | author = (author || []).join`|` 15 | let q = m.quoted ? m.quoted : m 16 | let mime = (q.msg || q).mimetype || '' 17 | if (!/webp/.test(mime)) throw Func.texted('bold', `🚩 Reply to the sticker you want to change the watermark.`) 18 | let img = await q.download() 19 | if (!img) throw global.status.wrong 20 | conn.sendSticker(m.chat, img, m, { 21 | packname: packname || '', 22 | author: author || '' 23 | }) 24 | } catch (e) { 25 | throw Func.jsonFormat(e) 26 | } 27 | }, 28 | limit: true, 29 | premium: true, 30 | error: false 31 | } -------------------------------------------------------------------------------- /plugins/tools/fetch.js: -------------------------------------------------------------------------------- 1 | const util = require('util') 2 | 3 | module.exports = { 4 | help: ['fetch'], 5 | aliases: ['get'], 6 | use: 'url', 7 | tags: 'tools', 8 | run: async (m, { 9 | conn, 10 | usedPrefix, 11 | command, 12 | text, 13 | Func 14 | }) => { 15 | if (!/^https?:\/\//.test(text)) throw Func.example(usedPrefix, command, 'https://google.com') 16 | let url = text 17 | let res = await fetch(url) 18 | if (res.headers.get('content-length') > 100 * 1024 * 1024 * 1024) { 19 | delete res 20 | return m.reply(`Content-Length: ${res.headers.get('content-length')}`) 21 | } 22 | if (!/text|json/.test(res.headers.get('content-type'))) return conn.sendFile(m.chat, url, '', text, m) 23 | let txt = await res.buffer() 24 | try { 25 | txt = util.format(JSON.parse(txt + '')) 26 | } catch (e) { 27 | txt = txt + '' 28 | } finally { 29 | m.reply(txt.slice(0, 65536) + '') 30 | } 31 | }, 32 | limit: true 33 | } -------------------------------------------------------------------------------- /plugins/ai/text2img.js: -------------------------------------------------------------------------------- 1 | module.exports = { 2 | help: ['txt2img'], 3 | aliases: ['text2image', 'texttoimage', 'txttoimg'], 4 | use: 'prompt | negative | model | ratio', 5 | tags: 'ai', 6 | run: async (m, { 7 | conn, 8 | usedPrefix, 9 | command, 10 | text, 11 | Func 12 | }) => { 13 | try { 14 | if (!text) throw Func.example(usedPrefix, command, 'White cat | black | Text to Image | 1:1 | true') 15 | conn.sendReact(m.chat, '🕒', m.key) 16 | let [prompt, negative_prompt, model, ratio, upscale] = text.split` | `, old = new Date() 17 | const json = await Api.post('/text2img', { 18 | prompt, negative_prompt, model, ratio, upscale 19 | }) 20 | if (!json.status) throw Func.jsonFormat(json) 21 | conn.sendFile(m.chat, json.data.images[0].url, '', `🍟 *Process* : ${((new Date - old) * 1)} ms`, m) 22 | } catch (e) { 23 | throw Func.jsonFormat(e) 24 | } 25 | }, 26 | limit: 3, 27 | premium: true, 28 | error: false 29 | } -------------------------------------------------------------------------------- /README.md: -------------------------------------------------------------------------------- 1 | ## MOON BOT - WhatsApp Unofficial Bot (Baileys) 2 | > This is an unofficial WhatsApp bot built using the Baileys library. It connects to WhatsApp Web and allows you to send and receive messages, handle groups, share media, and automate various tasks. With Baileys, developers can easily create custom commands and integrate WhatsApp into their applications. 3 | 4 | ## Docs 5 | > [ID](/ID.md) | [EN](/EN.md) 6 | 7 | [![Forks](https://img.shields.io/github/forks/znanx/moon-bot?style=flat-square)](https://github.com/znanx/moon-bot/network/members) 8 | [![Stars](https://img.shields.io/github/stars/znanx/moon-bot?style=flat-square)](https://github.com/znanx/moon-bot/stargazers) 9 | [![License](https://img.shields.io/github/license/znanx/moon-bot?style=flat-square)](./LICENSE) 10 | [![Issues](https://img.shields.io/github/issues/znanx/moon-bot?style=flat-square)](https://github.com/znanx/moon-bot/issues) 11 | 12 | > [!NOTE] 13 | > This script is still in development and will continue to be updated, keep an eye on this repository, don't forget to give stars and forks -------------------------------------------------------------------------------- /plugins/converter/emojimix.js: -------------------------------------------------------------------------------- 1 | module.exports = { 2 | help: ['emojimix'], 3 | use: 'emoji + emoji', 4 | tags: 'converter', 5 | run: async (m, { 6 | conn, 7 | usedPrefix, 8 | command, 9 | text, 10 | setting, 11 | Func 12 | }) => { 13 | try { 14 | if (!text) throw Func.example(usedPrefix, command, '😳 + 😩') 15 | conn.sendReact(m.chat, '🕒', m.key) 16 | let [emo1, emo2] = text.split` + ` 17 | if (!emo1 || !emo2) throw Func.texted('bold', `🚩 Give 2 emoji to mix.`) 18 | const json = await Api.get('/emojimix', { 19 | emo1, emo2 20 | }) 21 | if (!json.status) throw Func.texted('bold', `🚩 Emoji can't be mixed.`) 22 | conn.sendSticker(m.chat, json.data.url, m, { 23 | packname: setting.sk_pack, 24 | author: setting.sk_author, 25 | categories: [emo1, emo2] 26 | }) 27 | } catch (e) { 28 | throw Func.jsonFormat(e) 29 | } 30 | }, 31 | limit: true, 32 | error: false 33 | } -------------------------------------------------------------------------------- /plugins/internet/wallpaper.js: -------------------------------------------------------------------------------- 1 | module.exports = { 2 | help: ['wallpaper'], 3 | use: 'query', 4 | tags: 'internet', 5 | run: async (m, { 6 | conn, 7 | usedPrefix, 8 | command, 9 | text, 10 | Func 11 | }) => { 12 | try { 13 | if (!text) throw Func.example(usedPrefix, command, 'sunset') 14 | conn.sendReact(m.chat, '🕒', m.key) 15 | const json = await Api.get('/wallpaper', { 16 | q: text 17 | }) 18 | if (!json.status) throw Func.jsonFormat(json) 19 | const medias = Array.from({ length: 5 }, () => { 20 | const rand = Math.floor(Math.random() * json.data.length) 21 | return { url: json.data[rand].url } 22 | }) 23 | if (medias.length === 1) { 24 | conn.sendFile(m.chat, medias[0].url, '', '', m) 25 | } else { 26 | conn.sendAlbumMessage(m.chat, medias, m) 27 | } 28 | } catch (e) { 29 | throw Func.jsonFormat(e) 30 | } 31 | }, 32 | limit: true, 33 | error: false 34 | } -------------------------------------------------------------------------------- /plugins/tools/noiseremover.js: -------------------------------------------------------------------------------- 1 | module.exports = { 2 | help: ['noiseremover'], 3 | aliases: ['noise'], 4 | use: 'reply audio', 5 | tags: 'tools', 6 | run: async (m, { 7 | conn, 8 | usedPrefix, 9 | command, 10 | Scraper, 11 | Func 12 | }) => { 13 | try { 14 | let q = m.quoted ? m.quoted : m 15 | let mime = (q.msg || q).mimetype || '' 16 | if (!mime) throw Func.texted('bold', `🚩 Reply audio.`) 17 | if (!/audio\/(mpeg|vn)/.test(mime)) throw Func.texted('bold', `🚩 Only for audio.`) 18 | conn.sendReact(m.chat, '🕒', m.key) 19 | const cdn = await Scraper.uploader(await q.download()) 20 | if (!cdn.status) throw Func.jsonFormat(cdn) 21 | const json = await Api.get('/noise-remover', { 22 | audio: cdn.data.url 23 | }) 24 | if (!json.status) throw Func.jsonFormat(json) 25 | conn.sendFile(m.chat, json.data.url, '', '', m) 26 | } catch (e) { 27 | throw Func.jsonFormat(e) 28 | } 29 | }, 30 | limit: true 31 | } -------------------------------------------------------------------------------- /plugins/ai/meta.js: -------------------------------------------------------------------------------- 1 | module.exports = { 2 | help: ['meta'], 3 | use: 'prompt / query', 4 | tags: 'ai', 5 | run: async (m, { 6 | conn, 7 | usedPrefix, 8 | command, 9 | text, 10 | Func 11 | }) => { 12 | try { 13 | if (!text) throw Func.example(usedPrefix, command, 'mark itu orang atau alien') 14 | conn.sendReact(m.chat, '🕒', m.key) 15 | const json = await Api.get('/ai-meta', { 16 | prompt: text 17 | }) 18 | var media = [] 19 | if (!json.status) throw Func.jsonFormat(json) 20 | if (json.data.imagine_media.length != 0) { 21 | json.data.imagine_media.map(async v => { 22 | media.push({ 23 | url: v.uri 24 | }) 25 | }) 26 | conn.sendAlbumMessage(m.chat, media, m) 27 | } else { 28 | conn.reply(m.chat, json.data.content, m) 29 | } 30 | } catch (e) { 31 | throw Func.jsonFormat(e) 32 | } 33 | }, 34 | limit: true, 35 | error: false 36 | } -------------------------------------------------------------------------------- /plugins/internet/pinterest.js: -------------------------------------------------------------------------------- 1 | module.exports = { 2 | help: ['pinterest'], 3 | aliases: ['pin'], 4 | use: 'query', 5 | tags: 'internet', 6 | run: async (m, { 7 | conn, 8 | usedPrefix, 9 | command, 10 | text, 11 | Func 12 | }) => { 13 | try { 14 | if (!text) throw Func.example(usedPrefix, command, 'red moon') 15 | conn.sendReact(m.chat, '🕒', m.key) 16 | const json = await Api.get('/pinterest', { 17 | q: text 18 | }) 19 | if (!json.status) throw Func.jsonFormat(json) 20 | const medias = Array.from({ length: 5 }, () => { 21 | const rand = Math.floor(Math.random() * json.data.length) 22 | return { url: json.data[rand].url } 23 | }) 24 | if (medias.length === 1) { 25 | conn.sendFile(m.chat, medias[0].url, '', '', m) 26 | } else { 27 | conn.sendAlbumMessage(m.chat, medias, m) 28 | } 29 | } catch (e) { 30 | throw Func.jsonFormat(e) 31 | } 32 | }, 33 | limit: true 34 | } -------------------------------------------------------------------------------- /plugins/owner/restore.js: -------------------------------------------------------------------------------- 1 | const { readFileSync } = require('fs') 2 | module.exports = { 3 | help: ['restore'], 4 | tags: 'owner', 5 | run: async (m, { 6 | conn, 7 | command, 8 | database, 9 | env, 10 | Func 11 | }) => { 12 | try { 13 | if (m.quoted && /document/.test(m.quoted.mtype) && /json/.test(m.quoted.fileName)) { 14 | const fn = await Func.getFile(await m.quoted.download()) 15 | if (!fn.status) return conn.reply(m.chat, Func.texted('bold', `🚩 File cannot be downloaded.`), m) 16 | global.db = JSON.parse(readFileSync(fn.file, 'utf-8')) 17 | conn.reply(m.chat, '✅ Database was successfully restored.', m).then(async () => { 18 | await database.save(JSON.parse(readFileSync(fn.file, 'utf-8'))) 19 | }) 20 | } else conn.reply(m.chat, Func.texted('bold', `🚩 Reply to the backup file first then reply with this feature.`), m) 21 | } catch (e) { 22 | return conn.reply(m.chat, Func.jsonFormat(e), m) 23 | } 24 | }, 25 | owner: true 26 | } -------------------------------------------------------------------------------- /plugins/tools/screenshot.js: -------------------------------------------------------------------------------- 1 | module.exports = { 2 | help: ['screenshot'], 3 | aliases: ['ss'], 4 | use: 'link', 5 | tags: 'tools', 6 | run: async (m, { 7 | conn, 8 | usedPrefix, 9 | command, 10 | args, 11 | Func 12 | }) => { 13 | try { 14 | if (!args[1]) throw Func.example(usedPrefix, command, 'mobile https://api.alyachan.dev') 15 | if (!/^https?:\/\//.test(args[1])) throw Func.texted('bold', '🚩 Prefix the link with https:// or http://') 16 | let old = new Date(), mode = args[0].toLowerCase(), url = args[1] 17 | if (!['mobile', 'desktop'].includes(mode)) throw Func.texted('bold', '🚩 Use mobile or desktop mode.') 18 | conn.sendReact(m.chat, '🕒', m.key) 19 | const json = await Api.get('/ssweb', { 20 | url: url, mode: mode 21 | }) 22 | if (!json.status) throw Func.jsonFormat(json) 23 | conn.sendFile(m.chat, json.data.url, '', `🍟 *Process* : ${((new Date - old) * 1)} ms`, m) 24 | } catch (e) { 25 | throw Func.jsonFormat(e) 26 | } 27 | }, 28 | limit: true 29 | } -------------------------------------------------------------------------------- /LICENSE: -------------------------------------------------------------------------------- 1 | MIT License 2 | 3 | Copyright (c) 2023 Znanx 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 | -------------------------------------------------------------------------------- /plugins/converter/tovideo.js: -------------------------------------------------------------------------------- 1 | module.exports = { 2 | help: ['tovideo'], 3 | aliases: ['togif'], 4 | use: 'reply gif sticker', 5 | tags: 'converter', 6 | run: async (m, { 7 | conn, 8 | Scraper, 9 | Func 10 | }) => { 11 | try { 12 | let exif = global.db.setting 13 | let old = new Date() 14 | if (!m.quoted) throw Func.texted('bold', `🚩 Reply to gif sticker.`) 15 | let q = m.quoted ? m.quoted : m 16 | let mime = (q.msg || q).mimetype || '' 17 | if (!/webp/.test(mime)) throw Func.texted('bold', `🚩 Reply to gif sticker.`) 18 | conn.sendReact(m.chat, '🕒', m.key) 19 | const cdn = await Scraper.uploader(await q.download()) 20 | if (!cdn.status) throw Func.jsonFormat(cdn) 21 | const json = await Api.get('/webp-convert', { 22 | url: cdn.data.url, action: 'webp-to-mp4' 23 | }) 24 | conn.sendFile(m.chat, json.data.url, '', `🍟 *Process* : ${((new Date - old) * 1)} ms`, m) 25 | } catch (e) { 26 | throw Func.jsonFormat(e) 27 | } 28 | }, 29 | limit: true, 30 | error: false 31 | } -------------------------------------------------------------------------------- /plugins/downloader/instagram.js: -------------------------------------------------------------------------------- 1 | module.exports = { 2 | help: ['instagram'], 3 | aliases: ['ig'], 4 | use: 'link', 5 | tags: 'downloader', 6 | run: async (m, { 7 | conn, 8 | usedPrefix, 9 | command, 10 | args, 11 | Func 12 | }) => { 13 | try { 14 | if (!args || !args[0]) throw Func.example(usedPrefix, command, 'https://www.instagram.com/p/CK0tLXyAzEI') 15 | if (!args[0].match(/(https:\/\/www.instagram.com)/gi)) throw global.status.invalid 16 | let old = new Date() 17 | conn.sendReact(m.chat, '🕒', m.key) 18 | const json = await Api.get('/ig', { 19 | url: args[0] 20 | }) 21 | if (!json.status) throw Func.jsonFormat(json) 22 | if (json.data.length == 1) { 23 | conn.sendFile(m.chat, json.data[0].url, '', `🍟 *Process* : ${((new Date - old) * 1)} ms`, m) 24 | } else { 25 | const album = json.data.map(v => ({ url: v.url })) 26 | conn.sendAlbumMessage(m.chat, album, m) 27 | } 28 | } catch (e) { 29 | throw Func.jsonFormat(e) 30 | } 31 | }, 32 | limit: true, 33 | error: false 34 | } -------------------------------------------------------------------------------- /plugins/miscs/server.js: -------------------------------------------------------------------------------- 1 | const os = require('os') 2 | module.exports = { 3 | help: ['server'], 4 | tags: 'miscs', 5 | run: async (m, { 6 | conn, 7 | setting, 8 | Func 9 | }) => { 10 | try { 11 | const json = await Func.fetchJson('http://ip-api.com/json') 12 | delete json.status 13 | delete json.query 14 | let caption = `乂 *S E R V E R*\n\n` 15 | caption += `┌ ◦ OS : ${os.type()} (${os.arch()} / ${os.release()})\n` 16 | caption += `│ ◦ Ram : ${Func.formatSize(process.memoryUsage().rss)} / ${Func.formatSize(os.totalmem())}\n` 17 | for (let key in json) caption += `│ ◦ ${Func.ucword(key)} : ${json[key]}\n` 18 | caption += `│ ◦ Uptime : ${Func.toTime(os.uptime * 1000)}\n` 19 | caption += `└ ◦ Processor : ${os.cpus()[0].model}\n\n` 20 | caption += global.footer 21 | conn.sendMessageModify(m.chat, caption, m, { 22 | largeThumb: true, 23 | thumbnail: Func.isUrl(setting.cover) ? setting.cover : Buffer.from(setting.cover, 'base64'), 24 | }) 25 | } catch (e) { 26 | console.log(e) 27 | } 28 | } 29 | } -------------------------------------------------------------------------------- /plugins/_events/auto/auto_sticker.js: -------------------------------------------------------------------------------- 1 | module.exports = { 2 | run: async (m, { 3 | conn, 4 | body, 5 | isOwner, 6 | groupSet, 7 | setting, 8 | Func 9 | }) => { 10 | try { 11 | if (groupSet.autosticker && /video|image/.test(m.mtype)) { 12 | let mime = m.msg.mimetype 13 | if (/image\/(jpe?g|png)/.test(mime)) { 14 | let img = await m.download() 15 | if (!img) return 16 | conn.sendSticker(m.chat, img, m, { 17 | packname: setting.sk_pack, 18 | author: setting.sk_author 19 | }) 20 | } else if (/video/.test(mime)) { 21 | if (m.msg.seconds > 10) return 22 | let img = await m.download() 23 | if (!img) return 24 | conn.sendSticker(m.chat, img, m, { 25 | packname: setting.sk_pack, 26 | author: setting.sk_author 27 | }) 28 | } 29 | } 30 | } catch (e) { 31 | return conn.reply(m.chat, Func.jsonFormat(e), m) 32 | } 33 | }, 34 | group: true, 35 | error: false 36 | } -------------------------------------------------------------------------------- /plugins/downloader/xbuddy.js: -------------------------------------------------------------------------------- 1 | module.exports = { 2 | help: ['xbuddy'], 3 | use: 'link', 4 | tags: 'downloader', 5 | run: async (m, { 6 | conn, 7 | usedPrefix, 8 | command, 9 | args, 10 | users, 11 | env, 12 | Func 13 | }) => { 14 | try { 15 | if (!args || !args[0]) throw Func.example(usedPrefix, command, 'https://www.tiktok.com/@cikaseiska/video/7379107227363200261?is_from_webapp=1&sender_device=pc&web_id=7330639260519974418') 16 | if (!/^https?:\/\//.test(args[0])) throw global.status.invalid 17 | conn.sendReact(m.chat, '🕒', m.key), old = new Date() 18 | const json = await Api.get('/xbuddy', { 19 | url: args[0] 20 | }) 21 | if (!json.status) throw Func.jsonFormat(json) 22 | const result = json.data.response.formats.filter(v => v.type === 'video').map(v => v.url) 23 | if (result.length > 0) { 24 | conn.sendFile(m.chat, result[0], '', `🍟 *Process* : ${((new Date - old) * 1)} ms`, m) 25 | } else { } 26 | } catch (e) { 27 | throw Func.jsonFormat(e) 28 | } 29 | }, 30 | limit: 5, 31 | error: false 32 | } -------------------------------------------------------------------------------- /plugins/downloader/threads.js: -------------------------------------------------------------------------------- 1 | module.exports = { 2 | help: ['threads'], 3 | use: 'link', 4 | tags: 'downloader', 5 | run: async (m, { 6 | conn, 7 | usedPrefix, 8 | command, 9 | args, 10 | Func 11 | }) => { 12 | try { 13 | if (!args[0]) return m.reply(Func.example(usedPrefix, command, 'https://www.threads.net/t/CuiXbGvPyJz/?igshid=NTc4MTIwNjQ2YQ==')) 14 | if (!/https?:\/\/(?:www\.)?(threads\.(net|com)|[\w-]+\.com)\/[^\s"]*/i.test(args[0])) throw global.status.invalid 15 | let old = new Date() 16 | conn.sendReact(m.chat, '🕒', m.key) 17 | const json = await Api.get('/threads', { 18 | url: args[0] 19 | }) 20 | if (!json.status) throw Func.jsonFormat(json) 21 | if (json.data.length == 1) { 22 | conn.sendFile(m.chat, json.data[0].url, '', `🍟 *Process* : ${((new Date - old) * 1)} ms`, m) 23 | } else { 24 | const album = json.data.map(v => ({ url: v.url })) 25 | conn.sendAlbumMessage(m.chat, album, m) 26 | } 27 | } catch (e) { 28 | throw Func.jsonFormat(e) 29 | } 30 | }, 31 | limit: true, 32 | error: false 33 | } -------------------------------------------------------------------------------- /plugins/_events/afk_detector.js: -------------------------------------------------------------------------------- 1 | module.exports = { 2 | run: async (m, { 3 | conn, 4 | groupMetadata, 5 | Func 6 | }) => { 7 | try { 8 | let afk = [...new Set([...(m.mentionedJid || []), ...(m.quoted ? [m.quoted.sender] : [])])] 9 | for (let jid of afk) { 10 | let is_user = global.db.users[jid] 11 | if (!is_user) continue 12 | let afkTime = is_user.afk 13 | if (!afkTime || afkTime < 0) continue 14 | let reason = is_user.afkReason || '' 15 | if (!m.fromMe) { 16 | conn.reply(m.chat, `*Away From Keyboard* : @${jid.split('@')[0]}\n• *Reason* : ${reason ? reason : '-'}\n• *During* : [ ${Func.toTime(new Date - afkTime)} ]`, m).then(async () => { 17 | conn.reply(jid, `Someone from *${groupMetadata.subject}*'s group, tagged or mention you.\n\n• *Sender* : @${m.sender.split('@')[0]}`, m).then(async () => { 18 | await conn.copyNForward(jid, m) 19 | }) 20 | }) 21 | } 22 | } 23 | } catch (e) { 24 | return conn.reply(m.chat, Func.jsonFormat(e), m) 25 | } 26 | }, 27 | group: true, 28 | error: false 29 | } -------------------------------------------------------------------------------- /plugins/downloader/douyin.js: -------------------------------------------------------------------------------- 1 | module.exports = { 2 | help: ['douyin'], 3 | use: 'link', 4 | tags: 'downloader', 5 | run: async (m, { 6 | conn, 7 | usedPrefix, 8 | command, 9 | args, 10 | Func 11 | }) => { 12 | try { 13 | if (!args[0]) throw Func.example(usedPrefix, command, 'https://v.douyin.com/ieWfMQA1/') 14 | if (!args[0].match('douyin.com')) throw global.status.invalid 15 | conn.sendReact(m.chat, '🕒', m.key) 16 | let old = new Date() 17 | const json = await Api.get('/douyin', { 18 | url: args[0] 19 | }) 20 | if (!json.status) throw Func.jsonFormat(json) 21 | const result = json.data.find(v => v.type == 'video') 22 | if (!result) { 23 | json.data.map(x => { 24 | conn.sendFile(m.chat, x.url, Func.filename('jpg'), `🍟 *Process* : ${((new Date - old) * 1)} ms`, m) 25 | }) 26 | } else { 27 | conn.sendFile(m.chat, result.url, Func.filename('mp4'), `🍟 *Process* : ${((new Date - old) * 1)} ms`, m) 28 | } 29 | } catch (e) { 30 | throw Func.jsonFormat(e) 31 | } 32 | }, 33 | limit: true, 34 | error: false 35 | } -------------------------------------------------------------------------------- /plugins/downloader/x.js: -------------------------------------------------------------------------------- 1 | module.exports = { 2 | help: ['x'], 3 | aliases: ['twitter'], 4 | use: 'link', 5 | tags: 'downloader', 6 | run: async (m, { 7 | conn, 8 | usedPrefix, 9 | command, 10 | args, 11 | Func 12 | }) => { 13 | try { 14 | if (!args[0]) throw Func.example(usedPrefix, command, 'https://twitter.com/gofoodindonesia/status/1229369819511709697') 15 | if (!args[0].match(/(https?:\/\/)?(www\.)?(twitter\.com|x\.com)\/([a-zA-Z0-9_]+)\/status\/(\d+)/)) throw global.status.invalid 16 | let old = new Date() 17 | conn.sendReact(m.chat, '🕒', m.key) 18 | const json = await Api.get('/twitter', { 19 | url: args[0] 20 | }) 21 | if (!json.status) throw Func.jsonFormat(json) 22 | if (json.data.length == 1) { 23 | conn.sendFile(m.chat, json.data[0].url, '', `🍟 *Process* : ${((new Date - old) * 1)} ms`, m) 24 | } else { 25 | const album = json.data.map(v => ({ url: v.url })) 26 | conn.sendAlbumMessage(m.chat, album, m) 27 | } 28 | } catch (e) { 29 | throw Func.jsonFormat(e) 30 | } 31 | }, 32 | limit: true, 33 | error: false 34 | } -------------------------------------------------------------------------------- /plugins/downloader/ytsearch.js: -------------------------------------------------------------------------------- 1 | const ytsearch = require('yt-search') 2 | 3 | const ytsO = { 4 | help: ['ytsearch'], 5 | aliases: ['yts', 'youtubesearch'], 6 | use: 'query', 7 | tags: 'downloader', 8 | run: async (m, { 9 | conn, 10 | usedPrefix, 11 | command, 12 | text, 13 | Func 14 | }) => { 15 | try { 16 | if (!text) throw Func.example(usedPrefix, command, 'Oasis') 17 | conn.sendReact(m.chat, '🕒', m.key) 18 | const json = (await ytsearch(text)).all.filter(p => p.type === 'video') 19 | let txt = '乂 *Y T - S E A R C H*\n\n' 20 | json.map((v, i) => { 21 | txt += `*${i + 1}*. ${v.title}\n` 22 | txt += `◦ *Channel* : ${v.author.name}\n` 23 | txt += `◦ *Duration* : ${v.timestamp}\n` 24 | txt += `◦ *Views* : ${Func.h2k(v.views)}\n` 25 | txt += `◦ *Upload* : ${v.ago}\n` 26 | txt += `◦ *Link* : ${v.url}\n\n` 27 | }).join('\n\n') 28 | txt += global.footer 29 | conn.reply(m.chat, txt, m) 30 | } catch (e) { 31 | throw Func.jsonFormat(e) 32 | } 33 | }, 34 | limit: true, 35 | error: false 36 | } 37 | 38 | module.exports = ytsO -------------------------------------------------------------------------------- /plugins/_events/protector/anti_porn.js: -------------------------------------------------------------------------------- 1 | module.exports = { 2 | run: async (m, { 3 | conn, 4 | groupSet, 5 | Scraper, 6 | Func 7 | }) => { 8 | try { 9 | if (!m.fromMe && groupSet.antiporn && /image/.test(m.mtype) && !isAdmin) { 10 | const cdn = await Scraper.uploader(await m.download()) 11 | if (!cdn.status) throw new Error(cdn) 12 | const json = await Api.get('/detect-porn', { 13 | image: cdn.data.url 14 | }) 15 | if (!json.status) throw new Error(json) 16 | if (json.data.isPorn) return conn.sendMessage(m.chat, { 17 | delete: { 18 | remoteJid: m.chat, 19 | fromMe: false, 20 | id: m.key.id, 21 | participant: m.sender 22 | } 23 | }).then(() => { 24 | conn.reply(m.chat, Func.texted('bold', `🚩 Detected @${m.sender.split('@')[0]} sending porn`), m) 25 | conn.groupParticipantsUpdate(m.chat, [m.sender], 'remove') 26 | }) 27 | } 28 | } catch (e) { 29 | console.log(e) 30 | } 31 | }, 32 | group: true, 33 | botAdmin: true, 34 | error: false 35 | } -------------------------------------------------------------------------------- /plugins/miscs/sc.js: -------------------------------------------------------------------------------- 1 | const moment = require('moment-timezone') 2 | 3 | module.exports = { 4 | help: ['sourcecode'], 5 | aliases: ['sc'], 6 | tags: 'miscs', 7 | run: async (m, { 8 | conn, 9 | setting, 10 | Func 11 | }) => { 12 | try { 13 | const json = await Func.fetchJson('https://api.github.com/repos/rifnd/moon-bot') 14 | let txt = `乂 *S C R I P T*\n\n` 15 | txt += ` ∘ *Name* : ${json.name}\n` 16 | txt += ` ∘ *Size* : ${(json.size / 1024).toFixed(2)} MB\n` 17 | txt += ` ∘ *Updated* : ${moment(json.updated_at).format('DD/MM/YY - HH:mm:ss')}\n` 18 | txt += ` ∘ *Url* : ${json.html_url}\n` 19 | txt += ` ∘ *Forks* : ${json.forks_count}\n` 20 | txt += ` ∘ *Stars* : ${json.stargazers_count}\n` 21 | txt += ` ∘ *Issues* : ${json.open_issues_count}\n\n` 22 | txt += global.footer 23 | conn.sendMessageModify(m.chat, txt, m, { 24 | largeThumb: true, 25 | thumbnail: Func.isUrl(setting.cover) ? setting.cover : Buffer.from(setting.cover, 'base64'), 26 | url: 'https://github.com/rifnd/moon-bot', 27 | }) 28 | } catch (e) { 29 | throw Func.jsonFormat(e) 30 | } 31 | }, 32 | error: false 33 | } -------------------------------------------------------------------------------- /plugins/downloader/pinterest.js: -------------------------------------------------------------------------------- 1 | module.exports = { 2 | help: ['pindl'], 3 | use: 'link', 4 | tags: 'downloader', 5 | run: async (m, { 6 | conn, 7 | usedPrefix, 8 | command, 9 | args, 10 | Func 11 | }) => { 12 | try { 13 | if (!args[0]) throw Func.example(usedPrefix, command, 'https://pin.it/1wu7KDR9a') 14 | if (!args[0].match(/pin(?:terest)?(?:\.it|\.com)/)) throw global.status.invalid 15 | let old = new Date() 16 | conn.sendReact(m.chat, '🕒', m.key) 17 | const json = await Api.get('/pin-dl', { 18 | url: args[0] 19 | }) 20 | if (!json.status) throw Func.jsonFormat(json) 21 | json.data.map(v => { 22 | if (v.type == 'image') return conn.sendFile(m.chat, v.url, '', `🍟 *Process* : ${((new Date - old) * 1)} ms`, m) 23 | if (v.type == 'video') return conn.sendFile(m.chat, v.url, '', `🍟 *Process* : ${((new Date - old) * 1)} ms`, m) 24 | if (v.type == 'gif') return conn.sendFile(m.chat, v.url, '', `🍟 *Process* : ${((new Date - old) * 1)} ms`, m, { 25 | gif: true 26 | }) 27 | }) 28 | } catch (e) { 29 | throw Func.jsonFormat(e) 30 | } 31 | }, 32 | limit: true, 33 | error: false 34 | } -------------------------------------------------------------------------------- /plugins/internet/gempa.js: -------------------------------------------------------------------------------- 1 | module.exports = { 2 | help: ['gempa'], 3 | tags: 'internet', 4 | run: async (m, { 5 | conn, 6 | usedPrefix, 7 | command, 8 | text, 9 | Scraper, 10 | Func 11 | }) => { 12 | try { 13 | const json = await Api.get('/gempa', {}) 14 | if (!json.status) throw Func.jsonFormat(json) 15 | conn.sendReact(m.chat, '🕒', m.key) 16 | let txt = `乂 *G E M P A*\n\n` 17 | txt += ` ◦ *Date* : ${json.data.Tanggal}\n` 18 | txt += ` ◦ *At* : ${json.data.Jam}\n` 19 | txt += ` ◦ *Magnitude* : ${json.data.Magnitude}\n` 20 | txt += ` ◦ *Coordinate* : ${json.data.Coordinates}\n` 21 | txt += ` ◦ *Latitude* : ${json.data.Lintang}\n` 22 | txt += ` ◦ *Longitude* : ${json.data.Bujur}\n` 23 | txt += ` ◦ *Depth* : ${json.data.Kedalaman}\n` 24 | txt += ` ◦ *Region* : ${json.data.Wilayah}\n` 25 | txt += ` ◦ *Potential* : ${json.data.Potensi}\n` 26 | txt += ` ◦ *Sensed* : ${json.data.Dirasakan}\n\n` 27 | txt += global.footer 28 | conn.sendFile(m.chat, json.data.Shakemap, '', txt, m) 29 | } catch (e) { 30 | throw Func.jsonFormat(e) 31 | } 32 | }, 33 | limit: true, 34 | error: false 35 | } -------------------------------------------------------------------------------- /plugins/owner/system.js: -------------------------------------------------------------------------------- 1 | module.exports = { 2 | help: ['autobackup', 'autodownload', 'antispam', 'debug', 'groupmode', 'privatemode', 'multiprefix', 'noprefix', 'online', 'self', 'anticall', 'notifier', 'game'], 3 | use: 'on / off', 4 | tags: 'owner', 5 | run: async (m, { 6 | conn, 7 | args, 8 | usedPrefix, 9 | command, 10 | Func 11 | }) => { 12 | let system = global.db.setting 13 | let type = command.toLowerCase() 14 | if (!args || !args[0]) return conn.reply(m.chat, `🚩 *Current status* : [ ${system[type] ? 'ON' : 'OFF'} ] (Enter *On* or *Off*)`, m) 15 | let option = args[0].toLowerCase() 16 | let optionList = ['on', 'off'] 17 | if (!optionList.includes(option)) return conn.reply(m.chat, `🚩 *Current status* : [ ${system[type] ? 'ON' : 'OFF'} ] (Enter *On* or *Off*)`, m) 18 | let status = option != 'on' ? false : true 19 | if (system[type] == status) return conn.reply(m.chat, Func.texted('bold', `🚩 ${Func.ucword(command)} has been ${option == 'on' ? 'activated' : 'inactivated'} previously.`), m) 20 | system[type] = status 21 | conn.reply(m.chat, Func.texted('bold', `🚩 ${Func.ucword(command)} has been ${option == 'on' ? 'activated' : 'inactivated'} successfully.`), m) 22 | }, 23 | owner: true, 24 | error: false, 25 | } -------------------------------------------------------------------------------- /plugins/downloader/facebook.js: -------------------------------------------------------------------------------- 1 | module.exports = { 2 | help: ['facebook'], 3 | aliases: ['fb'], 4 | use: 'link', 5 | tags: 'downloader', 6 | run: async (m, { 7 | conn, 8 | usedPrefix, 9 | command, 10 | args, 11 | Func 12 | }) => { 13 | try { 14 | if (!args[0]) throw Func.example(usedPrefix, command, 'https://www.facebook.com/share/r/1WCkXg8fsT/') 15 | if (!args[0].match(/(?:https?:\/\/(web\.|www\.|m\.)?(facebook|fb)\.(com|watch)\S+)?$/)) throw status.invalid 16 | conn.sendReact(m.chat, '🕒', m.key) 17 | const json = await Api.get('/fb', { 18 | url: args[0] 19 | }) 20 | if (!json.status) throw Func.jsonFormat(json) 21 | const result = json.data.find(v => v.quality == 'HD') || json.data.find(v => v.quality == 'SD') 22 | if (result && json.data.length == 1) { 23 | conn.sendFile(m.chat, result.url, Func.filename(result.quality === 'jpeg' ? 'jpeg' : 'mp4'), `◦ *Quality* : ${result.quality}`, m) 24 | } else if (json.data.length > 1) { 25 | const album = json.data.map(v => ({ url: v.url })) 26 | conn.sendAlbumMessage(m.chat, album, m) 27 | } 28 | } catch (e) { 29 | throw Func.jsonFormat(e) 30 | } 31 | }, 32 | limit: true 33 | } -------------------------------------------------------------------------------- /plugins/downloader/igstory.js: -------------------------------------------------------------------------------- 1 | module.exports = { 2 | help: ['igstory'], 3 | aliases: ['igs'], 4 | use: 'link / username', 5 | tags: 'downloader', 6 | run: async (m, { 7 | conn, 8 | usedPrefix, 9 | command, 10 | args, 11 | Func 12 | }) => { 13 | try { 14 | if (!args || !args[0]) throw Func.example(usedPrefix, command, 'https://instagram.com/stories/pandusjahrir/3064777897102858938?igshid=MDJmNzVkMjY=') 15 | conn.sendReact(m.chat, '🕒', m.key) 16 | let old = new Date() 17 | const json = await Api.get('/igs', { 18 | q: args[0] 19 | }) 20 | if (!json.status) throw Func.jsonFormat(json) 21 | const medias = json.data.map(v => ({ 22 | url: v.url, 23 | type: v.type 24 | })) 25 | if (medias.length === 1) { 26 | const file = medias[0] 27 | conn.sendFile(m.chat, file.url, file.type === 'video' ? Func.filename('mp4') : Func.filename('jpg'), `🍟 *Process* : ${((new Date - old) * 1)} ms`, m) 28 | } else { 29 | const album = medias.map(v => ({ url: v.url })) 30 | conn.sendAlbumMessage(m.chat, album, m) 31 | } 32 | } catch (e) { 33 | throw Func.jsonFormat(e) 34 | } 35 | }, 36 | limit: true 37 | } -------------------------------------------------------------------------------- /plugins/internet/shalat.js: -------------------------------------------------------------------------------- 1 | module.exports = { 2 | help: ['jadwalshalat'], 3 | use: 'city', 4 | tags: 'internet', 5 | run: async (m, { 6 | conn, 7 | usedPrefix, 8 | command, 9 | text, 10 | Scraper, 11 | Func 12 | }) => { 13 | try { 14 | if (!text) throw Func.example(usedPrefix, command, 'Surabaya') 15 | conn.sendReact(m.chat, '🕒', m.key) 16 | const json = await Api.get('/jadwalsholat', { 17 | q: text 18 | }) 19 | if (!json.status) throw Func.jsonFormat(json) 20 | let txt = '乂 *S H A L A T*\n\n' 21 | txt += ' ◦ *Tanggal* : ' + json.data.tgl + '\n' 22 | txt += ' ◦ *Imsyak* : ' + json.data.imsyak + '\n' 23 | txt += ' ◦ *Subuh* : ' + json.data.subuh + '\n' 24 | txt += ' ◦ *Terbit* : ' + json.data.terbit + '\n' 25 | txt += ' ◦ *Dzuhur* : ' + json.data.dzuhur + '\n' 26 | txt += ' ◦ *Asar* : ' + json.data.ashr + '\n' 27 | txt += ' ◦ *Maghrib* : ' + json.data.maghrib + '\n' 28 | txt += ' ◦ *Isya* : ' + json.data.isya + '\n\n' 29 | txt += json.data.parameter 30 | conn.reply(m.chat, txt, m) 31 | } catch (e) { 32 | throw Func.jsonFormat(e) 33 | } 34 | }, 35 | limit: true, 36 | error: false 37 | } -------------------------------------------------------------------------------- /plugins/converter/toimg.js: -------------------------------------------------------------------------------- 1 | const { readFileSync: read, unlinkSync: remove } = require('fs') 2 | const path = require('path') 3 | const { exec } = require('child_process') 4 | 5 | module.exports = { 6 | help: ['toimg'], 7 | aliases: ['toimage'], 8 | use: 'reply sticker', 9 | tags: 'converter', 10 | run: async (m, { 11 | conn, 12 | Func 13 | }) => { 14 | try { 15 | if (!m.quoted) throw Func.texted('bold', `🚩 Reply to sticker you want to convert to an image/photo (not supported for sticker animation).`) 16 | if (m.quoted.mimetype != 'image/webp') throw Func.texted('bold', `🚩 Reply to sticker you want to convert to an image/photo (not supported for sticker animation).`) 17 | conn.sendReact(m.chat, '🕒', m.key) 18 | let media = await conn.saveMediaMessage(m.quoted) 19 | let file = Func.filename('png') 20 | let isFile = path.join('./tmp/', file) 21 | exec(`ffmpeg -i ${media} ${isFile}`, (err, stderr, stdout) => { 22 | remove(media) 23 | if (err) throw Func.texted('bold', `🚩 Conversion failed.`) 24 | const buffer = read(isFile) 25 | conn.sendFile(m.chat, buffer, '', '', m) 26 | remove(isFile) 27 | }) 28 | } catch (e) { 29 | throw Func.jsonFormat(e) 30 | } 31 | }, 32 | limit: true 33 | } 34 | -------------------------------------------------------------------------------- /plugins/downloader/terabox.js: -------------------------------------------------------------------------------- 1 | module.exports = { 2 | help: ['terabox'], 3 | use: 'link', 4 | tags: 'downloader', 5 | run: async (m, { 6 | conn, 7 | usedPrefix, 8 | command, 9 | args, 10 | users, 11 | env, 12 | Func 13 | }) => { 14 | try { 15 | if (!args || !args[0]) throw Func.example(usedPrefix, command, 'https://terabox.com/s/1jDTI6wLo066ALCYQ69sDyA') 16 | if (!args[0].match(/(?:https?:\/\/(www\.)?terabox\.(com|app)\S+)?$/)) throw global.status.invalid 17 | conn.sendReact(m.chat, '🕒', m.key) 18 | const json = await Api.get('/terabox', { 19 | url: args[0] 20 | }) 21 | if (!json.status) throw Func.jsonFormat(json) 22 | const chSize = Func.sizeLimit(json.data.size, users.premium ? env.max_upload : env.max_upload_free) 23 | const isOver = users.premium ? `💀 File size (${json.data.size}) exceeds the maximum limit.` : `⚠️ File size (${json.data.size}), you can only download files with a maximum size of ${env.max_upload_free} MB and for premium users a maximum of ${env.max_upload} MB.` 24 | if (chSize.oversize) throw isOver 25 | conn.sendFile(m.chat, json.data.url, json.data.filename, '', m) 26 | } catch (e) { 27 | throw Func.jsonFormat(e) 28 | } 29 | }, 30 | limit: true, 31 | error: false 32 | } -------------------------------------------------------------------------------- /package.json: -------------------------------------------------------------------------------- 1 | { 2 | "name": "moon-bot", 3 | "version": "5.0-beta", 4 | "description": "Simple Whatsapp Bot", 5 | "keywords": [ 6 | "whatsapp-bot", 7 | "wabot" 8 | ], 9 | "homepage": "https://github.com/znanx/moon-bot#readme", 10 | "bugs": { 11 | "url": "https://github.com/znanx/moon-bot/issues" 12 | }, 13 | "repository": { 14 | "type": "git", 15 | "url": "git+https://github.com/znanx/moon-bot.git" 16 | }, 17 | "license": "MIT", 18 | "author": "znanx", 19 | "main": "index.js", 20 | "engines": { 21 | "node": ">= 20.x" 22 | }, 23 | "directories": { 24 | "lib": "lib" 25 | }, 26 | "scripts": { 27 | "start": "node index.js --max-old-space-size=1024", 28 | "pm2": "pm2 start index.js --name moon-bot --max-memory-restart 1G -- --max-old-space-size=1024", 29 | "test": "node test.js", 30 | "server": "node index.js --server" 31 | }, 32 | "dependencies": { 33 | "@whiskeysockets/baileys": "6.7.21", 34 | "@znan/wabot": "^0.0.74", 35 | "archiver": "^7.0.1", 36 | "cfonts": "^3.3.0", 37 | "express": "^4.21.2", 38 | "ignore": "^7.0.0", 39 | "node-cron": "^3.0.0", 40 | "yt-search": "^2.10.4" 41 | }, 42 | "overrides": { 43 | "jimp": "0.22.12" 44 | }, 45 | "resolutions": { 46 | "jimp": "0.22.12" 47 | } 48 | } 49 | -------------------------------------------------------------------------------- /plugins/downloader/gdrive.js: -------------------------------------------------------------------------------- 1 | module.exports = { 2 | help: ['gdrive'], 3 | use: 'link', 4 | tags: 'downloader', 5 | run: async (m, { 6 | conn, 7 | usedPrefix, 8 | command, 9 | args, 10 | users, 11 | env, 12 | Func 13 | }) => { 14 | try { 15 | if (!args || !args[0]) throw Func.example(usedPrefix, command, 'https://drive.google.com/file/d/1SluvqDGhjFqg2f-74RJB8DjobcCZO_rY/view?usp=drive_link') 16 | if (!args[0].match('drive.google.com')) throw global.status.invalid 17 | conn.sendReact(m.chat, '🕒', m.key) 18 | const json = await Api.get('/gdrive', { 19 | url: args[0] 20 | }) 21 | if (!json.status) throw Func.jsonFormat(json) 22 | const chSize = Func.sizeLimit(json.data.size, users.premium ? env.max_upload : env.max_upload_free) 23 | const isOver = users.premium ? `💀 File size (${json.data.size}) exceeds the maximum limit.` : `⚠️ File size (${json.data.size}), you can only download files with a maximum size of ${env.max_upload_free} MB and for premium users a maximum of ${env.max_upload} MB.` 24 | if (chSize.oversize) throw isOver 25 | conn.sendFile(m.chat, json.data.url, json.data.filename, '', m) 26 | } catch (e) { 27 | throw Func.jsonFormat(e) 28 | } 29 | }, 30 | limit: true, 31 | error: false 32 | } -------------------------------------------------------------------------------- /plugins/owner/command.js: -------------------------------------------------------------------------------- 1 | 2 | module.exports = { 3 | help: ['disable', 'enable'], 4 | use: 'command', 5 | tags: 'owner', 6 | run: async (m, { 7 | conn, 8 | args, 9 | command, 10 | usedPrefix, 11 | setting: cmd, 12 | plugins, 13 | Func 14 | }) => { 15 | if (!args || !args[0]) return conn.reply(m.chat, Func.example(usedPrefix, command, 'tiktok'), m) 16 | let commands = args[0]?.toLowerCase() 17 | if (!plugins.has(commands)) return conn.reply(m.chat, Func.texted('bold', `🚩 Command ${usedPrefix + commands} does not exist.`), m) 18 | if (command === 'disable') { 19 | if (cmd.error.includes(commands)) return conn.reply(m.chat, Func.texted('bold', `🚩 ${usedPrefix + commands} command was previously disabled.`), m) 20 | cmd.error.push(commands) 21 | conn.reply(m.chat, Func.texted('bold', `✅ Command ${usedPrefix + commands} disabled successfully.`), m) 22 | } else if (command === 'enable') { 23 | if (!cmd.error.includes(commands)) return conn.reply(m.chat, Func.texted('bold', `🚩 Command ${usedPrefix + commands} does not exist.`), m) 24 | cmd.error = cmd.error.filter(cmd => cmd !== commands) 25 | await conn.reply(m.chat, `✅ Command *${usedPrefix}${commands}* successfully activated.`, m) 26 | } 27 | }, 28 | owner: true, 29 | error: false 30 | } -------------------------------------------------------------------------------- /plugins/tools/translate.js: -------------------------------------------------------------------------------- 1 | module.exports = { 2 | help: ['translate'], 3 | aliases: ['tr'], 4 | use: 'lang text', 5 | tags: 'tools', 6 | run: async (m, { 7 | conn, 8 | usedPrefix, 9 | command, 10 | text, 11 | Scraper, 12 | Func 13 | }) => { 14 | if (!text) throw Func.example(usedPrefix, command, 'id Love You') 15 | conn.sendReact(m.chat, '🕒', m.key) 16 | if (text && m.quoted && m.quoted.text) { 17 | let lang = text.slice(0, 2) 18 | try { 19 | let data = m.quoted.text 20 | const result = await Api.get('/translate', { 21 | text: data, 22 | iso: lang 23 | }) 24 | conn.reply(m.chat, result.data.text, m) 25 | } catch { 26 | throw Func.texted('bold', '🚩 Language codes are not supported.') 27 | } 28 | } else if (text) { 29 | let lang = text.slice(0, 2) 30 | try { 31 | let data = text.substring(2).trim() 32 | const result = await Api.get('/translate', { 33 | text: data, 34 | iso: lang 35 | }) 36 | conn.reply(m.chat, result.data.text, m) 37 | } catch { 38 | throw Func.texted('bold', '🚩 Language codes are not supported.') 39 | } 40 | } 41 | }, 42 | limit: true 43 | } -------------------------------------------------------------------------------- /plugins/ai/gemini.js: -------------------------------------------------------------------------------- 1 | module.exports = { 2 | help: ['gemini', 'bard'], 3 | use: 'query', 4 | tags: 'ai', 5 | run: async (m, { 6 | conn, 7 | usedPrefix, 8 | command, 9 | text, 10 | Scraper, 11 | Func 12 | }) => { 13 | try { 14 | if (!text) throw Func.example(usedPrefix, command, 'moonbot') 15 | conn.sendReact(m.chat, '🕒', m.key) 16 | let q = m.quoted ? m.quoted : m 17 | let mime = (q.msg || q).mimetype || '' 18 | if (/image\/(jpe?g|png)/.test(mime)) { 19 | const cdn = await Scraper.uploader(await conn.downloadMediaMessage(q)) 20 | if (!cdn.status) throw Func.jsonFormat(cdn) 21 | const json = await Api.get('/func-chat', { 22 | model: 'gemini', 23 | system: text, 24 | image: cdn.data.url 25 | }) 26 | if (!json.status) throw Func.jsonFormat(json) 27 | conn.reply(m.chat, json.data.content, m) 28 | } else if (text) { 29 | const json = await Api.get('/ai-gemini', { 30 | q: text 31 | }) 32 | if (!json.status) throw Func.jsonFormat(json) 33 | conn.reply(m.chat, json.data.content, m) 34 | } 35 | } catch (e) { 36 | throw Func.jsonFormat(e) 37 | } 38 | }, 39 | limit: true, 40 | error: false 41 | } -------------------------------------------------------------------------------- /plugins/admin/outsider.js: -------------------------------------------------------------------------------- 1 | module.exports = { 2 | help: ['outsider'], 3 | use: '(option)', 4 | tags: 'admin', 5 | run: async (m, { 6 | conn, 7 | usedPrefix, 8 | command, 9 | args, 10 | participants, 11 | Func 12 | }) => { 13 | try { 14 | let member = participants.filter(v => !v.admin).map(v => v.jid || v.id).filter(v => !v.startsWith('62') && v != conn.decodeJid(conn.user.id)) 15 | if (!args || !args[0]) { 16 | if (member.length == 0) return conn.reply(m.chat, Func.texted('bold', `🚩 This group is clean from outsiders.`), m) 17 | let teks = `✅ *${member.length}* outsiders found, send *${usedPrefix + command} -y* to remove them.\n\n` 18 | teks += member.map(v => '◦ @' + v.replace(/@.+/, '')).join('\n') 19 | conn.reply(m.chat, teks, m) 20 | } else if (args[0] == '-y') { 21 | for (let jid of member) { 22 | await Func.delay(2000) 23 | await conn.groupParticipantsUpdate(m.chat, [jid], 'remove') 24 | } 25 | await conn.reply(m.chat, Func.texted('bold', `🚩 Done, ${member.length} outsiders successfully removed.`), m) 26 | } 27 | } catch (e) { 28 | conn.reply(m.chat, Func.jsonFormat(e), m) 29 | } 30 | }, 31 | group: true, 32 | admin: true, 33 | botAdmin: true, 34 | error: false 35 | } -------------------------------------------------------------------------------- /plugins/internet/resi.js: -------------------------------------------------------------------------------- 1 | module.exports = { 2 | help: ['cekresi'], 3 | use: 'kurir | resi', 4 | tags: 'internet', 5 | run: async (m, { 6 | conn, 7 | usedPrefix, 8 | command, 9 | text, 10 | Func 11 | }) => { 12 | try { 13 | if (!text) throw Func.example(usedPrefix, command, 'jnt | 842748402') 14 | conn.sendReact(m.chat, '🕒', m.key) 15 | let [kurir, resi] = text.split` | ` 16 | const json = await Api.get('/resicheck', { 17 | kurir, resi 18 | }) 19 | if (!json.status) throw `🚩 ${json.msg}` 20 | let p = '◦ *Code* : ' + json.data.detail.code + '\n' 21 | p += '◦ *Status* : ' + json.data.detail.status + '\n' 22 | p += '◦ *Shipment* : ' + json.data.detail.shipment ? json.data.detail.shipment : '-' + '\n' 23 | p += '◦ *Received* : ' + json.data.detail.received ? json.data.detail.received : '-' + '\n\n' 24 | p += '*History Detail*' + '\n\n' 25 | json.data.detail.history.map((v, i) => { 26 | p += '◦ *Time* : ' + v.time + '\n' 27 | p += '◦ *Position* : ' + v.position + '\n' 28 | p += '◦ *Desc* : ' + v.desc + '\n\n' 29 | }) 30 | conn.reply(m.chat, p, m) 31 | } catch (e) { 32 | conn.reply(m.chat, Func.jsonFormat(e), m) 33 | } 34 | }, 35 | limit: true, 36 | error: false 37 | } -------------------------------------------------------------------------------- /plugins/downloader/mediafire.js: -------------------------------------------------------------------------------- 1 | const axios = require('axios') 2 | module.exports = { 3 | help: ['mediafire'], 4 | use: 'link', 5 | tags: 'downloader', 6 | run: async (m, { 7 | conn, 8 | usedPrefix, 9 | command, 10 | args, 11 | users, 12 | env, 13 | Func 14 | }) => { 15 | try { 16 | if (!args || !args[0]) throw Func.example(usedPrefix, command, 'https://www.mediafire.com/file/c2fyjyrfckwgkum/ZETSv1%25282%2529.zip/file') 17 | if (!args[0].match(/(https:\/\/www.mediafire.com\/)/gi)) throw global.status.invalid 18 | conn.sendReact(m.chat, '🕒', m.key) 19 | const json = await Api.get('/mediafire', { 20 | url: args[0] 21 | }) 22 | if (!json.status) throw Func.jsonFormat(json) 23 | const chSize = Func.sizeLimit(json.data.size, users.premium ? env.max_upload : env.max_upload_free) 24 | const isOver = users.premium ? `💀 File size (${json.data.size}) exceeds the maximum limit.` : `⚠ File size (${json.data.size}), you can only download files with a maximum size of ${env.max_upload_free} MB and for premium users a maximum of ${env.max_upload} MB.` 25 | if (chSize.oversize) throw isOver 26 | await conn.sendFile(m.chat, json.data.url, json.data.filename, '', m) 27 | } catch (e) { 28 | throw Func.jsonFormat(e) 29 | } 30 | }, 31 | limit: true, 32 | error: false 33 | } -------------------------------------------------------------------------------- /lib/system/config.js: -------------------------------------------------------------------------------- 1 | const { Function: Func, AlyaApi } = require('@znan/wabot') 2 | global.creator = '@naando.io - moon.bot' 3 | global.Api = AlyaApi(process.env.API_ENDPOINT, process.env.API_KEY) 4 | global.header = `moon-bot v${require('package.json').version}` 5 | global.footer = Func.Styles('simple whatsapp bot made by moon') 6 | global.status = Object.freeze({ 7 | wait: Func.texted('bold', 'Processing. . .'), 8 | invalid: Func.texted('bold', 'Invalid URL!'), 9 | wrong: Func.texted('bold', 'Wrong format!'), 10 | error: Func.texted('bold', 'Error occurred!'), 11 | errorF: Func.texted('bold', 'This feature is an error'), 12 | premium: Func.texted('bold', 'This feature is only for premium users.'), 13 | admin: Func.texted('bold', 'This command is specific to Admins.'), 14 | botAdmin: Func.texted('bold', 'Make the bot admin to use this command.'), 15 | owner: Func.texted('bold', 'This command is for Owner only.'), 16 | mod: Func.texted('bold', 'This command is for Moderators only.'), 17 | group: Func.texted('bold', 'This command is Group specific.'), 18 | private: Func.texted('bold', 'This command is private chat only.'), 19 | register: Func.texted('bold', 'Please register first to use this command.'), 20 | gameInactive: Func.texted('bold', 'The game feature has not been activated.'), 21 | restrict: Func.texted('bold', 'This feature is disabled') 22 | }) 23 | Func.updateFile(require.resolve(__filename)) -------------------------------------------------------------------------------- /lib/system/schema.js: -------------------------------------------------------------------------------- 1 | const init = new (require('./init')) 2 | const { models } = require('./models') 3 | 4 | module.exports = (m, env) => { 5 | const user = global.db.users[m.sender] 6 | if (user) { 7 | init.execute(user, models.users, { 8 | lid: m.sender?.endsWith('lid') ? m.sender : null, 9 | name: m.pushName, 10 | limit: 10, 11 | }) 12 | } else { 13 | global.db.users[m.sender] = { 14 | lid: m.sender?.endsWith('lid') ? m.sender : null, 15 | name: m.pushName, 16 | limit: 10, 17 | ...(init.getModel(models?.users || {})) 18 | } 19 | } 20 | 21 | if (m.isGroup) { 22 | const group = global.db.groups[m.chat] 23 | if (group) { 24 | init.execute(group, models.groups) 25 | } else { 26 | global.db.groups[m.chat] = { 27 | ...(init.getModel(models?.groups || {})) 28 | } 29 | } 30 | } 31 | 32 | const chat = global.db.chats[m.chat] 33 | if (chat) { 34 | init.execute(chat, models.chats) 35 | } else { 36 | global.db.chats[m.chat] = { 37 | ...(init.getModel(models?.chats || {})) 38 | } 39 | } 40 | 41 | let setting = global.db.setting 42 | if (setting && Object.keys(setting).length < 1) { 43 | init.execute(setting, models.setting) 44 | } else { 45 | setting = { 46 | ...(init.getModel(models?.setting || {})) 47 | } 48 | } 49 | } -------------------------------------------------------------------------------- /plugins/internet/npm.js: -------------------------------------------------------------------------------- 1 | const moment = require('moment-timezone') 2 | 3 | module.exports = { 4 | help: ['npmjs'], 5 | use: 'query', 6 | tags: 'internet', 7 | run: async (m, { 8 | conn, 9 | usedPrefix, 10 | command, 11 | text, 12 | Scraper, 13 | Func 14 | }) => { 15 | try { 16 | if (!text) throw Func.example(usedPrefix, command, 'chalk') 17 | conn.sendReact(m.chat, '🕒', m.key) 18 | const json = await Api.get('/npm', { 19 | q: text 20 | }) 21 | if (!json.status) throw Func.jsonFormat(json) 22 | if (json.data.length == 0) throw Func.texted('bold', '🚩 Package not found.') 23 | let txt = `乂 *N P M J S*\n\n` 24 | json.data.map((v, i) => { 25 | txt += '*' + (i + 1) + '. ' + v.package.name + '*\n' 26 | txt += ' ◦ *Version* : ' + v.package.version + '\n' 27 | txt += ' ◦ *Description* : ' + v.package.description + '\n' 28 | txt += ' ◦ *Author* : @' + v.package.publisher.username + '\n' 29 | txt += ' ◦ *Published* : ' + moment(v.package.date).format('dddd, DD/MM/YYYY hh:mm') + '\n' 30 | txt += ' ◦ *Link* : ' + v.package.links.npm + '\n\n' 31 | }) 32 | conn.reply(m.chat, txt + global.footer, m) 33 | } catch (e) { 34 | throw Func.jsonFormat(e) 35 | } 36 | }, 37 | limit: true, 38 | error: false 39 | } -------------------------------------------------------------------------------- /plugins/owner/getfile.js: -------------------------------------------------------------------------------- 1 | const fs = require('fs') 2 | const path = require('path') 3 | 4 | module.exports = { 5 | help: ['getfile'], 6 | aliases: ['gf', 'gp'], 7 | use: 'path/to/file.js', 8 | tags: 'owner', 9 | run: async (m, { 10 | conn, 11 | usedPrefix, 12 | command, 13 | text, 14 | Func 15 | }) => { 16 | try { 17 | if (!text) return conn.reply(m.chat, Func.example(usedPrefix, command, 'plugins/menu.js'), m) 18 | const filePath = path.resolve(process.cwd(), text) 19 | if (!fs.existsSync(filePath)) return conn.reply(m.chat, `🚩 File '${text}' not found.`, m) 20 | if (fs.lstatSync(filePath).isDirectory()) { 21 | const list = fs.readdirSync(filePath).map(v => ' ' + v).join('\n') 22 | return conn.reply(m.chat, `📂 Directory listing for *${text}*:\n\n${list}`, m) 23 | } 24 | const content = fs.readFileSync(filePath, 'utf-8') 25 | if (content.length > 4000) { 26 | return conn.sendMessage(m.chat, { 27 | document: fs.readFileSync(filePath), 28 | fileName: path.basename(filePath), 29 | mimetype: 'text/plain' 30 | }, { quoted: m }) 31 | } else { 32 | return conn.reply(m.chat, content, m) 33 | } 34 | } catch (e) { 35 | conn.reply(m.chat, Func.jsonFormat(e), m) 36 | } 37 | }, 38 | owner: true, 39 | error: false 40 | } -------------------------------------------------------------------------------- /lib/system/localdb.js: -------------------------------------------------------------------------------- 1 | const fs = require('fs').promises 2 | module.exports = class LocalDB { 3 | constructor(filePath) { 4 | this.filePath = filePath ? filePath + '.json' : 'database' 5 | this.queue = [] 6 | this.initDB() 7 | } 8 | 9 | initDB = async () => { 10 | try { 11 | await fs.access(this.filePath) 12 | } catch (err) { 13 | await this.save({}) 14 | } 15 | } 16 | 17 | validateJSON = (data) => { 18 | try { 19 | JSON.stringify(data, null) 20 | return true 21 | } catch (err) { 22 | return false 23 | } 24 | } 25 | 26 | enqueue = data => this.queue.push(data) 27 | 28 | save = async data => { 29 | this.enqueue(data) 30 | 31 | const validData = this.queue.filter(this.validateJSON) 32 | this.queue = [] 33 | 34 | if (validData.length > 0) { 35 | try { 36 | await fs.writeFile(this.filePath, JSON.stringify(validData[0], null), 'utf8') 37 | } catch (err) { 38 | console.log(`Failed to save data: ${err.message}`) 39 | } 40 | } else { 41 | console.log('No valid data to save'); 42 | } 43 | } 44 | 45 | fetch = async () => { 46 | try { 47 | const data = await fs.readFile(this.filePath, 'utf8') 48 | return JSON.parse(data) 49 | } catch (err) { 50 | console.log(`Failed to fetch data: ${err.message}`) 51 | } 52 | } 53 | } -------------------------------------------------------------------------------- /plugins/users/unreg.js: -------------------------------------------------------------------------------- 1 | const { createHash } = require('crypto') 2 | 3 | module.exports = { 4 | help: ['unreg'], 5 | aliases: ['unregister'], 6 | use: 'sn', 7 | tags: 'user', 8 | run: async (m, { 9 | conn, 10 | usedPrefix, 11 | command, 12 | args, 13 | Func 14 | }) => { 15 | try { 16 | if (!args[0]) throw Func.example(usedPrefix, command, '31j3h1oh23423p') 17 | let users = global.db.users[m.sender] 18 | let sn = createHash('md5').update(m.sender).digest('hex') 19 | if (args[0] !== sn) throw Func.texted('bold', '🚩 Wrong / invalid serial number.') 20 | 21 | let now = Date.now() 22 | let diff = now - users.reg_time 23 | let limit = 72 * 60 * 60 * 1000 // 72 hours 24 | 25 | if (diff < limit) { 26 | const remaining = limit - diff 27 | const hours = Math.floor(remaining / (60 * 60 * 1000)) 28 | const minutes = Math.floor((remaining % (60 * 60 * 1000)) / (60 * 1000)) 29 | throw Func.texted('bold', `🚩 You can unregister after ${hours}h ${minutes}m.`) 30 | } 31 | 32 | conn.reply(m.chat, '✅ Successfully unregistered', m).then(() => { 33 | users.registered = false 34 | users.reg_time = 0 35 | users.age = 0 36 | }) 37 | } catch (e) { 38 | throw Func.jsonFormat(e) 39 | } 40 | }, 41 | private: true, 42 | register: true 43 | } -------------------------------------------------------------------------------- /plugins/_other/anonymous-send_contact.js: -------------------------------------------------------------------------------- 1 | module.exports = { 2 | help: ['sendcontact'], 3 | tags: 'anonymous', 4 | run: async (m, { 5 | conn, 6 | command, 7 | usedPrefix, 8 | text, 9 | Func 10 | }) => { 11 | try { 12 | conn.anonymous = conn.anonymous ? conn.anonymous : {} 13 | let who = m.sender 14 | let room = Object.values(conn.anonymous).find(room => room.check(who)) 15 | if (!room) return conn.reply(m.chat, Func.texted('bold', 'You are not in anonymous chat'), m) 16 | let other = room.other(who) 17 | var name 18 | if (text) name = text 19 | else name = conn.getName(m.sender) 20 | var number = who.split('@')[0] 21 | let vcard = ` 22 | BEGIN:VCARD 23 | VERSION:3.0 24 | FN:${name.replace(/\n/g, '\\n')} 25 | TEL;type=CELL;type=VOICE;waid=${number}:${PhoneNumber('+' + number).getNumber('international')} 26 | END:VCARD` 27 | conn.reply(m.chat, Func.texted('bold', `You successfully sent a contact to your partner.`), m) 28 | if (other) conn.reply(other, Func.texted('bold', `Partner sends contact to you`), m) 29 | if (other) conn.sendMessage(other, { 30 | contacts: { 31 | displayName: name, 32 | contacts: [{ vcard }] 33 | } 34 | }) 35 | } catch (e) { 36 | console.log(e) 37 | } 38 | }, 39 | private: true, 40 | error: false 41 | } -------------------------------------------------------------------------------- /lib/system/init.js: -------------------------------------------------------------------------------- 1 | module.exports = class Init { 2 | /** 3 | * Creates a deep clone of the provided object. 4 | * This is useful to avoid shared references between objects, 5 | * ensuring that modifications to the returned object do not affect the original. 6 | * 7 | * @function 8 | * @param {Object} [object={}] - The object to be deeply cloned. 9 | * @returns {Object} - A deep copy of the input object. 10 | */ 11 | getModel = (object = {}) => JSON.parse(JSON.stringify(object)) 12 | 13 | /** 14 | * Function to initialize an object with values from a template and custom properties. 15 | * Ensures correct types based on the template using isType. 16 | * 17 | * @param {Object} prefix - The object to be initialized or updated. 18 | * @param {Object} template - The template with default values and expected types. 19 | * @param {Object} [custom={}] - Optional custom properties to add if missing. 20 | */ 21 | execute = (prefix, template, custom = {}) => { 22 | const validTemplate = Object.assign({}, template) 23 | const validCustom = Object.assign({}, custom) 24 | 25 | Object.keys(validTemplate).forEach(key => { 26 | if (!(key in prefix)) { 27 | prefix[key] = validTemplate[key] 28 | } 29 | }) 30 | 31 | Object.keys(validCustom).forEach(key => { 32 | if (!(key in prefix)) { 33 | prefix[key] = validCustom[key] 34 | } 35 | }) 36 | } 37 | } -------------------------------------------------------------------------------- /plugins/tools/calculator.js: -------------------------------------------------------------------------------- 1 | module.exports = { 2 | help: ['calculator'], 3 | aliases: ['calc'], 4 | use: 'expression', 5 | tags: 'tools', 6 | run: async (m, { 7 | conn, 8 | usedPrefix, 9 | command, 10 | text, 11 | Scraper, 12 | Func 13 | }) => { 14 | let id = m.chat 15 | conn.math = conn.math ? conn.math : {} 16 | if (id in conn.math) { 17 | clearTimeout(conn.math[id][3]) 18 | delete conn.math[id] 19 | m.reply(`Game over, you're caught cheating..`) 20 | } 21 | let val = text 22 | .replace(/[^0-9\-\/+*×÷πEe()piPI/]/g, '') 23 | .replace(/×/g, '*') 24 | .replace(/÷/g, '/') 25 | .replace(/π|pi/gi, 'Math.PI') 26 | .replace(/e/gi, 'Math.E') 27 | .replace(/\/+/g, '/') 28 | .replace(/\++/g, '+') 29 | .replace(/-+/g, '-') 30 | let format = val 31 | .replace(/Math\.PI/g, 'π') 32 | .replace(/Math\.E/g, 'e') 33 | .replace(/\//g, '÷') 34 | .replace(/\*×/g, '×') 35 | try { 36 | console.log(val) 37 | let result = new Function('return ' + val)() 38 | if (!result) throw result 39 | m.reply(`*${format}* = _${result}_`) 40 | } catch (e) { 41 | if (e == undefined) throw `What's inside?` 42 | throw 'Incorrect format, only 0-9 and Symbols -, +, *, /, ×, ÷, π, e, (, ) are supported.' 43 | } 44 | }, 45 | limit: true 46 | } -------------------------------------------------------------------------------- /plugins/owner/savefile.js: -------------------------------------------------------------------------------- 1 | const fs = require('fs') 2 | const path = require('path') 3 | 4 | module.exports = { 5 | help: ['savefile'], 6 | aliases: ['sf'], 7 | use: 'path/to/file.js', 8 | tags: 'owner', 9 | run: async (m, { 10 | conn, 11 | usedPrefix, 12 | command, 13 | text, 14 | Func 15 | }) => { 16 | try { 17 | if (!text) return conn.reply(m.chat, Func.example(usedPrefix, command, 'miscs/ping.js'), m) 18 | if (!m.quoted) return conn.reply(m.chat, Func.texted('bold', '🚩 Reply to messages/files containing code.'), m) 19 | const filePath = path.resolve(process.cwd(), text) 20 | const dir = path.dirname(filePath) 21 | if (!fs.existsSync(dir)) { 22 | fs.mkdirSync(dir, { recursive: true }) 23 | } 24 | if (m.quoted.mimetype) { 25 | const buff = await m.quoted.download() 26 | fs.writeFileSync(filePath, buff) 27 | conn.reply(m.chat, `✅ The document file has been successfully saved : *${text}*`, m) 28 | } else if (m.quoted.text) { 29 | fs.writeFileSync(filePath, m.quoted.text, 'utf-8') 30 | conn.reply(m.chat, `✅ Code successfully saved : *${text}*`, m) 31 | } else { 32 | conn.reply(m.chat, '🚩 Reply with text or document files!', m) 33 | } 34 | } catch (e) { 35 | conn.reply(m.chat, Func.jsonFormat(e), m) 36 | } 37 | }, 38 | owner: true, 39 | error: false 40 | } -------------------------------------------------------------------------------- /lib/system/scraper.js: -------------------------------------------------------------------------------- 1 | const { Function: Func, Scraper } = require('@znan/wabot') 2 | const axios = require('axios') 3 | 4 | Scraper.viewpagesource = (url) => { 5 | return new Promise(async (resolve, reject) => { 6 | try { 7 | const response = await axios.post('https://viewsourcepage.com/wp-admin/admin-ajax.php', 8 | new URLSearchParams({ 9 | action: "psvAjaxAction", 10 | url: url, 11 | }).toString(), { 12 | headers: { 13 | "accept": "*/*^", 14 | "accept-language": "id;q=0.7^", 15 | "content-type": "application/x-www-form-urlencoded; charset=UTF-8^", 16 | "origin": "https://viewsourcepage.com^", 17 | "priority": "u=1, i^", 18 | "sec-ch-ua": '"Brave";v="131", "Chromium";v="131", "Not_A Brand";v="24"', 19 | "user-agent": "Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/131.0.0.0 Safari/537.36^" 20 | } 21 | }) 22 | return resolve({ 23 | creator: global.creator, 24 | status: true, 25 | data: { 26 | result: response.data 27 | } 28 | }) 29 | } catch (e) { 30 | console.log(e) 31 | return resolve({ 32 | creator: global.creator, 33 | status: false, 34 | msg: e 35 | }) 36 | } 37 | }) 38 | } 39 | 40 | Func.updateFile(require.resolve(__filename)) -------------------------------------------------------------------------------- /plugins/converter/brat.js: -------------------------------------------------------------------------------- 1 | module.exports = { 2 | help: ['brat'], 3 | use: 'text', 4 | tags: 'converter', 5 | run: async (m, { 6 | conn, 7 | usedPrefix, 8 | command, 9 | args, 10 | text, 11 | setting, 12 | Func 13 | }) => { 14 | try { 15 | const mode = args[0] === 'gif' ? 'gif' : 'text' 16 | const content = mode === 'gif' ? args.slice(1).join(' ') : text.trim() 17 | if (!content) throw Func.example(usedPrefix, command, 'moon-bot') 18 | if (content.length > 100) throw Func.texted('bold', '🚩 Text is too long, max 100 characters.') 19 | conn.sendReact(m.chat, '🕒', m.key) 20 | if (mode === 'gif') { 21 | const json = await Api.get('/bratgif', { 22 | text: content 23 | }) 24 | const buffer = Buffer.from(json.data, 'base64') 25 | conn.sendSticker(m.chat, buffer, m, { 26 | packname: setting.sk_pack, 27 | author: setting.sk_author 28 | }) 29 | } else { 30 | const json = await Api.get('/brat', { 31 | text: content 32 | }) 33 | conn.sendSticker(m.chat, json.data.url, m, { 34 | packname: setting.sk_pack, 35 | author: setting.sk_author 36 | }) 37 | } 38 | } catch (e) { 39 | throw Func.jsonFormat(e) 40 | } 41 | }, 42 | limit: true, 43 | error: false 44 | } -------------------------------------------------------------------------------- /plugins/converter/emojis.js: -------------------------------------------------------------------------------- 1 | module.exports = { 2 | help: ['emoji'], 3 | aliases: ['semoji'], 4 | use: 'emo', 5 | tags: 'converter', 6 | run: async (m, { 7 | conn, 8 | usedPrefix, 9 | command, 10 | text, 11 | setting, 12 | Func 13 | }) => { 14 | try { 15 | if (!text) throw Func.example(usedPrefix, command, 'apple 😁') 16 | let [type, ...rest] = text.split(' ') 17 | let data = rest.join(' ').trim() 18 | let lists = ['apple', 'google', 'facebook', 'twitter', 'samsung', 'microsoft', 'whatsapp', 'messenger', 'joypixels', 'openmoji', 'emojidex', 'htc', 'lg', 'mozilla', 'softbank', 'au-kddi'] 19 | if (!type || !lists.includes(type.toLowerCase())) { 20 | let p = `Use this feature based on the styles below:\n\n` 21 | p += lists.sort().map((v, i) => ` ◦ ${usedPrefix + command} ${v}`).join('\n') 22 | p += `\n\n${global.footer}` 23 | throw p 24 | } 25 | const json = await Api.get('/emoji', { 26 | emo: data 27 | }) 28 | if (!json.status) throw Func.jsonFormat(json) 29 | const result = json.data[type.toLowerCase()] 30 | if (!result) throw Func.texted('bold', '🚩 Emoji style not found!') 31 | conn.sendSticker(m.chat, result.image, m, { 32 | packname: setting.sk_pack, 33 | author: setting.sk_author 34 | }) 35 | } catch (e) { 36 | throw Func.jsonFormat(e) 37 | } 38 | }, 39 | limit: true 40 | } -------------------------------------------------------------------------------- /plugins/admin/settext.js: -------------------------------------------------------------------------------- 1 | module.exports = { 2 | help: ['setwelcome', 'setbye'], 3 | use: 'text', 4 | tags: 'admin', 5 | run: async (m, { 6 | conn, 7 | usedPrefix, 8 | command, 9 | text, 10 | groupSet, 11 | Func 12 | }) => { 13 | if (command == 'setwelcome') { 14 | if (!text) return conn.reply(m.chat, formatWel(usedPrefix, command), m) 15 | groupSet.sWelcome = text 16 | await conn.reply(m.chat, Func.texted('bold', `🚩 Successfully set.`), m) 17 | } else if (/set(out|left)/i.test(command)) { 18 | if (!text) return conn.reply(m.chat, formatLef(usedPrefix, command), m) 19 | groupSet.sBye = text 20 | await conn.reply(m.chat, Func.texted('bold', `🚩 Successfully set.`), m) 21 | } 22 | }, 23 | group: true, 24 | admin: true, 25 | error: false 26 | } 27 | 28 | const formatWel = (prefix, command) => { 29 | return `Sorry, can't return without text, and this explanation and how to use : 30 | 31 | *1.* @tag : for mention new member on welcome message. 32 | *2.* @subject : for getting group name. 33 | *3.* @desc : for getting group description. 34 | 35 | • *Example* : ${prefix + command} Hi +tag, welcome to +grup group, we hope you enjoyed with us.` 36 | } 37 | 38 | const formatLef = (prefix, command) => { 39 | return `Sorry, can't return without text, and this explanation and how to use : 40 | 41 | *1.* @tag : for mention new member on left message. 42 | *2.* @subject : for getting group name. 43 | 44 | • *Example* : ${prefix + command} Good by +tag` 45 | } -------------------------------------------------------------------------------- /plugins/downloader/capcut.js: -------------------------------------------------------------------------------- 1 | module.exports = { 2 | help: ['capcut'], 3 | aliases: ['capcutwm'], 4 | use: 'link', 5 | tags: 'downloader', 6 | run: async (m, { 7 | conn, 8 | usedPrefix, 9 | command, 10 | args, 11 | Func 12 | }) => { 13 | try { 14 | if (!args[0]) throw Func.example(usedPrefix, command, 'https://www.capcut.com/template-detail/7355407233057950983?template_id=7355407233057950983&share_token=2fbab1d5-37fa-42ab-a00f-9d181da79409&enter_from=template_detail®ion=ID&language=in&platform=copy_link&is_copy_link=1') 15 | if (!args[0].match('capcut.com')) throw global.status.invalid 16 | conn.sendReact(m.chat, '🕒', m.key) 17 | if (command == 'capcut') { 18 | const json = await Api.get('/capcut-dl', { 19 | url: args[0], type: 'nowatermark' 20 | }) 21 | if (!json.status) throw Func.jsonFormat(json) 22 | conn.sendFile(m.chat, json.data.url, Func.filename('mp4'), `◦ *Title* : ${json.data.title}\n◦ *Description* : ${json.data.description}`, m) 23 | } else if (command == 'capcutwm') { 24 | const json = await Api.get('/capcut-dl', { 25 | url: args[0], type: 'watermark' 26 | }) 27 | if (!json.status) throw Func.jsonFormat(json) 28 | conn.sendFile(m.chat, json.data[0].url, Func.filename('mp4'), `◦ *Title* : ${json.title}`, m) 29 | } 30 | } catch (e) { 31 | throw Func.jsonFormat(e) 32 | } 33 | }, 34 | limit: true, 35 | error: false 36 | } -------------------------------------------------------------------------------- /plugins/owner/prefix.js: -------------------------------------------------------------------------------- 1 | module.exports = { 2 | help: ['+prefix', '-prefix'], 3 | use: 'symbol', 4 | tags: 'owner', 5 | run: async (m, { 6 | conn, 7 | args, 8 | usedPrefix, 9 | command, 10 | Func, 11 | env 12 | }) => { 13 | let system = global.db.setting 14 | if (command == '+prefix') { 15 | if (!args || !args[0]) return conn.reply(m.chat, Func.example(usedPrefix, command, '#'), m) 16 | if (env.evaluate_chars.includes(args[0])) return conn.reply(m.chat, Func.texted('bold', `🚩 Cannot add prefix ${args[0]} because an error will occur.`), m) 17 | if (system.prefix.includes(args[0])) return conn.reply(m.chat, Func.texted('bold', `🚩 Prefix ${args[0]} already exists in the database.`), m) 18 | system.prefix.push(args[0]) 19 | conn.reply(m.chat, Func.texted('bold', `🚩 Prefix ${args[0]} successfully added.`), m) 20 | } else if (command == '-prefix') { 21 | if (!args || !args[0]) return conn.reply(m.chat, Func.example(usedPrefix, command, '#'), m) 22 | if (system.prefix.length < 2) return conn.reply(m.chat, Func.texted('bold', `🚩 Can't removing more prefix.`), m) 23 | if (!system.prefix.includes(args[0])) return conn.reply(m.chat, Func.texted('bold', `🚩 Prefix ${args[0]} not exists in the database.`), m) 24 | system.prefix.forEach((data, index) => { 25 | if (data === args[0]) system.prefix.splice(index, 1) 26 | }) 27 | conn.reply(m.chat, Func.texted('bold', `🚩 Prefix ${args[0]} successfully removed.`), m) 28 | } 29 | }, 30 | owner: true 31 | } -------------------------------------------------------------------------------- /plugins/group/slander.js: -------------------------------------------------------------------------------- 1 | module.exports = { 2 | help: ['slander'], 3 | use: '@mention text', 4 | tags: 'group', 5 | run: async (m, { 6 | conn, 7 | text, 8 | participants, 9 | Func 10 | }) => { 11 | if (!text) return 12 | let cm = copy(m) 13 | let who 14 | 15 | if (text.includes('@0')) { 16 | who = '0@s.whatsapp.net' 17 | } else if (m.isGroup && m.mentionedJid && m.mentionedJid[0]) { 18 | who = m.mentionedJid[0] 19 | 20 | if (who.includes('@lid')) { 21 | const participant = participants.find(p => p.lid === who) 22 | if (participant && participant.id) { 23 | who = participant.id 24 | } else { 25 | return conn.reply(m.chat, Func.texted('bold', '🚩 Cannot find user in group'), m) 26 | } 27 | } 28 | cm.participant = who 29 | } else { 30 | who = m.chat 31 | } 32 | 33 | if (!who) return conn.reply(m.chat, Func.texted('bold', '🚩 Tag the person you want to slander'), m) 34 | 35 | cm.key.fromMe = false 36 | cm.message[m.mtype] = copy(m.msg) 37 | 38 | let sp = '@' + who.split`@`[0] 39 | let [fake, ...real] = text.split(sp) 40 | 41 | conn.fakeReply(m.chat, real.join(sp).trimStart(), who, fake.trimEnd(), m.isGroup ? m.chat : false, { 42 | contextInfo: { 43 | mentionedJid: Func.mention(real.join(sp).trim()) 44 | } 45 | }) 46 | }, 47 | group: true, 48 | error: false 49 | } 50 | 51 | function copy(obj) { 52 | return JSON.parse(JSON.stringify(obj)) 53 | } -------------------------------------------------------------------------------- /plugins/_events/download/autodl_threads.js: -------------------------------------------------------------------------------- 1 | module.exports = { 2 | run: async (m, { 3 | conn, 4 | body, 5 | users, 6 | isPrem, 7 | setting, 8 | Func 9 | }) => { 10 | try { 11 | if (setting.autodownload && isPrem) { 12 | const regex = /^(?:https?:\/\/)?(?:www\.)?threads\.net\/(?:\d+|[\w-]+)(?:\/)?$/ 13 | const links = body.match(regex) 14 | if (links && links.length > 0) { 15 | const limitCost = 1 16 | if (users.limit < limitCost) { 17 | return conn.reply(m.chat, Func.texted('bold', '🚩 Your limit is not enough to use this feature'), m) 18 | } 19 | users.limit -= limitCost 20 | conn.sendReact(m.chat, '🕒', m.key) 21 | let old = new Date() 22 | for (const link of links) { 23 | try { 24 | let json = await Api.get('/threads', { 25 | url: link 26 | }) 27 | if (!json.status) return conn.reply(m.chat, Func.jsonFormat(json), m) 28 | for (let i of json.data) { 29 | conn.sendFile(m.chat, i.url, '', `🍟 *Process* : ${((new Date - old) * 1)} ms`, m) 30 | } 31 | } catch (e) { 32 | conn.reply(m.chat, Func.jsonFormat(e), m) 33 | } 34 | } 35 | } 36 | } 37 | } catch (e) { 38 | conn.reply(m.chat, Func.jsonFormat(e), m) 39 | } 40 | }, 41 | download: true, 42 | error: false 43 | } -------------------------------------------------------------------------------- /plugins/owner/plugin.js: -------------------------------------------------------------------------------- 1 | const path = require('path') 2 | 3 | module.exports = { 4 | help: ['plugdis', 'plugen'], 5 | use: 'plugin name', 6 | tags: 'owner', 7 | run: async (m, { 8 | conn, 9 | args, 10 | command, 11 | usedPrefix, 12 | plugins: plugs, 13 | Func 14 | }) => { 15 | let pluginDisable = global.db.setting.pluginDisable 16 | if (!args || !args[0]) return conn.reply(m.chat, Func.example(usedPrefix, command, 'tiktok'), m) 17 | let allPluginFiles = [...new Set([...plugs.values()].map(p => path.parse(p.filePath).name))] 18 | if (!allPluginFiles.includes(args[0])) return conn.reply(m.chat, Func.texted('bold', `🚩 Plugin ${args[0]}.js not found.`), m) 19 | let plugin = [...plugs.values()].find(p => path.parse(p.filePath).name === args[0]) 20 | let actualFilename = path.basename(plugin.filePath) 21 | if (command === 'plugdis') { 22 | if (pluginDisable.includes(args[0])) return conn.reply(m.chat, Func.texted('bold', `🚩 Plugin ${actualFilename}.js previously has been disabled.`), m) 23 | pluginDisable.push(args[0]) 24 | conn.reply(m.chat, Func.texted('bold', `🚩 Plugin ${actualFilename} successfully disabled.`), m) 25 | } else if (command === 'plugen') { 26 | if (!pluginDisable.includes(args[0])) return conn.reply(m.chat, Func.texted('bold', `🚩 Plugin ${actualFilename} not found.`), m) 27 | global.db.setting.pluginDisable = global.db.setting.pluginDisable.filter(v => v !== args[0]) 28 | conn.reply(m.chat, Func.texted('bold', `🚩 Plugin ${actualFilename} successfully enable.`), m) 29 | } 30 | }, 31 | owner: true, 32 | error: false 33 | } -------------------------------------------------------------------------------- /plugins/miscs/groups.js: -------------------------------------------------------------------------------- 1 | const moment = require('moment-timezone') 2 | const { models } = require('lib/system/models') 3 | const init = new (require('lib/system/init')) 4 | 5 | module.exports = { 6 | help: ['groups'], 7 | aliases: ['grouplist'], 8 | tags: 'miscs', 9 | run: async (m, { 10 | conn, 11 | usedPrefix, 12 | Func 13 | }) => { 14 | try { 15 | let groups = Object.entries(await conn.groupFetchAllParticipating()).map(entry => entry[1]).filter(group => !group.isCommunity) /** exclude community */ 16 | let caption = `乂 *G R O U P - L I S T*\n\n` 17 | caption += `*“Bot has joined into ${groups.length} groups, send _${usedPrefix}gc_ or _${usedPrefix}gcopt_ to show all setup options.”*\n\n` 18 | groups.map((x, i) => { 19 | let v = global.db.groups[x.id] 20 | if (!v) { 21 | global.db.groups[x.id] = { 22 | activity: new Date * 1, 23 | ...(init.getModel(models?.groups || {})) 24 | } 25 | v = global.db.groups[x.id] 26 | } 27 | caption += `› *${(i + 1)}.* ${x.subject}\n` 28 | caption += ` *💳* : ${x.id.split`@`[0]}\n` 29 | caption += `${v.stay ? ' FOREVER' : (v.expired == 0 ? ' NOT SET' : ' ' + Func.timeReverse(v.expired - new Date() * 1))} | ${x.participants.length} | ${(v.mute ? 'OFF' : 'ON')} | ${moment(v.activity).format('DD/MM/YY HH:mm:ss')}\n\n` 30 | }) 31 | caption += `${global.footer}` 32 | conn.reply(m.chat, caption, m) 33 | } catch (e) { 34 | conn.reply(m.chat, Func.jsonFormat(e), m) 35 | } 36 | }, 37 | error: false 38 | } -------------------------------------------------------------------------------- /plugins/owner/hide_category.js: -------------------------------------------------------------------------------- 1 | module.exports = { 2 | help: ['+hide', '-hide'], 3 | use: 'category / tags', 4 | tags: 'owner', 5 | run: async (m, { 6 | conn, 7 | text, 8 | command, 9 | usedPrefix, 10 | plugins, 11 | setting, 12 | Func 13 | }) => { 14 | try { 15 | let all = [...new Set([...plugins.values()].map(p => p.tags).filter(t => t && t !== 'main'))] 16 | let target = text.toLowerCase().trim() 17 | if (!target) { 18 | let txt = `Use format ${usedPrefix + command} tags\n\n` 19 | txt += `Tags available:\n◦ ${all.join('\n◦ ')}\n\n` 20 | txt += `Tags that were hidden before:\n◦ ${setting.hidden.length > 0 ? setting.hidden.join('\n') : '-'}` 21 | return m.reply(txt) 22 | } 23 | if (!all.includes(target)) return conn.reply(m.chat, `⚠️ Category "${target}" not found.`, m) 24 | if (command === '+hide') { 25 | if (setting.hidden.includes(target)) return conn.reply(m.chat, `⚠️ Category "${target}" previously been hidden.`, m) 26 | setting.hidden.push(target) 27 | conn.reply(m.chat, `✅ Category "${target}" successfully hidden.`, m) 28 | } else if (command === '-hide') { 29 | if (!setting.hidden.includes(target)) return conn.reply(m.chat, `⚠️ Category "${target}" category does not exist.`, m) 30 | setting.hidden = setting.hidden.filter(cat => cat !== target) 31 | conn.reply(m.chat, `✅ Category "${target}" has been removed from hidden list.`, m) 32 | } 33 | } catch (e) { 34 | conn.reply(m.chat, Func.jsonFormat(e), m) 35 | } 36 | }, 37 | owner: true 38 | } -------------------------------------------------------------------------------- /plugins/_events/download/autodl_ig.js: -------------------------------------------------------------------------------- 1 | module.exports = { 2 | run: async (m, { 3 | conn, 4 | users, 5 | isPrem, 6 | setting, 7 | Func 8 | }) => { 9 | try { 10 | if (setting.autodownload && isPrem) { 11 | const regex = /^(?:https?:\/\/)?(?:www\.)?(?:instagram\.com\/)(?:tv\/|p\/|reel\/)(?:\S+)?$/; 12 | const links = m.text.match(regex) 13 | if (links && links.length > 0) { 14 | const limitCost = 1 15 | if (users.limit < limitCost) { 16 | return conn.reply(m.chat, Func.texted('bold', '🚩 Your limit is not enough to use this feature'), m) 17 | } 18 | users.limit -= limitCost 19 | conn.sendReact(m.chat, '🕒', m.key) 20 | let old = new Date() 21 | for (const link of links) { 22 | try { 23 | let json = await Api.get('/ig', { 24 | url: link 25 | }) 26 | if (!json.status) return conn.reply(m.chat, Func.jsonFormat(json), m) 27 | for (let i of json.data) { 28 | conn.sendFile(m.chat, i.url, '', `🍟 *Process* : ${((new Date - old) * 1)} ms`, m) 29 | await Func.delay(1500) 30 | } 31 | } catch (e) { 32 | conn.reply(m.chat, Func.jsonFormat(e), m) 33 | } 34 | } 35 | } 36 | } 37 | } catch (e) { 38 | conn.reply(m.chat, Func.jsonFormat(e), m) 39 | } 40 | }, 41 | download: true, 42 | error: false 43 | } -------------------------------------------------------------------------------- /plugins/downloader/ytmp4.js: -------------------------------------------------------------------------------- 1 | module.exports = { 2 | help: ['ytmp4'], 3 | aliases: ['ytv'], 4 | use: 'link', 5 | tags: 'downloader', 6 | run: async (m, { 7 | conn, 8 | usedPrefix, 9 | command, 10 | args, 11 | users, 12 | env, 13 | Func 14 | }) => { 15 | try { 16 | if (!args[0]) throw Func.example(usedPrefix, command, 'https://youtu.be/zaRFmdtLhQ8') 17 | if (!/^(?:https?:\/\/)?(?:www\.|m\.|music\.)?youtu\.?be(?:\.com)?\/?.*(?:watch|embed)?(?:.*v=|v\/|\/)([\w\-_]+)\&?/.test(args[0])) throw global.status.invalid 18 | conn.sendReact(m.chat, '🕒', m.key) 19 | const json = await Api.get('/ytv', { 20 | url: args[0] 21 | }) 22 | if (!json.status) throw Func.jsonFormat(json) 23 | let txt = `乂 *Y T - M P 4*\n\n` 24 | txt += ` ◦ *Title* : ${json.title}\n` 25 | txt += ` ◦ *Duration* : ${json.duration}\n` 26 | txt += ` ◦ *Views* : ${json.views}\n` 27 | txt += ` ◦ *Size* : ${json.data.size}\n\n` 28 | txt += global.footer 29 | const chSize = Func.sizeLimit(json.data.size, users.premium ? env.max_upload : env.max_upload_free) 30 | const isOver = users.premium ? `💀 File size (${json.data.size}) exceeds the maximum limit.` : `⚠️ File size (${json.data.size}), you can only download files with a maximum size of ${env.max_upload_free} MB and for premium users a maximum of ${env.max_upload} MB.` 31 | if (chSize.oversize) throw isOver 32 | conn.sendFile(m.chat, json.data.url, json.data.filename, txt, m) 33 | } catch (e) { 34 | throw Func.jsonFormat(e) 35 | } 36 | }, 37 | limit: true, 38 | error: false 39 | } -------------------------------------------------------------------------------- /plugins/_events/download/autodl_x.js: -------------------------------------------------------------------------------- 1 | module.exports = { 2 | run: async (m, { 3 | conn, 4 | users, 5 | isPrem, 6 | setting, 7 | body, 8 | Func 9 | }) => { 10 | try { 11 | if (setting.autodownload && isPrem) { 12 | const regex = /^(https?:\/\/)?(www\.)?twitter|x\.com\/(?:#!\/)?([a-zA-Z0-9_]+)\/status(es)?\/(\d+)$/; 13 | const links = body.match(regex) 14 | if (links && links.length > 0) { 15 | const limitCost = 1 16 | if (users.limit < limitCost) { 17 | return conn.reply(m.chat, Func.texted('bold', '🚩 Your limit is not enough to use this feature'), m) 18 | } 19 | users.limit -= limitCost 20 | conn.sendReact(m.chat, '🕒', m.key) 21 | let old = new Date() 22 | for (let link of links) { 23 | try { 24 | const json = await Api.get('/twitter', { 25 | url: link 26 | }) 27 | console.log(link) 28 | if (!json.status) return conn.reply(m.chat, Func.jsonFormat(json), m) 29 | let url = json.data.find((v) => v.url).url 30 | await conn.sendFile(m.chat, url, '', `🍟 *Process* : ${((new Date - old) * 1)} ms`, m) 31 | } catch (e) { 32 | conn.reply(m.chat, Func.jsonFormat(e), m) 33 | } 34 | } 35 | } 36 | } 37 | } catch (e) { 38 | conn.reply(m.chat, Func.jsonFormat(e), m) 39 | } 40 | }, 41 | download: true, 42 | error: false 43 | } -------------------------------------------------------------------------------- /lib/system/levelling.js: -------------------------------------------------------------------------------- 1 | const { Config: env, Function: Func } = require('@znan/wabot') 2 | module.exports = class Levelling { 3 | /** 4 | * Growth rate 5 | * `2.576652002695681` 6 | */ 7 | growth = Math.pow(Math.PI / Math.E, 1.618) * Math.E * .75 8 | /** 9 | * get XP range at specified level 10 | * @param {Number} level 11 | * @param {Number} multiplier 12 | */ 13 | xpRange = (level, multiplier = env.multiplier || 1) => { 14 | if (level < 0) throw new TypeError('level cannot be negative value') 15 | level = Math.floor(level) 16 | let min = level === 0 ? 0 : Math.round(Math.pow(level, this.growth) * multiplier) + 1 17 | let max = Math.round(Math.pow(++level, this.growth) * multiplier) 18 | return { 19 | min, 20 | max, 21 | xp: max - min 22 | } 23 | } 24 | /** 25 | * get level by xp 26 | * @param {Number} xp 27 | * @param {Number} multiplier 28 | */ 29 | findLevel = (xp, multiplier = env.multiplier || 1) => { 30 | if (xp === Infinity) return Infinity 31 | if (isNaN(xp)) return NaN 32 | if (xp <= 0) return -1 33 | let level = 0 34 | do level++ 35 | while (this.xpRange(level, multiplier).min <= xp) 36 | return --level 37 | } 38 | /** 39 | * is able to level up? 40 | * @param {Number} level 41 | * @param {Number} xp 42 | * @param {Number} multiplier 43 | */ 44 | canLevelUp = (level, xp, multiplier = env.multiplier || 1) => { 45 | if (level < 0) return false 46 | if (xp === Infinity) return true 47 | if (isNaN(xp)) return false 48 | if (xp <= 0) return false 49 | return level < this.findLevel(xp, multiplier) 50 | } 51 | } 52 | Func.updateFile(require.resolve(__filename)) -------------------------------------------------------------------------------- /plugins/miscs/cmdstic.js: -------------------------------------------------------------------------------- 1 | module.exports = { 2 | help: ['+cmdstic', '-cmdstic'], 3 | use: 'text / command', 4 | tags: 'owner', 5 | run: async (m, { 6 | conn, 7 | text, 8 | command, 9 | Func 10 | }) => { 11 | if (command == '+cmdstic') { 12 | if (!m.quoted || !/webp/.test(m.quoted.mimetype)) return conn.reply(m.chat, Func.texted('bold', `🚩 Reply sticker that will be used as sticker command.`), m) 13 | if (!text) return conn.reply(m.chat, Func.texted('bold', `🚩 Berikan teks atau command.`), m) 14 | let hash = m.quoted.fileSha256.toString().replace(/,/g, '') 15 | if (typeof global.db.sticker[hash] != 'undefined') return conn.reply(m.chat, `${Func.texted('bold', `🚩 Sticker is already in the database with text / command`)} : ${Func.texted('monospace', global.db.sticker[hash].text)}`, m) 16 | global.db.sticker[hash] = { 17 | text: text, 18 | created: new Date() * 1 19 | } 20 | conn.reply(m.chat, `${Func.texted('bold', `🚩 Sticker successfully set as text / command`)} : ${Func.texted('monospace', text)}`, m) 21 | } else if (command == '-cmdstic') { 22 | if (!m.quoted || !/webp/.test(m.quoted.mimetype)) return conn.reply(m.chat, Func.texted('bold', `🚩 Reply sticker that will be removed from the sticker command list.`), m) 23 | let hash = m.quoted.fileSha256.toString().replace(/,/g, '') 24 | if (typeof global.db.sticker[hash] == 'undefined') return conn.reply(m.chat, Func.texted('bold', `🚩 Sticker is not in the database.`), m) 25 | delete global.db.sticker[hash] 26 | conn.reply(m.chat, Func.texted('bold', `🚩 Sticker command successfully removed.`), m) 27 | } 28 | }, 29 | limit: true, 30 | error: false 31 | } -------------------------------------------------------------------------------- /plugins/users/reg.js: -------------------------------------------------------------------------------- 1 | const { createHash } = require('crypto') 2 | const Reg = /\|?(.*)([.|] *?)([0-9]*)$/i 3 | 4 | module.exports = { 5 | help: ['reg'], 6 | aliases: ['register'], 7 | use: 'name.age', 8 | tags: 'user', 9 | run: async (m, { 10 | conn, 11 | usedPrefix, 12 | command, 13 | text, 14 | Func 15 | }) => { 16 | try { 17 | const users = global.db.users[m.sender] 18 | if (users.registered === true) throw Func.texted('bold', '🚩 You are already registered in the bot database.') 19 | if (!Reg.test(text)) throw Func.example(usedPrefix, command, 'moon.17') 20 | let [_, name, splitter, age] = text.match(Reg) 21 | if (!name) throw Func.texted('bold', '🚩 Enter your name') 22 | if (!age) throw Func.texted('bold', '🚩 Enter your age') 23 | age = parseInt(age) 24 | if (name.length > 20) throw Func.texted('bold', '🚩 Name is too long') 25 | if (age > 80) throw Func.texted('bold', '🚩 Age is too old') 26 | if (age < 5) throw Func.texted('bold', '🚩 Too young, can babies type?') 27 | let sn = createHash('md5').update(m.sender).digest('hex') 28 | let txt = `*Registered successfully* 29 | 30 | ∘ Name : ${name} 31 | ∘ Age : ${age} years old 32 | ∘ SN : ${sn} 33 | 34 | + 100 Limit 35 | + 20.000 EXP` 36 | conn.reply(m.chat, txt, m).then(() => { 37 | users.name = name.trim() 38 | users.age = age 39 | users.reg_time = +new Date() 40 | users.registered = true 41 | users.limit += 100 42 | users.exp += 20000 43 | }) 44 | } catch (e) { 45 | throw Func.jsonFormat(e) 46 | } 47 | }, 48 | private: true, 49 | error: false 50 | } -------------------------------------------------------------------------------- /plugins/exec.js: -------------------------------------------------------------------------------- 1 | const { exec } = require('child_process') 2 | const syntax = require('syntax-error') 3 | 4 | module.exports = { 5 | run: async (m, { 6 | conn, 7 | body, 8 | ctx, 9 | isOwner, 10 | Func, 11 | env, 12 | store, 13 | groupMetadata, 14 | participants, 15 | Scraper 16 | }) => { 17 | if (typeof body === 'object' || !isOwner) return 18 | let command, text 19 | let x = body && body.trim().split`\n`, 20 | y = '' 21 | command = x[0] ? x[0].split` `[0] : '' 22 | y += x[0] ? x[0].split` `.slice`1`.join` ` : '', y += x ? x.slice`1`.join`\n` : '' 23 | text = y.trim() 24 | if (!text) return 25 | if (command === '=>') { 26 | try { 27 | var evL = await eval(`(async () => { return ${text} })()`) 28 | conn.reply(m.chat, Func.jsonFormat(evL), m) 29 | } catch (e) { 30 | let err = await syntax(text) 31 | m.reply(typeof err != 'undefined' ? Func.texted('monospace', err) + '\n\n' : '' + require('util').format(e)) 32 | } 33 | } else if (command === '>') { 34 | try { 35 | var evL = await eval(`(async () => { ${text} })()`) 36 | m.reply(Func.jsonFormat(evL)) 37 | } catch (e) { 38 | let err = await syntax(text) 39 | m.reply(typeof err != 'undefined' ? Func.texted('monospace', err) + '\n\n' : '' + Func.jsonFormat(e)) 40 | } 41 | } else if (command == '$') { 42 | conn.sendReact(m.chat, '🕒', m.key) 43 | exec(text.trim(), (err, stdout) => { 44 | if (err) return m.reply(err.toString()) 45 | if (stdout) return m.reply(stdout.toString()) 46 | }) 47 | } 48 | }, 49 | error: false 50 | } -------------------------------------------------------------------------------- /plugins/miscs/ping.js: -------------------------------------------------------------------------------- 1 | const os = require('os') 2 | 3 | module.exports = { 4 | help: ['ping'], 5 | tags: 'miscs', 6 | run: async (m, { 7 | conn, 8 | Func 9 | }) => { 10 | try { 11 | const sentMsg = await conn.reply(m.chat, 'Testing Speed . . .', m) 12 | const reply = Object.entries(await getSystemStats(Func)).map(([key, val]) => `*${key}*: ${Array.isArray(val) ? val.join(', ') : val}`).join('\n') 13 | await conn.sendMessage(m.chat, { 14 | text: reply, 15 | edit: sentMsg.key 16 | }) 17 | } catch (e) { 18 | throw Func.jsonFormat(e) 19 | } 20 | }, 21 | error: false 22 | } 23 | 24 | const getSystemStats = async (Func) => { 25 | const memoryUsage = process.memoryUsage() 26 | const cpuUsage = process.cpuUsage() 27 | 28 | return { 29 | node: process.version, 30 | platform: os.platform(), 31 | arch: os.arch(), 32 | cpuModel: os.cpus()[0]?.model || '', 33 | cpuCores: os.cpus().length, 34 | loadAverage: os.loadavg(), 35 | uptime: Func.toTime(os.uptime()), 36 | rss: await Func.getSize(memoryUsage.rss), 37 | heapTotal: await Func.getSize(memoryUsage.heapTotal), 38 | heapUsed: await Func.getSize(memoryUsage.heapUsed), 39 | external: await Func.getSize(memoryUsage.external), 40 | arrayBuffers: memoryUsage.arrayBuffers !== undefined ? await Func.getSize(memoryUsage.arrayBuffers) : 'N/A', 41 | totalMem: await Func.getSize(os.totalmem()), 42 | freeMem: await Func.getSize(os.freemem()), 43 | processCpuUserMs: Math.round(cpuUsage.user / 1000), 44 | processCpuSystemMs: Math.round(cpuUsage.system / 1000), 45 | pid: process.pid, 46 | homeDir: os.homedir(), 47 | hostname: os.hostname() 48 | } 49 | } -------------------------------------------------------------------------------- /plugins/converter/qc.js: -------------------------------------------------------------------------------- 1 | const axios = require('axios') 2 | 3 | module.exports = { 4 | help: ['qc'], 5 | use: 'text', 6 | tags: 'converter', 7 | run: async (m, { 8 | conn, 9 | usedPrefix, 10 | command, 11 | text, 12 | setting, 13 | Func 14 | }) => { 15 | try { 16 | if (!text) throw Func.example(usedPrefix, command, 'Hi!') 17 | let pic = await conn.profilePictureUrl(m.quoted ? m.quoted.sender : m.sender, 'image').catch(() => 'https://cdn.moonx.site/ea776b1d721a28b6213150d64d87a193') 18 | conn.sendReact(m.chat, '🕒', m.key) 19 | const json = { 20 | "type": "quote", 21 | "format": "png", 22 | "backgroundColor": "#0C0C0C", 23 | "width": 512, 24 | "height": 768, 25 | "scale": 2, 26 | "messages": [{ 27 | "entities": [], 28 | "avatar": true, 29 | "from": { 30 | "id": 1, 31 | "name": m.quoted ? m.quoted.name : m.name, 32 | "photo": { 33 | "url": pic 34 | } 35 | }, 36 | "text": text, 37 | "replyMessage": {} 38 | }] 39 | } 40 | const response = await axios.post('https://bot.lyo.su/quote/generate', json, { 41 | headers: { 42 | 'Content-Type': 'application/json' 43 | } 44 | }) 45 | const buffer = Buffer.from(response.data.result.image, 'base64') 46 | conn.sendSticker(m.chat, buffer, m, { 47 | packname: setting.sk_pack, 48 | author: setting.sk_author 49 | }) 50 | } catch (e) { 51 | throw Func.jsonFormat(e) 52 | } 53 | }, 54 | limit: true 55 | } -------------------------------------------------------------------------------- /plugins/owner/toxic.js: -------------------------------------------------------------------------------- 1 | module.exports = { 2 | help: ['+toxic', '-toxic'], 3 | use: 'word', 4 | tags: 'owner', 5 | run: async (m, { 6 | conn, 7 | usedPrefix, 8 | command, 9 | Func 10 | }) => { 11 | try { 12 | if (command == '+toxic') { 13 | if (!args || !args[0]) return conn.reply(m.chat, Func.example(usedPrefix, command, 'fuck'), m) 14 | if (global.db.setting.toxic.includes(args[0])) return conn.reply(m.chat, Func.texted('bold', `🚩 '${args[0]}' already in the database.`), m) 15 | global.db.setting.toxic.push(args[0]) 16 | global.db.setting.toxic.sort(function (a, b) { 17 | if (a < b) { 18 | return -1; 19 | } 20 | if (a > b) { 21 | return 1; 22 | } 23 | return 0 24 | }) 25 | conn.reply(m.chat, Func.texted('bold', `🚩 '${args[0]}' added successfully!`), m) 26 | } else if (command == '-toxic') { 27 | if (!args || !args[0]) return conn.reply(m.chat, Func.example(usedPrefix, command, 'fuck'), m) 28 | if (global.db.setting.toxic.length < 2) return conn.reply(m.chat, Func.texted('bold', `🚩 Sorry, you can't remove more.`), m) 29 | if (!global.db.setting.toxic.includes(args[0])) return conn.reply(m.chat, Func.texted('bold', `🚩 '${args[0]}' not in database.`), m) 30 | global.db.setting.toxic.forEach((data, index) => { 31 | if (data === args[0]) global.db.setting.toxic.splice(index, 1) 32 | }) 33 | conn.reply(m.chat, Func.texted('bold', `🚩 '${args[0]}' has been removed.`), m) 34 | } 35 | } catch (e) { 36 | return conn.reply(m.chat, global.status.error, m) 37 | } 38 | }, 39 | owner: true 40 | } -------------------------------------------------------------------------------- /plugins/tools/ocr.js: -------------------------------------------------------------------------------- 1 | module.exports = { 2 | help: ['ocr'], 3 | use: 'reply photo', 4 | tags: 'tools', 5 | run: async (m, { 6 | conn, 7 | usedPrefix, 8 | Scraper, 9 | Func 10 | }) => { 11 | try { 12 | if (m.quoted ? m.quoted.message : m.msg.viewOnce) { 13 | let type = m.quoted ? Object.keys(m.quoted.message)[0] : m.mtype 14 | let q = m.quoted ? m.quoted.message[type] : m.msg 15 | if (/image/.test(type)) { 16 | conn.sendReact(m.chat, '🕒', m.key) 17 | const cdn = await Scraper.uploader(await conn.downloadMediaMessage(q)) 18 | if (!cdn.status) throw Func.jsonFormat(cdn) 19 | const json = await Api.get('/ocr', { 20 | image: cdn.data.url 21 | }) 22 | if (!json.status) throw Func.jsonFormat(json) 23 | conn.reply(m.chat, json.data.text, m) 24 | } else throw Func.texted('bold', `🚩 Only for photo.`) 25 | } else { 26 | let q = m.quoted ? m.quoted : m 27 | let mime = (q.msg || q).mimetype || '' 28 | if (!mime) throw Func.texted('bold', `🚩 Reply photo.`) 29 | if (!/image\/(jpe?g|png)/.test(mime)) throw Func.texted('bold', `🚩 Only for photo.`) 30 | conn.sendReact(m.chat, '🕒', m.key) 31 | const cdn = await Scraper.uploader(await q.download()) 32 | if (!cdn.status) throw Func.jsonFormat(cdn) 33 | const json = await Api.get('/ocr', { 34 | image: cdn.data.url 35 | }) 36 | if (!json.status) throw Func.jsonFormat(json) 37 | conn.reply(m.chat, json.data.text, m) 38 | } 39 | } catch (e) { 40 | throw Func.jsonFormat(e) 41 | } 42 | }, 43 | limit: true, 44 | } -------------------------------------------------------------------------------- /plugins/group/ava.js: -------------------------------------------------------------------------------- 1 | module.exports = { 2 | help: ['ava'], 3 | use: 'mention or reply', 4 | tags: 'group', 5 | run: async (m, { 6 | conn, 7 | text, 8 | participants, 9 | Func 10 | }) => { 11 | try { 12 | if (!text && !m.quoted && !m.mentionedJid) return conn.reply(m.chat, `🚩 Mention or reply chat target.`, m) 13 | let user 14 | if (m.mentionedJid && m.mentionedJid[0]) { 15 | user = m.mentionedJid[0] 16 | } else if (m.quoted && m.quoted.sender) { 17 | user = m.quoted.sender 18 | } else if (text) { 19 | let number = isNaN(text) ? (text.startsWith('+') ? text.replace(/[()+\s-]/g, '') : (text).split`@`[1]) : text 20 | if (isNaN(number)) return conn.reply(m.chat, `🚩 Invalid number.`, m) 21 | if (number.length > 15) return conn.reply(m.chat, `🚩 Invalid format.`, m) 22 | user = number + '@s.whatsapp.net' 23 | } 24 | if (!user) return conn.reply(m.chat, `🚩 Cannot detect user.`, m) 25 | if (user.includes('@lid')) { 26 | const participant = participants.find(p => p.lid === user) 27 | if (participant && participant.id) { 28 | user = participant.id 29 | } else { 30 | return conn.reply(m.chat, `🚩 Cannot find user in group.`, m) 31 | } 32 | } 33 | var pic = false 34 | try { 35 | var pic = await conn.profilePictureUrl(user, 'image') 36 | } catch { } finally { 37 | if (!pic) return conn.reply(m.chat, `🚩 He/She didn't put a profile picture.`, m) 38 | conn.sendFile(m.chat, pic, '', '', m) 39 | } 40 | } catch (e) { 41 | return conn.reply(m.chat, Func.jsonFormat(e), m) 42 | } 43 | }, 44 | group: true 45 | } -------------------------------------------------------------------------------- /.idx/dev.nix: -------------------------------------------------------------------------------- 1 | # To learn more about how to use Nix to configure your environment 2 | # see: https://developers.google.com/idx/guides/customize-idx-env 3 | { pkgs, ... }: { 4 | # Which nixpkgs channel to use. 5 | channel = "stable-24.11"; # or "unstable" 6 | 7 | # Use https://search.nixos.org/packages to find packages 8 | packages = [ 9 | pkgs.nodejs_20 10 | pkgs.neofetch 11 | pkgs.jellyfin-ffmpeg 12 | pkgs.imagemagick 13 | pkgs.libwebp 14 | pkgs.yarn 15 | pkgs.libuuid 16 | ]; 17 | 18 | # Sets environment variables in the workspace 19 | env = { 20 | LD_LIBRARY_PATH = pkgs.lib.makeLibraryPath [ 21 | pkgs.libuuid 22 | ]; 23 | }; 24 | idx = { 25 | # Search for the extensions you want on https://open-vsx.org/ and use "publisher.id" 26 | extensions = [ 27 | # "vscodevim.vim" 28 | ]; 29 | 30 | # Enable previews 31 | previews = { 32 | enable = true; 33 | previews = { 34 | # web = { 35 | # # Example: run "npm run dev" with PORT set to IDX's defined port for previews, 36 | # # and show it in IDX's web preview panel 37 | # command = ["npm" "run" "dev"]; 38 | # manager = "web"; 39 | # env = { 40 | # # Environment variables to set for your server 41 | # PORT = "$PORT"; 42 | # }; 43 | # }; 44 | }; 45 | }; 46 | 47 | # Workspace lifecycle hooks 48 | workspace = { 49 | # Runs when a workspace is first created 50 | onCreate = { 51 | # Example: install JS dependencies from NPM 52 | # npm-install = "npm install"; 53 | }; 54 | # Runs when the workspace is (re)started 55 | onStart = { 56 | # Example: start a background task to watch and re-build backend code 57 | # watch-backend = "npm run watch-backend"; 58 | }; 59 | }; 60 | }; 61 | } -------------------------------------------------------------------------------- /plugins/internet/google.js: -------------------------------------------------------------------------------- 1 | module.exports = { 2 | help: ['google', 'gimage'], 3 | use: 'query', 4 | tags: 'internet', 5 | run: async (m, { 6 | conn, 7 | usedPrefix, 8 | command, 9 | text, 10 | Scraper, 11 | Func 12 | }) => { 13 | try { 14 | if (!text) throw Func.example(usedPrefix, command, 'Cow') 15 | conn.sendReact(m.chat, '🕒', m.key) 16 | if (command == 'google') { 17 | const json = await Api.get('/google', { 18 | q: text 19 | }) 20 | if (!json.status) throw Func.jsonFormat(json) 21 | let txt = `乂 *G O O G L E*\n\n` 22 | json.data.map((v, i) => { 23 | txt += `*` + (i + 1) + `.* ` + v.title + `\n` 24 | txt += ` ∘ *Snippet* : ` + v.snippet + `\n` 25 | txt += ` ∘ *Link* : ` + v.url + `\n\n` 26 | }) 27 | conn.reply(m.chat, txt, m) 28 | } 29 | if (command == 'gimage') { 30 | const json = await Api.get('/google-image', { 31 | q: text 32 | }) 33 | if (!json.status) throw Func.jsonFormat(json) 34 | for (let i = 0; i < 5; i++) { 35 | let random = Math.floor(json.data.length * Math.random()) 36 | let caption = `乂 *G O O G L E - I M A G E*\n\n` 37 | caption += ` ◦ *Title* : ${json.data[random].origin.title}\n` 38 | caption += ` ◦ *Dimensions* : ${json.data[random].width} × ${json.data[random].height}\n\n` 39 | caption += global.footer 40 | conn.sendFile(m.chat, json.data[random].url, 'google.jpg', caption, m) 41 | await Func.delay(2500) 42 | } 43 | } 44 | } catch (e) { 45 | throw Func.jsonFormat(e) 46 | } 47 | }, 48 | limit: true, 49 | error: false 50 | } -------------------------------------------------------------------------------- /plugins/internet/chord.js: -------------------------------------------------------------------------------- 1 | module.exports = { 2 | help: ['chord'], 3 | use: 'query', 4 | tags: 'internet', 5 | run: async (m, { 6 | conn, 7 | usedPrefix, 8 | command, 9 | text, 10 | Func 11 | }) => { 12 | try { 13 | if (!conn.chord) conn.chord = {} 14 | if (/^\d+$/.test(text)) { 15 | if (typeof conn.chord?.[m.chat] === 'undefined') throw `🚩 The data has expired. Please search again with *${usedPrefix + command}*.` 16 | let idx = parseInt(text) - 1 17 | let data = conn.chord[m.chat].list 18 | if (isNaN(idx) || !data[idx]) throw '🚩 Invalid Number!' 19 | const { url } = data[idx] 20 | conn.sendReact(m.chat, '🕒', m.key) 21 | const json = await Api.get('/chord-get', { 22 | url: url 23 | }) 24 | conn.reply(m.chat, json.data.chord, m) 25 | } else { 26 | if (!text) throw Func.example(usedPrefix, command, 'demi kau dan si buah hati') 27 | conn.sendReact(m.chat, '🕒', m.key) 28 | const json = await Api.get('/chord', { 29 | q: text 30 | }) 31 | if (!json.status) throw Func.jsonFormat(json) 32 | conn.chord[m.chat] = { 33 | list: json.data, 34 | timer: setTimeout(() => { 35 | delete conn.chord[m.chat] 36 | }, 2 * 60 * 1000) // 2 minutes 37 | } 38 | let txt = `乂 *C H O R D*\n\n` 39 | json.data.slice(0, 10).map((v, i) => { 40 | txt += `*${i + 1}.* ${v.title}\n` 41 | }).join('\n') 42 | txt += `Type a number ( 1 - 10 ) to see details.` 43 | conn.reply(m.chat, txt, m) 44 | } 45 | } catch (e) { 46 | throw Func.jsonFormat(e) 47 | } 48 | }, 49 | limit: true, 50 | error: false 51 | } -------------------------------------------------------------------------------- /plugins/tools/age.js: -------------------------------------------------------------------------------- 1 | module.exports = { 2 | help: ['age'], 3 | use: 'reply photo', 4 | tags: 'tools', 5 | run: async (m, { 6 | conn, 7 | usedPrefix, 8 | command, 9 | Scraper, 10 | Func 11 | }) => { 12 | try { 13 | if (m.quoted ? m.quoted.message : m.msg.viewOnce) { 14 | let type = m.quoted ? Object.keys(m.quoted.message)[0] : m.mtype 15 | let q = m.quoted ? m.quoted.message[type] : m.msg 16 | if (/image/.test(type)) { 17 | conn.sendReact(m.chat, '🕒', m.key) 18 | const cdn = await Scraper.uploader(await conn.downloadMediaMessage(q)) 19 | if (!cdn.status) throw Func.jsonFormat(cdn) 20 | const json = await Api.get('/face-detect', { 21 | image: cdn.data.url 22 | }) 23 | if (!json.status) throw Func.jsonFormat(json) 24 | conn.reply(m.chat, `Gender : ${json.data.gender}\nAge : ${json.data.age}`, m) 25 | } else conn.reply(m.chat, 'Only for photo.', m) 26 | } else { 27 | let q = m.quoted ? m.quoted : m 28 | let mime = (q.msg || q).mimetype || '' 29 | if (!mime) throw `Reply photo with command ${usedPrefix + command}.` 30 | if (!/image\/(jpe?g|png)/.test(mime)) throw 'Only for photo.' 31 | conn.sendReact(m.chat, '🕒', m.key) 32 | const cdn = await Scraper.uploader(await q.download()) 33 | if (!cdn.status) throw Func.jsonFormat(cdn) 34 | const json = await Api.get('/face-detect', { 35 | image: cdn.data.url 36 | }) 37 | if (!json.status) throw Func.jsonFormat(json) 38 | conn.reply(m.chat, `Gender : ${json.data.gender}\nAge : ${json.data.age}`, m) 39 | } 40 | } catch (e) { 41 | throw Func.jsonFormat(e) 42 | } 43 | }, 44 | limit: true 45 | } -------------------------------------------------------------------------------- /index.js: -------------------------------------------------------------------------------- 1 | if (process.argv.includes('--server')) require('./server') 2 | require('dotenv').config(), require('rootpath')(), console.clear() 3 | const { spawn: spawn } = require('child_process'), path = require('path'), CFonts = require('cfonts') 4 | 5 | process.on('uncaughtException', error => { 6 | console.error('Uncaught Exception:', error.stack || error) 7 | }) 8 | process.on('unhandledRejection', (reason, promise) => { 9 | console.error('Unhandled Rejection at:', promise, 'reason:', reason) 10 | }) 11 | 12 | function start() { 13 | let args = [path.join(__dirname, 'main.js'), ...process.argv.slice(2)] 14 | let p = spawn(process.argv[0], args, { 15 | stdio: ['inherit', 'inherit', 'inherit', 'ipc'] 16 | }).on('message', data => { 17 | try { 18 | if (data === 'reset') { 19 | console.log('Restarting...') 20 | p.kill() 21 | } 22 | } catch (err) { 23 | console.error('Error handling message:', err) 24 | } 25 | }).on('exit', code => { 26 | console.error('Exited with code:', code) 27 | if (code !== 0) { 28 | console.log('Restarting process due to non-zero exit code...') 29 | start() 30 | } 31 | }).on('error', err => { 32 | console.error('Spawn error:', err) 33 | }) 34 | } 35 | 36 | console.clear() 37 | const major = parseInt(process.versions.node.split('.')[0], 10) 38 | if (major < 22) { 39 | console.error( 40 | `\n❌ This script requires Node.js 22 to run reliably.\n` + 41 | ` You are using Node.js ${process.versions.node}.\n` + 42 | ` Please upgrade to Node.js 22 or higher to proceed.\n` 43 | ) 44 | process.exit(1) 45 | } 46 | 47 | CFonts.say('MOON BOT', { 48 | font: 'tiny', 49 | align: 'center', 50 | colors: ['system'] 51 | }), CFonts.say('Github : https://github.com/znanx/moon-bot', { 52 | colors: ['system'], 53 | font: 'console', 54 | align: 'center' 55 | }), start() 56 | -------------------------------------------------------------------------------- /plugins/owner/setpp.js: -------------------------------------------------------------------------------- 1 | const { S_WHATSAPP_NET } = require('@whiskeysockets/baileys') 2 | const Jimp = require('jimp') 3 | 4 | module.exports = { 5 | help: ['setpp'], 6 | use: 'reply photo', 7 | tags: 'owner', 8 | run: async (m, { 9 | conn, 10 | usedPrefix, 11 | command, 12 | Func 13 | }) => { 14 | try { 15 | let q = m.quoted ? m.quoted : m 16 | let mime = ((m.quoted ? m.quoted : m.msg).mimetype || '') 17 | if (/image\/(jpe?g|png)/.test(mime)) { 18 | conn.sendReact(m.chat, '🕒', m.key) 19 | const buffer = await q.download() 20 | const { img } = await generate(buffer) 21 | await conn.query({ 22 | tag: 'iq', 23 | attrs: { 24 | to: S_WHATSAPP_NET, 25 | type: 'set', 26 | xmlns: 'w:profile:picture' 27 | }, 28 | content: [{ 29 | tag: 'picture', 30 | attrs: { 31 | type: 'image' 32 | }, 33 | content: img 34 | }] 35 | }) 36 | conn.reply(m.chat, Func.texted('bold', `🚩 Profile photo has been successfully changed.`), m) 37 | } else return conn.reply(m.chat, Func.texted('bold', `🚩 Reply to the photo that will be made into the bot's profile photo.`), m) 38 | } catch (e) { 39 | conn.reply(m.chat, Func.jsonFormat(e), m) 40 | } 41 | }, 42 | owner: true, 43 | error: false 44 | } 45 | 46 | async function generate(media) { 47 | const jimp = await Jimp.read(media) 48 | const min = jimp.getWidth() 49 | const max = jimp.getHeight() 50 | const cropped = jimp.crop(0, 0, min, max) 51 | return { 52 | img: await cropped.scaleToFit(720, 720).getBufferAsync(Jimp.MIME_JPEG), 53 | preview: await cropped.normalize().getBufferAsync(Jimp.MIME_JPEG) 54 | } 55 | } -------------------------------------------------------------------------------- /plugins/tools/photoexif.js: -------------------------------------------------------------------------------- 1 | module.exports = { 2 | help: ['photoexif'], 3 | use: 'reply photo', 4 | tags: 'tools', 5 | run: async (m, { 6 | conn, 7 | usedPrefix, 8 | Scraper, 9 | Func 10 | }) => { 11 | try { 12 | if (m.quoted ? m.quoted.message : m.msg.viewOnce) { 13 | let type = m.quoted ? Object.keys(m.quoted.message)[0] : m.mtype 14 | let q = m.quoted ? m.quoted.message[type] : m.msg 15 | if (/image/.test(type)) { 16 | conn.sendReact(m.chat, '🕒', m.key) 17 | const cdn = await Scraper.uploader(await conn.downloadMediaMessage(q)) 18 | if (!cdn.status) throw Func.jsonFormat(cdn) 19 | const json = await Api.get('/photoexif', { 20 | image: cdn.data.url 21 | }) 22 | if (!json.status) throw Func.jsonFormat(json) 23 | conn.reply(m.chat, Func.jsonFormat(json.data), m) 24 | } else throw Func.texted('bold', `🚩 Only for photo.`) 25 | } else { 26 | let q = m.quoted ? m.quoted : m 27 | let mime = (q.msg || q).mimetype || '' 28 | if (!mime) return conn.reply(m.chat, Func.texted('bold', `🚩 Reply photo.`), m) 29 | if (!/image\/(jpe?g|png)/.test(mime)) return conn.reply(m.chat, Func.texted('bold', `🚩 Only for photo.`), m) 30 | conn.sendReact(m.chat, '🕒', m.key) 31 | const cdn = await Scraper.uploader(await conn.downloadMediaMessage(q)) 32 | if (!cdn.status) throw Func.jsonFormat(await q.download()) 33 | const json = await Api.get('/photoexif', { 34 | image: cdn.data.url 35 | }) 36 | if (!json.status) throw Func.jsonFormat(json) 37 | conn.reply(m.chat, Func.jsonFormat(json.data), m) 38 | } 39 | } catch (e) { 40 | throw Func.jsonFormat(e) 41 | } 42 | }, 43 | premium: true, 44 | } -------------------------------------------------------------------------------- /plugins/_events/protector/anti_toxic.js: -------------------------------------------------------------------------------- 1 | module.exports = { 2 | run: async (m, { 3 | conn, 4 | body, 5 | groupSet, 6 | setting, 7 | isAdmin, 8 | isBotAdmin, 9 | Func 10 | }) => { 11 | try { 12 | if (groupSet.antitoxic && !isAdmin && isBotAdmin && !m.fromMe) { 13 | let toxic = setting.toxic 14 | if (body && (new RegExp('\\b' + toxic.join('\\b|\\b') + '\\b')).test(body.toLowerCase())) { 15 | groupSet.member[m.sender].warning += 1 16 | let warning = groupSet.member[m.sender].warning 17 | if (warning > 4) return conn.reply(m.chat, Func.texted('bold', `🚩 Warning : [ 5 / 5 ], good bye ~~`), m).then(() => { 18 | conn.groupParticipantsUpdate(m.chat, [m.sender], 'remove').then(async () => { 19 | groupSet.member[m.sender].warning = 0 20 | conn.sendMessage(m.chat, { 21 | delete: { 22 | remoteJid: m.chat, 23 | fromMe: isBotAdmin ? false : true, 24 | id: m.key.id, 25 | participant: m.sender 26 | } 27 | }) 28 | }) 29 | }) 30 | return conn.reply(m.chat, `乂 *W A R N I N G* \n\nYou got warning : [ ${warning} / 5 ]\n\If you get 5 warnings you will be kicked automatically from the group.`, m).then(() => conn.sendMessage(m.chat, { 31 | delete: { 32 | remoteJid: m.chat, 33 | fromMe: isBotAdmin ? false : true, 34 | id: m.key.id, 35 | participant: m.sender 36 | } 37 | })) 38 | } 39 | } 40 | } catch (e) { 41 | return conn.reply(m.chat, Func.jsonFormat(e), m) 42 | } 43 | }, 44 | group: true, 45 | error: false 46 | } -------------------------------------------------------------------------------- /plugins/tools/topixel.js: -------------------------------------------------------------------------------- 1 | module.exports = { 2 | help: ['topixel'], 3 | use: 'reply photo', 4 | tags: 'tools', 5 | run: async (m, { 6 | conn, 7 | usedPrefix, 8 | Scraper, 9 | Func 10 | }) => { 11 | try { 12 | if (m.quoted ? m.quoted.message : m.msg.viewOnce) { 13 | let type = m.quoted ? Object.keys(m.quoted.message)[0] : m.mtype 14 | let q = m.quoted ? m.quoted.message[type] : m.msg 15 | if (/image/.test(type)) { 16 | conn.sendReact(m.chat, '🕒', m.key), old = new Date() 17 | const cdn = await Scraper.uploader(await conn.downloadMediaMessage(q)) 18 | if (!cdn.status) throw Func.jsonFormat(cdn) 19 | const json = await Api.get('/topixel', { 20 | image: cdn.data.url 21 | }) 22 | if (!json.status) throw `🚩 ${json.msg}` 23 | conn.sendFile(m.chat, json.data.url, ``, `🍟 *Process* : ${((new Date - old) * 1)} ms`, m) 24 | } else throw Func.texted('bold', `🚩 Only for photo.`) 25 | } else { 26 | let q = m.quoted ? m.quoted : m 27 | let mime = (q.msg || q).mimetype || '' 28 | if (!mime) throw Func.texted('bold', `🚩 Reply photo.`) 29 | if (!/image\/(jpe?g|png)/.test(mime)) throw Func.texted('bold', `🚩 Only for photo.`) 30 | conn.sendReact(m.chat, '🕒', m.key), old = new Date() 31 | const cdn = await Scraper.uploader(await q.download()) 32 | if (!cdn.status) throw Func.jsonFormat(cdn) 33 | const json = await Api.get('/topixel', { 34 | image: cdn.data.url 35 | }) 36 | if (!json.status) throw `🚩 ${json.msg}` 37 | conn.sendFile(m.chat, json.data.url, ``, `🍟 *Process* : ${((new Date - old) * 1)} ms`, m) 38 | } 39 | } catch (e) { 40 | throw Func.jsonFormat(e) 41 | } 42 | }, 43 | limit: true, 44 | } -------------------------------------------------------------------------------- /plugins/tools/wmremover.js: -------------------------------------------------------------------------------- 1 | module.exports = { 2 | help: ['wmremover'], 3 | use: 'reply photo', 4 | tags: 'tools', 5 | run: async (m, { 6 | conn, 7 | usedPrefix, 8 | Scraper, 9 | Func 10 | }) => { 11 | try { 12 | if (m.quoted ? m.quoted.message : m.msg.viewOnce) { 13 | let type = m.quoted ? Object.keys(m.quoted.message)[0] : m.mtype 14 | let q = m.quoted ? m.quoted.message[type] : m.msg 15 | if (/image/.test(type)) { 16 | conn.sendReact(m.chat, '🕒', m.key) 17 | const cdn = await Scraper.uploader(await conn.downloadMediaMessage(q)) 18 | if (!cdn.status) throw Func.jsonFormat(cdn) 19 | const json = await Api.get('/watermark-remover', { 20 | image: cdn.data.url 21 | }) 22 | if (!json.status) throw Func.jsonFormat(json) 23 | conn.sendFile(m.chat, json.data.url, 'image.jpg', `🍟 *Process* : ${((new Date - old) * 1)} ms`, m) 24 | } else throw Func.texted('bold', `🚩 Only for photo.`) 25 | } else { 26 | let q = m.quoted ? m.quoted : m 27 | let mime = (q.msg || q).mimetype || '' 28 | if (!mime) throw Func.texted('bold', `🚩 Reply photo.`) 29 | if (!/image\/(jpe?g|png)/.test(mime)) throw Func.texted('bold', `🚩 Only for photo.`) 30 | conn.sendReact(m.chat, '🕒', m.key) 31 | const cdn = await Scraper.uploader(await q.download()) 32 | if (!cdn.status) throw Func.jsonFormat(cdn) 33 | const json = await Api.get('/watermark-remover', { 34 | image: cdn.data.url 35 | }) 36 | if (!json.status) throw Func.jsonFormat(json) 37 | conn.sendFile(m.chat, json.data.url, 'image.jpg', `🍟 *Process* : ${((new Date - old) * 1)} ms`, m) 38 | } 39 | } catch (e) { 40 | throw Func.jsonFormat(e) 41 | } 42 | }, 43 | limit: true 44 | } -------------------------------------------------------------------------------- /plugins/owner/backupsc.js: -------------------------------------------------------------------------------- 1 | const { createWriteStream, readFileSync } = require('fs') 2 | const moment = require('moment-timezone') 3 | const path = require('path') 4 | const archiver = require('archiver') 5 | const ignore = require('ignore') 6 | 7 | module.exports = { 8 | help: ['backsupsc'], 9 | tags: 'owner', 10 | run: async (m, { 11 | conn, 12 | usedPrefix, 13 | command, 14 | text, 15 | Func 16 | }) => { 17 | const gitignorePath = path.join(__dirname, '../../.gitignore') 18 | const zipPath = path.join(__dirname, '../../tmp/backup.zip') 19 | try { 20 | const ig = ignore() 21 | const gitignoreContent = readFileSync(gitignorePath, 'utf-8') 22 | ig.add(gitignoreContent) 23 | conn.sendReact(m.chat, '🕒', m.key) 24 | const output = createWriteStream(zipPath) 25 | const archive = archiver('zip', { zlib: { level: 9 } }) 26 | output.on('close', async () => { 27 | await conn.sendFile(m.chat, zipPath, `Backup Script - ${moment(new Date()).format('DD/MM/YY')}_${Date.now()}.zip`, `The backup is complete, with a file size of : ${await Func.getSize(archive.pointer())}`, m) 28 | }) 29 | archive.on('error', (e) => { 30 | console.log(e) 31 | return conn.reply(m.chat, Func.jsonFormat(e), m) 32 | }) 33 | archive.pipe(output) 34 | const rootDir = path.join(__dirname, '../../') 35 | const allFiles = require('glob').sync('**/*', { 36 | cwd: rootDir, 37 | dot: true, 38 | }) 39 | for (const file of allFiles) { 40 | if (!ig.ignores(file)) { 41 | const filePath = path.join(rootDir, file) 42 | archive.file(filePath, { name: file }) 43 | } 44 | } 45 | archive.finalize() 46 | } catch (e) { 47 | return conn.reply(m.chat, Func.jsonFormat(e), m) 48 | } 49 | }, 50 | owner: true, 51 | error: false 52 | } -------------------------------------------------------------------------------- /plugins/tools/tozombie.js: -------------------------------------------------------------------------------- 1 | module.exports = { 2 | help: ['tozombie'], 3 | use: 'reply photo', 4 | tags: 'tools', 5 | run: async (m, { 6 | conn, 7 | usedPrefix, 8 | Scraper, 9 | Func 10 | }) => { 11 | try { 12 | if (m.quoted ? m.quoted.message : m.msg.viewOnce) { 13 | let type = m.quoted ? Object.keys(m.quoted.message)[0] : m.mtype 14 | let q = m.quoted ? m.quoted.message[type] : m.msg 15 | let old = new Date() 16 | if (/image/.test(type)) { 17 | conn.sendReact(m.chat, '🕒', m.key) 18 | const cdn = await Scraper.uploader(await conn.downloadMediaMessage(q)) 19 | if (!cdn.status) throw Func.jsonFormat(cdn) 20 | const json = await Api.get('/tozombie', { 21 | image: cdn.data.url 22 | }) 23 | if (!json.status) throw Func.jsonFormat(json) 24 | conn.sendFile(m.chat, json.data.url, 'image.jpg', `🍟 *Process* : ${((new Date - old) * 1)} ms`, m) 25 | } else throw Func.texted('bold', `🚩 Only for photo.`) 26 | } else { 27 | let q = m.quoted ? m.quoted : m 28 | let mime = (q.msg || q).mimetype || '' 29 | if (!mime) throw Func.texted('bold', `🚩 Reply photo.`) 30 | if (!/image\/(jpe?g|png)/.test(mime)) throw Func.texted('bold', `🚩 Only for photo.`) 31 | conn.sendReact(m.chat, '🕒', m.key) 32 | const cdn = await Scraper.uploader(await q.download()) 33 | if (!cdn.status) throw Func.jsonFormat(cdn) 34 | const json = await Api.get('/tozombie', { 35 | image: cdn.data.url 36 | }) 37 | if (!json.status) throw Func.jsonFormat(json) 38 | conn.sendFile(m.chat, json.data.url, 'image.jpg', `🍟 *Process* : ${((new Date - old) * 1)} ms`, m) 39 | } 40 | } catch (e) { 41 | throw Func.jsonFormat(e) 42 | } 43 | }, 44 | limit: true 45 | } -------------------------------------------------------------------------------- /plugins/downloader/play.js: -------------------------------------------------------------------------------- 1 | const yts = require('yt-search') 2 | module.exports = { 3 | help: ['play'], 4 | use: 'query', 5 | tags: 'downloader', 6 | run: async (m, { 7 | conn, 8 | usedPrefix, 9 | command, 10 | text, 11 | users, 12 | env, 13 | Func 14 | }) => { 15 | try { 16 | if (!text) throw Func.example(usedPrefix, command, 'Dewi') 17 | conn.sendReact(m.chat, '🕒', m.key) 18 | const ys = await (await yts(text)).all 19 | const yt = ys.filter(p => p.type == 'video') 20 | const json = await Api.get('/yta', { 21 | url: yt[0].url 22 | }) 23 | if (!json.status) throw Func.jsonFormat(json) 24 | let caption = `乂 *Y T - P L A Y*\n\n` 25 | caption += ` ∘ *Title* : ` + json.title + `\n` 26 | caption += ` ∘ *Size* : ` + json.data.size + `\n` 27 | caption += ` ∘ *Duration* : ` + json.duration + `\n` 28 | caption += ` ∘ *Quality* : ` + json.data.quality + '\n\n' 29 | caption += global.footer 30 | const chSize = Func.sizeLimit(json.data.size, users.premium ? env.max_upload : env.max_upload_free) 31 | const isOver = users.premium ? `💀 File size (${json.data.size}) exceeds the maximum limit.` : `⚠️ File size (${json.data.size}), you can only download files with a maximum size of ${env.max_upload_free} MB and for premium users a maximum of ${env.max_upload} MB.` 32 | if (chSize.oversize) throw isOver 33 | conn.sendMessageModify(m.chat, caption, m, { 34 | largeThumb: true, 35 | thumbnail: json.thumbnail, 36 | }).then(async () => { 37 | conn.sendFile(m.chat, json.data.url, json.data.filename, '', m, { 38 | document: false, 39 | APIC: await Func.fetchBuffer(json.thumbnail) 40 | }) 41 | }) 42 | } catch (e) { 43 | throw Func.jsonFormat(e) 44 | } 45 | }, 46 | limit: true, 47 | error: false 48 | } -------------------------------------------------------------------------------- /plugins/_events/download/autodl_tt.js: -------------------------------------------------------------------------------- 1 | module.exports = { 2 | run: async (m, { 3 | conn, 4 | users, 5 | body, 6 | isPrem, 7 | setting, 8 | Func 9 | }) => { 10 | try { 11 | if (setting.autodownload && isPrem) { 12 | const regex = /^(?:https?:\/\/)?(?:www\.|vt\.|vm\.|t\.)?(?:tiktok\.com\/)(?:\S+)?$/; 13 | const links = body.match(regex) 14 | if (links && links.length > 0) { 15 | const limitCost = 1 16 | if (users.limit < limitCost) { 17 | return conn.reply(m.chat, Func.texted('bold', '🚩 Your limit is not enough to use this feature'), m) 18 | } 19 | users.limit -= limitCost 20 | conn.sendReact(m.chat, '🕒', m.key) 21 | let old = new Date() 22 | for (const link of links) { 23 | try { 24 | let json = await Api.get('/tiktok', { 25 | url: link 26 | }) 27 | if (!json.status) return conn.reply(m.chat, Func.jsonFormat(json), m) 28 | let result = json.data.find(v => v.type == 'nowatermark') 29 | if (!result) { 30 | json.data.map(x => { 31 | conn.sendFile(m.chat, x.url, Func.filename('jpg'), `🍟 *Process* : ${((new Date - old) * 1)} ms`, m) 32 | }) 33 | } else { 34 | conn.sendFile(m.chat, result.url, Func.filename('mp4'), `🍟 *Process* : ${((new Date - old) * 1)} ms`, m) 35 | } 36 | } catch (e) { 37 | conn.reply(m.chat, Func.jsonFormat(e), m) 38 | } 39 | } 40 | } 41 | } 42 | } catch (e) { 43 | conn.reply(m.chat, Func.jsonFormat(e), m) 44 | } 45 | }, 46 | download: true, 47 | error: false 48 | } -------------------------------------------------------------------------------- /plugins/downloader/ytmp3.js: -------------------------------------------------------------------------------- 1 | module.exports = { 2 | help: ['ytmp3'], 3 | aliases: ['yta'], 4 | use: 'link', 5 | tags: 'downloader', 6 | run: async (m, { 7 | conn, 8 | usedPrefix, 9 | command, 10 | args, 11 | users, 12 | env, 13 | Func 14 | }) => { 15 | try { 16 | if (!args[0]) throw Func.example(usedPrefix, command, 'https://youtu.be/zaRFmdtLhQ8') 17 | if (!/^(?:https?:\/\/)?(?:www\.|m\.|music\.)?youtu\.?be(?:\.com)?\/?.*(?:watch|embed)?(?:.*v=|v\/|\/)([\w\-_]+)\&?/.test(args[0])) throw global.status.invalid 18 | conn.sendReact(m.chat, '🕒', m.key) 19 | const json = await Api.get('/yta', { 20 | url: args[0] 21 | }) 22 | if (!json.status) throw Func.jsonFormat(json) 23 | let txt = `乂 *Y T - M P 3*\n\n` 24 | txt += ` ◦ *Title* : ${json.title}\n` 25 | txt += ` ◦ *Size* : ${json.data.size}\n` 26 | txt += ` ◦ *Duration* : ${json.duration}\n` 27 | txt += ` ◦ *Size* : ${json.data.size}\n\n` 28 | txt += global.footer 29 | const chSize = Func.sizeLimit(json.data.size, users.premium ? env.max_upload : env.max_upload_free) 30 | const isOver = users.premium ? `💀 File size (${json.data.size}) exceeds the maximum limit.` : `⚠️ File size (${json.data.size}), you can only download files with a maximum size of ${env.max_upload_free} MB and for premium users a maximum of ${env.max_upload} MB.` 31 | if (chSize.oversize) throw isOver 32 | conn.sendMessageModify(m.chat, txt, m, { 33 | largeThumb: true, 34 | thumbnail: json.thumbnail 35 | }).then(async () => { 36 | conn.sendFile(m.chat, json.data.url, json.data.filename, '', m, { 37 | document: true, 38 | APIC: await Func.fetchBuffer(json.thumbnail) 39 | }) 40 | }) 41 | } catch (e) { 42 | throw Func.jsonFormat(e) 43 | } 44 | }, 45 | limit: true, 46 | error: false 47 | } -------------------------------------------------------------------------------- /plugins/tools/hdvideo.js: -------------------------------------------------------------------------------- 1 | 2 | module.exports = { 3 | help: ['hdvideo'], 4 | use: 'reply video', 5 | tags: 'tools', 6 | run: async (m, { 7 | conn, 8 | usedPrefix, 9 | Scraper, 10 | Func 11 | }) => { 12 | try { 13 | if (m.quoted ? m.quoted.message : m.msg.viewOnce) { 14 | let type = m.quoted ? Object.keys(m.quoted.message)[0] : m.mtype 15 | let q = m.quoted ? m.quoted.message[type] : m.msg 16 | if (/video/.test(type)) { 17 | conn.sendReact(m.chat, '🕒', m.key) 18 | let old = new Date() 19 | const cdn = await Scraper.uploader(await conn.downloadMediaMessage(q)) 20 | if (!cdn.status) throw Func.jsonFormat(cdn) 21 | const json = await Api.get('/remini-video', { 22 | video: cdn.data.url 23 | }) 24 | if (!json.status) throw Func.jsonFormat(json) 25 | conn.sendFile(m.chat, json.data.url, '', `🍟 *Process* : ${((new Date - old) * 1)} ms`, m) 26 | } throw Func.texted('bold', `🚩 Only for video.`) 27 | } else { 28 | let q = m.quoted ? m.quoted : m 29 | let mime = (q.msg || q).mimetype || '' 30 | if (!mime) throw Func.texted('bold', `🚩 Reply video.`) 31 | if (!/video\/(mp4)/.test(mime)) throw Func.texted('bold', `🚩 Only for video.`) 32 | conn.sendReact(m.chat, '🕒', m.key) 33 | let old = new Date() 34 | const cdn = await Scraper.uploader(await q.download()) 35 | if (!cdn.status) throw Func.jsonFormat(cdn) 36 | const json = await Api.get('/remini-video', { 37 | video: cdn.data.url 38 | }) 39 | if (!json.status) throw Func.jsonFormat(json) 40 | conn.sendFile(m.chat, json.data.url, '', `🍟 *Process* : ${((new Date - old) * 1)} ms`, m) 41 | } 42 | } catch (e) { 43 | throw Func.jsonFormat(e) 44 | } 45 | }, 46 | limit: true 47 | } -------------------------------------------------------------------------------- /plugins/tools/textremover.js: -------------------------------------------------------------------------------- 1 | module.exports = { 2 | help: ['textremover'], 3 | use: 'reply photo', 4 | tags: 'tools', 5 | run: async (m, { 6 | conn, 7 | usedPrefix, 8 | Scraper, 9 | Func 10 | }) => { 11 | try { 12 | if (m.quoted ? m.quoted.message : m.msg.viewOnce) { 13 | let type = m.quoted ? Object.keys(m.quoted.message)[0] : m.mtype 14 | let q = m.quoted ? m.quoted.message[type] : m.msg 15 | let old = new Date() 16 | if (/image/.test(type)) { 17 | conn.sendReact(m.chat, '🕒', m.key) 18 | const cdn = await Scraper.uploader(await conn.downloadMediaMessage(q)) 19 | if (!cdn.status) throw Func.jsonFormat(cdn) 20 | const json = await Api.get('/text-remover', { 21 | image: cdn.data.url 22 | }) 23 | if (!json.status) throw Func.jsonFormat(json) 24 | conn.sendFile(m.chat, json.data.url, 'image.jpg', `🍟 *Process* : ${((new Date - old) * 1)} ms`, m) 25 | } else throw Func.texted('bold', `🚩 Only for photo.`) 26 | } else { 27 | let q = m.quoted ? m.quoted : m 28 | let mime = (q.msg || q).mimetype || '' 29 | if (!mime) throw Func.texted('bold', `🚩 Reply photo.`) 30 | if (!/image\/(jpe?g|png)/.test(mime)) throw Func.texted('bold', `🚩 Only for photo.`) 31 | conn.sendReact(m.chat, '🕒', m.key) 32 | const cdn = await Scraper.uploader(await q.download()) 33 | if (!cdn.status) throw Func.jsonFormat(cdn) 34 | const json = await Api.get('/text-remover', { 35 | image: image.data.url 36 | }) 37 | if (!json.status) throw Func.jsonFormat(json) 38 | conn.sendFile(m.chat, json.data.url, 'image.jpg', `🍟 *Process* : ${((new Date - old) * 1)} ms`, m) 39 | } 40 | } catch (e) { 41 | throw Func.jsonFormat(e) 42 | } 43 | }, 44 | limit: true, 45 | premium: true 46 | } -------------------------------------------------------------------------------- /plugins/tools/recolor.js: -------------------------------------------------------------------------------- 1 | module.exports = { 2 | help: ['recolor'], 3 | use: 'reply photo', 4 | tags: 'tools', 5 | run: async (m, { 6 | conn, 7 | usedPrefix, 8 | Scraper, 9 | Func 10 | }) => { 11 | try { 12 | if (m.quoted ? m.quoted.message : m.msg.viewOnce) { 13 | let type = m.quoted ? Object.keys(m.quoted.message)[0] : m.mtype 14 | let q = m.quoted ? m.quoted.message[type] : m.msg 15 | let old = new Date() 16 | if (/image/.test(type)) { 17 | conn.sendReact(m.chat, '🕒', m.key) 18 | const cdn = await Scraper.uploader(await conn.downloadMediaMessage(q)) 19 | if (!cdn.status) throw Func.jsonFormat(cdn) 20 | const json = await Api.get('/recolor', { 21 | image: cdn.data.url 22 | }) 23 | if (!json.status) throw Func.jsonFormat(json) 24 | conn.sendFile(m.chat, json.data.url, 'image.jpg', `🍟 *Process* : ${((new Date - old) * 1)} ms`, m) 25 | } else throw Func.texted('bold', `🚩 Only for photo.`) 26 | } else { 27 | let q = m.quoted ? m.quoted : m 28 | let mime = (q.msg || q).mimetype || '' 29 | if (!mime) return conn.reply(m.chat, Func.texted('bold', `🚩 Reply photo.`), m) 30 | if (!/image\/(jpe?g|png)/.test(mime)) return conn.reply(m.chat, Func.texted('bold', `🚩 Only for photo.`), m) 31 | conn.sendReact(m.chat, '🕒', m.key) 32 | const cdn = await Scraper.uploader(await q.download()) 33 | if (!cdn.status) throw Func.jsonFormat(cdn) 34 | const json = await Api.get('/recolor', { 35 | image: cdn.data.url 36 | }) 37 | if (!json.status) throw Func.jsonFormat(json) 38 | conn.sendFile(m.chat, json.data.url, 'image.jpg', `🍟 *Process* : ${((new Date - old) * 1)} ms`, m) 39 | } 40 | } catch (e) { 41 | throw Func.jsonFormat(e) 42 | } 43 | }, 44 | limit: true, 45 | } -------------------------------------------------------------------------------- /plugins/tools/prompter.js: -------------------------------------------------------------------------------- 1 | module.exports = { 2 | help: ['prompter'], 3 | use: 'reply photo', 4 | tags: 'tools', 5 | run: async (m, { 6 | conn, 7 | usedPrefix, 8 | Scraper, 9 | Func 10 | }) => { 11 | try { 12 | if (m.quoted ? m.quoted.message : m.msg.viewOnce) { 13 | let type = m.quoted ? Object.keys(m.quoted.message)[0] : m.mtype 14 | let q = m.quoted ? m.quoted.message[type] : m.msg 15 | if (/image/.test(type)) { 16 | conn.sendReact(m.chat, '🕒', m.key) 17 | let old = new Date() 18 | const cdn = await Scraper.uploader(await conn.downloadMediaMessage(q)) 19 | if (!cdn.status) throw Func.jsonFormat(cdn) 20 | const json = await Api.get('/prompter', { 21 | image: cdn.data.url 22 | }) 23 | if (!json.status) throw Func.jsonFormat(json) 24 | let result = json.data[0].content.parts[0].text 25 | conn.reply(m.chat, Func.jsonFormat(result), m) 26 | } else throw Func.texted('bold', `🚩 Only for photo.`) 27 | } else { 28 | let q = m.quoted ? m.quoted : m 29 | let mime = (q.msg || q).mimetype || '' 30 | if (!mime) throw Func.texted('bold', `🚩 Reply photo.`) 31 | if (!/image\/(jpe?g|png)/.test(mime)) throw Func.texted('bold', `🚩 Only for photo.`) 32 | conn.sendReact(m.chat, '🕒', m.key) 33 | let old = new Date() 34 | const cdn = await Scraper.uploader(await q.download()) 35 | if (!cdn.status) throw Func.jsonFormat(cdn) 36 | const json = await Api.get('/prompter', { 37 | image: cdn.data.url 38 | }) 39 | if (!json.status) throw Func.jsonFormat(json) 40 | let result = json.data[0].content.parts[0].text 41 | conn.reply(m.chat, Func.jsonFormat(result), m) 42 | } 43 | } catch (e) { 44 | throw Func.jsonFormat(e) 45 | } 46 | }, 47 | premium: true, 48 | } -------------------------------------------------------------------------------- /plugins/miscs/hitstat.js: -------------------------------------------------------------------------------- 1 | const moment = require('moment-timezone') 2 | 3 | module.exports = { 4 | help: ['hitstat', 'hitdaily'], 5 | tags: 'miscs', 6 | run: async (m, { 7 | conn, 8 | usedPrefix, 9 | command, 10 | setting, 11 | Func 12 | }) => { 13 | const types = command == 'hitstat' ? global.db.statistic : Object.fromEntries(Object.entries(global.db.statistic).filter(([_, prop]) => moment(prop.lasthit).format('DDMMYY') == moment(new Date).format('DDMMYY'))) 14 | let stat = Object.keys(types) 15 | if (stat.length == 0) return conn.reply(true, Func.texted('bold', `🚩 No command used.`), m) 16 | class Hit extends Array { 17 | total(key) { 18 | return this.reduce((a, b) => a + (b[key] || 0), 0) 19 | } 20 | } 21 | let sum = new Hit(...Object.values(types)) 22 | let sorted = command == 'hitstat' ? Object.entries(types).sort((a, b) => b[1].hitstat - a[1].hitstat) : Object.entries(types).sort((a, b) => b[1].today - a[1].today) 23 | let prepare = sorted.map(v => v[0]) 24 | let show = Math.min(10, prepare.length) 25 | let teks = `乂 *H I T S T A T*\n\n` 26 | teks += Func.texted('bold', `“Total command hit statistics ${command == 'hitstat' ? 'are currently' : 'for today'} ${Func.formatNumber(command == 'hitstat' ? sum.total('hitstat') : sum.total('today'))} hits.”`) + '\n\n' 27 | teks += sorted.slice(0, show).map(([cmd, prop], i) => (i + 1) + '. ' + Func.texted('bold', 'Command') + ' : ' + Func.texted('monospace', usedPrefix + cmd) + '\n ' + Func.texted('bold', 'Hit') + ' : ' + Func.formatNumber(command == 'hitstat' ? prop.hitstat : prop.today) + 'x\n ' + Func.texted('bold', 'Last Hit') + ' : ' + moment(prop.lasthit).format('DD/MM/YY HH:mm:ss')).join`\n` 28 | teks += `\n\n${global.footer}` 29 | conn.sendMessageModify(m.chat, teks, m, { 30 | ads: false, 31 | largeThumb: true, 32 | thumbnail: Func.isUrl(setting.cover) ? setting.cover : Buffer.from(setting.cover, 'base64') 33 | }) 34 | }, 35 | error: false 36 | } -------------------------------------------------------------------------------- /plugins/tools/removebg.js: -------------------------------------------------------------------------------- 1 | module.exports = { 2 | help: ['removebg'], 3 | use: 'reply photo', 4 | tags: 'tools', 5 | run: async (m, { 6 | conn, 7 | usedPrefix, 8 | Scraper, 9 | Func 10 | }) => { 11 | try { 12 | if (m.quoted ? m.quoted.message : m.msg.viewOnce) { 13 | let type = m.quoted ? Object.keys(m.quoted.message)[0] : m.mtype 14 | let q = m.quoted ? m.quoted.message[type] : m.msg 15 | if (/image/.test(type)) { 16 | conn.sendReact(m.chat, '🕒', m.key) 17 | const cdn = await Scraper.uploader(await conn.downloadMediaMessage(q)) 18 | if (!cdn.status) throw Func.jsonFormat(cdn) 19 | const json = await Api.get('/removebg', { 20 | image: cdn.data.url 21 | }) 22 | if (!json.status) throw Func.jsonFormat(json) 23 | conn.sendFile(m.chat, json.data.url, 'Remove Background - ' + Func.randomString(10) + '.jpg', '', m, { 24 | document: true 25 | }) 26 | } else throw Func.texted('bold', `🚩 Only for photo.`) 27 | } else { 28 | let q = m.quoted ? m.quoted : m 29 | let mime = (q.msg || q).mimetype || '' 30 | if (!mime) throw Func.texted('bold', `🚩 Reply photo.`) 31 | if (!/image\/(jpe?g|png)/.test(mime)) throw Func.texted('bold', `🚩 Only for photo.`) 32 | conn.sendReact(m.chat, '🕒', m.key) 33 | const cdn = await Scraper.uploader(await q.download()) 34 | if (!cdn.status) throw Func.jsonFormat(cdn) 35 | const json = await Api.get('/removebg', { 36 | image: cdn.data.url 37 | }) 38 | if (!json.status) throw Func.jsonFormat(json) 39 | conn.sendFile(m.chat, json.data.url, 'Remove Background - ' + Func.randomString(10) + '.jpg', '', m, { 40 | document: true 41 | }) 42 | } 43 | } catch (e) { 44 | throw Func.jsonFormat(e) 45 | } 46 | }, 47 | limit: true 48 | } -------------------------------------------------------------------------------- /plugins/tools/tonude.js: -------------------------------------------------------------------------------- 1 | module.exports = { 2 | help: ['tonude'], 3 | use: 'reply photo', 4 | tags: 'tools', 5 | run: async (m, { 6 | conn, 7 | usedPrefix, 8 | Scraper, 9 | Func 10 | }) => { 11 | try { 12 | if (m.quoted ? m.quoted.message : m.msg.viewOnce) { 13 | let type = m.quoted ? Object.keys(m.quoted.message)[0] : m.mtype 14 | let q = m.quoted ? m.quoted.message[type] : m.msg 15 | if (/image/.test(type)) { 16 | conn.sendReact(m.chat, '🕒', m.key) 17 | let old = new Date() 18 | const cdn = await Scraper.uploader(await conn.downloadMediaMessage(q)) 19 | if (!cdn.status) throw Func.jsonFormat(cdn) 20 | const json = await Api.get('/ai-remove-clothes', { 21 | image: cdn.data.url 22 | }) 23 | if (!json.status) throw Func.jsonFormat(json) 24 | conn.sendFile(m.chat, json.data.url, Func.filename('jpg'), `🍟 *Process* : ${((new Date - old) * 1)} ms`, m) 25 | } throw Func.texted('bold', `🚩 Only for photo.`) 26 | } else { 27 | let q = m.quoted ? m.quoted : m 28 | let mime = (q.msg || q).mimetype || '' 29 | if (!mime) throw Func.texted('bold', `🚩 Reply photo.`) 30 | if (!/image\/(jpe?g|png)/.test(mime)) throw Func.texted('bold', `🚩 Only for photo.`) 31 | conn.sendReact(m.chat, '🕒', m.key) 32 | let old = new Date() 33 | const cdn = await Scraper.uploader(await q.download()) 34 | if (!cdn.status) throw Func.jsonFormat(cdn) 35 | const json = await Api.get('/ai-remove-clothes', { 36 | image: cdn.data.url 37 | }) 38 | if (!json.status) throw Func.jsonFormat(json) 39 | conn.sendFile(m.chat, json.data.url, Func.filename('jpg'), `🍟 *Process* : ${((new Date - old) * 1)} ms`, m) 40 | } 41 | } catch (e) { 42 | throw Func.jsonFormat(e) 43 | } 44 | }, 45 | limit: true, 46 | premium: true 47 | } -------------------------------------------------------------------------------- /plugins/tools/remini.js: -------------------------------------------------------------------------------- 1 | module.exports = { 2 | help: ['remini'], 3 | aliases: ['hd'], 4 | use: 'reply photo', 5 | tags: 'tools', 6 | run: async (m, { 7 | conn, 8 | usedPrefix, 9 | Scraper, 10 | Func 11 | }) => { 12 | try { 13 | if (m.quoted ? m.quoted.message : m.msg.viewOnce) { 14 | let type = m.quoted ? Object.keys(m.quoted.message)[0] : m.mtype 15 | let q = m.quoted ? m.quoted.message[type] : m.msg 16 | if (/image/.test(type)) { 17 | conn.sendReact(m.chat, '🕒', m.key) 18 | const cdn = await Scraper.uploader(await conn.downloadMediaMessage(q)) 19 | if (!cdn.status) throw Func.jsonFormat(cdn) 20 | const json = await Api.get('/remini', { 21 | image: cdn.data.url 22 | }) 23 | if (!json.status) throw Func.jsonFormat(json) 24 | conn.sendFile(m.chat, json.data.url, 'Remini - ' + Func.randomString(10) + '.jpg', '', m, { 25 | document: true 26 | }) 27 | } else throw Func.texted('bold', `🚩 Only for photo.`) 28 | } else { 29 | let q = m.quoted ? m.quoted : m 30 | let mime = (q.msg || q).mimetype || '' 31 | if (!mime) throw Func.texted('bold', `🚩 Reply photo.`) 32 | if (!/image\/(jpe?g|png)/.test(mime)) throw Func.texted('bold', `🚩 Only for photo.`) 33 | conn.sendReact(m.chat, '🕒', m.key) 34 | const cdn = await Scraper.uploader(await q.download()) 35 | if (!cdn.status) throw Func.jsonFormat(cdn) 36 | const json = await Api.get('/remini', { 37 | image: cdn.data.url 38 | }) 39 | if (!json.status) throw Func.jsonFormat(json) 40 | conn.sendFile(m.chat, json.data.url, 'Remini - ' + Func.randomString(10) + '.jpg', '', m, { 41 | document: true 42 | }) 43 | } 44 | } catch (e) { 45 | throw Func.jsonFormat(e) 46 | } 47 | }, 48 | limit: true, 49 | premium: true 50 | } -------------------------------------------------------------------------------- /plugins/tools/toanime.js: -------------------------------------------------------------------------------- 1 | module.exports = { 2 | help: ['toanime'], 3 | use: 'reply photo', 4 | tags: 'tools', 5 | run: async (m, { 6 | conn, 7 | usedPrefix, 8 | Scraper, 9 | Func 10 | }) => { 11 | try { 12 | if (m.quoted ? m.quoted.message : m.msg.viewOnce) { 13 | let type = m.quoted ? Object.keys(m.quoted.message)[0] : m.mtype 14 | let q = m.quoted ? m.quoted.message[type] : m.msg 15 | if (/image/.test(type)) { 16 | conn.sendReact(m.chat, '🕒', m.key) 17 | let old = new Date() 18 | const cdn = await Scraper.uploader(await conn.downloadMediaMessage(q)) 19 | if (!cdn.status) throw Func.jsonFormat(cdn) 20 | const json = await Api.get('/toanime', { 21 | image: cdn.data.url, style: 'anime' 22 | }) 23 | if (!json.status) throw Func.jsonFormat(json) 24 | conn.sendFile(m.chat, json.data.url, Func.filename('jpg'), `🍟 *Process* : ${((new Date - old) * 1)} ms`, m) 25 | } else throw Func.texted('bold', `🚩 Only for photo.`) 26 | } else { 27 | let q = m.quoted ? m.quoted : m 28 | let mime = (q.msg || q).mimetype || '' 29 | if (!mime) throw Func.texted('bold', `🚩 Reply photo.`) 30 | if (!/image\/(jpe?g|png)/.test(mime)) throw Func.texted('bold', `🚩 Only for photo.`) 31 | conn.sendReact(m.chat, '🕒', m.key) 32 | let old = new Date() 33 | const cdn = await Scraper.uploader(await q.download()) 34 | if (!cdn.status) throw Func.jsonFormat(cdn) 35 | const json = await Api.get('/toanime', { 36 | image: cdn.data.url, style: 'anime' 37 | }) 38 | if (!json.status) throw Func.jsonFormat(json) 39 | conn.sendFile(m.chat, json.data.url, Func.filename('jpg'), `🍟 *Process* : ${((new Date - old) * 1)} ms`, m) 40 | } 41 | } catch (e) { 42 | throw Func.jsonFormat(e) 43 | } 44 | }, 45 | limit: true, 46 | premium: true 47 | } --------------------------------------------------------------------------------