├── sessions └── temp ├── lib ├── ban.json ├── sudo.json ├── index.js ├── emix-utils.js ├── database.js ├── video-utils.js ├── fetchGif.js ├── sticker-utils.js ├── functions.js └── antidel.js ├── tohid ├── menu.m4a ├── autosticker │ ├── cute.webp │ ├── huh.webp │ ├── ayain.webp │ ├── chumi.webp │ └── hello.webp ├── autovoice.json ├── autoreply.json └── autosticker.json ├── heroku.yml ├── data ├── version.json ├── index.js ├── updateDB.js ├── sticker-converter.js ├── converter.js └── antidel.js ├── Dockerfile ├── koyeb.yaml ├── plugins ├── auto-typing.js ├── auto-recoding.js ├── presence.js ├── quote.js ├── fetch-quote.js ├── restart.js ├── auto-reply.js ├── anti-bad.js ├── group-lock.js ├── group-unlock.js ├── group-leave.js ├── group-mute.js ├── rw-tool.js ├── group-unmute.js ├── get-jid.js ├── group-gname.js ├── auto-sticker.js ├── group-resetlink.js ├── group-gdesc.js ├── auto-voice.js ├── tiny-url.js ├── tool-fetch.js ├── tool-repeat.js ├── couples-dp.js ├── repo-search.js ├── tool-wikipedia.js ├── news.js ├── tool-broadcast.js ├── gitstalk.js ├── tool-pdf.js ├── delete-links.js ├── group-add.js ├── emix-fun.js ├── ssweb-tool.js ├── weather.js ├── tool-request.js ├── group-promote.js ├── tweet-stalk.js ├── group-dismiss.js ├── group-poll.js ├── status-saver.js ├── search-npm.js ├── get-pair.js ├── tool-wstalk.js ├── define.js ├── define-word.js ├── group-out.js ├── group-newgc.js ├── gen-pass.js ├── tiktok-search.js ├── ttstalk-tool.js ├── fun-ship.js ├── fun-etc.js ├── group-join.js ├── anti-vv.js ├── antilink-kick.js ├── tool-vfc.js ├── tts-trt.js ├── npm-search.js ├── group-link.js ├── tag-admins.js ├── group-kick.js ├── mention-reply.js ├── group-info.js ├── tool-cinfo.js ├── fun-match.js ├── pinterest-dl.js ├── group-tagall.js ├── prank-fun.js ├── block-unblock.js ├── movie.js ├── get-cmd.js ├── ping.js ├── sticker-maker.js ├── re-caption.js ├── ttdl-extra.js ├── tool-sticker.js ├── img-wanted.js ├── img-rmbg.js ├── prayertime.js ├── main-updater.js ├── tts-new.js ├── anti-link.js ├── main-ban.js ├── tool-tempmail.js ├── check-uptime.js └── group-tag.js ├── .gitignore ├── command.js ├── SECURITY.md ├── LICENSE ├── package.json └── config.js /sessions/temp: -------------------------------------------------------------------------------- 1 | 2 | -------------------------------------------------------------------------------- /lib/ban.json: -------------------------------------------------------------------------------- 1 | [] 2 | -------------------------------------------------------------------------------- /lib/sudo.json: -------------------------------------------------------------------------------- 1 | ["917849917350@s.whatsapp.net"] 2 | -------------------------------------------------------------------------------- /tohid/menu.m4a: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Tohidkhan6332/TOHID_MD/HEAD/tohid/menu.m4a -------------------------------------------------------------------------------- /tohid/autosticker/cute.webp: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Tohidkhan6332/TOHID_MD/HEAD/tohid/autosticker/cute.webp -------------------------------------------------------------------------------- /tohid/autosticker/huh.webp: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Tohidkhan6332/TOHID_MD/HEAD/tohid/autosticker/huh.webp -------------------------------------------------------------------------------- /tohid/autosticker/ayain.webp: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Tohidkhan6332/TOHID_MD/HEAD/tohid/autosticker/ayain.webp -------------------------------------------------------------------------------- /tohid/autosticker/chumi.webp: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Tohidkhan6332/TOHID_MD/HEAD/tohid/autosticker/chumi.webp -------------------------------------------------------------------------------- /tohid/autosticker/hello.webp: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Tohidkhan6332/TOHID_MD/HEAD/tohid/autosticker/hello.webp -------------------------------------------------------------------------------- /heroku.yml: -------------------------------------------------------------------------------- 1 | build: 2 | docker: 3 | worker: DockerFile 4 | run: 5 | worker: npm install -g pm2 && npm start 6 | -------------------------------------------------------------------------------- /tohid/autovoice.json: -------------------------------------------------------------------------------- 1 | { 2 | "hello": "tohid.m4a", 3 | "bye": "tohid.m4a", 4 | "khan": "menu.m4a", 5 | "tohid": "menu.m4a" 6 | } -------------------------------------------------------------------------------- /data/version.json: -------------------------------------------------------------------------------- 1 | { 2 | "version": "3.0.1", 3 | "changelog": "📌 Fixed YouTube Downloader -: .play and .song \n 📌 Added Update command, plugin count, and command count.\n🛠 Improved system info.\n🚀 Enhanced update detection." 4 | } 5 | -------------------------------------------------------------------------------- /Dockerfile: -------------------------------------------------------------------------------- 1 | FROM node:lts-buster 2 | RUN git clone https://github.com/Tohidkhan6332/TOHID_MD/root/mrtohid 3 | WORKDIR /root/mrtohid 4 | RUN npm install && npm install -g pm2 || yarn install --network-concurrency 1 5 | COPY . . 6 | EXPOSE 9090 7 | CMD ["npm", "start"] 8 | -------------------------------------------------------------------------------- /koyeb.yaml: -------------------------------------------------------------------------------- 1 | name: tohid_md 2 | services: 3 | - name: tohid_md-service 4 | type: web 5 | ports: 6 | - 5000 7 | routes: 8 | - path: "/" 9 | build: 10 | type: docker 11 | dockerfile: ./Dockerfile 12 | regions: 13 | - fra 14 | - sin 15 | 16 | -------------------------------------------------------------------------------- /plugins/auto-typing.js: -------------------------------------------------------------------------------- 1 | const fs = require('fs'); 2 | const path = require('path'); 3 | const config = require('../config') 4 | const {cmd , commands} = require('../command') 5 | 6 | 7 | // Composing (Auto Typing) 8 | cmd({ 9 | on: "body" 10 | }, 11 | async (conn, mek, m, { from, body, isOwner }) => { 12 | if (config.AUTO_TYPING === 'true') { 13 | await conn.sendPresenceUpdate('composing', from); // send typing 14 | } 15 | }); 16 | -------------------------------------------------------------------------------- /plugins/auto-recoding.js: -------------------------------------------------------------------------------- 1 | const fs = require('fs'); 2 | const path = require('path'); 3 | const config = require('../config') 4 | const {cmd , commands} = require('../command') 5 | 6 | 7 | //auto recording 8 | cmd({ 9 | on: "body" 10 | }, 11 | async (conn, mek, m, { from, body, isOwner }) => { 12 | if (config.AUTO_RECORDING === 'true') { 13 | await conn.sendPresenceUpdate('recording', from); 14 | } 15 | } 16 | ); 17 | -------------------------------------------------------------------------------- /.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 | -------------------------------------------------------------------------------- /command.js: -------------------------------------------------------------------------------- 1 | var commands = []; 2 | 3 | function cmd(info, func) { 4 | var data = info; 5 | data.function = func; 6 | if (!data.dontAddCommandList) data.dontAddCommandList = false; 7 | if (!info.desc) info.desc = ''; 8 | if (!data.fromMe) data.fromMe = false; 9 | if (!info.category) data.category = 'misc'; 10 | if(!info.filename) data.filename = "Not Provided"; 11 | commands.push(data); 12 | return data; 13 | } 14 | module.exports = { 15 | cmd, 16 | AddCommand:cmd, 17 | Function:cmd, 18 | Module:cmd, 19 | commands, 20 | }; 21 | -------------------------------------------------------------------------------- /tohid/autoreply.json: -------------------------------------------------------------------------------- 1 | { 2 | "Hi": "*💖HI*... *How are You..!*", 3 | "Good Morning": "*Good Morning 🌅*", 4 | "Good Night": "*Good Night..🌉*", 5 | "Bye": "*Bye bye....*", 6 | "Aslam o Alykum": "> *walykum salam ❤‍🔥🤌🏻*", 7 | "owner": "*Mr Tohid 🇮🇳*", 8 | "Tohid": "Kis Na Yad Kia Mujha?..🐵", 9 | "link": "*Raha Nhai Jata 🌚🙌😂*", 10 | "Haram": "*Haram Haram Haram🙈🤣*", 11 | "dafa": "*dfm.😣*", 12 | "dhur": "*dhur bagrt.🔪*", 13 | "hmm": "> *Hamm.🌚*", 14 | "lanat": "*Lakhhhhhhhhhh Di Lanat 🙌😂*", 15 | "uff": "*💋 Hyee*", 16 | "love": "*Lub you too 💗😁*" 17 | } 18 | -------------------------------------------------------------------------------- /plugins/presence.js: -------------------------------------------------------------------------------- 1 | const config = require('../config'); 2 | const { cmd } = require('../command'); 3 | 4 | // Presence Control (Online/Offline) 5 | 6 | cmd({ 7 | on: "body" 8 | }, async (conn, mek, m, { from }) => { 9 | try { 10 | // If ALWAYS_ONLINE=true → Bot stays online 24/7 11 | // If ALWAYS_ONLINE=false → Bot shows default WhatsApp behavior (no forced online/offline) 12 | if (config.ALWAYS_ONLINE === "true") { 13 | await conn.sendPresenceUpdate("available", from); 14 | } 15 | // If false, do nothing (let WhatsApp handle presence naturally) 16 | } catch (e) { 17 | console.error("[Presence Error]", e); 18 | } 19 | }); 20 | -------------------------------------------------------------------------------- /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/quote.js: -------------------------------------------------------------------------------- 1 | const axios = require("axios"); 2 | const { cmd } = require("../command"); 3 | 4 | cmd({ 5 | pattern: "quote", 6 | desc: "Get a random inspiring quote.", 7 | category: "fun", 8 | react: "💬", 9 | filename: __filename 10 | }, async (conn, m, store, { from, reply }) => { 11 | try { 12 | const response = await axios.get("https://api.quotable.io/random"); 13 | const { content, author } = response.data; 14 | 15 | const message = `💬 *"${content}"*\n- ${author}\n\n> *QUOTES BY TOHID_MD*`; 16 | reply(message); 17 | } catch (error) { 18 | console.error("Error fetching quote:", error); 19 | reply("⚠️ API issue or coding error, please check the logs!"); 20 | } 21 | }); -------------------------------------------------------------------------------- /plugins/fetch-quote.js: -------------------------------------------------------------------------------- 1 | const axios = require("axios"); 2 | const { cmd } = require("../command"); 3 | 4 | cmd({ 5 | pattern: "quote", 6 | desc: "Get a random inspiring quote.", 7 | category: "fun", 8 | react: "💬", 9 | filename: __filename 10 | }, async (conn, m, store, { from, reply }) => { 11 | try { 12 | const response = await axios.get("https://api.quotable.io/random"); 13 | const { content, author } = response.data; 14 | 15 | const message = `💬 *"${content}"*\n- ${author}\n\n> *QUOTES BY TOHID_MD*`; 16 | reply(message); 17 | } catch (error) { 18 | console.error("Error fetching quote:", error); 19 | reply("⚠️ API issue or coding error, please check the logs!"); 20 | } 21 | }); 22 | -------------------------------------------------------------------------------- /tohid/autosticker.json: -------------------------------------------------------------------------------- 1 | { 2 | "chumi": "chumi.webp", 3 | "chumi do": "chumi.webp", 4 | "aly": "cute.webp", 5 | "love you": "huh.webp", 6 | "ruk": "huh.webp", 7 | "dj": "huh.webp", 8 | "bisma": "huh.webp", 9 | "bahi": "huh.webp", 10 | "bhabhi": "huh.webp", 11 | "handsome": "huh.webp", 12 | "bhai": "huh.webp", 13 | "mela bacha": "cute.webp", 14 | "bubu": "cute.webp", 15 | "babu": "cute.webp", 16 | "aww": "cute.webp", 17 | "baby": "cute.webp", 18 | "janam": "cute.webp", 19 | "jan": "cute.webp", 20 | "tohid": "ayain.webp", 21 | "khan": "ayain.webp", 22 | "hi": "hello.webp", 23 | "hello": "hello.webp", 24 | "oye": "hello.webp", 25 | "bye": "hello.webp", 26 | "ayain": "ayain.webp" 27 | } -------------------------------------------------------------------------------- /plugins/restart.js: -------------------------------------------------------------------------------- 1 | const { cmd } = require("../command"); 2 | const { sleep } = require("../lib/functions"); 3 | 4 | cmd({ 5 | pattern: "restart", 6 | desc: "Restart TOHID_MD", 7 | category: "owner", 8 | filename: __filename 9 | }, 10 | async (conn, mek, m, { reply, isCreator }) => { 11 | try { 12 | if (!isCreator) { 13 | return reply("Only the bot owner can use this command."); 14 | } 15 | 16 | const { exec } = require("child_process"); 17 | reply("Restarting..."); 18 | await sleep(1500); 19 | exec("pm2 restart all"); 20 | } catch (e) { 21 | console.error(e); 22 | reply(`${e}`); 23 | } 24 | }); 25 | -------------------------------------------------------------------------------- /plugins/auto-reply.js: -------------------------------------------------------------------------------- 1 | const fs = require('fs'); 2 | const path = require('path'); 3 | const config = require('../config') 4 | const {cmd , commands} = require('../command') 5 | 6 | //auto reply 7 | cmd({ 8 | on: "body" 9 | }, 10 | async (conn, mek, m, { from, body, isOwner }) => { 11 | const filePath = path.join(__dirname, '../tohid/autoreply.json'); 12 | const data = JSON.parse(fs.readFileSync(filePath, 'utf8')); 13 | for (const text in data) { 14 | if (body.toLowerCase() === text.toLowerCase()) { 15 | 16 | if (config.AUTO_REPLY === 'true') { 17 | //if (isOwner) return; 18 | await m.reply(data[text]) 19 | 20 | } 21 | } 22 | } 23 | }); 24 | -------------------------------------------------------------------------------- /lib/index.js: -------------------------------------------------------------------------------- 1 | const { DeletedText, 2 | DeletedMedia, 3 | AntiDelete, } = require('./antidel'); 4 | //const { AntiViewOnce } = require('./antivv'); 5 | const { 6 | DATABASE 7 | } = require('./database'); 8 | const { getBuffer, getGroupAdmins, getRandom, h2k, isUrl, Json, runtime, sleep, fetchJson } = require('./functions'); 9 | const {sms, downloadMediaMessage} = require('./msg'); 10 | //const {shannzCdn} = require('./shannzCdn'); 11 | 12 | module.exports = { 13 | DeletedText, 14 | DeletedMedia, 15 | AntiDelete, 16 | //AntiViewOnce, 17 | getBuffer, 18 | getGroupAdmins, 19 | getRandom, 20 | h2k, 21 | isUrl, 22 | Json, 23 | runtime, 24 | sleep, 25 | fetchJson, 26 | DATABASE, 27 | sms, 28 | downloadMediaMessage, 29 | // shannzCdn, 30 | }; -------------------------------------------------------------------------------- /data/index.js: -------------------------------------------------------------------------------- 1 | const { AntiDelDB, 2 | initializeAntiDeleteSettings, 3 | setAnti, 4 | getAnti, 5 | getAllAntiDeleteSettings, } = require('./antidel'); 6 | const { 7 | saveContact, 8 | loadMessage, 9 | getName, 10 | getChatSummary, 11 | saveGroupMetadata, 12 | getGroupMetadata, 13 | saveMessageCount, 14 | getInactiveGroupMembers, 15 | getGroupMembersMessageCount, 16 | saveMessage, 17 | } = require('./store'); 18 | 19 | 20 | module.exports = { 21 | AntiDelDB, 22 | initializeAntiDeleteSettings, 23 | setAnti, 24 | getAnti, 25 | getAllAntiDeleteSettings, 26 | saveContact, 27 | loadMessage, 28 | getName, 29 | getChatSummary, 30 | saveGroupMetadata, 31 | getGroupMetadata, 32 | saveMessageCount, 33 | getInactiveGroupMembers, 34 | getGroupMembersMessageCount, 35 | saveMessage, 36 | }; -------------------------------------------------------------------------------- /plugins/anti-bad.js: -------------------------------------------------------------------------------- 1 | const { cmd } = require('../command'); 2 | const config = require("../config"); 3 | 4 | // Anti-Bad Words System 5 | cmd({ 6 | 'on': "body" 7 | }, async (conn, m, store, { 8 | from, 9 | body, 10 | isGroup, 11 | isAdmins, 12 | isBotAdmins, 13 | reply, 14 | sender 15 | }) => { 16 | try { 17 | const badWords = ["wtf", "mia", "xxx", "fuck", 'sex', "huththa", "pakaya", 'ponnaya', "hutto"]; 18 | 19 | if (!isGroup || isAdmins || !isBotAdmins) { 20 | return; 21 | } 22 | 23 | const messageText = body.toLowerCase(); 24 | const containsBadWord = badWords.some(word => messageText.includes(word)); 25 | 26 | if (containsBadWord && config.ANTI_BAD_WORD === "true") { 27 | await conn.sendMessage(from, { 'delete': m.key }, { 'quoted': m }); 28 | await conn.sendMessage(from, { 'text': "🚫 ⚠️ BAD WORDS NOT ALLOWED ⚠️ 🚫" }, { 'quoted': m }); 29 | } 30 | } catch (error) { 31 | console.error(error); 32 | reply("An error occurred while processing the message."); 33 | } 34 | }); 35 | -------------------------------------------------------------------------------- /lib/emix-utils.js: -------------------------------------------------------------------------------- 1 | const axios = require("axios"); 2 | 3 | /** 4 | * Fetch Emoji Mix image from API. 5 | * @param {string} emoji1 - First emoji. 6 | * @param {string} emoji2 - Second emoji. 7 | * @returns {Promise} - The image URL. 8 | */ 9 | async function fetchEmix(emoji1, emoji2) { 10 | try { 11 | if (!emoji1 || !emoji2) { 12 | throw new Error("Invalid emoji input. Please provide two emojis."); 13 | } 14 | 15 | const apiUrl = `https://levanter.onrender.com/emix?q=${encodeURIComponent(emoji1)},${encodeURIComponent(emoji2)}`; 16 | const response = await axios.get(apiUrl); 17 | 18 | if (response.data && response.data.result) { 19 | return response.data.result; // Return the image URL 20 | } else { 21 | throw new Error("No valid image found."); 22 | } 23 | } catch (error) { 24 | console.error("Error fetching emoji mix:", error.message); 25 | throw new Error("Failed to fetch emoji mix."); 26 | } 27 | } 28 | 29 | module.exports = { fetchEmix }; 30 | -------------------------------------------------------------------------------- /plugins/group-lock.js: -------------------------------------------------------------------------------- 1 | const config = require('../config') 2 | const { cmd, commands } = require('../command') 3 | const { getBuffer, getGroupAdmins, getRandom, h2k, isUrl, Json, runtime, sleep, fetchJson} = require('../lib/functions') 4 | 5 | cmd({ 6 | pattern: "lockgc", 7 | alias: ["lock"], 8 | react: "🔒", 9 | desc: "Lock the group (Prevents new members from joining).", 10 | category: "group", 11 | filename: __filename 12 | }, 13 | async (conn, mek, m, { from, isGroup, isAdmins, isBotAdmins, reply }) => { 14 | try { 15 | if (!isGroup) return reply("❌ This command can only be used in groups."); 16 | if (!isAdmins) return reply("❌ Only group admins can use this command."); 17 | if (!isBotAdmins) return reply("❌ I need to be an admin to lock the group."); 18 | 19 | await conn.groupSettingUpdate(from, "locked"); 20 | reply("✅ Group has been locked. New members cannot join."); 21 | } catch (e) { 22 | console.error("Error locking group:", e); 23 | reply("❌ Failed to lock the group. Please try again."); 24 | } 25 | }); 26 | 27 | -------------------------------------------------------------------------------- /plugins/group-unlock.js: -------------------------------------------------------------------------------- 1 | const config = require('../config') 2 | const { cmd, commands } = require('../command') 3 | const { getBuffer, getGroupAdmins, getRandom, h2k, isUrl, Json, runtime, sleep, fetchJson} = require('../lib/functions') 4 | 5 | cmd({ 6 | pattern: "unlockgc", 7 | alias: ["unlock"], 8 | react: "🔓", 9 | desc: "Unlock the group (Allows new members to join).", 10 | category: "group", 11 | filename: __filename 12 | }, 13 | async (conn, mek, m, { from, isGroup, isAdmins, isBotAdmins, reply }) => { 14 | try { 15 | if (!isGroup) return reply("❌ This command can only be used in groups."); 16 | if (!isAdmins) return reply("❌ Only group admins can use this command."); 17 | if (!isBotAdmins) return reply("❌ I need to be an admin to unlock the group."); 18 | 19 | await conn.groupSettingUpdate(from, "unlocked"); 20 | reply("✅ Group has been unlocked. New members can now join."); 21 | } catch (e) { 22 | console.error("Error unlocking group:", e); 23 | reply("❌ Failed to unlock the group. Please try again."); 24 | } 25 | }); 26 | -------------------------------------------------------------------------------- /plugins/group-leave.js: -------------------------------------------------------------------------------- 1 | const { sleep } = require('../lib/functions'); 2 | const config = require('../config') 3 | const { cmd, commands } = require('../command') 4 | 5 | 6 | // JawadTechX 7 | 8 | cmd({ 9 | pattern: "leave", 10 | alias: ["left", "leftgc", "leavegc"], 11 | desc: "Leave the group", 12 | react: "🎉", 13 | category: "owner", 14 | filename: __filename 15 | }, 16 | async (conn, mek, m, { 17 | from, quoted, body, isCmd, command, args, q, isGroup, senderNumber, reply 18 | }) => { 19 | try { 20 | 21 | if (!isGroup) { 22 | return reply("This command can only be used in groups."); 23 | } 24 | 25 | 26 | const botOwner = conn.user.id.split(":")[0]; 27 | if (senderNumber !== botOwner) { 28 | return reply("Only the bot owner can use this command."); 29 | } 30 | 31 | reply("Leaving group..."); 32 | await sleep(1500); 33 | await conn.groupLeave(from); 34 | reply("Goodbye! 👋"); 35 | } catch (e) { 36 | console.error(e); 37 | reply(`❌ Error: ${e}`); 38 | } 39 | }); 40 | 41 | -------------------------------------------------------------------------------- /plugins/group-mute.js: -------------------------------------------------------------------------------- 1 | const config = require('../config') 2 | const { cmd, commands } = require('../command') 3 | const { getBuffer, getGroupAdmins, getRandom, h2k, isUrl, Json, runtime, sleep, fetchJson} = require('../lib/functions') 4 | 5 | cmd({ 6 | pattern: "mute", 7 | alias: ["groupmute"], 8 | react: "🔇", 9 | desc: "Mute the group (Only admins can send messages).", 10 | category: "group", 11 | filename: __filename 12 | }, 13 | async (conn, mek, m, { from, isGroup, senderNumber, isAdmins, isBotAdmins, reply }) => { 14 | try { 15 | if (!isGroup) return reply("❌ This command can only be used in groups."); 16 | if (!isAdmins) return reply("❌ Only group admins can use this command."); 17 | if (!isBotAdmins) return reply("❌ I need to be an admin to mute the group."); 18 | 19 | await conn.groupSettingUpdate(from, "announcement"); 20 | reply("✅ Group has been muted. Only admins can send messages."); 21 | } catch (e) { 22 | console.error("Error muting group:", e); 23 | reply("❌ Failed to mute the group. Please try again."); 24 | } 25 | }); 26 | -------------------------------------------------------------------------------- /LICENSE: -------------------------------------------------------------------------------- 1 | MIT License 2 | 3 | Copyright (c) 2025 TOHID MD 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/rw-tool.js: -------------------------------------------------------------------------------- 1 | const { cmd } = require("../command"); 2 | const axios = require("axios"); 3 | 4 | cmd({ 5 | pattern: "rw", 6 | alias: ["randomwall", "wallpaper"], 7 | react: "🌌", 8 | desc: "Download random wallpapers based on keywords.", 9 | category: "wallpapers", 10 | use: ".rw ", 11 | filename: __filename 12 | }, async (conn, m, store, { from, args, reply }) => { 13 | try { 14 | const query = args.join(" ") || "random"; 15 | const apiUrl = `https://pikabotzapi.vercel.app/random/randomwall/?apikey=anya-md&query=${encodeURIComponent(query)}`; 16 | 17 | const { data } = await axios.get(apiUrl); 18 | 19 | if (data.status && data.imgUrl) { 20 | const caption = `🌌 *Random Wallpaper: ${query}*\n\n> *©𝙿𝙾𝚆𝙴𝚁𝙴𝙳 𝙱𝚈 𝚃𝙾𝙷𝙸𝙳_𝙼𝙳*`; 21 | await conn.sendMessage(from, { image: { url: data.imgUrl }, caption }, { quoted: m }); 22 | } else { 23 | reply(`❌ No wallpaper found for *"${query}"*.`); 24 | } 25 | } catch (error) { 26 | console.error("Wallpaper Error:", error); 27 | reply("❌ An error occurred while fetching the wallpaper. Please try again."); 28 | } 29 | }); -------------------------------------------------------------------------------- /plugins/group-unmute.js: -------------------------------------------------------------------------------- 1 | const config = require('../config') 2 | const { cmd, commands } = require('../command') 3 | const { getBuffer, getGroupAdmins, getRandom, h2k, isUrl, Json, runtime, sleep, fetchJson} = require('../lib/functions') 4 | 5 | cmd({ 6 | pattern: "unmute", 7 | alias: ["groupunmute"], 8 | react: "🔊", 9 | desc: "Unmute the group (Everyone can send messages).", 10 | category: "group", 11 | filename: __filename 12 | }, 13 | async (conn, mek, m, { from, isGroup, senderNumber, isAdmins, isBotAdmins, reply }) => { 14 | try { 15 | if (!isGroup) return reply("❌ This command can only be used in groups."); 16 | if (!isAdmins) return reply("❌ Only group admins can use this command."); 17 | if (!isBotAdmins) return reply("❌ I need to be an admin to unmute the group."); 18 | 19 | await conn.groupSettingUpdate(from, "not_announcement"); 20 | reply("✅ Group has been unmuted. Everyone can send messages."); 21 | } catch (e) { 22 | console.error("Error unmuting group:", e); 23 | reply("❌ Failed to unmute the group. Please try again."); 24 | } 25 | }); 26 | -------------------------------------------------------------------------------- /plugins/get-jid.js: -------------------------------------------------------------------------------- 1 | const { cmd } = require('../command'); 2 | 3 | cmd({ 4 | pattern: "jid", 5 | alias: ["id", "chatid", "gjid"], 6 | desc: "Get full JID of current chat/user (Creator Only)", 7 | react: "🆔", 8 | category: "utility", 9 | filename: __filename, 10 | }, async (conn, mek, m, { 11 | from, isGroup, isCreator, reply, sender 12 | }) => { 13 | try { 14 | if (!isCreator) { 15 | return reply("❌ *Command Restricted* - Only my creator can use this."); 16 | } 17 | 18 | if (isGroup) { 19 | // Ensure group JID ends with @g.us 20 | const groupJID = from.includes('@g.us') ? from : `${from}@g.us`; 21 | return reply(`👥 *Group JID:*\n\`\`\`${groupJID}\`\`\``); 22 | } else { 23 | // Ensure user JID ends with @s.whatsapp.net 24 | const userJID = sender.includes('@s.whatsapp.net') ? sender : `${sender}@s.whatsapp.net`; 25 | return reply(`👤 *User JID:*\n\`\`\`${userJID}\`\`\``); 26 | } 27 | 28 | } catch (e) { 29 | console.error("JID Error:", e); 30 | reply(`⚠️ Error fetching JID:\n${e.message}`); 31 | } 32 | }); 33 | -------------------------------------------------------------------------------- /plugins/group-gname.js: -------------------------------------------------------------------------------- 1 | const config = require('../config') 2 | const { cmd, commands } = require('../command') 3 | const { getBuffer, getGroupAdmins, getRandom, h2k, isUrl, Json, runtime, sleep, fetchJson} = require('../lib/functions') 4 | 5 | cmd({ 6 | pattern: "updategname", 7 | alias: ["upgname", "gname"], 8 | react: "📝", 9 | desc: "Change the group name.", 10 | category: "group", 11 | filename: __filename 12 | }, 13 | async (conn, mek, m, { from, isGroup, isAdmins, isBotAdmins, args, q, reply }) => { 14 | try { 15 | if (!isGroup) return reply("❌ This command can only be used in groups."); 16 | if (!isAdmins) return reply("❌ Only group admins can use this command."); 17 | if (!isBotAdmins) return reply("❌ I need to be an admin to update the group name."); 18 | if (!q) return reply("❌ Please provide a new group name."); 19 | 20 | await conn.groupUpdateSubject(from, q); 21 | reply(`✅ Group name has been updated to: *${q}*`); 22 | } catch (e) { 23 | console.error("Error updating group name:", e); 24 | reply("❌ Failed to update the group name. Please try again."); 25 | } 26 | }); 27 | -------------------------------------------------------------------------------- /plugins/auto-sticker.js: -------------------------------------------------------------------------------- 1 | const fs = require('fs'); 2 | const path = require('path'); 3 | const config = require('../config'); 4 | const { cmd } = require('../command'); 5 | 6 | cmd({ 7 | on: "body" 8 | }, 9 | async (conn, mek, m, { from, body }) => { 10 | const filePath = path.join(__dirname, '../tohid/autosticker.json'); 11 | const data = JSON.parse(fs.readFileSync(filePath, 'utf8')); 12 | 13 | for (const text in data) { 14 | if (body.toLowerCase() === text.toLowerCase()) { 15 | if (config.AUTO_STICKER === 'true') { 16 | const stickerPath = path.join(__dirname, '../tohid/autosticker', data[text]); 17 | 18 | if (fs.existsSync(stickerPath)) { 19 | const stickerBuffer = fs.readFileSync(stickerPath); 20 | 21 | await conn.sendMessage(from, { 22 | sticker: stickerBuffer, 23 | packname: 'TOHID_MD', 24 | author: 'AUTO-STICKER' 25 | }, { quoted: mek }); 26 | } else { 27 | console.warn(`Sticker not found: ${stickerPath}`); 28 | } 29 | } 30 | } 31 | } 32 | }); -------------------------------------------------------------------------------- /plugins/group-resetlink.js: -------------------------------------------------------------------------------- 1 | const config = require('../config') 2 | const { cmd } = require('../command') 3 | const { getBuffer, getGroupAdmins, getRandom, h2k, isUrl, Json, runtime, sleep, fetchJson } = require('../lib/functions') 4 | 5 | cmd({ 6 | pattern: "revoke", 7 | react: "🖇️", 8 | alias: ["revokegrouplink", "resetglink", "revokelink", "f_revoke"], 9 | desc: "To Reset the group link", 10 | category: "group", 11 | use: '.revoke', 12 | filename: __filename 13 | }, 14 | async (conn, mek, m, { 15 | from, isCmd, isGroup, sender, isBotAdmins, 16 | isAdmins, reply 17 | }) => { 18 | try { 19 | if (!isGroup) return reply(`❌ This command only works in groups.`); 20 | if (!isAdmins) return reply(`⛔ You must be a *Group Admin* to use this command.`); 21 | if (!isBotAdmins) return reply(`❌ I need to be *admin* to reset the group link.`); 22 | 23 | await conn.groupRevokeInvite(from); 24 | await conn.sendMessage(from, { 25 | text: `✅ *Group Link has been reset successfully!*` 26 | }, { quoted: mek }); 27 | 28 | } catch (err) { 29 | console.error(err); 30 | reply(`❌ Error resetting group link.`); 31 | } 32 | }); 33 | -------------------------------------------------------------------------------- /plugins/group-gdesc.js: -------------------------------------------------------------------------------- 1 | const config = require('../config') 2 | const { cmd, commands } = require('../command') 3 | const { getBuffer, getGroupAdmins, getRandom, h2k, isUrl, Json, runtime, sleep, fetchJson} = require('../lib/functions') 4 | 5 | cmd({ 6 | pattern: "updategdesc", 7 | alias: ["upgdesc", "gdesc"], 8 | react: "📜", 9 | desc: "Change the group description.", 10 | category: "group", 11 | filename: __filename 12 | }, 13 | async (conn, mek, m, { from, isGroup, isAdmins, isBotAdmins, args, q, reply }) => { 14 | try { 15 | if (!isGroup) return reply("❌ This command can only be used in groups."); 16 | if (!isAdmins) return reply("❌ Only group admins can use this command."); 17 | if (!isBotAdmins) return reply("❌ I need to be an admin to update the group description."); 18 | if (!q) return reply("❌ Please provide a new group description."); 19 | 20 | await conn.groupUpdateDescription(from, q); 21 | reply("✅ Group description has been updated."); 22 | } catch (e) { 23 | console.error("Error updating group description:", e); 24 | reply("❌ Failed to update the group description. Please try again."); 25 | } 26 | }); 27 | 28 | -------------------------------------------------------------------------------- /plugins/auto-voice.js: -------------------------------------------------------------------------------- 1 | const fs = require('fs'); 2 | const path = require('path'); 3 | const config = require('../config'); 4 | const { cmd } = require('../command'); 5 | 6 | cmd({ 7 | on: "body" 8 | }, 9 | async (conn, mek, m, { from, body }) => { 10 | const filePath = path.join(__dirname, '../tohid/autovoice.json'); 11 | const data = JSON.parse(fs.readFileSync(filePath, 'utf8')); 12 | 13 | for (const text in data) { 14 | if (body.toLowerCase() === text.toLowerCase()) { 15 | if (config.AUTO_VOICE === 'true') { 16 | const voicePath = path.join(__dirname, '../tohid/autovoice', data[text]); 17 | 18 | if (fs.existsSync(voicePath)) { 19 | const voiceBuffer = fs.readFileSync(voicePath); 20 | 21 | await conn.sendPresenceUpdate('recording', from); 22 | await conn.sendMessage(from, { 23 | audio: voiceBuffer, 24 | mimetype: 'audio/mp4', 25 | ptt: true 26 | }, { quoted: mek }); 27 | } else { 28 | console.warn(`Voice file not found: ${voicePath}`); 29 | } 30 | } 31 | } 32 | } 33 | }); -------------------------------------------------------------------------------- /plugins/tiny-url.js: -------------------------------------------------------------------------------- 1 | const { cmd } = require("../command"); 2 | const fetch = require("node-fetch"); 3 | const axios = require("axios"); 4 | 5 | cmd({ 6 | pattern: "tiny", 7 | alias: ['short', 'shorturl'], 8 | react: "🫧", 9 | desc: "Makes URL tiny.", 10 | category: "convert", 11 | use: "", 12 | filename: __filename, 13 | }, 14 | async (conn, mek, m, { from, quoted, isOwner, isAdmins, reply, args }) => { 15 | console.log("Command tiny triggered"); // Ajoutez ceci pour vérifier si la commande est déclenchée 16 | 17 | if (!args[0]) { 18 | console.log("No URL provided"); // Ajoutez ceci pour vérifier si l'URL est fournie 19 | return reply("*🏷️ ᴘʟᴇᴀsᴇ ᴘʀᴏᴠɪᴅᴇ ᴍᴇ ᴀ ʟɪɴᴋ.*"); 20 | } 21 | 22 | try { 23 | const link = args[0]; 24 | console.log("URL to shorten:", link); // Ajoutez ceci pour vérifier l'URL fournie 25 | const response = await axios.get(`https://tinyurl.com/api-create.php?url=${link}`); 26 | const shortenedUrl = response.data; 27 | 28 | console.log("Shortened URL:", shortenedUrl); // Ajoutez ceci pour vérifier l'URL raccourcie 29 | return reply(`*🛡️YOUR SHORTENED URL*\n\n${shortenedUrl}`); 30 | } catch (e) { 31 | console.error("Error shortening URL:", e); 32 | return reply("An error occurred while shortening the URL. Please try again."); 33 | } 34 | }); 35 | -------------------------------------------------------------------------------- /plugins/tool-fetch.js: -------------------------------------------------------------------------------- 1 | const { cmd, commands } = require('../command'); 2 | const { fetchJson } = require('../lib/functions'); 3 | 4 | cmd({ 5 | pattern: "fetch", 6 | alias: ["get", "api"], 7 | desc: "Fetch data from a provided URL or API", 8 | category: "main", 9 | react: "🌐", 10 | filename: __filename 11 | }, 12 | async (conn, mek, m, { from, quoted, body, args, reply }) => { 13 | try { 14 | const q = args.join(' ').trim(); // Extract the URL or API query 15 | if (!q) return reply('❌ Please provide a valid URL or query.'); 16 | 17 | if (!/^https?:\/\//.test(q)) return reply('❌ URL must start with http:// or https://.'); 18 | 19 | const data = await fetchJson(q); // Use your fetchJson utility function to get data 20 | const content = JSON.stringify(data, null, 2); 21 | 22 | await conn.sendMessage(from, { 23 | text: `🔍 *Fetched Data*:\n\`\`\`${content.slice(0, 2048)}\`\`\``, 24 | contextInfo: { 25 | mentionedJid: [m.sender], 26 | forwardingScore: 999, 27 | isForwarded: true, 28 | forwardingSourceMessage: 'Your Data Request', 29 | } 30 | }, { quoted: mek }); 31 | } catch (e) { 32 | console.error("Error in fetch command:", e); 33 | reply(`❌ An error occurred:\n${e.message}`); 34 | } 35 | }); 36 | -------------------------------------------------------------------------------- /plugins/tool-repeat.js: -------------------------------------------------------------------------------- 1 | const config = require('../config') 2 | const { cmd, commands } = require('../command'); 3 | 4 | cmd({ 5 | pattern: "msg", 6 | desc: "Send a message multiple times (Owner Only)", 7 | category: "utility", 8 | react: "🔁", 9 | filename: __filename 10 | }, 11 | async (conn, mek, m, { from, reply, isCreator, q }) => { 12 | // Owner-only restriction 13 | if (!isCreator) return reply('🚫 *Owner only command!*'); 14 | 15 | try { 16 | // Check format: .msg text,count 17 | if (!q.includes(',')) { 18 | return reply("❌ *Format:* .msg text,count\n*Example:* .msg Hello,5"); 19 | } 20 | 21 | const [message, countStr] = q.split(','); 22 | const count = parseInt(countStr.trim()); 23 | 24 | // Hard limit: 1-100 messages 25 | if (isNaN(count) || count < 1 || count > 100) { 26 | return reply("❌ *Max 100 messages at once!*"); 27 | } 28 | 29 | // Silent execution (no confirmations) 30 | for (let i = 0; i < count; i++) { 31 | await conn.sendMessage(from, { text: message }, { quoted: null }); 32 | if (i < count - 1) await new Promise(resolve => setTimeout(resolve, 500)); // 500ms delay 33 | } 34 | 35 | } catch (e) { 36 | console.error("Error in msg command:", e); 37 | reply(`❌ *Error:* ${e.message}`); 38 | } 39 | }); 40 | 41 | -------------------------------------------------------------------------------- /plugins/couples-dp.js: -------------------------------------------------------------------------------- 1 | const { cmd, commands } = require('../command'); 2 | const axios = require('axios'); 3 | 4 | cmd({ 5 | 'pattern': "couplepp", 6 | 'alias': ["couple", "cpp"], 7 | 'react': '💑', 8 | 'desc': "Get a male and female couple profile picture.", 9 | 'category': "image", 10 | 'use': ".couplepp", 11 | 'filename': __filename 12 | }, async (conn, m, store, { 13 | from, 14 | args, 15 | reply 16 | }) => { 17 | try { 18 | reply("*💑 Fetching couple profile pictures...*"); 19 | 20 | const response = await axios.get("https://api.davidcyriltech.my.id/couplepp"); 21 | 22 | if (!response.data || !response.data.success) { 23 | return reply("❌ Failed to fetch couple profile pictures. Please try again later."); 24 | } 25 | 26 | const malePp = response.data.male; 27 | const femalePp = response.data.female; 28 | 29 | if (malePp) { 30 | await conn.sendMessage(from, { 31 | 'image': { 'url': malePp }, 32 | 'caption': "👨 Male Couple Profile Picture" 33 | }, { 'quoted': m }); 34 | } 35 | 36 | if (femalePp) { 37 | await conn.sendMessage(from, { 38 | 'image': { 'url': femalePp }, 39 | 'caption': "👩 Female Couple Profile Picture" 40 | }, { 'quoted': m }); 41 | } 42 | 43 | } catch (error) { 44 | console.error(error); 45 | reply("❌ An error occurred while fetching the couple profile pictures."); 46 | } 47 | }); 48 | -------------------------------------------------------------------------------- /data/updateDB.js: -------------------------------------------------------------------------------- 1 | const { DATABASE } = require('../lib/database'); 2 | const { DataTypes } = require('sequelize'); 3 | 4 | const UpdateDB = DATABASE.define('UpdateInfo', { 5 | id: { 6 | type: DataTypes.INTEGER, 7 | primaryKey: true, 8 | autoIncrement: false, 9 | defaultValue: 1, 10 | }, 11 | commitHash: { 12 | type: DataTypes.STRING, 13 | allowNull: false, 14 | }, 15 | }, { 16 | tableName: 'update_info', 17 | timestamps: false, 18 | hooks: { 19 | beforeCreate: (record) => { record.id = 1; }, 20 | beforeBulkCreate: (records) => { 21 | records.forEach(record => { record.id = 1; }); 22 | }, 23 | }, 24 | }); 25 | 26 | async function initializeUpdateDB() { 27 | await UpdateDB.sync(); 28 | const [record, created] = await UpdateDB.findOrCreate({ 29 | where: { id: 1 }, 30 | defaults: { commitHash: 'unknown' }, 31 | }); 32 | return record; 33 | } 34 | 35 | async function setCommitHash(hash) { 36 | await initializeUpdateDB(); 37 | const record = await UpdateDB.findByPk(1); 38 | record.commitHash = hash; 39 | await record.save(); 40 | } 41 | 42 | async function getCommitHash() { 43 | await initializeUpdateDB(); 44 | const record = await UpdateDB.findByPk(1); 45 | return record ? record.commitHash : 'unknown'; 46 | } 47 | 48 | module.exports = { 49 | UpdateDB, 50 | setCommitHash, 51 | getCommitHash, 52 | }; 53 | -------------------------------------------------------------------------------- /plugins/repo-search.js: -------------------------------------------------------------------------------- 1 | const axios = require("axios"); 2 | const { cmd } = require("../command"); 3 | 4 | cmd({ 5 | pattern: "srepo", 6 | desc: "Fetch information about a GitHub repository.", 7 | category: "other", 8 | react: "🍃", 9 | filename: __filename 10 | }, async (conn, m, store, { from, args, reply }) => { 11 | try { 12 | const repoName = args.join(" "); 13 | if (!repoName) { 14 | return reply("❌ Please provide a GitHub repository in the format 📌 `owner/repo`."); 15 | } 16 | 17 | const apiUrl = `https://api.github.com/repos/${repoName}`; 18 | const { data } = await axios.get(apiUrl); 19 | 20 | let responseMsg = `📁 *GitHub Repository Info* 📁\n\n`; 21 | responseMsg += `📌 *Name*: ${data.name}\n`; 22 | responseMsg += `🔗 *URL*: ${data.html_url}\n`; 23 | responseMsg += `📝 *Description*: ${data.description || "No description"}\n`; 24 | responseMsg += `⭐ *Stars*: ${data.stargazers_count}\n`; 25 | responseMsg += `🍴 *Forks*: ${data.forks_count}\n`; 26 | responseMsg += `👤 *Owner*: ${data.owner.login}\n`; 27 | responseMsg += `📅 *Created At*: ${new Date(data.created_at).toLocaleDateString()}\n`; 28 | responseMsg += `\n> *©𝙿𝙾𝚆𝙴𝚁𝙴𝙳 𝙱𝚈 𝚃𝙾𝙷𝙸𝙳_𝙼𝙳*`; 29 | 30 | await conn.sendMessage(from, { text: responseMsg }, { quoted: m }); 31 | } catch (error) { 32 | console.error("GitHub API Error:", error); 33 | reply(`❌ Error fetching repository data: ${error.response?.data?.message || error.message}`); 34 | } 35 | }); -------------------------------------------------------------------------------- /plugins/tool-wikipedia.js: -------------------------------------------------------------------------------- 1 | const { cmd, commands } = require("../command"); 2 | const { fetchJson } = require("../lib/functions"); 3 | const { translate } = require("@vitalets/google-translate-api"); 4 | 5 | cmd({ 6 | pattern: "wikipedia", 7 | alias: ["wiki"], 8 | react: "📖", 9 | desc: "Fetch Wikipedia information and translate to English.", 10 | category: "information", 11 | filename: __filename 12 | }, async (conn, mek, m, { from, quoted, body, isCmd, command, args, q, isGroup, sender, reply }) => { 13 | try { 14 | if (!q) { 15 | return reply("Please provide a search query for Wikipedia."); 16 | } 17 | 18 | await reply("Searching Wikipedia..."); 19 | 20 | const response = await fetchJson(`https://api.siputzx.my.id/api/s/wikipedia?query=${encodeURIComponent(q)}`); 21 | 22 | if (!response.status || !response.data) { 23 | return reply("No results found for your query."); 24 | } 25 | 26 | const { wiki, thumb } = response.data; 27 | 28 | // Translate the Wikipedia text to English 29 | const translated = await translate(wiki, { to: "en" }); 30 | 31 | let message = `📖 *Wikipedia Result*\n\n📝 *Query:* ${q}\n\n${translated.text}`; 32 | 33 | if (thumb) { 34 | await conn.sendMessage(m.chat, { 35 | image: { url: thumb }, 36 | caption: message 37 | }); 38 | } else { 39 | await reply(message); 40 | } 41 | 42 | } catch (error) { 43 | console.error(error); 44 | reply("An error occurred: " + error.message); 45 | } 46 | }); -------------------------------------------------------------------------------- /lib/database.js: -------------------------------------------------------------------------------- 1 | const Sequelize = require('sequelize'); 2 | 3 | class DatabaseManager { 4 | static instance = null; 5 | 6 | static getInstance() { 7 | if (!DatabaseManager.instance) { 8 | const DATABASE_URL = process.env.DATABASE_URL || './database.db'; 9 | 10 | DatabaseManager.instance = 11 | DATABASE_URL === './database.db' 12 | ? new Sequelize({ 13 | dialect: 'sqlite', 14 | storage: DATABASE_URL, 15 | logging: false, 16 | }) 17 | : new Sequelize(DATABASE_URL, { 18 | dialect: 'postgres', 19 | ssl: true, 20 | protocol: 'postgres', 21 | dialectOptions: { 22 | native: true, 23 | ssl: { require: true, rejectUnauthorized: false }, 24 | }, 25 | logging: false, 26 | }); 27 | } 28 | return DatabaseManager.instance; 29 | } 30 | } 31 | 32 | const DATABASE = DatabaseManager.getInstance(); 33 | 34 | DATABASE.sync() 35 | .then(() => { 36 | console.log('Database synchronized successfully.'); 37 | }) 38 | .catch((error) => { 39 | console.error('Error synchronizing the database:', error); 40 | }); 41 | 42 | module.exports = { DATABASE }; 43 | 44 | // code by Tohid khan -------------------------------------------------------------------------------- /plugins/news.js: -------------------------------------------------------------------------------- 1 | const axios = require('axios'); 2 | const { cmd } = require('../command'); 3 | 4 | cmd({ 5 | pattern: "news", 6 | desc: "Get the latest news headlines.", 7 | category: "news", 8 | react: "📰", 9 | filename: __filename 10 | }, 11 | async (conn, mek, m, { from, reply }) => { 12 | try { 13 | const apiKey="0f2c43ab11324578a7b1709651736382"; 14 | const response = await axios.get(`https://newsapi.org/v2/top-headlines?country=us&apiKey=${apiKey}`); 15 | const articles = response.data.articles; 16 | 17 | if (!articles.length) return reply("No news articles found."); 18 | 19 | // Send each article as a separate message with image and title 20 | for (let i = 0; i < Math.min(articles.length, 5); i++) { 21 | const article = articles[i]; 22 | let message = ` 23 | 📰 *${article.title}* 24 | ⚠️ _${article.description}_ 25 | 🔗 _${article.url}_ 26 | 27 | ©𝙿𝙾𝚆𝙴𝚁𝙴𝙳 𝙱𝚈 𝚃𝙾𝙷𝙸𝙳_𝙼𝙳 28 | `; 29 | 30 | console.log('Article URL:', article.urlToImage); // Log image URL for debugging 31 | 32 | if (article.urlToImage) { 33 | // Send image with caption 34 | await conn.sendMessage(from, { image: { url: article.urlToImage }, caption: message }); 35 | } else { 36 | // Send text message if no image is available 37 | await conn.sendMessage(from, { text: message }); 38 | } 39 | }; 40 | } catch (e) { 41 | console.error("Error fetching news:", e); 42 | reply("Could not fetch news. Please try again later."); 43 | } 44 | }); 45 | -------------------------------------------------------------------------------- /plugins/tool-broadcast.js: -------------------------------------------------------------------------------- 1 | const { cmd, commands } = require('../command'); 2 | const config = require('../config'); 3 | const prefix = config.PREFIX; 4 | const fs = require('fs'); 5 | const { getBuffer, getGroupAdmins, getRandom, h2k, isUrl, Json, sleep, fetchJson } = require('../lib/functions2'); 6 | const { writeFileSync } = require('fs'); 7 | const path = require('path'); 8 | 9 | cmd({ 10 | pattern: "broadcast", 11 | category: "group", 12 | desc: "Bot makes a broadcast in all groups", 13 | filename: __filename, 14 | use: "" 15 | }, async (conn, mek, m, { q, isGroup, isAdmins, reply }) => { 16 | try { 17 | if (!isGroup) return reply("❌ This command can only be used in groups!"); 18 | if (!isAdmins) return reply("❌ You need to be an admin to broadcast in this group!"); 19 | 20 | if (!q) return reply("❌ Provide text to broadcast in all groups!"); 21 | 22 | let allGroups = await conn.groupFetchAllParticipating(); 23 | let groupIds = Object.keys(allGroups); // Extract group IDs 24 | 25 | reply(`📢 Sending Broadcast To ${groupIds.length} Groups...\n⏳ Estimated Time: ${groupIds.length * 1.5} seconds`); 26 | 27 | for (let groupId of groupIds) { 28 | try { 29 | await sleep(1500); // Avoid rate limits 30 | await conn.sendMessage(groupId, { text: q }); // Sends only the provided text 31 | } catch (err) { 32 | console.log(`❌ Failed to send broadcast to ${groupId}:`, err); 33 | } 34 | } 35 | 36 | return reply(`✅ Successfully sent broadcast to ${groupIds.length} groups!`); 37 | 38 | } catch (err) { 39 | await m.error(`❌ Error: ${err}\n\nCommand: broadcast`, err); 40 | } 41 | }); 42 | -------------------------------------------------------------------------------- /plugins/gitstalk.js: -------------------------------------------------------------------------------- 1 | const axios = require('axios'); 2 | const config = require('../config'); 3 | const { cmd, commands } = require('../command'); 4 | 5 | cmd({ 6 | pattern: "githubstalk", 7 | desc: "Fetch detailed GitHub user profile including profile picture.", 8 | category: "menu", 9 | react: "🖥️", 10 | filename: __filename 11 | }, 12 | async (conn, mek, m, { from, quoted, body, isCmd, command, args, q, isGroup, sender, senderNumber, botNumber2, botNumber, pushname, isMe, isOwner, groupMetadata, groupName, participants, groupAdmins, isBotAdmins, isAdmins, reply }) => { 13 | try { 14 | const username = args[0]; 15 | if (!username) { 16 | return reply("Please provide a GitHub username."); 17 | } 18 | const apiUrl = `https://api.github.com/users/${username}`; 19 | const response = await axios.get(apiUrl); 20 | const data = response.data; 21 | 22 | let userInfo = `👤 *Username*: ${data.name || data.login} 23 | 🔗 *Github Url*:(${data.html_url}) 24 | 📝 *Bio*: ${data.bio || 'Not available'} 25 | 🏙️ *Location*: ${data.location || 'Unknown'} 26 | 📊 *Public Repos*: ${data.public_repos} 27 | 👥 *Followers*: ${data.followers} | Following: ${data.following} 28 | 📅 *Created At*: ${new Date(data.created_at).toDateString()} 29 | 🔭 *Public Gists*: ${data.public_gists} 30 | > ©𝙿𝙾𝚆𝙴𝚁𝙴𝙳 𝙱𝚈 𝚃𝙾𝙷𝙸𝙳_𝙼𝙳`; 31 | const sentMsg = await conn.sendMessage(from,{image:{url: data.avatar_url },caption: userInfo },{quoted:mek }) 32 | } catch (e) { 33 | console.log(e); 34 | reply(`error: ${e.response ? e.response.data.message : e.message}`); 35 | } 36 | }); 37 | 38 | // jawad tech x 39 | -------------------------------------------------------------------------------- /plugins/tool-pdf.js: -------------------------------------------------------------------------------- 1 | const { cmd } = require('../command'); 2 | const PDFDocument = require('pdfkit'); 3 | const { Buffer } = require('buffer'); 4 | 5 | cmd({ 6 | pattern: "topdf", 7 | alias: ["pdf","topdf"],use: '.topdf', 8 | desc: "Convert provided text to a PDF file.", 9 | react: "📄", 10 | category: "utilities", 11 | filename: __filename 12 | }, 13 | async (conn, mek, m, { from, quoted, body, isCmd, command, args, q, isGroup, sender, senderNumber, botNumber2, botNumber, pushname, isMe, isOwner, groupMetadata, groupName, participants, groupAdmins, isBotAdmins, isAdmins, reply }) => { 14 | try { 15 | if (!q) return reply("Please provide the text you want to convert to PDF. *Eg* `.topdf` *India ZindaBad 🇮🇳*"); 16 | 17 | // Create a new PDF document 18 | const doc = new PDFDocument(); 19 | let buffers = []; 20 | doc.on('data', buffers.push.bind(buffers)); 21 | doc.on('end', async () => { 22 | const pdfData = Buffer.concat(buffers); 23 | 24 | // Send the PDF file 25 | await conn.sendMessage(from, { 26 | document: pdfData, 27 | mimetype: 'application/pdf', 28 | fileName: 'TohidMd.pdf', 29 | caption: ` 30 | *📄 PDF created successully!* 31 | 32 | > ©𝙿𝙾𝚆𝙴𝚁𝙴𝙳 𝙱𝚈 𝚃𝙾𝙷𝙸𝙳_𝙼𝙳 💜` 33 | }, { quoted: mek }); 34 | }); 35 | 36 | // Add text to the PDF 37 | doc.text(q); 38 | 39 | // Finalize the PDF and end the stream 40 | doc.end(); 41 | 42 | } catch (e) { 43 | console.error(e); 44 | reply(`Error: ${e.message}`); 45 | } 46 | }); 47 | 48 | -------------------------------------------------------------------------------- /plugins/delete-links.js: -------------------------------------------------------------------------------- 1 | const { cmd } = require('../command'); 2 | const config = require('../config'); 3 | 4 | const linkPatterns = [ 5 | /https?:\/\/(?:chat\.whatsapp\.com|wa\.me)\/\S+/gi, 6 | /^https?:\/\/(www\.)?whatsapp\.com\/channel\/([a-zA-Z0-9_-]+)$/, 7 | /wa\.me\/\S+/gi, 8 | /https?:\/\/(?:t\.me|telegram\.me)\/\S+/gi, 9 | /https?:\/\/(?:www\.)?youtube\.com\/\S+/gi, 10 | /https?:\/\/youtu\.be\/\S+/gi, 11 | /https?:\/\/(?:www\.)?facebook\.com\/\S+/gi, 12 | /https?:\/\/fb\.me\/\S+/gi, 13 | /https?:\/\/(?:www\.)?instagram\.com\/\S+/gi, 14 | /https?:\/\/(?:www\.)?twitter\.com\/\S+/gi, 15 | /https?:\/\/(?:www\.)?tiktok\.com\/\S+/gi, 16 | /https?:\/\/(?:www\.)?linkedin\.com\/\S+/gi, 17 | /https?:\/\/(?:www\.)?snapchat\.com\/\S+/gi, 18 | /https?:\/\/(?:www\.)?pinterest\.com\/\S+/gi, 19 | /https?:\/\/(?:www\.)?reddit\.com\/\S+/gi, 20 | /https?:\/\/ngl\/\S+/gi, 21 | /https?:\/\/(?:www\.)?discord\.com\/\S+/gi, 22 | /https?:\/\/(?:www\.)?twitch\.tv\/\S+/gi, 23 | /https?:\/\/(?:www\.)?vimeo\.com\/\S+/gi, 24 | /https?:\/\/(?:www\.)?dailymotion\.com\/\S+/gi, 25 | /https?:\/\/(?:www\.)?medium\.com\/\S+/gi 26 | ]; 27 | 28 | cmd({ 29 | on: 'body' 30 | }, async (conn, m, store, { 31 | from, 32 | body, 33 | sender, 34 | isGroup, 35 | isAdmins, 36 | isBotAdmins 37 | }) => { 38 | try { 39 | if (!isGroup || isAdmins || !isBotAdmins) { 40 | return; 41 | } 42 | 43 | const containsLink = linkPatterns.some(pattern => pattern.test(body)); 44 | 45 | if (containsLink && config.DELETE_LINKS === 'true') { 46 | await conn.sendMessage(from, { delete: m.key }, { quoted: m }); 47 | } 48 | } catch (error) { 49 | console.error(error); 50 | } 51 | }); -------------------------------------------------------------------------------- /plugins/group-add.js: -------------------------------------------------------------------------------- 1 | const { cmd } = require('../command'); 2 | 3 | cmd({ 4 | pattern: "add", 5 | alias: ["a", "invite"], 6 | desc: "Adds a member to the group", 7 | category: "admin", 8 | react: "➕", 9 | filename: __filename 10 | }, 11 | async (conn, mek, m, { 12 | from, q, isGroup, isBotAdmins, reply, quoted, senderNumber 13 | }) => { 14 | // Check if the command is used in a group 15 | if (!isGroup) return reply("❌ This command can only be used in groups."); 16 | 17 | // Get the bot owner's number dynamically from conn.user.id 18 | const botOwner = conn.user.id.split(":")[0]; 19 | if (senderNumber !== botOwner) { 20 | return reply("❌ Only the bot owner can use this command."); 21 | } 22 | 23 | // Check if the bot is an admin 24 | if (!isBotAdmins) return reply("❌ I need to be an admin to use this command."); 25 | 26 | let number; 27 | if (m.quoted) { 28 | number = m.quoted.sender.split("@")[0]; // If replying to a message, get the sender's number 29 | } else if (q && q.includes("@")) { 30 | number = q.replace(/[@\s]/g, ''); // If manually typing a number with '@' 31 | } else if (q && /^\d+$/.test(q)) { 32 | number = q; // If directly typing a number 33 | } else { 34 | return reply("❌ Please reply to a message, mention a user, or provide a number to add."); 35 | } 36 | 37 | const jid = number + "@s.whatsapp.net"; 38 | 39 | try { 40 | await conn.groupParticipantsUpdate(from, [jid], "add"); 41 | reply(`✅ Successfully added @${number}`, { mentions: [jid] }); 42 | } catch (error) { 43 | console.error("Add command error:", error); 44 | reply("❌ Failed to add the member."); 45 | } 46 | }); 47 | -------------------------------------------------------------------------------- /plugins/emix-fun.js: -------------------------------------------------------------------------------- 1 | const { cmd } = require("../command"); 2 | const { fetchEmix } = require("../lib/emix-utils"); 3 | const { getBuffer } = require("../lib/functions"); 4 | const { Sticker, StickerTypes } = require("wa-sticker-formatter"); 5 | 6 | cmd({ 7 | pattern: "emix", 8 | desc: "Combine two emojis into a sticker.", 9 | category: "fun", 10 | react: "😃", 11 | use: ".emix 😂,🙂", 12 | filename: __filename, 13 | }, async (conn, mek, m, { args, q, reply }) => { 14 | try { 15 | if (!q.includes(",")) { 16 | return reply("❌ *Usage:* .emix 😂,🙂\n_Send two emojis separated by a comma._"); 17 | } 18 | 19 | let [emoji1, emoji2] = q.split(",").map(e => e.trim()); 20 | 21 | if (!emoji1 || !emoji2) { 22 | return reply("❌ Please provide two emojis separated by a comma."); 23 | } 24 | 25 | let imageUrl = await fetchEmix(emoji1, emoji2); 26 | 27 | if (!imageUrl) { 28 | return reply("❌ Could not generate emoji mix. Try different emojis."); 29 | } 30 | 31 | let buffer = await getBuffer(imageUrl); 32 | let sticker = new Sticker(buffer, { 33 | pack: "Emoji Mix", 34 | author: "TOHID_MD", 35 | type: StickerTypes.FULL, 36 | categories: ["🤩", "🎉"], 37 | quality: 75, 38 | background: "transparent", 39 | }); 40 | 41 | const stickerBuffer = await sticker.toBuffer(); 42 | await conn.sendMessage(mek.chat, { sticker: stickerBuffer }, { quoted: mek }); 43 | 44 | } catch (e) { 45 | console.error("Error in .emix command:", e.message); 46 | reply(`❌ Could not generate emoji mix: ${e.message}`); 47 | } 48 | }); 49 | 50 | -------------------------------------------------------------------------------- /plugins/ssweb-tool.js: -------------------------------------------------------------------------------- 1 | // code by Tohid khan 2 | 3 | const axios = require("axios"); 4 | const config = require('../config'); 5 | const { cmd } = require('../command'); 6 | 7 | cmd({ 8 | pattern: "sss", 9 | alias: ["ssweb"], 10 | react: "💫", 11 | desc: "Download screenshot of a given link.", 12 | category: "other", 13 | use: ".ss ", 14 | filename: __filename, 15 | }, 16 | async (conn, mek, m, { 17 | from, l, quoted, body, isCmd, command, args, q, isGroup, sender, 18 | senderNumber, botNumber2, botNumber, pushname, isMe, isOwner, 19 | groupMetadata, groupName, participants, isItzcp, groupAdmins, 20 | isBotAdmins, isAdmins, reply 21 | }) => { 22 | if (!q) { 23 | return reply("Please provide a URL to capture a screenshot."); 24 | } 25 | 26 | try { 27 | // created by jawad tech 28 | const response = await axios.get(`https://api.davidcyriltech.my.id/ssweb?url=${q}`); 29 | const screenshotUrl = response.data.screenshotUrl; 30 | 31 | // give credit and use 32 | const imageMessage = { 33 | image: { url: screenshotUrl }, 34 | caption: "*WEB SS DOWNLOADER*\n\n> *©𝙿𝙾𝚆𝙴𝚁𝙴𝙳 𝙱𝚈 𝚃𝙾𝙷𝙸𝙳_𝙼𝙳*", 35 | contextInfo: { 36 | mentionedJid: [m.sender], 37 | forwardingScore: 999, 38 | isForwarded: true, 39 | forwardedNewsletterMessageInfo: { 40 | newsletterJid: '120363207624903731@newsletter', 41 | newsletterName: "𝐓𝐎𝐇𝐈𝐃 𝐓𝐄𝐂𝐇 🤖", 42 | serverMessageId: 143, 43 | }, 44 | }, 45 | }; 46 | 47 | await conn.sendMessage(from, imageMessage, { quoted: m }); 48 | } catch (error) { 49 | console.error(error); 50 | reply("Failed to capture the screenshot. Please try again."); 51 | } 52 | }); 53 | 54 | 55 | -------------------------------------------------------------------------------- /plugins/weather.js: -------------------------------------------------------------------------------- 1 | const axios = require('axios'); 2 | const config = require('../config'); 3 | const { cmd, commands } = require('../command'); 4 | cmd({ 5 | pattern: "weather", 6 | desc: "🌤 Get weather information for a location", 7 | react: "🌤", 8 | category: "other", 9 | filename: __filename 10 | }, 11 | async (conn, mek, m, { from, q, reply }) => { 12 | try { 13 | if (!q) return reply("❗ Please provide a city name. Usage: .weather [city name]"); 14 | const apiKey = '2d61a72574c11c4f36173b627f8cb177'; 15 | const city = q; 16 | const url = `http://api.openweathermap.org/data/2.5/weather?q=${city}&appid=${apiKey}&units=metric`; 17 | const response = await axios.get(url); 18 | const data = response.data; 19 | const weather = ` 20 | > 🌍 *Weather Information for ${data.name}, ${data.sys.country}* 🌍 21 | > 🌡️ *Temperature*: ${data.main.temp}°C 22 | > 🌡️ *Feels Like*: ${data.main.feels_like}°C 23 | > 🌡️ *Min Temp*: ${data.main.temp_min}°C 24 | > 🌡️ *Max Temp*: ${data.main.temp_max}°C 25 | > 💧 *Humidity*: ${data.main.humidity}% 26 | > ☁️ *Weather*: ${data.weather[0].main} 27 | > 🌫️ *Description*: ${data.weather[0].description} 28 | > 💨 *Wind Speed*: ${data.wind.speed} m/s 29 | > 🔽 *Pressure*: ${data.main.pressure} hPa 30 | 31 | > *©𝙿𝙾𝚆𝙴𝚁𝙴𝙳 𝙱𝚈 𝚃𝙾𝙷𝙸𝙳_𝙼𝙳* 32 | `; 33 | return reply(weather); 34 | } catch (e) { 35 | console.log(e); 36 | if (e.response && e.response.status === 404) { 37 | return reply("🚫 City not found. Please check the spelling and try again."); 38 | } 39 | return reply("⚠️ An error occurred while fetching the weather information. Please try again later."); 40 | } 41 | }); 42 | 43 | -------------------------------------------------------------------------------- /plugins/tool-request.js: -------------------------------------------------------------------------------- 1 | 2 | const { cmd } = require("../command"); 3 | const config = require("../config"); 4 | 5 | cmd({ 6 | pattern: "report", 7 | alias: ["ask", "bug", "request"], 8 | desc: "Report a bug or request a feature", 9 | category: "utility", 10 | filename: __filename 11 | }, async (conn, mek, m, { 12 | from, body, command, args, senderNumber, reply 13 | }) => { 14 | try { 15 | const botOwner = conn.user.id.split(":")[0]; // Extract the bot owner's number 16 | if (senderNumber !== botOwner) { 17 | return reply("Only the bot owner can use this command."); 18 | } 19 | 20 | if (!args.length) { 21 | return reply(`Example: ${config.PREFIX}report Play command is not working`); 22 | } 23 | 24 | const reportedMessages = {}; 25 | const devNumber = "917849917350"; // Bot owner's number 26 | const messageId = m.key.id; 27 | 28 | if (reportedMessages[messageId]) { 29 | return reply("This report has already been forwarded to the owner. Please wait for a response."); 30 | } 31 | reportedMessages[messageId] = true; 32 | 33 | const reportText = `*| REQUEST/BUG |*\n\n*User*: @${m.sender.split("@")[0]}\n*Request/Bug*: ${args.join(" ")}`; 34 | const confirmationText = `Hi ${m.pushName}, your request has been forwarded to the owner. Please wait...`; 35 | 36 | await conn.sendMessage(`${devNumber}@s.whatsapp.net`, { 37 | text: reportText, 38 | mentions: [m.sender] 39 | }, { quoted: m }); 40 | 41 | reply(confirmationText); 42 | } catch (error) { 43 | console.error(error); 44 | reply("An error occurred while processing your report."); 45 | } 46 | }); 47 | -------------------------------------------------------------------------------- /plugins/group-promote.js: -------------------------------------------------------------------------------- 1 | const { cmd } = require('../command'); 2 | 3 | cmd({ 4 | pattern: "promote", 5 | alias: ["p", "makeadmin"], 6 | desc: "Promotes a member to group admin", 7 | category: "admin", 8 | react: "⬆️", 9 | filename: __filename 10 | }, 11 | async(conn, mek, m, { 12 | from, l, quoted, body, isCmd, command, args, q, isGroup, sender, senderNumber, botNumber2, botNumber, pushname, isMe, isOwner, groupMetadata, groupName, participants, groupAdmins, isBotAdmins, isCreator, isDev, isAdmins, reply 13 | }) => { 14 | // Check if the command is used in a group 15 | if (!isGroup) return reply("❌ This command can only be used in groups."); 16 | 17 | // Check if the user is an admin 18 | if (!isAdmins) return reply("❌ Only group admins can use this command."); 19 | 20 | // Check if the bot is an admin 21 | if (!isBotAdmins) return reply("❌ I need to be an admin to use this command."); 22 | 23 | let number; 24 | if (m.quoted) { 25 | number = m.quoted.sender.split("@")[0]; // If replying to a message, get the sender's number 26 | } else if (q && q.includes("@")) { 27 | number = q.replace(/[@\s]/g, ''); // If manually typing a number 28 | } else { 29 | return reply("❌ Please reply to a message or provide a number to promote."); 30 | } 31 | 32 | // Prevent promoting the bot itself 33 | if (number === botNumber) return reply("❌ The bot cannot promote itself."); 34 | 35 | const jid = number + "@s.whatsapp.net"; 36 | 37 | try { 38 | await conn.groupParticipantsUpdate(from, [jid], "promote"); 39 | reply(`✅ Successfully promoted @${number} to admin.`, { mentions: [jid] }); 40 | } catch (error) { 41 | console.error("Promote command error:", error); 42 | reply("❌ Failed to promote the member."); 43 | } 44 | }); 45 | -------------------------------------------------------------------------------- /plugins/tweet-stalk.js: -------------------------------------------------------------------------------- 1 | const { cmd } = require('../command'); 2 | const axios = require('axios'); 3 | 4 | cmd({ 5 | pattern: "xstalk", 6 | alias: ["twitterstalk", "twtstalk"], 7 | desc: "Get details about a Twitter/X user.", 8 | react: "🔍", 9 | category: "search", 10 | filename: __filename 11 | }, async (conn, m, store, { from, quoted, q, reply }) => { 12 | try { 13 | if (!q) { 14 | return reply("❌ Please provide a valid Twitter/X username."); 15 | } 16 | 17 | await conn.sendMessage(from, { 18 | react: { text: "⏳", key: m.key } 19 | }); 20 | 21 | const apiUrl = `https://delirius-apiofc.vercel.app/tools/xstalk?username=${encodeURIComponent(q)}`; 22 | const { data } = await axios.get(apiUrl); 23 | 24 | if (!data || !data.status || !data.data) { 25 | return reply("⚠️ Failed to fetch Twitter/X user details. Ensure the username is correct."); 26 | } 27 | 28 | const user = data.data; 29 | const verifiedBadge = user.verified ? "✅" : "❌"; 30 | 31 | const caption = `╭━━━〔 *TWITTER/X STALKER* 〕━━━⊷\n` 32 | + `┃👤 *Name:* ${user.name}\n` 33 | + `┃🔹 *Username:* @${user.username}\n` 34 | + `┃✔️ *Verified:* ${verifiedBadge}\n` 35 | + `┃👥 *Followers:* ${user.followers_count}\n` 36 | + `┃👤 *Following:* ${user.following_count}\n` 37 | + `┃📝 *Tweets:* ${user.tweets_count}\n` 38 | + `┃📅 *Joined:* ${user.created}\n` 39 | + `┃🔗 *Profile:* [Click Here](${user.url})\n` 40 | + `╰━━━⪼\n\n` 41 | + `🔹 *©𝙿𝙾𝚆𝙴𝚁𝙴𝙳 𝙱𝚈 𝚃𝙾𝙷𝙸𝙳_𝙼𝙳*`; 42 | 43 | await conn.sendMessage(from, { 44 | image: { url: user.avatar }, 45 | caption: caption 46 | }, { quoted: m }); 47 | 48 | } catch (error) { 49 | console.error("Error:", error); 50 | reply("❌ An error occurred while processing your request. Please try again."); 51 | } 52 | }); 53 | -------------------------------------------------------------------------------- /package.json: -------------------------------------------------------------------------------- 1 | { 2 | "name": "TOHID_MD", 3 | "version": "4.5.0", 4 | "description": "A WhatsApp Bot Created By TohidKhan", 5 | "main": "index.js", 6 | "scripts": { 7 | "start": "pm2 start index.js --deep-monitoring --attach --name TOHID_MD", 8 | "stop": "pm2 stop TOHID_MD", 9 | "restart": "pm2 restart TOHID_MD" 10 | }, 11 | "dependencies": { 12 | "@whiskeysockets/baileys": "npm:@fizzxydev/baileys-pro@8.5.12", 13 | "@adiwajshing/keyed-db": "^0.2.4", 14 | "@dark-yasiya/yt-dl.js": "1.0.5", 15 | "@ffmpeg-installer/ffmpeg": "^1.1.0", 16 | "@vitalets/google-translate-api": "^9.2.0", 17 | "@dark-yasiya/scrap":"1.0.1", 18 | "pino": "^7.0.5", 19 | "pm2": "^6.0.5", 20 | "util": "^0.12.4", 21 | "express": "latest", 22 | "moment-timezone": "^0.5.45", 23 | "axios": "^1.2.5", 24 | "crypto-digest-sync": "^1.0.0", 25 | "crypto-js": "latest", 26 | "file_size_url": "1.0.4", 27 | "fs-extra": "^11.1.0", 28 | "fs": "^0.0.1-security", 29 | "ffmpeg": "^0.0.4", 30 | "file-type": "^16.5.3", 31 | "fluent-ffmpeg": "^2.1.2", 32 | "form-data": "^4.0.0", 33 | "google-tts-api": "^2.0.2", 34 | "path": "^0.12.7", 35 | "node-fetch": "^2.6.1", 36 | "btch-downloader": "^2.2.9", 37 | "megajs": "^1.1.0", 38 | "pdfkit": "^0.14.0", 39 | "wa_set_pkg": "1.0.5", 40 | "wa-sticker-formatter": "^4.4.4", 41 | "path": "^0.12.7", 42 | "vm": "^0.1.0", 43 | "adm-zip": "^0.5.16", 44 | "cheerio": "^1.0.0-rc.12", 45 | "ruhend-scraper" : "8.0.3", 46 | "qrcode-terminal": "^0.12.0", 47 | "yt-search":"2.11.1", 48 | "sequelize": "^6.37.5", 49 | "sqlite3": "^5.1.7", 50 | "vm": "^0.1.0", 51 | "api-dylux":"1.8.5", 52 | "@mrnima/tiktok-downloader":"1.0.0", 53 | "@mrnima/facebook-downloader":"1.0.0", 54 | "mrnima-moviedl":"1.0.0" 55 | } 56 | } 57 | -------------------------------------------------------------------------------- /plugins/group-dismiss.js: -------------------------------------------------------------------------------- 1 | const { cmd } = require('../command'); 2 | 3 | cmd({ 4 | pattern: "demote", 5 | alias: ["d", "dismiss", "removeadmin"], 6 | desc: "Demotes a group admin to a normal member", 7 | category: "admin", 8 | react: "⬇️", 9 | filename: __filename 10 | }, 11 | async(conn, mek, m, { 12 | from, l, quoted, body, isCmd, command, args, q, isGroup, sender, senderNumber, botNumber2, botNumber, pushname, isMe, isOwner, groupMetadata, groupName, participants, groupAdmins, isBotAdmins, isCreator, isDev, isAdmins, reply 13 | }) => { 14 | // Check if the command is used in a group 15 | if (!isGroup) return reply("❌ This command can only be used in groups."); 16 | 17 | // Check if the user is an admin 18 | if (!isAdmins) return reply("❌ Only group admins can use this command."); 19 | 20 | // Check if the bot is an admin 21 | if (!isBotAdmins) return reply("❌ I need to be an admin to use this command."); 22 | 23 | let number; 24 | if (m.quoted) { 25 | number = m.quoted.sender.split("@")[0]; // If replying to a message, get the sender's number 26 | } else if (q && q.includes("@")) { 27 | number = q.replace(/[@\s]/g, ''); // If manually typing a number 28 | } else { 29 | return reply("❌ Please reply to a message or provide a number to demote."); 30 | } 31 | 32 | // Prevent demoting the bot itself 33 | if (number === botNumber) return reply("❌ The bot cannot demote itself."); 34 | 35 | const jid = number + "@s.whatsapp.net"; 36 | 37 | try { 38 | await conn.groupParticipantsUpdate(from, [jid], "demote"); 39 | reply(`✅ Successfully demoted @${number} to a normal member.`, { mentions: [jid] }); 40 | } catch (error) { 41 | console.error("Demote command error:", error); 42 | reply("❌ Failed to demote the member."); 43 | } 44 | }); 45 | -------------------------------------------------------------------------------- /plugins/group-poll.js: -------------------------------------------------------------------------------- 1 | //--------------------------------------------------------------------------- 2 | // TOHID_MD 3 | //--------------------------------------------------------------------------- 4 | // ⚠️ DO NOT MODIFY THIS FILE ⚠️ 5 | //--------------------------------------------------------------------------- 6 | const { cmd, commands } = require('../command'); 7 | const config = require('../config'); 8 | const prefix = config.PREFIX; 9 | const fs = require('fs'); 10 | const { getBuffer, getGroupAdmins, getRandom, h2k, isUrl, Json, sleep, fetchJson } = require('../lib/functions2'); 11 | const { writeFileSync } = require('fs'); 12 | const path = require('path'); 13 | 14 | cmd({ 15 | pattern: "poll", 16 | category: "group", 17 | desc: "Create a poll with a question and options in the group.", 18 | filename: __filename, 19 | }, async (conn, mek, m, { from, isGroup, body, sender, groupMetadata, participants, prefix, pushname, reply }) => { 20 | try { 21 | let [question, optionsString] = body.split(";"); 22 | 23 | if (!question || !optionsString) { 24 | return reply(`Usage: ${prefix}poll question;option1,option2,option3...`); 25 | } 26 | 27 | let options = []; 28 | for (let option of optionsString.split(",")) { 29 | if (option && option.trim() !== "") { 30 | options.push(option.trim()); 31 | } 32 | } 33 | 34 | if (options.length < 2) { 35 | return reply("*Please provide at least two options for the poll.*"); 36 | } 37 | 38 | await conn.sendMessage(from, { 39 | poll: { 40 | name: question, 41 | values: options, 42 | selectableCount: 1, 43 | toAnnouncementGroup: true, 44 | } 45 | }, { quoted: mek }); 46 | } catch (e) { 47 | return reply(`*An error occurred while processing your request.*\n\n_Error:_ ${e.message}`); 48 | } 49 | }); 50 | -------------------------------------------------------------------------------- /plugins/status-saver.js: -------------------------------------------------------------------------------- 1 | const { cmd } = require("../command"); 2 | 3 | cmd({ 4 | pattern: "send", 5 | alias: ["sendme", 'save'], 6 | react: '📤', 7 | desc: "Forwards quoted message back to user", 8 | category: "utility", 9 | filename: __filename 10 | }, async (client, message, match, { from }) => { 11 | try { 12 | if (!match.quoted) { 13 | return await client.sendMessage(from, { 14 | text: "*🍁 Please reply to a message!*" 15 | }, { quoted: message }); 16 | } 17 | 18 | const buffer = await match.quoted.download(); 19 | const mtype = match.quoted.mtype; 20 | const options = { quoted: message }; 21 | 22 | let messageContent = {}; 23 | switch (mtype) { 24 | case "imageMessage": 25 | messageContent = { 26 | image: buffer, 27 | caption: match.quoted.text || '', 28 | mimetype: match.quoted.mimetype || "image/jpeg" 29 | }; 30 | break; 31 | case "videoMessage": 32 | messageContent = { 33 | video: buffer, 34 | caption: match.quoted.text || '', 35 | mimetype: match.quoted.mimetype || "video/mp4" 36 | }; 37 | break; 38 | case "audioMessage": 39 | messageContent = { 40 | audio: buffer, 41 | mimetype: "audio/mp4", 42 | ptt: match.quoted.ptt || false 43 | }; 44 | break; 45 | default: 46 | return await client.sendMessage(from, { 47 | text: "❌ Only image, video, and audio messages are supported" 48 | }, { quoted: message }); 49 | } 50 | 51 | await client.sendMessage(from, messageContent, options); 52 | } catch (error) { 53 | console.error("Forward Error:", error); 54 | await client.sendMessage(from, { 55 | text: "❌ Error forwarding message:\n" + error.message 56 | }, { quoted: message }); 57 | } 58 | }); 59 | -------------------------------------------------------------------------------- /plugins/search-npm.js: -------------------------------------------------------------------------------- 1 | const axios = require("axios"); 2 | const { cmd } = require("../command"); 3 | 4 | cmd({ 5 | pattern: "npm", 6 | desc: "Search for a package on npm.", 7 | react: '📦', 8 | category: "convert", 9 | filename: __filename, 10 | use: ".npm " 11 | }, async (conn, mek, msg, { from, args, reply }) => { 12 | try { 13 | // Check if a package name is provided 14 | if (!args.length) { 15 | return reply("Please provide the name of the npm package you want to search for. Example: .npm express"); 16 | } 17 | 18 | const packageName = args.join(" "); 19 | const apiUrl = `https://registry.npmjs.org/${encodeURIComponent(packageName)}`; 20 | 21 | // Fetch package details from npm registry 22 | const response = await axios.get(apiUrl); 23 | if (response.status !== 200) { 24 | throw new Error("Package not found or an error occurred."); 25 | } 26 | 27 | const packageData = response.data; 28 | const latestVersion = packageData["dist-tags"].latest; 29 | const description = packageData.description || "No description available."; 30 | const npmUrl = `https://www.npmjs.com/package/${packageName}`; 31 | const license = packageData.license || "Unknown"; 32 | const repository = packageData.repository ? packageData.repository.url : "Not available"; 33 | 34 | // Create the response message 35 | const message = ` 36 | *TOHID_MD NPM SEARCH* 37 | 38 | *🔰 NPM PACKAGE:* ${packageName} 39 | *📄 DESCRIPTION:* ${description} 40 | *⏸️ LAST VERSION:* ${latestVersion} 41 | *🪪 LICENSE:* ${license} 42 | *🪩 REPOSITORY:* ${repository} 43 | *🔗 NPM URL:* ${npmUrl} 44 | `; 45 | 46 | // Send the message 47 | await conn.sendMessage(from, { text: message }, { quoted: mek }); 48 | 49 | } catch (error) { 50 | console.error("Error:", error); 51 | reply("An error occurred: " + error.message); 52 | } 53 | }); 54 | -------------------------------------------------------------------------------- /plugins/get-pair.js: -------------------------------------------------------------------------------- 1 | const { cmd, commands } = require('../command'); 2 | const axios = require('axios'); 3 | 4 | cmd({ 5 | pattern: "pair", 6 | alias: ["getpair", "clonebot"], 7 | react: "✅", 8 | desc: "Get pairing code for TOHID_MD bot", 9 | category: "download", 10 | use: ".pair 917849917350", 11 | filename: __filename 12 | }, async (conn, mek, m, { from, quoted, body, isCmd, command, args, q, isGroup, senderNumber, reply }) => { 13 | try { 14 | // Extract phone number from command 15 | const phoneNumber = q ? q.trim().replace(/[^0-9]/g, '') : senderNumber.replace(/[^0-9]/g, ''); 16 | 17 | // Validate phone number format 18 | if (!phoneNumber || phoneNumber.length < 10 || phoneNumber.length > 15) { 19 | return await reply("❌ Please provide a valid phone number without `+`\nExample: `.pair 917849917350`"); 20 | } 21 | 22 | // Make API request to get pairing code 23 | const response = await axios.get(`https://tohid-ai-web-pair-be01.onrender.com/code?number=${encodeURIComponent(phoneNumber)}`); 24 | 25 | if (!response.data || !response.data.code) { 26 | return await reply("❌ Failed to retrieve pairing code. Please try again later."); 27 | } 28 | 29 | const pairingCode = response.data.code; 30 | const doneMessage = "> *TOHID_MD PAIRING COMPLETED*"; 31 | 32 | // Send initial message with formatting 33 | await reply(`${doneMessage}\n\n*Your pairing code is:* ${pairingCode}`); 34 | 35 | // Optional 2-second delay 36 | await new Promise(resolve => setTimeout(resolve, 2000)); 37 | 38 | // Send clean code again 39 | await reply(`${pairingCode}`); 40 | 41 | } catch (error) { 42 | console.error("Pair command error:", error); 43 | await reply("❌ An error occurred while getting pairing code. Please try again later."); 44 | } 45 | }); 46 | -------------------------------------------------------------------------------- /plugins/tool-wstalk.js: -------------------------------------------------------------------------------- 1 | const { cmd } = require('../command'); 2 | const axios = require('axios'); 3 | 4 | cmd({ 5 | pattern: "wstalk", 6 | alias: ["channelstalk", "chinfo"], 7 | desc: "Get WhatsApp channel information", 8 | category: "utility", 9 | react: "🔍", 10 | filename: __filename 11 | }, 12 | async (conn, mek, m, { from, reply, args }) => { 13 | try { 14 | // Check if URL is provided 15 | if (!args) return reply("❌ Please provide a WhatsApp channel URL\nExample: .wstalk https://whatsapp.com/channel/0029VaGyP933bbVC7G0x0i2T"); 16 | 17 | // Extract channel ID from URL 18 | const channelId = args.match(/channel\/([0-9A-Za-z]+)/i)?.[1]; 19 | if (!channelId) return reply("❌ Invalid WhatsApp channel URL"); 20 | 21 | // API endpoint 22 | const apiUrl = `https://itzpire.com/stalk/whatsapp-channel?url=https://whatsapp.com/channel/${channelId}`; 23 | 24 | // Fetch channel info 25 | const response = await axios.get(apiUrl); 26 | const data = response.data.data; 27 | 28 | // Format the information 29 | const channelInfo = `╭━━〔 *CHANNEL INFO* 〕━━┈⊷ 30 | ┃◈╭─────────────·๏ 31 | ┃◈┃• *📢 Title*: ${data.title} 32 | ┃◈┃• *👥 Followers*: ${data.followers} 33 | ┃◈┃• *📝 Description*: ${data.description.replace(/\n/g, '\n┃◈┃• ')} 34 | ┃◈└───────────┈⊷ 35 | ╰──────────────┈⊷ 36 | > ©𝙿𝙾𝚆𝙴𝚁𝙴𝙳 𝙱𝚈 𝚃𝙾𝙷𝙸𝙳_𝙼𝙳`; 37 | 38 | // Send message with channel image 39 | await conn.sendMessage(from, { 40 | image: { url: data.img }, 41 | caption: channelInfo, 42 | contextInfo: { 43 | forwardingScore: 999, 44 | isForwarded: true 45 | } 46 | }, { quoted: mek }); 47 | 48 | } catch (e) { 49 | console.error("Error in wstalk command:", e); 50 | reply(`❌ Error: ${e.response?.data?.message || e.message}`); 51 | } 52 | }); 53 | -------------------------------------------------------------------------------- /lib/video-utils.js: -------------------------------------------------------------------------------- 1 | const fs = require('fs'); 2 | const path = require('path'); 3 | const { tmpdir } = require('os'); 4 | const Crypto = require('crypto'); 5 | const ffmpegPath = require('@ffmpeg-installer/ffmpeg').path; 6 | const ffmpeg = require('fluent-ffmpeg'); 7 | 8 | // Set ffmpeg path 9 | ffmpeg.setFfmpegPath(ffmpegPath); 10 | 11 | /** 12 | * Converts a video or GIF buffer to a WebP sticker format. 13 | * @param {Buffer} videoBuffer - The video or GIF buffer to convert. 14 | * @returns {Promise} - The converted WebP sticker buffer. 15 | */ 16 | async function videoToWebp(videoBuffer) { 17 | const outputPath = path.join( 18 | tmpdir(), 19 | Crypto.randomBytes(6).readUIntLE(0, 6).toString(36) + '.webp' 20 | ); 21 | const inputPath = path.join( 22 | tmpdir(), 23 | Crypto.randomBytes(6).readUIntLE(0, 6).toString(36) + '.mp4' 24 | ); 25 | 26 | // Save the video buffer to a file 27 | fs.writeFileSync(inputPath, videoBuffer); 28 | 29 | await new Promise((resolve, reject) => { 30 | ffmpeg(inputPath) 31 | .on('error', reject) 32 | .on('end', () => resolve(true)) 33 | .addOutputOptions([ 34 | '-vcodec', 'libwebp', 35 | '-vf', "scale='min(320,iw)':min'(320,ih)':force_original_aspect_ratio=decrease,fps=15,pad=320:320:-1:-1:color=white@0.0,split [a][b];[a] palettegen=reserve_transparent=on:transparency_color=ffffff [p];[b][p] paletteuse", 36 | '-loop', '0', // Loop forever 37 | '-ss', '00:00:00', // Start time (optional) 38 | '-t', '00:00:05', // Duration (optional) 39 | '-preset', 'default', 40 | '-an', // No audio 41 | '-vsync', '0' 42 | ]) 43 | .toFormat('webp') 44 | .save(outputPath); 45 | }); 46 | 47 | const webpBuffer = fs.readFileSync(outputPath); 48 | fs.unlinkSync(outputPath); 49 | fs.unlinkSync(inputPath); 50 | 51 | return webpBuffer; 52 | } 53 | 54 | module.exports = { 55 | videoToWebp 56 | }; 57 | -------------------------------------------------------------------------------- /plugins/define.js: -------------------------------------------------------------------------------- 1 | const axios = require('axios'); 2 | const { cmd } = require('../command'); 3 | 4 | cmd({ 5 | pattern: "define", 6 | desc: "📖 Get the definition of a word", 7 | react: "🔍", 8 | category: "search", 9 | filename: __filename 10 | }, 11 | async (conn, mek, m, { from, q, reply }) => { 12 | try { 13 | if (!q) return reply("Please provide a word to define.\n\n📌 *Usage:* .define [word]"); 14 | 15 | const word = q.trim(); 16 | const url = `https://api.dictionaryapi.dev/api/v2/entries/en/${word}`; 17 | 18 | const response = await axios.get(url); 19 | const definitionData = response.data[0]; 20 | 21 | const definition = definitionData.meanings[0].definitions[0].definition; 22 | const example = definitionData.meanings[0].definitions[0].example || '❌ No example available'; 23 | const synonyms = definitionData.meanings[0].definitions[0].synonyms.join(', ') || '❌ No synonyms available'; 24 | const phonetics = definitionData.phonetics[0]?.text || '🔇 No phonetics available'; 25 | const audio = definitionData.phonetics[0]?.audio || null; 26 | 27 | const wordInfo = ` 28 | 📖 *Word*: *${definitionData.word}* 29 | 🗣️ *Pronunciation*: _${phonetics}_ 30 | 📚 *Definition*: ${definition} 31 | ✍️ *Example*: ${example} 32 | 📝 *Synonyms*: ${synonyms} 33 | 34 | 🔗 *©𝙿𝙾𝚆𝙴𝚁𝙴𝙳 𝙱𝚈 𝚃𝙾𝙷𝙸𝙳_𝙼𝙳*`; 35 | 36 | if (audio) { 37 | await conn.sendMessage(from, { audio: { url: audio }, mimetype: 'audio/mpeg' }, { quoted: mek }); 38 | } 39 | 40 | return reply(wordInfo); 41 | } catch (e) { 42 | console.error("❌ Error:", e); 43 | if (e.response && e.response.status === 404) { 44 | return reply("🚫 *Word not found.* Please check the spelling and try again."); 45 | } 46 | return reply("⚠️ An error occurred while fetching the definition. Please try again later."); 47 | } 48 | }); 49 | -------------------------------------------------------------------------------- /plugins/define-word.js: -------------------------------------------------------------------------------- 1 | const axios = require('axios'); 2 | const { cmd } = require('../command'); 3 | 4 | cmd({ 5 | pattern: "define", 6 | desc: "📖 Get the definition of a word", 7 | react: "🔍", 8 | category: "search", 9 | filename: __filename 10 | }, 11 | async (conn, mek, m, { from, q, reply }) => { 12 | try { 13 | if (!q) return reply("Please provide a word to define.\n\n📌 *Usage:* .define [word]"); 14 | 15 | const word = q.trim(); 16 | const url = `https://api.dictionaryapi.dev/api/v2/entries/en/${word}`; 17 | 18 | const response = await axios.get(url); 19 | const definitionData = response.data[0]; 20 | 21 | const definition = definitionData.meanings[0].definitions[0].definition; 22 | const example = definitionData.meanings[0].definitions[0].example || '❌ No example available'; 23 | const synonyms = definitionData.meanings[0].definitions[0].synonyms.join(', ') || '❌ No synonyms available'; 24 | const phonetics = definitionData.phonetics[0]?.text || '🔇 No phonetics available'; 25 | const audio = definitionData.phonetics[0]?.audio || null; 26 | 27 | const wordInfo = ` 28 | 📖 *Word*: *${definitionData.word}* 29 | 🗣️ *Pronunciation*: _${phonetics}_ 30 | 📚 *Definition*: ${definition} 31 | ✍️ *Example*: ${example} 32 | 📝 *Synonyms*: ${synonyms} 33 | 34 | 🔗 *©𝙿𝙾𝚆𝙴𝚁𝙴𝙳 𝙱𝚈 𝚃𝙾𝙷𝙸𝙳_𝙼𝙳*`; 35 | 36 | if (audio) { 37 | await conn.sendMessage(from, { audio: { url: audio }, mimetype: 'audio/mpeg' }, { quoted: mek }); 38 | } 39 | 40 | return reply(wordInfo); 41 | } catch (e) { 42 | console.error("❌ Error:", e); 43 | if (e.response && e.response.status === 404) { 44 | return reply("🚫 *Word not found.* Please check the spelling and try again."); 45 | } 46 | return reply("⚠️ An error occurred while fetching the definition. Please try again later."); 47 | } 48 | }); 49 | -------------------------------------------------------------------------------- /plugins/group-out.js: -------------------------------------------------------------------------------- 1 | const { cmd } = require('../command'); 2 | 3 | cmd({ 4 | pattern: "out", 5 | alias: ["ck", "🦶"], 6 | desc: "Removes all members with specific country code from the group", 7 | category: "admin", 8 | react: "❌", 9 | filename: __filename 10 | }, 11 | async (conn, mek, m, { 12 | from, q, isGroup, isBotAdmins, reply, groupMetadata, isCreator 13 | }) => { 14 | // Check if the command is used in a group 15 | if (!isGroup) return reply("❌ This command can only be used in groups."); 16 | 17 | // Check if the user is the bot owner/creator 18 | if (!isCreator) { 19 | return reply("❌ Only the bot owner can use this command."); 20 | } 21 | 22 | // Check if the bot is an admin 23 | if (!isBotAdmins) return reply("❌ I need to be an admin to use this command."); 24 | 25 | if (!q) return reply("❌ Please provide a country code. Example: .out 91"); 26 | 27 | const countryCode = q.trim(); 28 | if (!/^\d+$/.test(countryCode)) { 29 | return reply("❌ Invalid country code. Please provide only numbers (e.g., 91 for +91 numbers)"); 30 | } 31 | 32 | try { 33 | const participants = await groupMetadata.participants; 34 | const targets = participants.filter( 35 | participant => participant.id.startsWith(countryCode) && 36 | !participant.admin // Don't remove admins 37 | ); 38 | 39 | if (targets.length === 0) { 40 | return reply(`❌ No members found with country code +${countryCode}`); 41 | } 42 | 43 | const jids = targets.map(p => p.id); 44 | await conn.groupParticipantsUpdate(from, jids, "remove"); 45 | 46 | reply(`✅ Successfully removed ${targets.length} members with country code +${countryCode}`); 47 | } catch (error) { 48 | console.error("Out command error:", error); 49 | reply("❌ Failed to remove members. Error: " + error.message); 50 | } 51 | }); 52 | -------------------------------------------------------------------------------- /plugins/group-newgc.js: -------------------------------------------------------------------------------- 1 | //--------------------------------------------------------------------------- 2 | // KHAN_MD 3 | //--------------------------------------------------------------------------- 4 | // ⚠️ DO NOT MODIFY THIS FILE ⚠️ 5 | //--------------------------------------------------------------------------- 6 | const { cmd, commands } = require('../command'); 7 | const config = require('../config'); 8 | const prefix = config.PREFIX; 9 | const fs = require('fs'); 10 | const { getBuffer, getGroupAdmins, getRandom, h2k, isUrl, Json, sleep, fetchJson } = require('../lib/functions2'); 11 | const { writeFileSync } = require('fs'); 12 | const path = require('path'); 13 | 14 | cmd({ 15 | pattern: "newgc", 16 | category: "group", 17 | desc: "Create a new group and add participants.", 18 | filename: __filename, 19 | }, async (conn, mek, m, { from, isGroup, body, sender, groupMetadata, participants, reply }) => { 20 | try { 21 | if (!body) { 22 | return reply(`Usage: !newgc group_name;number1,number2,...`); 23 | } 24 | 25 | const [groupName, numbersString] = body.split(";"); 26 | 27 | if (!groupName || !numbersString) { 28 | return reply(`Usage: !newgc group_name;number1,number2,...`); 29 | } 30 | 31 | const participantNumbers = numbersString.split(",").map(number => `${number.trim()}@s.whatsapp.net`); 32 | 33 | const group = await conn.groupCreate(groupName, participantNumbers); 34 | console.log('created group with id: ' + group.id); // Use group.id here 35 | 36 | const inviteLink = await conn.groupInviteCode(group.id); // Use group.id to get the invite link 37 | 38 | await conn.sendMessage(group.id, { text: 'hello there' }); 39 | 40 | reply(`Group created successfully with invite link: https://chat.whatsapp.com/${inviteLink}\nWelcome message sent.`); 41 | } catch (e) { 42 | return reply(`*An error occurred while processing your request.*\n\n_Error:_ ${e.message}`); 43 | } 44 | }); 45 | 46 | 47 | -------------------------------------------------------------------------------- /data/sticker-converter.js: -------------------------------------------------------------------------------- 1 | const fs = require('fs'); 2 | const path = require('path'); 3 | const { execSync } = require('child_process'); 4 | const ffmpegPath = require('@ffmpeg-installer/ffmpeg').path; 5 | const ffmpeg = require('fluent-ffmpeg'); 6 | 7 | // Set ffmpeg path 8 | ffmpeg.setFfmpegPath(ffmpegPath); 9 | 10 | class StickerConverter { 11 | constructor() { 12 | this.tempDir = path.join(__dirname, '../temp'); 13 | this.ensureTempDir(); 14 | } 15 | 16 | ensureTempDir() { 17 | if (!fs.existsSync(this.tempDir)) { 18 | fs.mkdirSync(this.tempDir, { recursive: true }); 19 | } 20 | } 21 | 22 | async convertStickerToImage(stickerBuffer) { 23 | const tempPath = path.join(this.tempDir, `sticker_${Date.now()}.webp`); 24 | const outputPath = path.join(this.tempDir, `image_${Date.now()}.png`); 25 | 26 | try { 27 | // Save sticker to temp file 28 | await fs.promises.writeFile(tempPath, stickerBuffer); 29 | 30 | // Convert using fluent-ffmpeg (same as your video sticker converter) 31 | await new Promise((resolve, reject) => { 32 | ffmpeg(tempPath) 33 | .on('error', reject) 34 | .on('end', resolve) 35 | .output(outputPath) 36 | .run(); 37 | }); 38 | 39 | // Read and return converted image 40 | return await fs.promises.readFile(outputPath); 41 | } catch (error) { 42 | console.error('Conversion error:', error); 43 | throw new Error('Failed to convert sticker to image'); 44 | } finally { 45 | // Cleanup temp files 46 | await Promise.all([ 47 | fs.promises.unlink(tempPath).catch(() => {}), 48 | fs.promises.unlink(outputPath).catch(() => {}) 49 | ]); 50 | } 51 | } 52 | } 53 | 54 | module.exports = new StickerConverter(); 55 | -------------------------------------------------------------------------------- /plugins/gen-pass.js: -------------------------------------------------------------------------------- 1 | const crypto = require("crypto"); 2 | const { cmd } = require("../command"); 3 | 4 | cmd({ 5 | pattern: "gpass", 6 | desc: "Generate a strong password.", 7 | category: "other", 8 | react: '🔐', 9 | filename: __filename 10 | }, async (conn, m, store, { 11 | from, 12 | quoted, 13 | body, 14 | isCmd, 15 | command, 16 | args, 17 | q, 18 | isGroup, 19 | sender, 20 | senderNumber, 21 | botNumber2, 22 | botNumber, 23 | pushname, 24 | isMe, 25 | isOwner, 26 | groupMetadata, 27 | groupName, 28 | participants, 29 | groupAdmins, 30 | isBotAdmins, 31 | isAdmins, 32 | reply 33 | }) => { 34 | try { 35 | // Password length specified by the user, defaults to 12 if not provided 36 | const passwordLength = args[0] ? parseInt(args[0]) : 12; 37 | 38 | // Validate the password length 39 | if (isNaN(passwordLength) || passwordLength < 8) { 40 | return reply("❌ Please provide a valid length for the password (Minimum 8 Characters)."); 41 | } 42 | 43 | // Password generation function 44 | const generatePassword = (length) => { 45 | const chars = 'abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ0123456789!@#$%^&*()_+[]{}|;:,.<>?'; 46 | let password = ''; 47 | for (let i = 0; i < length; i++) { 48 | const randomIndex = crypto.randomInt(0, chars.length); 49 | password += chars[randomIndex]; 50 | } 51 | return password; 52 | }; 53 | 54 | // Generate the password 55 | const generatedPassword = generatePassword(passwordLength); 56 | 57 | // Send the message with the generated password 58 | await conn.sendMessage(from, { 59 | text: "🔐 *Your Strong Password* 🔐\n\nPlease find your generated password below:\n\n" + generatedPassword + "\n\n*Powered By JawadTechX*" 60 | }, { 61 | quoted: quoted 62 | }); 63 | 64 | } catch (error) { 65 | console.error(error); 66 | reply("❌ Error generating password: " + error.message); 67 | } 68 | }); -------------------------------------------------------------------------------- /plugins/tiktok-search.js: -------------------------------------------------------------------------------- 1 | const fetch = require("node-fetch"); 2 | const { cmd } = require("../command"); 3 | 4 | cmd({ 5 | pattern: "tiktoksearch", 6 | alias: ["tiktoks", "tiks"], 7 | desc: "Search for TikTok videos using a query.", 8 | react: '✅', 9 | category: 'tools', 10 | filename: __filename 11 | }, async (conn, m, store, { 12 | from, 13 | args, 14 | reply 15 | }) => { 16 | if (!args[0]) { 17 | return reply("🌸 What do you want to search on TikTok?\n\n*Usage Example:*\n.tiktoksearch "); 18 | } 19 | 20 | const query = args.join(" "); 21 | await store.react('⌛'); 22 | 23 | try { 24 | reply(`🔎 Searching TikTok for: *${query}*`); 25 | 26 | const response = await fetch(`https://apis-starlights-team.koyeb.app/starlight/tiktoksearch?text=${encodeURIComponent(query)}`); 27 | const data = await response.json(); 28 | 29 | if (!data || !data.data || data.data.length === 0) { 30 | await store.react('❌'); 31 | return reply("❌ No results found for your query. Please try with a different keyword."); 32 | } 33 | 34 | // Get up to 7 random results 35 | const results = data.data.slice(0, 7).sort(() => Math.random() - 0.5); 36 | 37 | for (const video of results) { 38 | const message = `🌸 *TikTok Video Result*:\n\n` 39 | + `*• Title*: ${video.title}\n` 40 | + `*• Author*: ${video.author || 'Unknown'}\n` 41 | + `*• Duration*: ${video.duration || "Unknown"}\n` 42 | + `*• URL*: ${video.link}\n\n`; 43 | 44 | if (video.nowm) { 45 | await conn.sendMessage(from, { 46 | video: { url: video.nowm }, 47 | caption: message 48 | }, { quoted: m }); 49 | } else { 50 | reply(`❌ Failed to retrieve video for *"${video.title}"*.`); 51 | } 52 | } 53 | 54 | await store.react('✅'); 55 | } catch (error) { 56 | console.error("Error in TikTokSearch command:", error); 57 | await store.react('❌'); 58 | reply("❌ An error occurred while searching TikTok. Please try again later."); 59 | } 60 | }); -------------------------------------------------------------------------------- /plugins/ttstalk-tool.js: -------------------------------------------------------------------------------- 1 | const axios = require("axios"); 2 | const { cmd } = require("../command"); 3 | 4 | cmd({ 5 | pattern: "tiktokstalk", 6 | alias: ["tstalk", "ttstalk"], 7 | react: "📱", 8 | desc: "Fetch TikTok user profile details.", 9 | category: "search", 10 | filename: __filename 11 | }, async (conn, m, store, { from, args, q, reply }) => { 12 | try { 13 | if (!q) { 14 | return reply("❎ Please provide a TikTok username.\n\n*Example:* .tiktokstalk mrbeast"); 15 | } 16 | 17 | const apiUrl = `https://api.siputzx.my.id/api/stalk/tiktok?username=${encodeURIComponent(q)}`; 18 | const { data } = await axios.get(apiUrl); 19 | 20 | if (!data.status) { 21 | return reply("❌ User not found. Please check the username and try again."); 22 | } 23 | 24 | const user = data.data.user; 25 | const stats = data.data.stats; 26 | 27 | const profileInfo = `🎭 *TikTok Profile Stalker* 🎭 28 | 29 | 👤 *Username:* @${user.uniqueId} 30 | 📛 *Nickname:* ${user.nickname} 31 | ✅ *Verified:* ${user.verified ? "Yes ✅" : "No ❌"} 32 | 📍 *Region:* ${user.region} 33 | 📝 *Bio:* ${user.signature || "No bio available."} 34 | 🔗 *Bio Link:* ${user.bioLink?.link || "No link available."} 35 | 36 | 📊 *Statistics:* 37 | 👥 *Followers:* ${stats.followerCount.toLocaleString()} 38 | 👤 *Following:* ${stats.followingCount.toLocaleString()} 39 | ❤️ *Likes:* ${stats.heartCount.toLocaleString()} 40 | 🎥 *Videos:* ${stats.videoCount.toLocaleString()} 41 | 42 | 📅 *Account Created:* ${new Date(user.createTime * 1000).toLocaleDateString()} 43 | 🔒 *Private Account:* ${user.privateAccount ? "Yes 🔒" : "No 🌍"} 44 | 45 | 🔗 *Profile URL:* https://www.tiktok.com/@${user.uniqueId} 46 | `; 47 | 48 | const profileImage = { image: { url: user.avatarLarger }, caption: profileInfo }; 49 | 50 | await conn.sendMessage(from, profileImage, { quoted: m }); 51 | } catch (error) { 52 | console.error("❌ Error in TikTok stalk command:", error); 53 | reply("⚠️ An error occurred while fetching TikTok profile data."); 54 | } 55 | }); 56 | 57 | -------------------------------------------------------------------------------- /plugins/fun-ship.js: -------------------------------------------------------------------------------- 1 | const axios = require("axios"); 2 | const fetch = require("node-fetch"); 3 | const { sleep } = require('../lib/functions'); 4 | const { cmd, commands } = require("../command"); 5 | const config = require("../config"); 6 | 7 | cmd({ 8 | pattern: "ship", 9 | alias: ["match", "love"], 10 | desc: "Randomly pairs the command user with another group member.", 11 | react: "❤️", 12 | category: "fun", 13 | filename: __filename 14 | }, async (conn, m, store, { from, isGroup, groupMetadata, reply, sender }) => { 15 | try { 16 | if (!isGroup) return reply("❌ This command can only be used in groups."); 17 | 18 | const specialNumber = config.DEV ? `${config.DEV}@s.whatsapp.net` : null; // Convert to WhatsApp format 19 | const participants = groupMetadata.participants.map(user => user.id); 20 | 21 | let randomPair; 22 | 23 | if (specialNumber && participants.includes(specialNumber) && sender !== specialNumber) { 24 | randomPair = specialNumber; // Always pair with this number if available 25 | } else { 26 | // Pair randomly but ensure user is not paired with themselves 27 | do { 28 | randomPair = participants[Math.floor(Math.random() * participants.length)]; 29 | } while (randomPair === sender); 30 | } 31 | 32 | const message = `💘 *Match Found!* 💘\n❤️ @${sender.split("@")[0]} + @${randomPair.split("@")[0]}\n💖 Congratulations! 🎉`; 33 | 34 | await conn.sendMessage(from, { 35 | text: message, 36 | contextInfo: { 37 | mentionedJid: [sender, randomPair], 38 | forwardingScore: 999, 39 | isForwarded: true, 40 | forwardedNewsletterMessageInfo: { 41 | newsletterJid: "©𝙿𝙾𝚆𝙴𝚁𝙴𝙳 𝙱𝚈 𝚃𝙾𝙷𝙸𝙳_𝙼𝙳", 42 | newsletterName: "𝐓𝐎𝐇𝐈𝐃 𝐓𝐄𝐂𝐇 🤖", 43 | serverMessageId: 143 44 | } 45 | } 46 | }); 47 | 48 | } catch (error) { 49 | console.error("❌ Error in ship command:", error); 50 | reply("⚠️ An error occurred while processing the command. Please try again."); 51 | } 52 | }); 53 | -------------------------------------------------------------------------------- /plugins/fun-etc.js: -------------------------------------------------------------------------------- 1 | const axios = require("axios"); 2 | const { cmd } = require("../command"); 3 | const { fetchGif, gifToVideo } = require("../lib/fetchGif"); 4 | 5 | cmd({ 6 | pattern: "marige", 7 | alias: ["shadi", "marriage", "wedding"], 8 | desc: "Randomly pairs two users for marriage with a wedding GIF", 9 | react: "💍", 10 | category: "fun", 11 | filename: __filename 12 | }, async (conn, mek, store, { isGroup, groupMetadata, reply, sender }) => { 13 | try { 14 | if (!isGroup) return reply("❌ This command can only be used in groups!"); 15 | 16 | const participants = groupMetadata.participants.map(user => user.id); 17 | 18 | // Filter out the sender and bot number if needed 19 | const eligibleParticipants = participants.filter(id => id !== sender && !id.includes(conn.user.id.split('@')[0])); 20 | 21 | if (eligibleParticipants.length < 1) { 22 | return reply("❌ Not enough participants to perform a marriage!"); 23 | } 24 | 25 | // Select random pair 26 | const randomIndex = Math.floor(Math.random() * eligibleParticipants.length); 27 | const randomPair = eligibleParticipants[randomIndex]; 28 | 29 | // Fetch wedding GIF 30 | const apiUrl = "https://api.waifu.pics/sfw/hug"; // Using kiss as wedding GIF 31 | let res = await axios.get(apiUrl); 32 | let gifUrl = res.data.url; 33 | 34 | let gifBuffer = await fetchGif(gifUrl); 35 | let videoBuffer = await gifToVideo(gifBuffer); 36 | 37 | const message = `💍 *Shadi Mubarak!* 💒\n\n👰 @${sender.split("@")[0]} + 🤵 @${randomPair.split("@")[0]}\n\nMay you both live happily ever after! 💖`; 38 | 39 | await conn.sendMessage( 40 | mek.chat, 41 | { 42 | video: videoBuffer, 43 | caption: message, 44 | gifPlayback: true, 45 | mentions: [sender, randomPair] 46 | }, 47 | { quoted: mek } 48 | ); 49 | 50 | } catch (error) { 51 | console.error("❌ Error in .marige command:", error); 52 | reply(`❌ *Error in .marige command:*\n\`\`\`${error.message}\`\`\``); 53 | } 54 | }); 55 | -------------------------------------------------------------------------------- /plugins/group-join.js: -------------------------------------------------------------------------------- 1 | const config = require('../config') 2 | const { cmd, commands } = require('../command') 3 | const { getBuffer, getGroupAdmins, getRandom, h2k, isUrl, Json, runtime, sleep, fetchJson } = require('../lib/functions') 4 | 5 | cmd({ 6 | pattern: "join", 7 | react: "📬", 8 | alias: ["joinme", "f_join"], 9 | desc: "To Join a Group from Invite link", 10 | category: "group", 11 | use: '.join < Group Link >', 12 | filename: __filename 13 | }, async (conn, mek, m, { from, l, quoted, body, isCmd, command, args, q, isGroup, sender, senderNumber, botNumber2, botNumber, pushname, isMe, isOwner, groupMetadata, groupName, participants, groupAdmins, isBotAdmins, isCreator, isDev, isAdmins, reply }) => { 14 | try { 15 | const msr = { 16 | own_cmd: "You don't have permission to use this command." 17 | }; 18 | 19 | // Only allow the creator to use the command 20 | if (!isCreator) return reply(msr.own_cmd); 21 | 22 | // If there's no input, check if the message is a reply with a link 23 | if (!q && !quoted) return reply("*Please write the Group Link*️ 🖇️"); 24 | 25 | let groupLink; 26 | 27 | // If the message is a reply to a group invite link 28 | if (quoted && quoted.type === 'conversation' && isUrl(quoted.text)) { 29 | groupLink = quoted.text.split('https://chat.whatsapp.com/')[1]; 30 | } else if (q && isUrl(q)) { 31 | // If the user provided the link in the command 32 | groupLink = q.split('https://chat.whatsapp.com/')[1]; 33 | } 34 | 35 | if (!groupLink) return reply("❌ *Invalid Group Link* 🖇️"); 36 | 37 | // Accept the group invite 38 | await conn.groupAcceptInvite(groupLink); 39 | await conn.sendMessage(from, { text: `✔️ *Successfully Joined*` }, { quoted: mek }); 40 | 41 | } catch (e) { 42 | await conn.sendMessage(from, { react: { text: '❌', key: mek.key } }); 43 | console.log(e); 44 | reply(`❌ *Error Occurred!!*\n\n${e}`); 45 | } 46 | }); 47 | -------------------------------------------------------------------------------- /plugins/anti-vv.js: -------------------------------------------------------------------------------- 1 | const { cmd } = require("../command"); 2 | 3 | cmd({ 4 | pattern: "vv", 5 | alias: ["viewonce", 'retrive'], 6 | react: '🐳', 7 | desc: "Owner Only - retrieve quoted message back to user", 8 | category: "owner", 9 | filename: __filename 10 | }, async (client, message, match, { from, isCreator }) => { 11 | try { 12 | if (!isCreator) { 13 | return await client.sendMessage(from, { 14 | text: "*📛 This is an owner command.*" 15 | }, { quoted: message }); 16 | } 17 | 18 | if (!match.quoted) { 19 | return await client.sendMessage(from, { 20 | text: "*🍁 Please reply to a view once message!*" 21 | }, { quoted: message }); 22 | } 23 | 24 | const buffer = await match.quoted.download(); 25 | const mtype = match.quoted.mtype; 26 | const options = { quoted: message }; 27 | 28 | let messageContent = {}; 29 | switch (mtype) { 30 | case "imageMessage": 31 | messageContent = { 32 | image: buffer, 33 | caption: match.quoted.text || '', 34 | mimetype: match.quoted.mimetype || "image/jpeg" 35 | }; 36 | break; 37 | case "videoMessage": 38 | messageContent = { 39 | video: buffer, 40 | caption: match.quoted.text || '', 41 | mimetype: match.quoted.mimetype || "video/mp4" 42 | }; 43 | break; 44 | case "audioMessage": 45 | messageContent = { 46 | audio: buffer, 47 | mimetype: "audio/mp4", 48 | ptt: match.quoted.ptt || false 49 | }; 50 | break; 51 | default: 52 | return await client.sendMessage(from, { 53 | text: "❌ Only image, video, and audio messages are supported" 54 | }, { quoted: message }); 55 | } 56 | 57 | await client.sendMessage(from, messageContent, options); 58 | } catch (error) { 59 | console.error("vv Error:", error); 60 | await client.sendMessage(from, { 61 | text: "❌ Error fetching vv message:\n" + error.message 62 | }, { quoted: message }); 63 | } 64 | }); 65 | -------------------------------------------------------------------------------- /lib/fetchGif.js: -------------------------------------------------------------------------------- 1 | const axios = require('axios'); 2 | const fs = require('fs'); 3 | const path = require('path'); 4 | const { tmpdir } = require('os'); 5 | const Crypto = require('crypto'); 6 | const ffmpeg = require('fluent-ffmpeg'); 7 | const ffmpegPath = require('@ffmpeg-installer/ffmpeg').path; 8 | 9 | ffmpeg.setFfmpegPath(ffmpegPath); 10 | 11 | /** 12 | * Fetch a GIF from a given API URL. 13 | * @param {string} url - The API endpoint to fetch the GIF. 14 | * @returns {Promise} - The GIF buffer. 15 | */ 16 | async function fetchGif(url) { 17 | try { 18 | const response = await axios.get(url, { responseType: 'arraybuffer' }); 19 | return response.data; 20 | } catch (error) { 21 | console.error("❌ Error fetching GIF:", error); 22 | throw new Error("Could not fetch GIF."); 23 | } 24 | } 25 | 26 | /** 27 | * Converts a GIF buffer to a video buffer. 28 | * @param {Buffer} gifBuffer - The GIF buffer. 29 | * @returns {Promise} - The MP4 video buffer. 30 | */ 31 | async function gifToVideo(gifBuffer) { 32 | const filename = Crypto.randomBytes(6).toString('hex'); 33 | const gifPath = path.join(tmpdir(), `${filename}.gif`); 34 | const mp4Path = path.join(tmpdir(), `${filename}.mp4`); 35 | 36 | fs.writeFileSync(gifPath, gifBuffer); 37 | 38 | await new Promise((resolve, reject) => { 39 | ffmpeg(gifPath) 40 | .outputOptions([ 41 | "-movflags faststart", 42 | "-pix_fmt yuv420p", 43 | "-vf scale=trunc(iw/2)*2:trunc(ih/2)*2" 44 | ]) 45 | .on("error", (err) => { 46 | console.error("❌ ffmpeg conversion error:", err); 47 | reject(new Error("Could not process GIF to video.")); 48 | }) 49 | .on("end", resolve) 50 | .save(mp4Path); 51 | }); 52 | 53 | const videoBuffer = fs.readFileSync(mp4Path); 54 | fs.unlinkSync(gifPath); 55 | fs.unlinkSync(mp4Path); 56 | 57 | return videoBuffer; 58 | } 59 | 60 | module.exports = { fetchGif, gifToVideo }; 61 | 62 | -------------------------------------------------------------------------------- /plugins/antilink-kick.js: -------------------------------------------------------------------------------- 1 | const { cmd } = require('../command'); 2 | const config = require("../config"); 3 | 4 | // Anti-Link System 5 | const linkPatterns = [ 6 | /https?:\/\/(?:chat\.whatsapp\.com|wa\.me)\/\S+/gi, 7 | /^https?:\/\/(www\.)?whatsapp\.com\/channel\/([a-zA-Z0-9_-]+)$/, 8 | /wa\.me\/\S+/gi, 9 | /https?:\/\/(?:t\.me|telegram\.me)\/\S+/gi, 10 | /https?:\/\/(?:www\.)?youtube\.com\/\S+/gi, 11 | /https?:\/\/youtu\.be\/\S+/gi, 12 | /https?:\/\/(?:www\.)?facebook\.com\/\S+/gi, 13 | /https?:\/\/fb\.me\/\S+/gi, 14 | /https?:\/\/(?:www\.)?instagram\.com\/\S+/gi, 15 | /https?:\/\/(?:www\.)?twitter\.com\/\S+/gi, 16 | /https?:\/\/(?:www\.)?tiktok\.com\/\S+/gi, 17 | /https?:\/\/(?:www\.)?linkedin\.com\/\S+/gi, 18 | /https?:\/\/(?:www\.)?snapchat\.com\/\S+/gi, 19 | /https?:\/\/(?:www\.)?pinterest\.com\/\S+/gi, 20 | /https?:\/\/(?:www\.)?reddit\.com\/\S+/gi, 21 | /https?:\/\/ngl\/\S+/gi, 22 | /https?:\/\/(?:www\.)?discord\.com\/\S+/gi, 23 | /https?:\/\/(?:www\.)?twitch\.tv\/\S+/gi, 24 | /https?:\/\/(?:www\.)?vimeo\.com\/\S+/gi, 25 | /https?:\/\/(?:www\.)?dailymotion\.com\/\S+/gi, 26 | /https?:\/\/(?:www\.)?medium\.com\/\S+/gi 27 | ]; 28 | 29 | cmd({ 30 | 'on': "body" 31 | }, async (conn, m, store, { 32 | from, 33 | body, 34 | sender, 35 | isGroup, 36 | isAdmins, 37 | isBotAdmins, 38 | reply 39 | }) => { 40 | try { 41 | if (!isGroup || isAdmins || !isBotAdmins) { 42 | return; 43 | } 44 | 45 | const containsLink = linkPatterns.some(pattern => pattern.test(body)); 46 | 47 | if (containsLink && config.ANTI_LINK_KICK === 'true') { 48 | await conn.sendMessage(from, { 'delete': m.key }, { 'quoted': m }); 49 | await conn.sendMessage(from, { 50 | 'text': `⚠️ Links are not allowed in this group.\n@${sender.split('@')[0]} has been removed. 🚫`, 51 | 'mentions': [sender] 52 | }, { 'quoted': m }); 53 | 54 | await conn.groupParticipantsUpdate(from, [sender], "remove"); 55 | } 56 | } catch (error) { 57 | console.error(error); 58 | reply("An error occurred while processing the message."); 59 | } 60 | }); 61 | -------------------------------------------------------------------------------- /plugins/tool-vfc.js: -------------------------------------------------------------------------------- 1 | const fs = require('fs'); 2 | const config = require('../config') 3 | const { cmd, commands } = require('../command') 4 | const { getBuffer, getGroupAdmins, getRandom, h2k, isUrl, Json, runtime, sleep, fetchJson} = require('../lib/functions') 5 | 6 | 7 | 8 | //vcf// 9 | 10 | cmd({ 11 | pattern: 'savecontact', 12 | alias: ["vcf","scontact","savecontacts"], 13 | desc: 'gc vcard', 14 | category: 'tools', 15 | filename: __filename 16 | }, async (conn, mek, m, { from, quoted, body, isCmd, command, args, isGroup, sender, senderNumber, botNumber2, botNumber, pushname, isMe, isOwner, groupMetadata, groupName, participants, groupAdmins, isBotAdmins, isAdmins, reply }) => { 17 | try { 18 | if (!isGroup) return reply("This command is for groups only."); 19 | if (!isOwner) return reply("*_This command is for the owner only_*"); 20 | 21 | let card = quoted || m; // Handle if quoted message exists 22 | let cmiggc = groupMetadata; 23 | const { participants } = groupMetadata; 24 | 25 | let orgiggc = participants.map(a => a.id); 26 | let vcard = ''; 27 | let noPort = 0; 28 | 29 | for (let a of cmiggc.participants) { 30 | vcard += `BEGIN:VCARD\nVERSION:3.0\nFN:[${noPort++}] +${a.id.split("@")[0]}\nTEL;type=CELL;type=VOICE;waid=${a.id.split("@")[0]}:+${a.id.split("@")[0]}\nEND:VCARD\n`; 31 | } 32 | 33 | let nmfilect = './TohidMd.vcf'; 34 | reply('Saving ' + cmiggc.participants.length + ' participants contact'); 35 | 36 | fs.writeFileSync(nmfilect, vcard.trim()); 37 | await sleep(2000); 38 | 39 | await conn.sendMessage(from, { 40 | document: fs.readFileSync(nmfilect), 41 | mimetype: 'text/vcard', 42 | fileName: 'TohidMd.vcf', 43 | caption: `\nDone saving.\nGroup Name: *${cmiggc.subject}*\nContacts: *${cmiggc.participants.length}*\n> ©𝙿𝙾𝚆𝙴𝚁𝙴𝙳 𝙱𝚈 𝚃𝙾𝙷𝙸𝙳_𝙼𝙳`}, { quoted: mek }); 44 | 45 | fs.unlinkSync(nmfilect); // Cleanup the file after sending 46 | } catch (err) { 47 | reply(err.toString()); 48 | } 49 | }); 50 | 51 | 52 | -------------------------------------------------------------------------------- /plugins/tts-trt.js: -------------------------------------------------------------------------------- 1 | const axios = require('axios'); 2 | const config = require('../config') 3 | const {cmd , commands} = require('../command') 4 | const googleTTS = require('google-tts-api') 5 | 6 | cmd({ 7 | pattern: "trt", 8 | alias: ["translate"], 9 | desc: "🌍 Translate text between languages", 10 | react: "⚡", 11 | category: "other", 12 | filename: __filename 13 | }, 14 | async (conn, mek, m, { from, q, reply }) => { 15 | try { 16 | const args = q.split(' '); 17 | if (args.length < 2) return reply("❗ Please provide a language code and text. Usage: .translate [language code] [text]"); 18 | 19 | const targetLang = args[0]; 20 | const textToTranslate = args.slice(1).join(' '); 21 | 22 | const url = `https://api.mymemory.translated.net/get?q=${encodeURIComponent(textToTranslate)}&langpair=en|${targetLang}`; 23 | 24 | const response = await axios.get(url); 25 | const translation = response.data.responseData.translatedText; 26 | 27 | const translationMessage = `> *TOHID_MD-TRANSLATION* 28 | 29 | > 🔤 *Original*: ${textToTranslate} 30 | 31 | > 🔠 *Translated*: ${translation} 32 | 33 | > 🌐 *Language*: ${targetLang.toUpperCase()}`; 34 | 35 | return reply(translationMessage); 36 | } catch (e) { 37 | console.log(e); 38 | return reply("⚠️ An error occurred data while translating the your text. Please try again later🤕"); 39 | } 40 | }); 41 | 42 | //____________________________TTS___________________________ 43 | cmd({ 44 | pattern: "tts", 45 | desc: "download songs", 46 | category: "download", 47 | react: "👧", 48 | filename: __filename 49 | }, 50 | async(conn, mek, m,{from, quoted, body, isCmd, command, args, q, isGroup, sender, senderNumber, botNumber2, botNumber, pushname, isMe, isOwner, groupMetadata, groupName, participants, groupAdmins, isBotAdmins, isAdmins, reply}) => { 51 | try{ 52 | if(!q) return reply("Need some text.") 53 | const url = googleTTS.getAudioUrl(q, { 54 | lang: 'hi-IN', 55 | slow: false, 56 | host: 'https://translate.google.com', 57 | }) 58 | await conn.sendMessage(from, { audio: { url: url }, mimetype: 'audio/mpeg', ptt: true }, { quoted: mek }) 59 | }catch(a){ 60 | reply(`${a}`) 61 | } 62 | }) 63 | -------------------------------------------------------------------------------- /plugins/npm-search.js: -------------------------------------------------------------------------------- 1 | const axios = require("axios"); 2 | const { cmd } = require("../command"); 3 | 4 | cmd({ 5 | pattern: "npm", 6 | desc: "Search for a package on npm.", 7 | react: '📦', 8 | category: "convert", 9 | filename: __filename, 10 | use: ".npm " 11 | }, async (conn, mek, msg, { from, args, reply }) => { 12 | try { 13 | // Check if a package name is provided 14 | if (!args.length) { 15 | return reply("Please provide the name of the npm package you want to search for. Example: .npm express"); 16 | } 17 | 18 | const packageName = args.join(" "); 19 | const apiUrl = `https://registry.npmjs.org/${encodeURIComponent(packageName)}`; 20 | 21 | // Fetch package details from npm registry 22 | const response = await axios.get(apiUrl); 23 | if (response.status !== 200) { 24 | throw new Error("Package not found or an error occurred."); 25 | } 26 | 27 | const packageData = response.data; 28 | const latestVersion = packageData["dist-tags"].latest; 29 | const description = packageData.description || "No description available."; 30 | const npmUrl = `https://www.npmjs.com/package/${packageName}`; 31 | const license = packageData.license || "Unknown"; 32 | const repository = packageData.repository ? packageData.repository.url : "Not available"; 33 | 34 | // Create the response message 35 | const message = ` 36 | *TOHID_MD NPM SEARCH* 37 | 38 | *🔰 NPM PACKAGE:* ${packageName} 39 | *📄 DESCRIPTION:* ${description} 40 | *⏸️ LAST VERSION:* ${latestVersion} 41 | *🪪 LICENSE:* ${license} 42 | *🪩 REPOSITORY:* ${repository} 43 | *🔗 NPM URL:* ${npmUrl} 44 | `; 45 | 46 | // Send the message 47 | await conn.sendMessage(from, { text: message }, { quoted: mek }); 48 | 49 | } catch (error) { 50 | console.error("Error:", error); 51 | 52 | // Send detailed error logs to WhatsApp 53 | const errorMessage = ` 54 | *❌ NPM Command Error Logs* 55 | 56 | *Error Message:* ${error.message} 57 | *Stack Trace:* ${error.stack || "Not available"} 58 | *Timestamp:* ${new Date().toISOString()} 59 | `; 60 | 61 | await conn.sendMessage(from, { text: errorMessage }, { quoted: mek }); 62 | reply("An error occurred while fetching the npm package details."); 63 | } 64 | }); 65 | -------------------------------------------------------------------------------- /plugins/group-link.js: -------------------------------------------------------------------------------- 1 | const { cmd, commands } = require('../command'); 2 | const config = require('../config'); 3 | const prefix = config.PREFIX; 4 | const fs = require('fs'); 5 | const { getBuffer, getGroupAdmins, getRandom, h2k, isUrl, Json, sleep, fetchJson } = require('../lib/functions2'); 6 | const { writeFileSync } = require('fs'); 7 | const path = require('path'); 8 | 9 | cmd({ 10 | pattern: "invite", 11 | alias: ["glink", "grouplink"], 12 | desc: "Get group invite link.", 13 | category: "group", // Already group 14 | filename: __filename, 15 | }, async (conn, mek, m, { from, quoted, body, args, q, isGroup, sender, reply }) => { 16 | try { 17 | // Ensure this is being used in a group 18 | if (!isGroup) return reply("𝐓𝐡𝐢𝐬 𝐅𝐞𝐚𝐭𝐮𝐫𝐞 𝐈𝐬 𝐎𝐧𝐥𝐲 𝐅𝐨𝐫 𝐆𝐫𝐨𝐮𝐩❗"); 19 | 20 | // Get the sender's number 21 | const senderNumber = sender.split('@')[0]; 22 | const botNumber = conn.user.id.split(':')[0]; 23 | 24 | // Check if the bot is an admin 25 | const groupMetadata = isGroup ? await conn.groupMetadata(from) : ''; 26 | const groupAdmins = groupMetadata ? groupMetadata.participants.filter(member => member.admin) : []; 27 | const isBotAdmins = isGroup ? groupAdmins.some(admin => admin.id === botNumber + '@s.whatsapp.net') : false; 28 | 29 | if (!isBotAdmins) return reply("𝐏𝐥𝐞𝐚𝐬𝐞 𝐏𝐫𝐨𝐯𝐢𝐝𝐞 𝐌𝐞 𝐀𝐝𝐦𝐢𝐧 𝐑𝐨𝐥𝐞 ❗"); 30 | 31 | // Check if the sender is an admin 32 | const isAdmins = isGroup ? groupAdmins.some(admin => admin.id === sender) : false; 33 | if (!isAdmins) return reply("𝐏𝐥𝐞𝐚𝐬𝐞 𝐏𝐫𝐨𝐯𝐢𝐝𝐞 𝐌𝐞 𝐀𝐝𝐦𝐢𝐧 𝐑𝐨𝐥𝐞 ❗"); 34 | 35 | // Get the invite code and generate the link 36 | const inviteCode = await conn.groupInviteCode(from); 37 | if (!inviteCode) return reply("Failed to retrieve the invite code."); 38 | 39 | const inviteLink = `https://chat.whatsapp.com/${inviteCode}`; 40 | 41 | // Reply with the invite link 42 | return reply(`*Here is your group invite link:*\n${inviteLink}`); 43 | 44 | } catch (error) { 45 | console.error("Error in invite command:", error); 46 | reply(`An error occurred: ${error.message || "Unknown error"}`); 47 | } 48 | }); 49 | 50 | -------------------------------------------------------------------------------- /plugins/tag-admins.js: -------------------------------------------------------------------------------- 1 | const config = require('../config') 2 | const { cmd, commands } = require('../command') 3 | const { getBuffer, getGroupAdmins, getRandom, h2k, isUrl, Json, runtime, sleep, fetchJson} = require('../lib/functions') 4 | 5 | cmd({ 6 | pattern: "tagadmins", 7 | react: "👑", 8 | alias: ["gc_tagadmins"], 9 | desc: "To Tag all Admins of the Group", 10 | category: "group", 11 | use: '.tagadmins [message]', 12 | filename: __filename 13 | }, 14 | async (conn, mek, m, { from, participants, reply, isGroup, senderNumber, groupAdmins, prefix, command, args, body }) => { 15 | try { 16 | if (!isGroup) return reply("❌ This command can only be used in groups."); 17 | 18 | const botOwner = conn.user.id.split(":")[0]; // Extract bot owner's number 19 | const senderJid = senderNumber + "@s.whatsapp.net"; 20 | 21 | // Ensure group metadata is fetched properly 22 | let groupInfo = await conn.groupMetadata(from).catch(() => null); 23 | if (!groupInfo) return reply("❌ Failed to fetch group information."); 24 | 25 | let groupName = groupInfo.subject || "Unknown Group"; 26 | let admins = await getGroupAdmins(participants); 27 | let totalAdmins = admins ? admins.length : 0; 28 | if (totalAdmins === 0) return reply("❌ No admins found in this group."); 29 | 30 | let emojis = ['👑', '⚡', '🌟', '✨', '🎖️', '💎', '🔱', '🛡️', '🚀', '🏆']; 31 | let randomEmoji = emojis[Math.floor(Math.random() * emojis.length)]; 32 | 33 | // Proper message extraction 34 | let message = body.slice(body.indexOf(command) + command.length).trim(); 35 | if (!message) message = "Attention Admins"; // Default message 36 | 37 | let teks = `▢ Group : *${groupName}*\n▢ Admins : *${totalAdmins}*\n▢ Message: *${message}*\n\n┌───⊷ *ADMIN MENTIONS*\n`; 38 | 39 | for (let admin of admins) { 40 | if (!admin) continue; // Prevent undefined errors 41 | teks += `${randomEmoji} @${admin.split('@')[0]}\n`; 42 | } 43 | 44 | teks += "└──✪ TOHID ┃ MD ✪──"; 45 | 46 | conn.sendMessage(from, { text: teks, mentions: admins }, { quoted: mek }); 47 | 48 | } catch (e) { 49 | console.error("TagAdmins Error:", e); 50 | reply(`❌ *Error Occurred !!*\n\n${e.message || e}`); 51 | } 52 | }); 53 | -------------------------------------------------------------------------------- /plugins/group-kick.js: -------------------------------------------------------------------------------- 1 | const config = require('../config'); 2 | const { cmd } = require('../command'); 3 | 4 | cmd({ 5 | pattern: "kick", 6 | alias: ["k", "💀"], 7 | desc: "Removes a participant by replying to or mentioning their message. (Admins can also be kicked)", 8 | react: "🚪", 9 | category: "group", 10 | filename: __filename, 11 | }, async (conn, mek, m, { 12 | from, 13 | quoted, 14 | isGroup, 15 | isAdmins, 16 | isOwner, 17 | participants, 18 | isBotAdmins, 19 | reply 20 | }) => { 21 | try { 22 | // Check if the command is used in a group 23 | if (!isGroup) return reply("❌ This command can only be used in groups."); 24 | // Only admins or the owner can use this command 25 | if (!isAdmins && !isOwner) return reply("*📛 σɴℓʏ gʀσᴜᴘ α∂мιɴs σʀ тнє σωɴєʀ ᴄαɴ ᴜsє тнιѕ ᴄσммαɴ∂.*"); 26 | // Check if the bot has admin privileges 27 | if (!isBotAdmins) return reply("*📛 ι ɴєє∂ тσ вє αɴ α∂мιɴ тσ кι¢к мємвєʀs.*"); 28 | 29 | // Determine the target user using reply or mention 30 | let target; 31 | if (m.quoted) { 32 | target = m.quoted.sender; 33 | } else if (m.mentionedJid && m.mentionedJid.length > 0) { 34 | target = m.mentionedJid[0]; 35 | } else if (m.msg && m.msg.contextInfo && m.msg.contextInfo.mentionedJid && m.msg.contextInfo.mentionedJid.length > 0) { 36 | target = m.msg.contextInfo.mentionedJid[0]; 37 | } 38 | 39 | if (!target) { 40 | return reply("❌ Please mention or reply to the message of the participant to remove."); 41 | } 42 | 43 | // Remove the participant from the group (admins can also be kicked) 44 | await conn.groupParticipantsUpdate(from, [target], "remove") 45 | .catch(err => { 46 | console.error(`⚠️ Failed to remove ${target}:`, err); 47 | return reply("❌ An error occurred while trying to remove the participant."); 48 | }); 49 | 50 | // Extraire le tag à partir du JID (ex: "1234567890" sans "@s.whatsapp.net") 51 | const tag = target.split('@')[0]; 52 | reply(`*@${tag} кι¢кє∂ ѕᴜᴄᴄєѕѕfᴜℓℓу!*`, { mentions: [target] }); 53 | } catch (error) { 54 | console.error('Error while executing kick:', error); 55 | reply('❌ An error occurred while executing the command.'); 56 | } 57 | }); 58 | -------------------------------------------------------------------------------- /plugins/mention-reply.js: -------------------------------------------------------------------------------- 1 | const config = require('../config'); 2 | const { cmd } = require('../command'); 3 | const axios = require('axios'); 4 | 5 | cmd({ 6 | on: "body" 7 | }, async (conn, m, { isGroup }) => { 8 | try { 9 | if (config.MENTION_REPLY !== 'true' || !isGroup) return; 10 | if (!m.mentionedJid || m.mentionedJid.length === 0) return; 11 | 12 | const voiceClips = [ 13 | "https://cdn.ironman.my.id/i/7p5plg.mp4", 14 | "https://cdn.ironman.my.id/i/l4dyvg.mp4", 15 | "https://cdn.ironman.my.id/i/4z93dg.mp4", 16 | "https://cdn.ironman.my.id/i/m9gwk0.mp4", 17 | "https://cdn.ironman.my.id/i/gr1jjc.mp4", 18 | "https://cdn.ironman.my.id/i/lbr8of.mp4", 19 | "https://cdn.ironman.my.id/i/0z95mz.mp4", 20 | "https://cdn.ironman.my.id/i/rldpwy.mp4", 21 | "https://cdn.ironman.my.id/i/lz2z87.mp4", 22 | "https://cdn.ironman.my.id/i/gg5jct.mp4" 23 | ]; 24 | 25 | const randomClip = voiceClips[Math.floor(Math.random() * voiceClips.length)]; 26 | const botNumber = conn.user.id.split(":")[0] + '@s.whatsapp.net'; 27 | 28 | if (m.mentionedJid.includes(botNumber)) { 29 | const thumbnailRes = await axios.get(config.MENU_IMAGE_URL || "https://i.ibb.co/4ZSYvPTq/lordali.jpg", { 30 | responseType: 'arraybuffer' 31 | }); 32 | const thumbnailBuffer = Buffer.from(thumbnailRes.data, 'binary'); 33 | 34 | await conn.sendMessage(m.chat, { 35 | audio: { url: randomClip }, 36 | mimetype: 'audio/mp4', 37 | ptt: true, 38 | waveform: [99, 0, 99, 0, 99], 39 | contextInfo: { 40 | forwardingScore: 999, 41 | isForwarded: true, 42 | externalAdReply: { 43 | title: config.BOT_NAME || "TOHID_MD 🥀", 44 | body: config.DESCRIPTION || "POWERED BY TOHID_MD🤌💗", 45 | mediaType: 1, 46 | renderLargerThumbnail: true, 47 | thumbnail: thumbnailBuffer, 48 | mediaUrl: "https://files.catbox.moe/l2t3e0.jpg", // Static image URL 49 | sourceUrl: "https://wa.me/message/O6KWTGOGTVTYO1", 50 | showAdAttribution: true 51 | } 52 | } 53 | }, { quoted: m }); 54 | } 55 | } catch (e) { 56 | console.error(e); 57 | const ownerJid = conn.user.id.split(":")[0] + "@s.whatsapp.net"; 58 | await conn.sendMessage(ownerJid, { 59 | text: `*Bot Error in Mention Handler:*\n${e.message}` 60 | }); 61 | } 62 | }); 63 | -------------------------------------------------------------------------------- /plugins/group-info.js: -------------------------------------------------------------------------------- 1 | const config = require('../config') 2 | const { cmd } = require('../command') 3 | const { getBuffer, getGroupAdmins, getRandom, h2k, isUrl, Json, runtime, sleep } = require('../lib/functions') 4 | 5 | cmd({ 6 | pattern: "ginfo", 7 | react: "🥏", 8 | alias: ["groupinfo"], 9 | desc: "Get group information.", 10 | category: "group", 11 | use: '.ginfo', 12 | filename: __filename 13 | }, 14 | async (conn, mek, m, { 15 | from, quoted, isCmd, isGroup, sender, isBotAdmins, 16 | isAdmins, isDev, reply, groupMetadata, participants 17 | }) => { 18 | try { 19 | // Requirements 20 | if (!isGroup) return reply(`❌ This command only works in group chats.`); 21 | if (!isAdmins && !isDev) return reply(`⛔ Only *Group Admins* or *Bot Dev Mr Tohid* can use this.`); 22 | if (!isBotAdmins) return reply(`❌ I need *admin* rights to fetch group details.`); 23 | 24 | const fallbackPpUrls = [ 25 | 'https://i.ibb.co/KhYC4FY/1221bc0bdd2354b42b293317ff2adbcf-icon.png', 26 | 'https://i.ibb.co/KhYC4FY/1221bc0bdd2354b42b293317ff2adbcf-icon.png', 27 | ]; 28 | let ppUrl; 29 | try { 30 | ppUrl = await conn.profilePictureUrl(from, 'image'); 31 | } catch { 32 | ppUrl = fallbackPpUrls[Math.floor(Math.random() * fallbackPpUrls.length)]; 33 | } 34 | 35 | const metadata = await conn.groupMetadata(from); 36 | const groupAdmins = participants.filter(p => p.admin); 37 | const listAdmin = groupAdmins.map((v, i) => `${i + 1}. @${v.id.split('@')[0]}`).join('\n'); 38 | const owner = metadata.owner || groupAdmins[0]?.id || "unknown"; 39 | 40 | const gdata = `*「 Group Information 」*\n 41 | *Group Name* : ${metadata.subject} 42 | *Group ID* : ${metadata.id} 43 | *Participants* : ${metadata.size} 44 | *Group Creator* : @${owner.split('@')[0]} 45 | *Description* : ${metadata.desc?.toString() || 'No description'}\n 46 | *Admins (${groupAdmins.length})*:\n${listAdmin}` 47 | 48 | await conn.sendMessage(from, { 49 | image: { url: ppUrl }, 50 | caption: gdata, 51 | mentions: groupAdmins.map(v => v.id).concat([owner]) 52 | }, { quoted: mek }); 53 | 54 | } catch (e) { 55 | console.error(e); 56 | await conn.sendMessage(from, { react: { text: '❌', key: mek.key } }); 57 | reply(`❌ An error occurred:\n\n${e}`); 58 | } 59 | }); 60 | -------------------------------------------------------------------------------- /plugins/tool-cinfo.js: -------------------------------------------------------------------------------- 1 | const { cmd } = require('../command'); 2 | const axios = require('axios'); 3 | 4 | cmd({ 5 | pattern: "countryinfo", 6 | alias: ["cinfo", "country","cinfo2"], 7 | desc: "Get information about a country", 8 | category: "info", 9 | react: "🌍", 10 | filename: __filename 11 | }, 12 | async (conn, mek, m, { from, args, q, reply, react }) => { 13 | try { 14 | if (!q) return reply("Please provide a country name.\nExample: `.countryinfo Pakistan`"); 15 | 16 | const apiUrl = `https://api.siputzx.my.id/api/tools/countryInfo?name=${encodeURIComponent(q)}`; 17 | const { data } = await axios.get(apiUrl); 18 | 19 | if (!data.status || !data.data) { 20 | await react("❌"); 21 | return reply(`No information found for *${q}*. Please check the country name.`); 22 | } 23 | 24 | const info = data.data; 25 | let neighborsText = info.neighbors.length > 0 26 | ? info.neighbors.map(n => `🌍 *${n.name}*`).join(", ") 27 | : "No neighboring countries found."; 28 | 29 | const text = `🌍 *Country Information: ${info.name}* 🌍\n\n` + 30 | `🏛 *Capital:* ${info.capital}\n` + 31 | `📍 *Continent:* ${info.continent.name} ${info.continent.emoji}\n` + 32 | `📞 *Phone Code:* ${info.phoneCode}\n` + 33 | `📏 *Area:* ${info.area.squareKilometers} km² (${info.area.squareMiles} mi²)\n` + 34 | `🚗 *Driving Side:* ${info.drivingSide}\n` + 35 | `💱 *Currency:* ${info.currency}\n` + 36 | `🔤 *Languages:* ${info.languages.native.join(", ")}\n` + 37 | `🌟 *Famous For:* ${info.famousFor}\n` + 38 | `🌍 *ISO Codes:* ${info.isoCode.alpha2.toUpperCase()}, ${info.isoCode.alpha3.toUpperCase()}\n` + 39 | `🌎 *Internet TLD:* ${info.internetTLD}\n\n` + 40 | `🔗 *Neighbors:* ${neighborsText}`; 41 | 42 | await conn.sendMessage(from, { 43 | image: { url: info.flag }, 44 | caption: text, 45 | contextInfo: { mentionedJid: [m.sender] } 46 | }, { quoted: mek }); 47 | 48 | await react("✅"); // React after successful response 49 | } catch (e) { 50 | console.error("Error in countryinfo command:", e); 51 | await react("❌"); 52 | reply("An error occurred while fetching country information."); 53 | } 54 | }); 55 | -------------------------------------------------------------------------------- /plugins/fun-match.js: -------------------------------------------------------------------------------- 1 | const { cmd } = require("../command"); 2 | 3 | // Command for random boy selection 4 | cmd({ 5 | pattern: "bacha", 6 | alias: ["boy", "larka"], 7 | desc: "Randomly selects a boy from the group", 8 | react: "👦", 9 | category: "fun", 10 | filename: __filename 11 | }, async (conn, mek, store, { isGroup, groupMetadata, reply, sender }) => { 12 | try { 13 | if (!isGroup) return reply("❌ This command can only be used in groups!"); 14 | 15 | const participants = groupMetadata.participants; 16 | 17 | // Filter out bot and get random participant 18 | const eligible = participants.filter(p => !p.id.includes(conn.user.id.split('@')[0])); 19 | 20 | if (eligible.length < 1) return reply("❌ No eligible participants found!"); 21 | 22 | const randomUser = eligible[Math.floor(Math.random() * eligible.length)]; 23 | 24 | await conn.sendMessage( 25 | mek.chat, 26 | { 27 | text: `👦 *Yeh lo tumhara Bacha!* \n\n@${randomUser.id.split('@')[0]} is your handsome boy! 😎`, 28 | mentions: [randomUser.id] 29 | }, 30 | { quoted: mek } 31 | ); 32 | 33 | } catch (error) { 34 | console.error("Error in .bacha command:", error); 35 | reply(`❌ Error: ${error.message}`); 36 | } 37 | }); 38 | 39 | // Command for random girl selection 40 | cmd({ 41 | pattern: "bachi", 42 | alias: ["girl", "kuri", "larki"], 43 | desc: "Randomly selects a girl from the group", 44 | react: "👧", 45 | category: "fun", 46 | filename: __filename 47 | }, async (conn, mek, store, { isGroup, groupMetadata, reply, sender }) => { 48 | try { 49 | if (!isGroup) return reply("❌ This command can only be used in groups!"); 50 | 51 | const participants = groupMetadata.participants; 52 | 53 | // Filter out bot and get random participant 54 | const eligible = participants.filter(p => !p.id.includes(conn.user.id.split('@')[0])); 55 | 56 | if (eligible.length < 1) return reply("❌ No eligible participants found!"); 57 | 58 | const randomUser = eligible[Math.floor(Math.random() * eligible.length)]; 59 | 60 | await conn.sendMessage( 61 | mek.chat, 62 | { 63 | text: `👧 *Yeh lo tumhari Bachi!* \n\n@${randomUser.id.split('@')[0]} is your beautiful girl! 💖`, 64 | mentions: [randomUser.id] 65 | }, 66 | { quoted: mek } 67 | ); 68 | 69 | } catch (error) { 70 | console.error("Error in .bachi command:", error); 71 | reply(`❌ Error: ${error.message}`); 72 | } 73 | }); 74 | -------------------------------------------------------------------------------- /plugins/pinterest-dl.js: -------------------------------------------------------------------------------- 1 | const { cmd } = require('../command'); 2 | const axios = require('axios'); 3 | 4 | cmd({ 5 | pattern: "pindl", 6 | alias: ["pinterestdl", "pin", "pins", "pindownload"], 7 | desc: "Download media from Pinterest", 8 | category: "download", 9 | filename: __filename 10 | }, async (conn, mek, m, { args, quoted, from, reply }) => { 11 | try { 12 | // Make sure the user provided the Pinterest URL 13 | if (args.length < 1) { 14 | return reply('❎ Please provide the Pinterest URL to download from.'); 15 | } 16 | 17 | // Extract Pinterest URL from the arguments 18 | const pinterestUrl = args[0]; 19 | 20 | // Call your Pinterest download API 21 | const response = await axios.get(`https://api.giftedtech.web.id/api/download/pinterestdl?apikey=gifted&url=${encodeURIComponent(pinterestUrl)}`); 22 | 23 | if (!response.data.success) { 24 | return reply('❎ Failed to fetch data from Pinterest.'); 25 | } 26 | 27 | const media = response.data.result.media; 28 | const description = response.data.result.description || 'No description available'; // Check if description exists 29 | const title = response.data.result.title || 'No title available'; 30 | 31 | // Select the best video quality or you can choose based on size or type 32 | const videoUrl = media.find(item => item.type.includes('720p'))?.download_url || media[0].download_url; 33 | 34 | // Prepare the new message with the updated caption 35 | const desc = `╭━━━〔 *TOHID_MD* 〕━━━┈⊷ 36 | ┃▸╭─────────── 37 | ┃▸┃๏ *PINS DOWNLOADER* 38 | ┃▸└───────────···๏ 39 | ╰────────────────┈⊷ 40 | ╭━━❐━⪼ 41 | ┇๏ *Title* - ${title} 42 | ┇๏ *Media Type* - ${media[0].type} 43 | ╰━━❑━⪼ 44 | > *©𝙿𝙾𝚆𝙴𝚁𝙴𝙳 𝙱𝚈 𝚃𝙾𝙷𝙸𝙳_𝙼𝙳 ♡*`; 45 | 46 | // Send the media (video or image) to the user 47 | if (videoUrl) { 48 | // If it's a video, send the video 49 | await conn.sendMessage(from, { video: { url: videoUrl }, caption: desc }, { quoted: mek }); 50 | } else { 51 | // If it's an image, send the image 52 | const imageUrl = media.find(item => item.type === 'Thumbnail')?.download_url; 53 | await conn.sendMessage(from, { image: { url: imageUrl }, caption: desc }, { quoted: mek }); 54 | } 55 | 56 | } catch (e) { 57 | console.error(e); 58 | await conn.sendMessage(from, { react: { text: '❌', key: mek.key } }); 59 | reply('❎ An error occurred while processing your request.'); 60 | } 61 | }); 62 | -------------------------------------------------------------------------------- /plugins/group-tagall.js: -------------------------------------------------------------------------------- 1 | const config = require('../config') 2 | const { cmd, commands } = require('../command') 3 | const { getBuffer, getGroupAdmins, getRandom, h2k, isUrl, Json, runtime, sleep, fetchJson} = require('../lib/functions') 4 | 5 | cmd({ 6 | pattern: "tagall", 7 | react: "🔊", 8 | alias: ["gc_tagall"], 9 | desc: "To Tag all Members", 10 | category: "group", 11 | use: '.tagall [message]', 12 | filename: __filename 13 | }, 14 | async (conn, mek, m, { from, participants, reply, isGroup, senderNumber, groupAdmins, prefix, command, args, body }) => { 15 | try { 16 | if (!isGroup) return reply("❌ This command can only be used in groups."); 17 | 18 | const botOwner = conn.user.id.split(":")[0]; // Extract bot owner's number 19 | const senderJid = senderNumber + "@s.whatsapp.net"; 20 | 21 | if (!groupAdmins.includes(senderJid) && senderNumber !== botOwner) { 22 | return reply("❌ Only group admins or the bot owner can use this command."); 23 | } 24 | 25 | // Ensure group metadata is fetched properly 26 | let groupInfo = await conn.groupMetadata(from).catch(() => null); 27 | if (!groupInfo) return reply("❌ Failed to fetch group information."); 28 | 29 | let groupName = groupInfo.subject || "Unknown Group"; 30 | let totalMembers = participants ? participants.length : 0; 31 | if (totalMembers === 0) return reply("❌ No members found in this group."); 32 | 33 | let emojis = ['📢', '🔊', '🌐', '🔰', '❤‍🩹', '🤍', '🖤', '🩵', '📝', '💗', '🔖', '🪩', '📦', '🎉', '🛡️', '💸', '⏳', '🗿', '🚀', '🎧', '🪀', '⚡', '🚩', '🍁', '🗣️', '👻', '⚠️', '🔥']; 34 | let randomEmoji = emojis[Math.floor(Math.random() * emojis.length)]; 35 | 36 | // Proper message extraction 37 | let message = body.slice(body.indexOf(command) + command.length).trim(); 38 | if (!message) message = "Attention Everyone"; // Default message 39 | 40 | let teks = `▢ Group : *${groupName}*\n▢ Members : *${totalMembers}*\n▢ Message: *${message}*\n\n┌───⊷ *MENTIONS*\n`; 41 | 42 | for (let mem of participants) { 43 | if (!mem.id) continue; // Prevent undefined errors 44 | teks += `${randomEmoji} @${mem.id.split('@')[0]}\n`; 45 | } 46 | 47 | teks += "└──✪ TOHID ┃ MD ✪──"; 48 | 49 | conn.sendMessage(from, { text: teks, mentions: participants.map(a => a.id) }, { quoted: mek }); 50 | 51 | } catch (e) { 52 | console.error("TagAll Error:", e); 53 | reply(`❌ *Error Occurred !!*\n\n${e.message || e}`); 54 | } 55 | }); 56 | 57 | -------------------------------------------------------------------------------- /plugins/prank-fun.js: -------------------------------------------------------------------------------- 1 | const { cmd } = require('../command'); 2 | 3 | cmd({ 4 | pattern: "hack", 5 | desc: "Displays a dynamic and playful 'Hacking' message for fun.", 6 | category: "fun", 7 | filename: __filename 8 | }, 9 | async (conn, mek, m, { 10 | from, quoted, body, isCmd, command, args, q, isGroup, senderNumber, reply 11 | }) => { 12 | try { 13 | // Get the bot owner's number dynamically from conn.user.id 14 | const botOwner = conn.user.id.split(":")[0]; // Extract the bot owner's number 15 | if (senderNumber !== botOwner) { 16 | return reply("Only the bot owner can use this command."); 17 | } 18 | 19 | const steps = [ 20 | '💻 *HACK STARTING...* 💻', 21 | 22 | '*Initializing hacking tools...* 🛠️', 23 | '*Connecting to remote servers...* 🌐', 24 | 25 | '```[██████████] 10%``` ⏳' , 26 | '```[███████████████████] 20%``` ⏳' , 27 | '```[███████████████████████] 30%``` ⏳' , 28 | '```[██████████████████████████] 40%``` ⏳' , 29 | '```[███████████████████████████████] 50%``` ⏳' , 30 | '```[█████████████████████████████████████] 60%``` ⏳' , 31 | '```[██████████████████████████████████████████] 70%``` ⏳' , 32 | '```[██████████████████████████████████████████████] 80%``` ⏳' , 33 | '```[██████████████████████████████████████████████████] 90%``` ⏳' , 34 | '```[████████████████████████████████████████████████████] 100%``` ✅', 35 | 36 | '🔒 *System Breach: Successful!* 🔓', 37 | '🚀 *Command Execution: Complete!* 🎯', 38 | 39 | '*📡 Transmitting data...* 📤', 40 | '_🕵️‍♂️ Ensuring stealth..._ 🤫', 41 | '*🔧 Finalizing operations...* 🏁', 42 | 43 | '⚠️ *Note:* All actions are for demonstration purposes only.', 44 | '⚠️ *Reminder:* Ethical hacking is the only way to ensure security.', 45 | 46 | '> *TOHID_MD-HACKING-COMPLETE ☣*' 47 | ]; 48 | 49 | for (const line of steps) { 50 | await conn.sendMessage(from, { text: line }, { quoted: mek }); 51 | await new Promise(resolve => setTimeout(resolve, 1000)); // Adjust the delay as needed 52 | } 53 | } catch (e) { 54 | console.error(e); 55 | reply(`❌ *Error:* ${e.message}`); 56 | } 57 | }); 58 | -------------------------------------------------------------------------------- /plugins/block-unblock.js: -------------------------------------------------------------------------------- 1 | const { cmd } = require('../command'); 2 | 3 | cmd({ 4 | pattern: "block", 5 | desc: "Blocks a person", 6 | category: "owner", 7 | react: "🚫", 8 | filename: __filename 9 | }, 10 | async (conn, m, { reply, q, react }) => { 11 | // Get the bot owner's number dynamically 12 | const botOwner = conn.user.id.split(":")[0] + "@s.whatsapp.net"; 13 | 14 | if (m.sender !== botOwner) { 15 | await react("❌"); 16 | return reply("Only the bot owner can use this command."); 17 | } 18 | 19 | let jid; 20 | if (m.quoted) { 21 | jid = m.quoted.sender; // If replying to a message, get sender JID 22 | } else if (m.mentionedJid.length > 0) { 23 | jid = m.mentionedJid[0]; // If mentioning a user, get their JID 24 | } else if (q && q.includes("@")) { 25 | jid = q.replace(/[@\s]/g, '') + "@s.whatsapp.net"; // If manually typing a JID 26 | } else { 27 | await react("❌"); 28 | return reply("Please mention a user or reply to their message."); 29 | } 30 | 31 | try { 32 | await conn.updateBlockStatus(jid, "block"); 33 | await react("✅"); 34 | reply(`Successfully blocked @${jid.split("@")[0]}`, { mentions: [jid] }); 35 | } catch (error) { 36 | console.error("Block command error:", error); 37 | await react("❌"); 38 | reply("Failed to block the user."); 39 | } 40 | }); 41 | 42 | cmd({ 43 | pattern: "unblock", 44 | desc: "Unblocks a person", 45 | category: "owner", 46 | react: "🔓", 47 | filename: __filename 48 | }, 49 | async (conn, m, { reply, q, react }) => { 50 | // Get the bot owner's number dynamically 51 | const botOwner = conn.user.id.split(":")[0] + "@s.whatsapp.net"; 52 | 53 | if (m.sender !== botOwner) { 54 | await react("❌"); 55 | return reply("Only the bot owner can use this command."); 56 | } 57 | 58 | let jid; 59 | if (m.quoted) { 60 | jid = m.quoted.sender; 61 | } else if (m.mentionedJid.length > 0) { 62 | jid = m.mentionedJid[0]; 63 | } else if (q && q.includes("@")) { 64 | jid = q.replace(/[@\s]/g, '') + "@s.whatsapp.net"; 65 | } else { 66 | await react("❌"); 67 | return reply("Please mention a user or reply to their message."); 68 | } 69 | 70 | try { 71 | await conn.updateBlockStatus(jid, "unblock"); 72 | await react("✅"); 73 | reply(`Successfully unblocked @${jid.split("@")[0]}`, { mentions: [jid] }); 74 | } catch (error) { 75 | console.error("Unblock command error:", error); 76 | await react("❌"); 77 | reply("Failed to unblock the user."); 78 | } 79 | }); 80 | -------------------------------------------------------------------------------- /lib/sticker-utils.js: -------------------------------------------------------------------------------- 1 | const axios = require('axios'); 2 | const fs = require('fs'); 3 | const path = require('path'); 4 | const { tmpdir } = require('os'); 5 | const Crypto = require('crypto'); 6 | const ffmpegPath = require('@ffmpeg-installer/ffmpeg').path; 7 | const ffmpeg = require('fluent-ffmpeg'); 8 | 9 | ffmpeg.setFfmpegPath(ffmpegPath); 10 | 11 | /** 12 | * Fetch an image from a given URL. 13 | * @param {string} url - The image URL. 14 | * @returns {Promise} - The image buffer. 15 | */ 16 | async function fetchImage(url) { 17 | try { 18 | const response = await axios.get(url, { responseType: 'arraybuffer' }); 19 | return response.data; 20 | } catch (error) { 21 | console.error("Error fetching image:", error); 22 | throw new Error("Could not fetch image."); 23 | } 24 | } 25 | 26 | /** 27 | * Fetch a GIF from a given API URL. 28 | * @param {string} url - API endpoint to fetch GIF. 29 | * @returns {Promise} - The GIF buffer. 30 | */ 31 | async function fetchGif(url) { 32 | try { 33 | const response = await axios.get(url, { responseType: 'arraybuffer' }); 34 | return response.data; 35 | } catch (error) { 36 | console.error("Error fetching GIF:", error); 37 | throw new Error("Could not fetch GIF."); 38 | } 39 | } 40 | 41 | /** 42 | * Converts a GIF buffer to WebP sticker format. 43 | * @param {Buffer} gifBuffer - The GIF buffer. 44 | * @returns {Promise} - The WebP sticker buffer. 45 | */ 46 | async function gifToSticker(gifBuffer) { 47 | const outputPath = path.join(tmpdir(), Crypto.randomBytes(6).toString('hex') + ".webp"); 48 | const inputPath = path.join(tmpdir(), Crypto.randomBytes(6).toString('hex') + ".gif"); 49 | 50 | fs.writeFileSync(inputPath, gifBuffer); 51 | 52 | await new Promise((resolve, reject) => { 53 | ffmpeg(inputPath) 54 | .on("error", reject) 55 | .on("end", () => resolve(true)) 56 | .addOutputOptions([ 57 | "-vcodec", "libwebp", 58 | "-vf", "scale='min(320,iw)':min'(320,ih)':force_original_aspect_ratio=decrease,fps=15,pad=320:320:-1:-1:color=white@0.0,split [a][b];[a] palettegen=reserve_transparent=on:transparency_color=ffffff [p];[b][p] paletteuse", 59 | "-loop", "0", 60 | "-preset", "default", 61 | "-an", 62 | "-vsync", "0" 63 | ]) 64 | .toFormat("webp") 65 | .save(outputPath); 66 | }); 67 | 68 | const webpBuffer = fs.readFileSync(outputPath); 69 | fs.unlinkSync(outputPath); 70 | fs.unlinkSync(inputPath); 71 | 72 | return webpBuffer; 73 | } 74 | 75 | module.exports = { fetchImage, fetchGif, gifToSticker }; 76 | 77 | -------------------------------------------------------------------------------- /lib/functions.js: -------------------------------------------------------------------------------- 1 | const axios = require('axios') 2 | 3 | const getBuffer = async(url, options) => { 4 | try { 5 | options ? options : {} 6 | var res = await axios({ 7 | method: 'get', 8 | url, 9 | headers: { 10 | 'DNT': 1, 11 | 'Upgrade-Insecure-Request': 1 12 | }, 13 | ...options, 14 | responseType: 'arraybuffer' 15 | }) 16 | return res.data 17 | } catch (e) { 18 | console.log(e) 19 | } 20 | } 21 | 22 | const getGroupAdmins = (participants) => { 23 | var admins = [] 24 | for (let i of participants) { 25 | i.admin !== null ? admins.push(i.id) : '' 26 | } 27 | return admins 28 | } 29 | 30 | const getRandom = (ext) => { 31 | return `${Math.floor(Math.random() * 10000)}${ext}` 32 | } 33 | 34 | const h2k = (eco) => { 35 | var lyrik = ['', 'K', 'M', 'B', 'T', 'P', 'E'] 36 | var ma = Math.log10(Math.abs(eco)) / 3 | 0 37 | if (ma == 0) return eco 38 | var ppo = lyrik[ma] 39 | var scale = Math.pow(10, ma * 3) 40 | var scaled = eco / scale 41 | var formatt = scaled.toFixed(1) 42 | if (/\.0$/.test(formatt)) 43 | formatt = formatt.substr(0, formatt.length - 2) 44 | return formatt + ppo 45 | } 46 | 47 | const isUrl = (url) => { 48 | return url.match( 49 | new RegExp( 50 | /https?:\/\/(www\.)?[-a-zA-Z0-9@:%.+~#=]{1,256}\.[a-zA-Z0-9()]{1,6}\b([-a-zA-Z0-9()@:%+.~#?&/=]*)/, 51 | 'gi' 52 | ) 53 | ) 54 | } 55 | 56 | const Json = (string) => { 57 | return JSON.stringify(string, null, 2) 58 | } 59 | 60 | const runtime = (seconds) => { 61 | seconds = Number(seconds) 62 | var d = Math.floor(seconds / (3600 * 24)) 63 | var h = Math.floor(seconds % (3600 * 24) / 3600) 64 | var m = Math.floor(seconds % 3600 / 60) 65 | var s = Math.floor(seconds % 60) 66 | var dDisplay = d > 0 ? d + (d == 1 ? ' day, ' : ' days, ') : '' 67 | var hDisplay = h > 0 ? h + (h == 1 ? ' hour, ' : ' hours, ') : '' 68 | var mDisplay = m > 0 ? m + (m == 1 ? ' minute, ' : ' minutes, ') : '' 69 | var sDisplay = s > 0 ? s + (s == 1 ? ' second' : ' seconds') : '' 70 | return dDisplay + hDisplay + mDisplay + sDisplay; 71 | } 72 | 73 | const sleep = async(ms) => { 74 | return new Promise(resolve => setTimeout(resolve, ms)) 75 | } 76 | 77 | const fetchJson = async (url, options) => { 78 | try { 79 | options ? options : {} 80 | const res = await axios({ 81 | method: 'GET', 82 | url: url, 83 | headers: { 84 | 'User-Agent': 'Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/95.0.4638.69 Safari/537.36' 85 | }, 86 | ...options 87 | }) 88 | return res.data 89 | } catch (err) { 90 | return err 91 | } 92 | } 93 | 94 | module.exports = { getBuffer, getGroupAdmins, getRandom, h2k, isUrl, Json, runtime, sleep , fetchJson} 95 | -------------------------------------------------------------------------------- /plugins/movie.js: -------------------------------------------------------------------------------- 1 | const axios = require('axios'); 2 | const { cmd } = require('../command'); 3 | 4 | cmd({ 5 | pattern: "movie", 6 | desc: "Fetch detailed information about a movie.", 7 | category: "utility", 8 | react: "🎬", 9 | filename: __filename 10 | }, 11 | async (conn, mek, m, { from, reply, sender, args }) => { 12 | try { 13 | // Properly extract the movie name from arguments 14 | const movieName = args.length > 0 ? args.join(' ') : m.text.replace(/^[\.\#\$\!]?movie\s?/i, '').trim(); 15 | 16 | if (!movieName) { 17 | return reply("📽️ Please provide the name of the movie.\nExample: .movie Iron Man"); 18 | } 19 | 20 | const apiUrl = `https://apis.davidcyriltech.my.id/imdb?query=${encodeURIComponent(movieName)}`; 21 | const response = await axios.get(apiUrl); 22 | 23 | if (!response.data.status || !response.data.movie) { 24 | return reply("🚫 Movie not found. Please check the name and try again."); 25 | } 26 | 27 | const movie = response.data.movie; 28 | 29 | // Format the caption 30 | const dec = ` 31 | 🎬 *${movie.title}* (${movie.year}) ${movie.rated || ''} 32 | 33 | ⭐ *IMDb:* ${movie.imdbRating || 'N/A'} | 🍅 *Rotten Tomatoes:* ${movie.ratings.find(r => r.source === 'Rotten Tomatoes')?.value || 'N/A'} | 💰 *Box Office:* ${movie.boxoffice || 'N/A'} 34 | 35 | 📅 *Released:* ${new Date(movie.released).toLocaleDateString()} 36 | ⏳ *Runtime:* ${movie.runtime} 37 | 🎭 *Genre:* ${movie.genres} 38 | 39 | 📝 *Plot:* ${movie.plot} 40 | 41 | 🎥 *Director:* ${movie.director} 42 | ✍️ *Writer:* ${movie.writer} 43 | 🌟 *Actors:* ${movie.actors} 44 | 45 | 🌍 *Country:* ${movie.country} 46 | 🗣️ *Language:* ${movie.languages} 47 | 🏆 *Awards:* ${movie.awards || 'None'} 48 | 49 | [View on IMDb](${movie.imdbUrl}) 50 | `; 51 | 52 | // Send message with the requested format 53 | await conn.sendMessage( 54 | from, 55 | { 56 | image: { 57 | url: movie.poster && movie.poster !== 'N/A' ? movie.poster : 'https://i.ibb.co/4ZSYvPTq/lordali.jpg' 58 | }, 59 | caption: dec, 60 | contextInfo: { 61 | mentionedJid: [sender], 62 | forwardingScore: 999, 63 | isForwarded: true, 64 | forwardedNewsletterMessageInfo: { 65 | newsletterJid: '120363207624903731@newsletter', 66 | newsletterName: '𝐓𝐎𝐇𝐈𝐃 𝐓𝐄𝐂𝐇 🤖', 67 | serverMessageId: 143 68 | } 69 | } 70 | }, 71 | { quoted: mek } 72 | ); 73 | 74 | } catch (e) { 75 | console.error('Movie command error:', e); 76 | reply(`❌ Error: ${e.message}`); 77 | } 78 | }); 79 | -------------------------------------------------------------------------------- /plugins/get-cmd.js: -------------------------------------------------------------------------------- 1 | const { cmd, commands } = require('../command'); 2 | const fs = require('fs'); 3 | const path = require('path'); 4 | 5 | cmd({ 6 | pattern: "get", 7 | alias: ["source", "js"], 8 | desc: "Fetch the full source code of a command", 9 | category: "owner", 10 | react: "📜", 11 | filename: __filename 12 | }, 13 | async (conn, mek, m, { from, args, reply, isOwner }) => { 14 | try { 15 | if (!isOwner) return reply("❌ You don't have permission to use this command!"); 16 | if (!args[0]) return reply("❌ Please provide a command name. Example: `.get alive`"); 17 | 18 | const commandName = args[0].toLowerCase(); 19 | const commandData = commands.find(cmd => cmd.pattern === commandName || (cmd.alias && cmd.alias.includes(commandName))); 20 | 21 | if (!commandData) return reply("❌ Command not found!"); 22 | 23 | // Get the command file path 24 | const commandPath = commandData.filename; 25 | 26 | // Read the full source code 27 | const fullCode = fs.readFileSync(commandPath, 'utf-8'); 28 | 29 | // Truncate long messages for WhatsApp 30 | let truncatedCode = fullCode; 31 | if (truncatedCode.length > 4000) { 32 | truncatedCode = fullCode.substring(0, 4000) + "\n\n// Code too long, sending full file 📂"; 33 | } 34 | 35 | // Formatted caption with truncated code 36 | const formattedCode = `⬤───〔 *📜 Command Source* 〕───⬤ 37 | \`\`\`js 38 | ${truncatedCode} 39 | \`\`\` 40 | ╰──────────⊷ 41 | ⚡ Full file sent below 📂 42 | *©𝙿𝙾𝚆𝙴𝚁𝙴𝙳 𝙱𝚈 𝚃𝙾𝙷𝙸𝙳_𝙼𝙳* 💜`; 43 | 44 | // Send image with truncated source code 45 | await conn.sendMessage(from, { 46 | image: { url: `https://i.ibb.co/4ZSYvPTq/lordali.jpg` }, // Image URL 47 | caption: formattedCode, 48 | contextInfo: { 49 | mentionedJid: [m.sender], 50 | forwardingScore: 999, 51 | isForwarded: true, 52 | forwardedNewsletterMessageInfo: { 53 | newsletterJid: '120363207624903731@newsletter', 54 | newsletterName: '𝐓𝐎𝐇𝐈𝐃 𝐓𝐄𝐂𝐇 🤖', 55 | serverMessageId: 143 56 | } 57 | } 58 | }, { quoted: mek }); 59 | 60 | // Send full source file 61 | const fileName = `${commandName}.js`; 62 | const tempPath = path.join(__dirname, fileName); 63 | fs.writeFileSync(tempPath, fullCode); 64 | 65 | await conn.sendMessage(from, { 66 | document: fs.readFileSync(tempPath), 67 | mimetype: 'text/javascript', 68 | fileName: fileName 69 | }, { quoted: mek }); 70 | 71 | // Delete the temporary file 72 | fs.unlinkSync(tempPath); 73 | 74 | } catch (e) { 75 | console.error("Error in .get command:", e); 76 | reply(`❌ Error: ${e.message}`); 77 | } 78 | }); 79 | -------------------------------------------------------------------------------- /plugins/ping.js: -------------------------------------------------------------------------------- 1 | const config = require('../config'); 2 | const { cmd, commands } = require('../command'); 3 | 4 | cmd({ 5 | pattern: "ping", 6 | alias: ["speed","pong"],use: '.ping', 7 | desc: "Check bot's response time.", 8 | category: "main", 9 | react: "⚡", 10 | filename: __filename 11 | }, 12 | async (conn, mek, m, { from, quoted, sender, reply }) => { 13 | try { 14 | const start = new Date().getTime(); 15 | 16 | const reactionEmojis = ['🔥', '⚡', '🚀', '💨', '🎯', '🎉', '🌟', '💥', '🕐', '🔹']; 17 | const textEmojis = ['💎', '🏆', '⚡️', '🚀', '🎶', '🌠', '🌀', '🔱', '🛡️', '✨']; 18 | 19 | const reactionEmoji = reactionEmojis[Math.floor(Math.random() * reactionEmojis.length)]; 20 | let textEmoji = textEmojis[Math.floor(Math.random() * textEmojis.length)]; 21 | 22 | // Ensure reaction and text emojis are different 23 | while (textEmoji === reactionEmoji) { 24 | textEmoji = textEmojis[Math.floor(Math.random() * textEmojis.length)]; 25 | } 26 | 27 | // Send reaction using conn.sendMessage() 28 | await conn.sendMessage(from, { 29 | react: { text: textEmoji, key: mek.key } 30 | }); 31 | 32 | const end = new Date().getTime(); 33 | const responseTime = (end - start) / 1000; 34 | 35 | const text = `> *𝐓𝐎𝐇𝐈𝐃_𝐌𝐃 𝐒𝐏𝐄𝐄𝐃: ${responseTime.toFixed(2)}ms ${reactionEmoji}*`; 36 | 37 | await conn.sendMessage(from, { 38 | text, 39 | contextInfo: { 40 | mentionedJid: [sender], 41 | forwardingScore: 999, 42 | isForwarded: true, 43 | forwardedNewsletterMessageInfo: { 44 | newsletterJid: '120363207624903731@newsletter', 45 | newsletterName: "𝐓𝐎𝐇𝐈𝐃 𝐓𝐄𝐂𝐇 🤖", 46 | serverMessageId: 143 47 | } 48 | } 49 | }, { quoted: mek }); 50 | 51 | } catch (e) { 52 | console.error("Error in ping command:", e); 53 | reply(`An error occurred: ${e.message}`); 54 | } 55 | }); 56 | 57 | // ping2 58 | 59 | cmd({ 60 | pattern: "ping2", 61 | desc: "Check bot's response time.", 62 | category: "main", 63 | react: "🍂", 64 | filename: __filename 65 | }, 66 | async (conn, mek, m, { from, quoted, body, isCmd, command, args, q, isGroup, sender, senderNumber, botNumber2, botNumber, pushname, isMe, isOwner, groupMetadata, groupName, participants, groupAdmins, isBotAdmins, isAdmins, reply }) => { 67 | try { 68 | const startTime = Date.now() 69 | const message = await conn.sendMessage(from, { text: '*PINGING...*' }) 70 | const endTime = Date.now() 71 | const ping = endTime - startTime 72 | await conn.sendMessage(from, { text: `*🔥 𝐓𝐎𝐇𝐈𝐃_𝐌𝐃 𝐒𝐏𝐄𝐄𝐃 : ${ping}ms*` }, { quoted: message }) 73 | } catch (e) { 74 | console.log(e) 75 | reply(`${e}`) 76 | } 77 | }) 78 | -------------------------------------------------------------------------------- /plugins/sticker-maker.js: -------------------------------------------------------------------------------- 1 | const { cmd } = require('../command'); 2 | const crypto = require('crypto'); 3 | const webp = require('node-webpmux'); 4 | const axios = require('axios'); 5 | const fs = require('fs-extra'); 6 | const { exec } = require('child_process'); 7 | const { Sticker, createSticker, StickerTypes } = require("wa-sticker-formatter"); 8 | const Config = require('../config'); 9 | 10 | // Take Sticker 11 | 12 | cmd( 13 | { 14 | pattern: 'take', 15 | alias: ['rename', 'stake'], 16 | desc: 'Create a sticker with a custom pack name.', 17 | category: 'sticker', 18 | use: '', 19 | filename: __filename, 20 | }, 21 | async (conn, mek, m, { quoted, args, q, reply, from }) => { 22 | if (!mek.quoted) return reply(`*Reply to any sticker.*`); 23 | if (!q) return reply(`*Please provide a pack name using .take *`); 24 | 25 | let mime = mek.quoted.mtype; 26 | let pack = q; 27 | 28 | if (mime === "imageMessage" || mime === "stickerMessage") { 29 | let media = await mek.quoted.download(); 30 | let sticker = new Sticker(media, { 31 | pack: pack, 32 | type: StickerTypes.FULL, 33 | categories: ["🤩", "🎉"], 34 | id: "12345", 35 | quality: 75, 36 | background: 'transparent', 37 | }); 38 | const buffer = await sticker.toBuffer(); 39 | return conn.sendMessage(mek.chat, { sticker: buffer }, { quoted: mek }); 40 | } else { 41 | return reply("*Uhh, Please reply to an image.*"); 42 | } 43 | } 44 | ); 45 | 46 | //Sticker create 47 | 48 | cmd( 49 | { 50 | pattern: 'sticker', 51 | alias: ['s', 'stickergif'], 52 | desc: 'Create a sticker from an image, video, or URL.', 53 | category: 'sticker', 54 | use: '', 55 | filename: __filename, 56 | }, 57 | async (conn, mek, m, { quoted, args, q, reply, from }) => { 58 | if (!mek.quoted) return reply(`*Reply to any Image or Video, Sir.*`); 59 | let mime = mek.quoted.mtype; 60 | let pack = Config.STICKER_NAME || "Jawad TechX"; 61 | 62 | if (mime === "imageMessage" || mime === "stickerMessage") { 63 | let media = await mek.quoted.download(); 64 | let sticker = new Sticker(media, { 65 | pack: pack, 66 | type: StickerTypes.FULL, 67 | categories: ["🤩", "🎉"], 68 | id: "12345", 69 | quality: 75, 70 | background: 'transparent', 71 | }); 72 | const buffer = await sticker.toBuffer(); 73 | return conn.sendMessage(mek.chat, { sticker: buffer }, { quoted: mek }); 74 | } else { 75 | return reply("*Uhh, Please reply to an image.*"); 76 | } 77 | } 78 | ); 79 | 80 | // tohid Khan 81 | -------------------------------------------------------------------------------- /plugins/re-caption.js: -------------------------------------------------------------------------------- 1 | const { cmd } = require("../command"); 2 | 3 | cmd({ 4 | pattern: "caption", 5 | alias: ["cap", "recaption", "c"], 6 | react: '✏️', 7 | desc: "Add or change caption of media/document", 8 | category: "utility", 9 | filename: __filename 10 | }, async (client, message, match, { from }) => { 11 | try { 12 | if (!message.quoted) { 13 | return await client.sendMessage(from, { 14 | text: "*🍁 Please reply to a media message (image/video/document) to add caption!*\n\n*Usage:*\n- Reply to media with .caption [your text]\n- Or just .caption [text] to add caption to previous media" 15 | }, { quoted: message }); 16 | } 17 | 18 | const quotedMsg = message.quoted; 19 | if (!quotedMsg || !quotedMsg.download) { 20 | return await client.sendMessage(from, { 21 | text: "❌ The quoted message is not valid media" 22 | }, { quoted: message }); 23 | } 24 | 25 | const buffer = await quotedMsg.download(); 26 | const mtype = quotedMsg.mtype; 27 | 28 | // Get the caption text (everything after the command) 29 | const cmdText = message.body.split(' ')[0].toLowerCase(); 30 | const newCaption = message.body.slice(cmdText.length).trim(); 31 | 32 | if (!buffer) { 33 | return await client.sendMessage(from, { 34 | text: "❌ Failed to download the media" 35 | }, { quoted: message }); 36 | } 37 | 38 | // Create the base message content 39 | const messageContent = { 40 | caption: newCaption, 41 | mimetype: quotedMsg.mimetype 42 | }; 43 | 44 | // Add the appropriate media property based on type 45 | switch (mtype) { 46 | case "imageMessage": 47 | messageContent.image = buffer; 48 | messageContent.mimetype = messageContent.mimetype || "image/jpeg"; 49 | break; 50 | case "videoMessage": 51 | messageContent.video = buffer; 52 | messageContent.mimetype = messageContent.mimetype || "video/mp4"; 53 | break; 54 | case "documentMessage": 55 | messageContent.document = buffer; 56 | messageContent.mimetype = messageContent.mimetype || "application/octet-stream"; 57 | break; 58 | case "audioMessage": 59 | messageContent.audio = buffer; 60 | messageContent.mimetype = messageContent.mimetype || "audio/mp4"; 61 | messageContent.ptt = quotedMsg.ptt || false; 62 | break; 63 | default: 64 | return await client.sendMessage(from, { 65 | text: "❌ Only image, video, document and audio messages can be recaptioned" 66 | }, { quoted: message }); 67 | } 68 | 69 | // Send the message with media and caption 70 | await client.sendMessage(from, messageContent, { quoted: message }); 71 | 72 | } catch (error) { 73 | console.error("Caption Error:", error); 74 | await client.sendMessage(from, { 75 | text: "❌ Error adding caption:\n" + (error.message || error.toString()) 76 | }, { quoted: message }); 77 | } 78 | }); 79 | -------------------------------------------------------------------------------- /data/converter.js: -------------------------------------------------------------------------------- 1 | const fs = require('fs'); 2 | const path = require('path'); 3 | const ffmpegPath = require('@ffmpeg-installer/ffmpeg').path; 4 | const { spawn } = require('child_process'); 5 | 6 | class AudioConverter { 7 | constructor() { 8 | this.tempDir = path.join(__dirname, '../temp'); 9 | this.ensureTempDir(); 10 | } 11 | 12 | ensureTempDir() { 13 | if (!fs.existsSync(this.tempDir)) { 14 | fs.mkdirSync(this.tempDir, { recursive: true }); 15 | } 16 | } 17 | 18 | async cleanFile(file) { 19 | if (file && fs.existsSync(file)) { 20 | await fs.promises.unlink(file).catch(() => {}); 21 | } 22 | } 23 | 24 | async convert(buffer, args, ext, ext2) { 25 | const inputPath = path.join(this.tempDir, `${Date.now()}.${ext}`); 26 | const outputPath = path.join(this.tempDir, `${Date.now()}.${ext2}`); 27 | 28 | try { 29 | await fs.promises.writeFile(inputPath, buffer); 30 | 31 | return new Promise((resolve, reject) => { 32 | const ffmpeg = spawn(ffmpegPath, [ 33 | '-y', 34 | '-i', inputPath, 35 | ...args, 36 | outputPath 37 | ], { timeout: 30000 }); 38 | 39 | let errorOutput = ''; 40 | ffmpeg.stderr.on('data', (data) => errorOutput += data.toString()); 41 | 42 | ffmpeg.on('close', async (code) => { 43 | await this.cleanFile(inputPath); 44 | 45 | if (code !== 0) { 46 | await this.cleanFile(outputPath); 47 | return reject(new Error(`Conversion failed with code ${code}`)); 48 | } 49 | 50 | try { 51 | const result = await fs.promises.readFile(outputPath); 52 | await this.cleanFile(outputPath); 53 | resolve(result); 54 | } catch (readError) { 55 | reject(readError); 56 | } 57 | }); 58 | 59 | ffmpeg.on('error', (err) => { 60 | reject(err); 61 | }); 62 | }); 63 | } catch (err) { 64 | await this.cleanFile(inputPath); 65 | await this.cleanFile(outputPath); 66 | throw err; 67 | } 68 | } 69 | 70 | toAudio(buffer, ext) { 71 | return this.convert(buffer, [ 72 | '-vn', 73 | '-ac', '2', 74 | '-b:a', '128k', 75 | '-ar', '44100', 76 | '-f', 'mp3' 77 | ], ext, 'mp3'); 78 | } 79 | 80 | toPTT(buffer, ext) { 81 | return this.convert(buffer, [ 82 | '-vn', 83 | '-c:a', 'libopus', 84 | '-b:a', '128k', 85 | '-vbr', 'on', 86 | '-compression_level', '10' 87 | ], ext, 'opus'); 88 | } 89 | } 90 | 91 | module.exports = new AudioConverter(); 92 | -------------------------------------------------------------------------------- /plugins/ttdl-extra.js: -------------------------------------------------------------------------------- 1 | const { cmd } = require('../command'); 2 | const fetch = require('node-fetch'); 3 | 4 | cmd({ 5 | pattern: "tiktok2", 6 | alias: ["tt2", "tiktokdl2", "ttdown2", "tiktokvid2", "ttdl"], 7 | desc: "Download TikTok videos using a link.", 8 | category: "downloader", 9 | filename: __filename 10 | }, 11 | async (conn, mek, m, { from, args, quoted, reply }) => { 12 | try { 13 | // Validate input 14 | if (!args[0]) { 15 | return reply(`✳️ Use this command like:\n *${command} *`); 16 | } 17 | 18 | reply("⏳ Fetching video details... Please wait."); 19 | 20 | const res = await fetch(`https://darkcore-api.onrender.com/api/tiktok?url=${encodeURIComponent(args[0])}`); 21 | if (!res.ok) { 22 | return reply("❎ Unable to fetch data. Please try again later."); 23 | } 24 | 25 | const data = await res.json(); 26 | if (!data.success) { 27 | return reply("❎ Failed to fetch video. Please check the link and try again."); 28 | } 29 | 30 | const { author, titulo, thumbanail, mp4, mp3 } = data.result; 31 | 32 | // Send the initial options with a thumbnail 33 | const caption = `📖 *Title:* ${titulo}\n👤 *Author:* ${author}\n\n📥 *Reply with:*\n1️⃣ for *Video*\n2️⃣ for *Audio*`; 34 | const menuMsg = await conn.sendMessage(from, { 35 | image: { url: thumbanail }, 36 | caption 37 | }, { quoted: mek }); 38 | 39 | // Wait for the user to reply with the option 40 | conn.ev.on('messages.upsert', async (msgUpdate) => { 41 | const msg = msgUpdate.messages[0]; 42 | if (!msg.message || !msg.message.extendedTextMessage) return; 43 | 44 | const userReply = msg.message.extendedTextMessage.text.trim(); 45 | 46 | // Ensure the user reply references the correct message 47 | if (msg.message.extendedTextMessage.contextInfo && msg.message.extendedTextMessage.contextInfo.stanzaId === menuMsg.key.id) { 48 | if (userReply === '1') { 49 | // Send video 50 | await conn.sendMessage(from, { 51 | video: { url: mp4 }, 52 | caption: "🎥 *Here is your TikTok video!*" 53 | }, { quoted: mek }); 54 | } else if (userReply === '2') { 55 | // Send audio 56 | await conn.sendMessage(from, { 57 | audio: { url: mp3 }, 58 | mimetype: 'audio/mpeg', 59 | caption: "🎵 *Here is the extracted audio!*" 60 | }, { quoted: mek }); 61 | } else { 62 | reply("❎ Invalid option. Please reply with `1` for video or `2` for audio."); 63 | } 64 | } 65 | }); 66 | 67 | } catch (error) { 68 | console.error(error); 69 | reply("❎ An error occurred while processing your request. Please try again later."); 70 | } 71 | }); 72 | 73 | 74 | -------------------------------------------------------------------------------- /plugins/tool-sticker.js: -------------------------------------------------------------------------------- 1 | // coded by Tohid khan 2 | 3 | const path = require("path"); 4 | const { fetchGif, fetchImage, gifToSticker } = require('../lib/sticker-utils'); 5 | const { tmpdir } = require("os"); 6 | const fetch = require("node-fetch"); 7 | const Crypto = require("crypto"); 8 | const ffmpegPath = require("@ffmpeg-installer/ffmpeg").path; 9 | const { getBuffer, getGroupAdmins, getRandom, h2k, isUrl, Json, runtime, sleep, fetchJson } = require("../lib/functions"); 10 | const ffmpeg = require("fluent-ffmpeg"); 11 | const fs = require("fs"); 12 | const { cmd } = require('../command'); 13 | const { videoToWebp } = require('../lib/video-utils'); 14 | const { Sticker, createSticker, StickerTypes } = require("wa-sticker-formatter"); 15 | const config = require("../config"); 16 | 17 | cmd( 18 | { 19 | pattern: 'vsticker', 20 | alias: ['gsticker', 'g2s', 'gs', 'v2s', 'vs',], 21 | desc: 'Convert GIF/Video to a sticker.', 22 | category: 'sticker', 23 | use: '', 24 | filename: __filename, 25 | }, 26 | async (conn, mek, m, { quoted, args, reply }) => { 27 | try { 28 | if (!mek.quoted) return reply('*Reply to a video or GIF to convert it to a sticker!*'); 29 | 30 | const mime = mek.quoted.mtype; 31 | if (!['videoMessage', 'imageMessage'].includes(mime)) { 32 | return reply('*Please reply to a valid video or GIF.*'); 33 | } 34 | 35 | // Download the media file 36 | const media = await mek.quoted.download(); 37 | 38 | // Convert the video to a WebP buffer 39 | const webpBuffer = await videoToWebp(media); 40 | 41 | // Generate sticker metadata 42 | const sticker = new Sticker(webpBuffer, { 43 | pack: config.STICKER_NAME || 'My Pack', 44 | author: '', // Leave blank or customize 45 | type: StickerTypes.FULL, // FULL for regular stickers 46 | categories: ['🤩', '🎉'], // Emoji categories 47 | id: '12345', // Optional ID 48 | quality: 75, // Set quality for optimization 49 | background: 'transparent', // Transparent background 50 | }); 51 | 52 | // Convert sticker to buffer and send 53 | const stickerBuffer = await sticker.toBuffer(); 54 | return conn.sendMessage(mek.chat, { sticker: stickerBuffer }, { quoted: mek }); 55 | } catch (error) { 56 | console.error(error); 57 | reply(`❌ An error occurred: ${error.message}`); 58 | } 59 | } 60 | ); 61 | 62 | 63 | cmd({ 64 | pattern: "attp", 65 | desc: "Convert text to a GIF sticker.", 66 | react: "✨", 67 | category: "convert", 68 | use: ".attp HI", 69 | filename: __filename, 70 | }, async (conn, mek, m, { args, reply }) => { 71 | try { 72 | if (!args[0]) return reply("*Please provide text!*"); 73 | 74 | const gifBuffer = await fetchGif(`https://api-fix.onrender.com/api/maker/attp?text=${encodeURIComponent(args[0])}`); 75 | const stickerBuffer = await gifToSticker(gifBuffer); 76 | 77 | await conn.sendMessage(m.chat, { sticker: stickerBuffer }, { quoted: mek }); 78 | } catch (error) { 79 | reply(`❌ ${error.message}`); 80 | } 81 | }); 82 | 83 | -------------------------------------------------------------------------------- /plugins/img-wanted.js: -------------------------------------------------------------------------------- 1 | const axios = require("axios"); 2 | const FormData = require('form-data'); 3 | const fs = require('fs'); 4 | const os = require('os'); 5 | const path = require("path"); 6 | const { cmd } = require("../command"); 7 | 8 | // Helper function to format bytes 9 | function formatBytes(bytes) { 10 | if (bytes === 0) return '0 Bytes'; 11 | const k = 1024; 12 | const sizes = ['Bytes', 'KB', 'MB', 'GB']; 13 | const i = Math.floor(Math.log(bytes) / Math.log(k)); 14 | return parseFloat((bytes / Math.pow(k, i)).toFixed(2)) + ' ' + sizes[i]; 15 | } 16 | 17 | cmd({ 18 | pattern: "wanted", 19 | alias: ["wantededit"], 20 | react: '📸', 21 | desc: "Scan and remove bg from images", 22 | category: "img_edit", 23 | use: ".wanted [reply to image]", 24 | filename: __filename 25 | }, async (conn, message, m, { reply, mek }) => { 26 | try { 27 | // Check if quoted message exists and has media 28 | const quotedMsg = message.quoted ? message.quoted : message; 29 | const mimeType = (quotedMsg.msg || quotedMsg).mimetype || ''; 30 | 31 | if (!mimeType || !mimeType.startsWith('image/')) { 32 | return reply("Please reply to an image file (JPEG/PNG)"); 33 | } 34 | 35 | // Download the media 36 | const mediaBuffer = await quotedMsg.download(); 37 | const fileSize = formatBytes(mediaBuffer.length); 38 | 39 | // Get file extension based on mime type 40 | let extension = ''; 41 | if (mimeType.includes('image/jpeg')) extension = '.jpg'; 42 | else if (mimeType.includes('image/png')) extension = '.png'; 43 | else { 44 | return reply("Unsupported image format. Please use JPEG or PNG"); 45 | } 46 | 47 | const tempFilePath = path.join(os.tmpdir(), `imgscan_${Date.now()}${extension}`); 48 | fs.writeFileSync(tempFilePath, mediaBuffer); 49 | 50 | // Upload to Catbox 51 | const form = new FormData(); 52 | form.append('fileToUpload', fs.createReadStream(tempFilePath), `image${extension}`); 53 | form.append('reqtype', 'fileupload'); 54 | 55 | const uploadResponse = await axios.post("https://catbox.moe/user/api.php", form, { 56 | headers: form.getHeaders() 57 | }); 58 | 59 | const imageUrl = uploadResponse.data; 60 | fs.unlinkSync(tempFilePath); // Clean up temp file 61 | 62 | if (!imageUrl) { 63 | throw "Failed to upload image to Catbox"; 64 | } 65 | 66 | // Scan the image using the API 67 | const apiUrl = `https://api.popcat.xyz/v2/wanted?image=${encodeURIComponent(imageUrl)}`; 68 | const response = await axios.get(apiUrl, { responseType: "arraybuffer" }); 69 | 70 | if (!response || !response.data) { 71 | return reply("Error: The API did not return a valid image. Try again later."); 72 | } 73 | 74 | const imageBuffer = Buffer.from(response.data, "binary"); 75 | 76 | await conn.sendMessage(m.chat, { 77 | image: imageBuffer, 78 | caption: `> *©𝙿𝙾𝚆𝙴𝚁𝙴𝙳 𝙱𝚈 𝚃𝙾𝙷𝙸𝙳_𝙼𝙳*` 79 | }); 80 | 81 | } catch (error) { 82 | console.error("Wanted Error:", error); 83 | reply(`An error occurred: ${error.response?.data?.message || error.message || "Unknown error"}`); 84 | } 85 | }); 86 | -------------------------------------------------------------------------------- /plugins/img-rmbg.js: -------------------------------------------------------------------------------- 1 | const axios = require("axios"); 2 | const FormData = require('form-data'); 3 | const fs = require('fs'); 4 | const os = require('os'); 5 | const path = require("path"); 6 | const { cmd } = require("../command"); 7 | 8 | // Helper function to format bytes 9 | function formatBytes(bytes) { 10 | if (bytes === 0) return '0 Bytes'; 11 | const k = 1024; 12 | const sizes = ['Bytes', 'KB', 'MB', 'GB']; 13 | const i = Math.floor(Math.log(bytes) / Math.log(k)); 14 | return parseFloat((bytes / Math.pow(k, i)).toFixed(2)) + ' ' + sizes[i]; 15 | } 16 | 17 | cmd({ 18 | pattern: "rmbg", 19 | alias: ["removebg"], 20 | react: '📸', 21 | desc: "Scan and remove bg from images", 22 | category: "img_edit", 23 | use: ".rmbg [reply to image]", 24 | filename: __filename 25 | }, async (conn, message, m, { reply, mek }) => { 26 | try { 27 | // Check if quoted message exists and has media 28 | const quotedMsg = message.quoted ? message.quoted : message; 29 | const mimeType = (quotedMsg.msg || quotedMsg).mimetype || ''; 30 | 31 | if (!mimeType || !mimeType.startsWith('image/')) { 32 | return reply("Please reply to an image file (JPEG/PNG)"); 33 | } 34 | 35 | // Download the media 36 | const mediaBuffer = await quotedMsg.download(); 37 | const fileSize = formatBytes(mediaBuffer.length); 38 | 39 | // Get file extension based on mime type 40 | let extension = ''; 41 | if (mimeType.includes('image/jpeg')) extension = '.jpg'; 42 | else if (mimeType.includes('image/png')) extension = '.png'; 43 | else { 44 | return reply("Unsupported image format. Please use JPEG or PNG"); 45 | } 46 | 47 | const tempFilePath = path.join(os.tmpdir(), `imgscan_${Date.now()}${extension}`); 48 | fs.writeFileSync(tempFilePath, mediaBuffer); 49 | 50 | // Upload to Catbox 51 | const form = new FormData(); 52 | form.append('fileToUpload', fs.createReadStream(tempFilePath), `image${extension}`); 53 | form.append('reqtype', 'fileupload'); 54 | 55 | const uploadResponse = await axios.post("https://catbox.moe/user/api.php", form, { 56 | headers: form.getHeaders() 57 | }); 58 | 59 | const imageUrl = uploadResponse.data; 60 | fs.unlinkSync(tempFilePath); // Clean up temp file 61 | 62 | if (!imageUrl) { 63 | throw "Failed to upload image to Catbox"; 64 | } 65 | 66 | // Scan the image using the API 67 | const apiUrl = `https://apis.davidcyriltech.my.id/removebg?url=${encodeURIComponent(imageUrl)}`; 68 | const response = await axios.get(apiUrl, { responseType: "arraybuffer" }); 69 | 70 | if (!response || !response.data) { 71 | return reply("Error: The API did not return a valid image. Try again later."); 72 | } 73 | 74 | const imageBuffer = Buffer.from(response.data, "binary"); 75 | 76 | await conn.sendMessage(m.chat, { 77 | image: imageBuffer, 78 | caption: `Background removed\n\n> *©𝙿𝙾𝚆𝙴𝚁𝙴𝙳 𝙱𝚈 𝚃𝙾𝙷𝙸𝙳_𝙼𝙳*` 79 | }); 80 | 81 | } catch (error) { 82 | console.error("Rmbg Error:", error); 83 | reply(`An error occurred: ${error.response?.data?.message || error.message || "Unknown error"}`); 84 | } 85 | }); 86 | -------------------------------------------------------------------------------- /plugins/prayertime.js: -------------------------------------------------------------------------------- 1 | const axios = require('axios'); 2 | const config = require('../config'); 3 | const { cmd, commands } = require('../command'); 4 | const fetch = require('node-fetch'); 5 | 6 | cmd({ 7 | pattern: "praytime", 8 | alias: ["prayertimes", "prayertime", "ptime" ], 9 | react: "✅", 10 | desc: "Get the prayer times, weather, and location for the city.", 11 | category: "information", 12 | filename: __filename, 13 | }, 14 | async(conn, mek, m, {from, l, quoted, body, isCmd, command, args, q, isGroup, sender, senderNumber, botNumber2, botNumber, pushname, isMe, isOwner, groupMetadata, groupName, participants, isItzcp, groupAdmins, isBotAdmins, isAdmins, reply}) => { 15 | try { 16 | const city = args.length > 0 ? args.join(" ") : "bhakkar"; // Default to Bhakkar if no city is provided 17 | const apiUrl = `https://api.nexoracle.com/islamic/prayer-times?city=${city}`; 18 | 19 | const response = await fetch(apiUrl); 20 | 21 | if (!response.ok) { 22 | return reply('Error fetching prayer times!'); 23 | } 24 | 25 | const data = await response.json(); 26 | 27 | if (data.status !== 200) { 28 | return reply('Failed to get prayer times. Please try again later.'); 29 | } 30 | 31 | const prayerTimes = data.result.items[0]; 32 | const weather = data.result.today_weather; 33 | const location = data.result.city; 34 | 35 | // Building the message content 36 | let dec = `*Prayer Times for ${location}, ${data.result.state}*\n\n`; 37 | dec += `📍 *Location*: ${location}, ${data.result.state}, ${data.result.country}\n`; 38 | dec += `🕌 *Method*: ${data.result.prayer_method_name}\n\n`; 39 | 40 | dec += `🌅 *Fajr*: ${prayerTimes.fajr}\n`; 41 | dec += `🌄 *Shurooq*: ${prayerTimes.shurooq}\n`; 42 | dec += `☀️ *Dhuhr*: ${prayerTimes.dhuhr}\n`; 43 | dec += `🌇 *Asr*: ${prayerTimes.asr}\n`; 44 | dec += `🌆 *Maghrib*: ${prayerTimes.maghrib}\n`; 45 | dec += `🌃 *Isha*: ${prayerTimes.isha}\n\n`; 46 | 47 | dec += `🧭 *Qibla Direction*: ${data.result.qibla_direction}°\n`; 48 | 49 | const temperature = weather.temperature !== null ? `${weather.temperature}°C` : 'Data not available'; 50 | dec += `🌡️ *Temperature*: ${temperature}\n`; 51 | 52 | // Send image with caption and context info only (no audio) 53 | await conn.sendMessage( 54 | from, 55 | { 56 | image: { url: `https://files.catbox.moe/8fy6up.jpg` }, 57 | caption: dec, 58 | contextInfo: { 59 | mentionedJid: [m.sender], 60 | forwardingScore: 999, 61 | isForwarded: true, 62 | forwardedNewsletterMessageInfo: { 63 | newsletterJid: '120363207624903731@newsletter', 64 | newsletterName: '𝐓𝐎𝐇𝐈𝐃 𝐓𝐄𝐂𝐇 🤖', 65 | serverMessageId: 143 66 | } 67 | } 68 | }, 69 | { quoted: mek } 70 | ); 71 | 72 | } catch (e) { 73 | console.log(e); 74 | reply('*Error occurred while fetching prayer times and weather.*'); 75 | } 76 | }); 77 | -------------------------------------------------------------------------------- /data/antidel.js: -------------------------------------------------------------------------------- 1 | const { DATABASE } = require('../lib/database'); 2 | const { DataTypes } = require('sequelize'); 3 | const config = require('../config'); 4 | 5 | const AntiDelDB = DATABASE.define('AntiDelete', { 6 | id: { 7 | type: DataTypes.INTEGER, 8 | primaryKey: true, 9 | autoIncrement: false, 10 | defaultValue: 1, 11 | }, 12 | status: { 13 | type: DataTypes.BOOLEAN, 14 | defaultValue: config.ANTI_DELETE || false, 15 | }, 16 | }, { 17 | tableName: 'antidelete', 18 | timestamps: false, 19 | hooks: { 20 | beforeCreate: record => { record.id = 1; }, 21 | beforeBulkCreate: records => { records.forEach(record => { record.id = 1; }); }, 22 | }, 23 | }); 24 | 25 | let isInitialized = false; 26 | 27 | async function initializeAntiDeleteSettings() { 28 | if (isInitialized) return; 29 | try { 30 | // First sync the model to ensure table exists 31 | await AntiDelDB.sync(); 32 | 33 | // Check if old schema exists 34 | const tableInfo = await DATABASE.getQueryInterface().describeTable('antidelete'); 35 | if (tableInfo.gc_status) { 36 | // Migrate from old schema to new schema 37 | const oldRecord = await DATABASE.query('SELECT * FROM antidelete WHERE id = 1', { type: DATABASE.QueryTypes.SELECT }); 38 | if (oldRecord && oldRecord.length > 0) { 39 | const newStatus = oldRecord[0].gc_status || oldRecord[0].dm_status; 40 | await DATABASE.query('DROP TABLE antidelete'); 41 | await AntiDelDB.sync(); 42 | await AntiDelDB.create({ id: 1, status: newStatus }); 43 | } 44 | } else { 45 | // Create new record if doesn't exist 46 | await AntiDelDB.findOrCreate({ 47 | where: { id: 1 }, 48 | defaults: { status: config.ANTI_DELETE || false }, 49 | }); 50 | } 51 | isInitialized = true; 52 | } catch (error) { 53 | console.error('Error initializing anti-delete settings:', error); 54 | // If table doesn't exist at all, create it 55 | if (error.original && error.original.code === 'SQLITE_ERROR' && error.original.message.includes('no such table')) { 56 | await AntiDelDB.sync(); 57 | await AntiDelDB.create({ id: 1, status: config.ANTI_DELETE || false }); 58 | isInitialized = true; 59 | } 60 | } 61 | } 62 | 63 | async function setAnti(status) { 64 | try { 65 | await initializeAntiDeleteSettings(); 66 | const [affectedRows] = await AntiDelDB.update({ status }, { where: { id: 1 } }); 67 | return affectedRows > 0; 68 | } catch (error) { 69 | console.error('Error setting anti-delete status:', error); 70 | return false; 71 | } 72 | } 73 | 74 | async function getAnti() { 75 | try { 76 | await initializeAntiDeleteSettings(); 77 | const record = await AntiDelDB.findByPk(1); 78 | return record ? record.status : (config.ANTI_DELETE || false); 79 | } catch (error) { 80 | console.error('Error getting anti-delete status:', error); 81 | return config.ANTI_DELETE || false; 82 | } 83 | } 84 | 85 | module.exports = { 86 | AntiDelDB, 87 | initializeAntiDeleteSettings, 88 | setAnti, 89 | getAnti, 90 | }; 91 | -------------------------------------------------------------------------------- /plugins/main-updater.js: -------------------------------------------------------------------------------- 1 | const { cmd } = require("../command"); 2 | const axios = require('axios'); 3 | const fs = require('fs'); 4 | const path = require("path"); 5 | const AdmZip = require("adm-zip"); 6 | const { setCommitHash, getCommitHash } = require('../data/updateDB'); 7 | 8 | cmd({ 9 | pattern: "update", 10 | alias: ["upgrade", "sync"], 11 | react: '🆕', 12 | desc: "Update the bot to the latest version.", 13 | category: "misc", 14 | filename: __filename 15 | }, async (client, message, args, { reply, isOwner }) => { 16 | if (!isOwner) return reply("This command is only for the bot owner."); 17 | 18 | try { 19 | await reply("🔍 Checking for TOHID_MD updates..."); 20 | 21 | // Fetch the latest commit hash from GitHub 22 | const { data: commitData } = await axios.get("https://api.github.com/repos/Tohidkhan6332/TOHID_MD/commits/main"); 23 | const latestCommitHash = commitData.sha; 24 | 25 | // Get the stored commit hash from the database 26 | const currentHash = await getCommitHash(); 27 | 28 | if (latestCommitHash === currentHash) { 29 | return reply("✅ Your TOHID_MD bot is already up-to-date!"); 30 | } 31 | 32 | await reply("🚀 Updating TOHID_MD Bot..."); 33 | 34 | // Download the latest code 35 | const zipPath = path.join(__dirname, "latest.zip"); 36 | const { data: zipData } = await axios.get("https://github.com/Tohidkhan6332/TOHID_MD/archive/main.zip", { responseType: "arraybuffer" }); 37 | fs.writeFileSync(zipPath, zipData); 38 | 39 | // Extract ZIP file 40 | await reply("📦 Extracting the latest code..."); 41 | const extractPath = path.join(__dirname, 'latest'); 42 | const zip = new AdmZip(zipPath); 43 | zip.extractAllTo(extractPath, true); 44 | 45 | // Copy updated files, preserving config.js and app.json 46 | await reply("🔄 Replacing files..."); 47 | const sourcePath = path.join(extractPath, "TOHID_MD-main"); 48 | const destinationPath = path.join(__dirname, '..'); 49 | copyFolderSync(sourcePath, destinationPath); 50 | 51 | // Save the latest commit hash to the database 52 | await setCommitHash(latestCommitHash); 53 | 54 | // Cleanup 55 | fs.unlinkSync(zipPath); 56 | fs.rmSync(extractPath, { recursive: true, force: true }); 57 | 58 | await reply("✅ Update complete! Restarting the bot..."); 59 | process.exit(0); 60 | } catch (error) { 61 | console.error("Update error:", error); 62 | return reply("❌ Update failed. Please try manually."); 63 | } 64 | }); 65 | 66 | // Helper function to copy directories while preserving config.js and app.json 67 | function copyFolderSync(source, target) { 68 | if (!fs.existsSync(target)) { 69 | fs.mkdirSync(target, { recursive: true }); 70 | } 71 | 72 | const items = fs.readdirSync(source); 73 | for (const item of items) { 74 | const srcPath = path.join(source, item); 75 | const destPath = path.join(target, item); 76 | 77 | // Skip config.js and app.json 78 | if (item === "config.js" || item === "app.json") { 79 | console.log(`Skipping ${item} to preserve custom settings.`); 80 | continue; 81 | } 82 | 83 | if (fs.lstatSync(srcPath).isDirectory()) { 84 | copyFolderSync(srcPath, destPath); 85 | } else { 86 | fs.copyFileSync(srcPath, destPath); 87 | } 88 | } 89 | } 90 | -------------------------------------------------------------------------------- /plugins/tts-new.js: -------------------------------------------------------------------------------- 1 | const { cmd } = require("../command"); 2 | const googleTTS = require('google-tts-api'); 3 | 4 | cmd({ 5 | pattern: "tts2", 6 | desc: "Convert text to speech with different voices.", 7 | category: "fun", 8 | react: "🔊", 9 | filename: __filename 10 | }, 11 | async (conn, mek, m, { from, quoted, body, isCmd, command, args, q, isGroup, sender, senderNumber, botNumber2, botNumber, pushname, isMe, isOwner, groupMetadata, groupName, participants, groupAdmins, isBotAdmins, isAdmins, reply }) => { 12 | try { 13 | // Ensure there is text 14 | if (!q) { 15 | return reply("Please provide text for conversion! Usage: `.tts `"); 16 | } 17 | 18 | // Select voice language based on user input or default to a male voice 19 | let voiceLanguage = 'en-US'; // Default language is American English with a male voice 20 | let selectedVoice = 'male'; // Default voice type (we assume it's male by default) 21 | 22 | // Check if user wants a different language or voice 23 | if (args[0] === "male") { 24 | voiceLanguage = 'en-US'; // Use American male voice 25 | } else if (args[0] === "female") { 26 | voiceLanguage = 'en-GB'; // Use British female voice 27 | selectedVoice = 'female'; 28 | } else if (args[0] === "loud") { 29 | voiceLanguage = 'en-US'; // Default male voice, but let's interpret "loud" as normal speech speed. 30 | } else if (args[0] === "deep") { 31 | voiceLanguage = 'en-US'; // Deep male voice (still has limitations with `google-tts-api`) 32 | } else { 33 | voiceLanguage = 'en-US'; // Default fallback 34 | } 35 | 36 | // Generate the URL for the TTS audio 37 | const url = googleTTS.getAudioUrl(q, { 38 | lang: voiceLanguage, // Choose language based on selected voice 39 | slow: false, // Normal speed for the speech 40 | host: 'https://translate.google.com' 41 | }); 42 | 43 | // Send the audio message to the user 44 | await conn.sendMessage(from, { 45 | audio: { url: url }, 46 | mimetype: 'audio/mpeg', 47 | ptt: true 48 | }, { quoted: mek }); 49 | 50 | } catch (error) { 51 | console.error(error); 52 | reply(`Error: ${error.message}`); 53 | } 54 | }); 55 | 56 | 57 | cmd({ 58 | pattern: "tts3", 59 | desc: "Convert text to speech with different voices.", 60 | category: "fun", 61 | react: "🔊", 62 | filename: __filename 63 | }, 64 | async (conn, mek, m, { from, quoted, body, isCmd, command, args, q, isGroup, sender, senderNumber, botNumber2, botNumber, pushname, isMe, isOwner, groupMetadata, groupName, participants, groupAdmins, isBotAdmins, isAdmins, reply }) => { 65 | try { 66 | // Ensure there is text 67 | if (!q) { 68 | return reply("Please provide text for conversion! Usage: `.tts2 `"); 69 | } 70 | 71 | // Set default language 72 | let voiceLanguage = 'en-US'; // Default language is American English 73 | 74 | // Check if user specifies Urdu language 75 | if (args[0] === "ur" || args[0] === "urdu") { 76 | voiceLanguage = 'ur'; // Set language to Urdu 77 | } 78 | 79 | // Generate the URL for the TTS audio 80 | const url = googleTTS.getAudioUrl(q, { 81 | lang: voiceLanguage, // Choose language based on input 82 | slow: false, // Normal speed for the speech 83 | host: 'https://translate.google.com' 84 | }); 85 | 86 | // Send the audio message to the user 87 | await conn.sendMessage(from, { 88 | audio: { url: url }, 89 | mimetype: 'audio/mpeg', 90 | ptt: true 91 | }, { quoted: mek }); 92 | 93 | } catch (error) { 94 | console.error(error); 95 | reply(`Error: ${error.message}`); 96 | } 97 | }); -------------------------------------------------------------------------------- /plugins/anti-link.js: -------------------------------------------------------------------------------- 1 | const { cmd } = require('../command'); 2 | const config = require("../config"); 3 | 4 | cmd({ 5 | 'on': "body" 6 | }, async (conn, m, store, { 7 | from, 8 | body, 9 | sender, 10 | isGroup, 11 | isAdmins, 12 | isBotAdmins, 13 | reply 14 | }) => { 15 | try { 16 | // Initialize warnings if not exists 17 | if (!global.warnings) { 18 | global.warnings = {}; 19 | } 20 | 21 | // Only act in groups where bot is admin and sender isn't admin 22 | if (!isGroup || isAdmins || !isBotAdmins) { 23 | return; 24 | } 25 | 26 | // List of link patterns to detect 27 | const linkPatterns = [ 28 | /https?:\/\/(?:chat\.whatsapp\.com|wa\.me)\/\S+/gi, // WhatsApp links 29 | /https?:\/\/(?:api\.whatsapp\.com|wa\.me)\/\S+/gi, // WhatsApp API links 30 | /wa\.me\/\S+/gi, // WhatsApp.me links 31 | /https?:\/\/(?:t\.me|telegram\.me)\/\S+/gi, // Telegram links 32 | /https?:\/\/(?:www\.)?\.com\/\S+/gi, // Generic .com links 33 | /https?:\/\/(?:www\.)?twitter\.com\/\S+/gi, // Twitter links 34 | /https?:\/\/(?:www\.)?linkedin\.com\/\S+/gi, // LinkedIn links 35 | /https?:\/\/(?:whatsapp\.com|channel\.me)\/\S+/gi, // Other WhatsApp/channel links 36 | /https?:\/\/(?:www\.)?reddit\.com\/\S+/gi, // Reddit links 37 | /https?:\/\/(?:www\.)?discord\.com\/\S+/gi, // Discord links 38 | /https?:\/\/(?:www\.)?twitch\.tv\/\S+/gi, // Twitch links 39 | /https?:\/\/(?:www\.)?vimeo\.com\/\S+/gi, // Vimeo links 40 | /https?:\/\/(?:www\.)?dailymotion\.com\/\S+/gi, // Dailymotion links 41 | /https?:\/\/(?:www\.)?medium\.com\/\S+/gi // Medium links 42 | ]; 43 | 44 | // Check if message contains any forbidden links 45 | const containsLink = linkPatterns.some(pattern => pattern.test(body)); 46 | 47 | // Only proceed if anti-link is enabled and link is detected 48 | if (containsLink && config.ANTI_LINK === 'true') { 49 | console.log(`Link detected from ${sender}: ${body}`); 50 | 51 | // Try to delete the message 52 | try { 53 | await conn.sendMessage(from, { 54 | delete: m.key 55 | }); 56 | console.log(`Message deleted: ${m.key.id}`); 57 | } catch (error) { 58 | console.error("Failed to delete message:", error); 59 | } 60 | 61 | // Update warning count for user 62 | global.warnings[sender] = (global.warnings[sender] || 0) + 1; 63 | const warningCount = global.warnings[sender]; 64 | 65 | // Handle warnings 66 | if (warningCount < 4) { 67 | // Send warning message 68 | await conn.sendMessage(from, { 69 | text: `‎*⚠️LINKS ARE NOT ALLOWED⚠️*\n` + 70 | `*╭────⬡ WARNING ⬡────*\n` + 71 | `*├▢ USER :* @${sender.split('@')[0]}!\n` + 72 | `*├▢ COUNT : ${warningCount}*\n` + 73 | `*├▢ REASON : LINK SENDING*\n` + 74 | `*├▢ WARN LIMIT : 3*\n` + 75 | `*╰─────⬡ *TOHID_MD* ⬡────*`, 76 | mentions: [sender] 77 | }); 78 | } else { 79 | // Remove user if they exceed warning limit 80 | await conn.sendMessage(from, { 81 | text: `@${sender.split('@')[0]} *TOHID_MD BOT HAS BEEN REMOVED - WARN LIMIT EXCEEDED!*`, 82 | mentions: [sender] 83 | }); 84 | await conn.groupParticipantsUpdate(from, [sender], "remove"); 85 | delete global.warnings[sender]; 86 | } 87 | } 88 | } catch (error) { 89 | console.error("Anti-link error:", error); 90 | reply("❌ An error occurred while processing the message."); 91 | } 92 | }); 93 | -------------------------------------------------------------------------------- /plugins/main-ban.js: -------------------------------------------------------------------------------- 1 | const fs = require("fs"); 2 | const path = require("path"); 3 | const { cmd } = require("../command"); 4 | 5 | cmd({ 6 | pattern: "ban", 7 | alias: ["blockuser", "addban"], 8 | desc: "Ban a user from using the bot", 9 | category: "owner", 10 | react: "⛔", 11 | filename: __filename 12 | }, async (conn, mek, m, { from, args, isCreator, reply }) => { 13 | try { 14 | if (!isCreator) return reply("_❗Only the bot owner can use this command!_"); 15 | 16 | let target = m.mentionedJid?.[0] 17 | || (m.quoted?.sender ?? null) 18 | || (args[0]?.replace(/[^0-9]/g, '') + "@s.whatsapp.net"); 19 | 20 | if (!target) return reply("❌ Please provide a number or tag/reply a user."); 21 | 22 | let banned = JSON.parse(fs.readFileSync("./lib/ban.json", "utf-8")); 23 | 24 | if (banned.includes(target)) { 25 | return reply("❌ This user is already banned."); 26 | } 27 | 28 | banned.push(target); 29 | fs.writeFileSync("./lib/ban.json", JSON.stringify([...new Set(banned)], null, 2)); 30 | 31 | await conn.sendMessage(from, { 32 | image: { url: "https://i.ibb.co/4ZSYvPTq/lordali.jpg" }, 33 | caption: `⛔ User has been banned from using the bot.` 34 | }, { quoted: mek }); 35 | 36 | } catch (err) { 37 | console.error(err); 38 | reply("❌ Error: " + err.message); 39 | } 40 | }); 41 | 42 | cmd({ 43 | pattern: "unban", 44 | alias: ["removeban"], 45 | desc: "Unban a user", 46 | category: "owner", 47 | react: "✅", 48 | filename: __filename 49 | }, async (conn, mek, m, { from, args, isCreator, reply }) => { 50 | try { 51 | if (!isCreator) return reply("_❗Only the bot owner can use this command!_"); 52 | 53 | let target = m.mentionedJid?.[0] 54 | || (m.quoted?.sender ?? null) 55 | || (args[0]?.replace(/[^0-9]/g, '') + "@s.whatsapp.net"); 56 | 57 | if (!target) return reply("❌ Please provide a number or tag/reply a user."); 58 | 59 | let banned = JSON.parse(fs.readFileSync("./lib/ban.json", "utf-8")); 60 | 61 | if (!banned.includes(target)) { 62 | return reply("❌ This user is not banned."); 63 | } 64 | 65 | const updated = banned.filter(u => u !== target); 66 | fs.writeFileSync("./lib/ban.json", JSON.stringify(updated, null, 2)); 67 | 68 | await conn.sendMessage(from, { 69 | image: { url: "https://i.ibb.co/4ZSYvPTq/lordali.jpg" }, 70 | caption: `✅ User has been unbanned.` 71 | }, { quoted: mek }); 72 | 73 | } catch (err) { 74 | console.error(err); 75 | reply("❌ Error: " + err.message); 76 | } 77 | }); 78 | 79 | cmd({ 80 | pattern: "listban", 81 | alias: ["banlist", "bannedusers"], 82 | desc: "List all banned users", 83 | category: "owner", 84 | react: "📋", 85 | filename: __filename 86 | }, async (conn, mek, m, { from, isCreator, reply }) => { 87 | try { 88 | if (!isCreator) return reply("_❗Only the bot owner can use this command!_"); 89 | 90 | let banned = JSON.parse(fs.readFileSync("./lib/ban.json", "utf-8")); 91 | banned = [...new Set(banned)]; 92 | 93 | if (banned.length === 0) return reply("✅ No banned users found."); 94 | 95 | let msg = "`⛔ Banned Users:`\n\n"; 96 | banned.forEach((id, i) => { 97 | msg += `${i + 1}. ${id.replace("@s.whatsapp.net", "")}\n`; 98 | }); 99 | 100 | await conn.sendMessage(from, { 101 | image: { url: "https://i.ibb.co/4ZSYvPTq/lordali.jpg" }, 102 | caption: msg 103 | }, { quoted: mek }); 104 | } catch (err) { 105 | console.error(err); 106 | reply("❌ Error: " + err.message); 107 | } 108 | }); 109 | -------------------------------------------------------------------------------- /plugins/tool-tempmail.js: -------------------------------------------------------------------------------- 1 | const axios = require('axios'); 2 | const { cmd } = require('../command'); 3 | 4 | cmd({ 5 | pattern: "tempmail", 6 | alias: ["genmail"], 7 | desc: "Generate a new temporary email address", 8 | category: "utility", 9 | react: "📧", 10 | filename: __filename 11 | }, 12 | async (conn, mek, m, { from, reply, prefix }) => { 13 | try { 14 | const response = await axios.get('https://apis.davidcyriltech.my.id/temp-mail'); 15 | const { email, session_id, expires_at } = response.data; 16 | 17 | // Format the expiration time and date 18 | const expiresDate = new Date(expires_at); 19 | const timeString = expiresDate.toLocaleTimeString('en-US', { 20 | hour: '2-digit', 21 | minute: '2-digit', 22 | hour12: true 23 | }); 24 | const dateString = expiresDate.toLocaleDateString('en-US', { 25 | weekday: 'short', 26 | month: 'short', 27 | day: 'numeric', 28 | year: 'numeric' 29 | }); 30 | 31 | // Create the complete message 32 | const message = ` 33 | 📧 *TEMPORARY EMAIL GENERATED* 34 | 35 | ✉️ *Email Address:* 36 | ${email} 37 | 38 | ⏳ *Expires:* 39 | ${timeString} • ${dateString} 40 | 41 | 🔑 *Session ID:* 42 | \`\`\`${session_id}\`\`\` 43 | 44 | 📥 *Check Inbox:* 45 | .inbox ${session_id} 46 | 47 | _Email will expire after 24 hours_ 48 | `; 49 | 50 | await conn.sendMessage( 51 | from, 52 | { 53 | text: message, 54 | contextInfo: { 55 | forwardingScore: 999, 56 | isForwarded: true, 57 | forwardedNewsletterMessageInfo: { 58 | newsletterJid: '120363207624903731@newsletter', 59 | newsletterName: 'TempMail Service', 60 | serverMessageId: 101 61 | } 62 | } 63 | }, 64 | { quoted: mek } 65 | ); 66 | 67 | } catch (e) { 68 | console.error('TempMail error:', e); 69 | reply(`❌ Error: ${e.message}`); 70 | } 71 | }); 72 | cmd({ 73 | pattern: "checkmail", 74 | alias: ["inbox", "tmail", "mailinbox"], 75 | desc: "Check your temporary email inbox", 76 | category: "utility", 77 | react: "📬", 78 | filename: __filename 79 | }, 80 | async (conn, mek, m, { from, reply, args }) => { 81 | try { 82 | const sessionId = args[0]; 83 | if (!sessionId) return reply('🔑 Please provide your session ID\nExample: .checkmail YOUR_SESSION_ID'); 84 | 85 | const inboxUrl = `https://apis.davidcyriltech.my.id/temp-mail/inbox?id=${encodeURIComponent(sessionId)}`; 86 | const response = await axios.get(inboxUrl); 87 | 88 | if (!response.data.success) { 89 | return reply('❌ Invalid session ID or expired email'); 90 | } 91 | 92 | const { inbox_count, messages } = response.data; 93 | 94 | if (inbox_count === 0) { 95 | return reply('📭 Your inbox is empty'); 96 | } 97 | 98 | let messageList = `📬 *You have ${inbox_count} message(s)*\n\n`; 99 | messages.forEach((msg, index) => { 100 | messageList += `━━━━━━━━━━━━━━━━━━\n` + 101 | `📌 *Message ${index + 1}*\n` + 102 | `👤 *From:* ${msg.from}\n` + 103 | `📝 *Subject:* ${msg.subject}\n` + 104 | `⏰ *Date:* ${new Date(msg.date).toLocaleString()}\n\n` + 105 | `📄 *Content:*\n${msg.body}\n\n`; 106 | }); 107 | 108 | await reply(messageList); 109 | 110 | } catch (e) { 111 | console.error('CheckMail error:', e); 112 | reply(`❌ Error checking inbox: ${e.response?.data?.message || e.message}`); 113 | } 114 | }); 115 | -------------------------------------------------------------------------------- /plugins/check-uptime.js: -------------------------------------------------------------------------------- 1 | const { cmd } = require('../command'); 2 | const { runtime } = require('../lib/functions'); 3 | const config = require('../config'); 4 | 5 | cmd({ 6 | pattern: "uptime", 7 | alias: ["runtime", "up"], 8 | desc: "Show bot uptime with stylish formats", 9 | category: "main", 10 | react: "⏱️", 11 | filename: __filename 12 | }, 13 | async (conn, mek, m, { from, reply }) => { 14 | try { 15 | const uptime = runtime(process.uptime()); 16 | const startTime = new Date(Date.now() - process.uptime() * 1000); 17 | 18 | // Style 1: Classic Box 19 | const style1 = `╭───『 UPTIME 』───⳹ 20 | │ 21 | │ ⏱️ ${uptime} 22 | │ 23 | │ 🚀 Started: ${startTime.toLocaleString()} 24 | │ 25 | ╰────────────────⳹ 26 | ${config.DESCRIPTION}`; 27 | 28 | // Style 2: Minimalist 29 | const style2 = `•——[ UPTIME ]——• 30 | │ 31 | ├─ ⏳ ${uptime} 32 | ├─ 🕒 Since: ${startTime.toLocaleTimeString()} 33 | │ 34 | •——[ ${config.BOT_NAME} ]——•`; 35 | 36 | // Style 3: Fancy Borders 37 | const style3 = `▄▀▄▀▄ BOT UPTIME ▄▀▄▀▄ 38 | 39 | ♢ Running: ${uptime} 40 | ♢ Since: ${startTime.toLocaleDateString()} 41 | 42 | ${config.DESCRIPTION}`; 43 | 44 | // Style 4: Code Style 45 | const style4 = `┌──────────────────────┐ 46 | │ ⚡ UPTIME STATUS ⚡ │ 47 | ├──────────────────────┤ 48 | │ • Time: ${uptime} 49 | │ • Started: ${startTime.toLocaleString()} 50 | │ • Version: 4.0.0 51 | └──────────────────────┘`; 52 | 53 | // Style 5: Modern Blocks 54 | const style5 = `▰▰▰▰▰ UPTIME ▰▰▰▰▰ 55 | 56 | ⏳ ${uptime} 57 | 🕰️ ${startTime.toLocaleString()} 58 | 59 | ${config.DESCRIPTION}`; 60 | 61 | // Style 6: Retro Terminal 62 | const style6 = `╔══════════════════════╗ 63 | ║ ${config.BOT_NAME} UPTIME ║ 64 | ╠══════════════════════╣ 65 | ║ > RUNTIME: ${uptime} 66 | ║ > SINCE: ${startTime.toLocaleString()} 67 | ╚══════════════════════╝`; 68 | 69 | // Style 7: Elegant 70 | const style7 = `┌───────────────┐ 71 | │ ⏱️ UPTIME │ 72 | └───────────────┘ 73 | │ 74 | │ ${uptime} 75 | │ 76 | │ Since ${startTime.toLocaleDateString()} 77 | │ 78 | ┌───────────────┐ 79 | │ ${config.BOT_NAME} │ 80 | └───────────────┘`; 81 | 82 | // Style 8: Social Media Style 83 | const style8 = `⏱️ *Uptime Report* ⏱️ 84 | 85 | 🟢 Online for: ${uptime} 86 | 📅 Since: ${startTime.toLocaleString()} 87 | 88 | ${config.DESCRIPTION}`; 89 | 90 | // Style 9: Fancy List 91 | const style9 = `╔♫═⏱️═♫══════════╗ 92 | ${config.BOT_NAME} UPTIME 93 | ╚♫═⏱️═♫══════════╝ 94 | 95 | •・゜゜・* ✧ *・゜゜・• 96 | ✧ ${uptime} 97 | ✧ Since ${startTime.toLocaleDateString()} 98 | •・゜゜・* ✧ *・゜゜・•`; 99 | 100 | // Style 10: Professional 101 | const style10 = `┏━━━━━━━━━━━━━━━━━━┓ 102 | ┃ UPTIME ANALYSIS ┃ 103 | ┗━━━━━━━━━━━━━━━━━━┛ 104 | 105 | ◈ Duration: ${uptime} 106 | ◈ Start Time: ${startTime.toLocaleString()} 107 | ◈ Stability: 100% 108 | ◈ Version: 4.0.0 109 | 110 | ${config.DESCRIPTION}`; 111 | 112 | const styles = [style1, style2, style3, style4, style5, style6, style7, style8, style9, style10]; 113 | const selectedStyle = styles[Math.floor(Math.random() * styles.length)]; 114 | 115 | await conn.sendMessage(from, { 116 | text: selectedStyle, 117 | contextInfo: { 118 | mentionedJid: [m.sender], 119 | forwardingScore: 999, 120 | isForwarded: true, 121 | forwardedNewsletterMessageInfo: { 122 | newsletterJid: '120363207624903731@newsletter', 123 | newsletterName: config.OWNER_NAME || '𝐓𝐎𝐇𝐈𝐃 𝐓𝐄𝐂𝐇 🤖', 124 | serverMessageId: 143 125 | } 126 | } 127 | }, { quoted: mek }); 128 | 129 | } catch (e) { 130 | console.error("Uptime Error:", e); 131 | reply(`❌ Error: ${e.message}`); 132 | } 133 | }); 134 | -------------------------------------------------------------------------------- /lib/antidel.js: -------------------------------------------------------------------------------- 1 | const { isJidGroup } = require('@whiskeysockets/baileys'); 2 | const { loadMessage, getAnti } = require('../data'); 3 | const config = require('../config'); 4 | 5 | const DeletedText = async (conn, mek, jid, deleteInfo, isGroup, update) => { 6 | const messageContent = mek.message?.conversation || mek.message?.extendedTextMessage?.text || 'Unknown content'; 7 | deleteInfo += `\n◈ Content ━ ${messageContent}`; 8 | 9 | await conn.sendMessage( 10 | jid, 11 | { 12 | text: deleteInfo, 13 | contextInfo: { 14 | mentionedJid: isGroup ? [update.key.participant, mek.key.participant] : [update.key.remoteJid], 15 | }, 16 | }, 17 | { quoted: mek }, 18 | ); 19 | }; 20 | 21 | const DeletedMedia = async (conn, mek, jid, deleteInfo) => { 22 | const antideletedmek = structuredClone(mek.message); 23 | const messageType = Object.keys(antideletedmek)[0]; 24 | if (antideletedmek[messageType]) { 25 | antideletedmek[messageType].contextInfo = { 26 | stanzaId: mek.key.id, 27 | participant: mek.sender, 28 | quotedMessage: mek.message, 29 | }; 30 | } 31 | if (messageType === 'imageMessage' || messageType === 'videoMessage') { 32 | antideletedmek[messageType].caption = deleteInfo; 33 | } else if (messageType === 'audioMessage' || messageType === 'documentMessage') { 34 | await conn.sendMessage(jid, { text: `*⚠️ Deleted Message Alert 🚨*\n${deleteInfo}` }, { quoted: mek }); 35 | } 36 | await conn.relayMessage(jid, antideletedmek, {}); 37 | }; 38 | 39 | const AntiDelete = async (conn, updates) => { 40 | for (const update of updates) { 41 | if (update.update.message === null) { 42 | const store = await loadMessage(update.key.id); 43 | 44 | if (store && store.message) { 45 | const mek = store.message; 46 | const isGroup = isJidGroup(store.jid); 47 | const antiDeleteStatus = await getAnti(); 48 | if (!antiDeleteStatus) continue; 49 | 50 | const deleteTime = new Date().toLocaleTimeString('en-GB', { 51 | hour: '2-digit', 52 | minute: '2-digit', 53 | second: '2-digit', 54 | }); 55 | 56 | let deleteInfo, jid; 57 | if (isGroup) { 58 | const groupMetadata = await conn.groupMetadata(store.jid); 59 | const groupName = groupMetadata.subject; 60 | const sender = mek.key.participant?.split('@')[0]; 61 | const deleter = update.key.participant?.split('@')[0]; 62 | 63 | deleteInfo = `*╭────❍「 TOHID_MD 」❍────* 64 | *├•♻️ SENDER:* @${sender} 65 | *├•👥 GROUP:* ${groupName} 66 | *├•⏰ DELETE TIME:* ${deleteTime} 67 | *├•🗑️ DELETED BY:* @${deleter} 68 | *├•⚠️ ACTION:* Deleted a Message 69 | *╰•💬 MESSAGE:* Content Below 🔽`; 70 | jid = config.ANTI_DEL_PATH === "inbox" ? conn.user.id : store.jid; 71 | } else { 72 | const senderNumber = mek.key.remoteJid?.split('@')[0]; 73 | const deleterNumber = update.key.remoteJid?.split('@')[0]; 74 | 75 | deleteInfo = `*╭────❍「 TOHID_MD 」❍────* 76 | *├•👤 SENDER:* @${senderNumber} 77 | *├•⏰ DELETE TIME:* ${deleteTime} 78 | *├•⚠️ ACTION:* Deleted a Message 79 | *╰•💬 MESSAGE:* Content Below 🔽`; 80 | jid = config.ANTI_DEL_PATH === "inbox" ? conn.user.id : update.key.remoteJid; 81 | } 82 | 83 | if (mek.message?.conversation || mek.message?.extendedTextMessage) { 84 | await DeletedText(conn, mek, jid, deleteInfo, isGroup, update); 85 | } else { 86 | await DeletedMedia(conn, mek, jid, deleteInfo); 87 | } 88 | } 89 | } 90 | } 91 | }; 92 | 93 | module.exports = { 94 | DeletedText, 95 | DeletedMedia, 96 | AntiDelete, 97 | }; 98 | -------------------------------------------------------------------------------- /config.js: -------------------------------------------------------------------------------- 1 | const fs = require('fs'); 2 | if (fs.existsSync('config.env')) require('dotenv').config({ path: './config.env' }); 3 | 4 | function convertToBool(text, fault = 'true') { 5 | return text === fault ? true : false; 6 | } 7 | module.exports = { 8 | SESSION_ID: process.env.SESSION_ID || "", 9 | // add your Session Id 10 | AUTO_STATUS_SEEN: process.env.AUTO_STATUS_SEEN || "true", 11 | // make true or false status auto seen 12 | AUTO_STATUS_REPLY: process.env.AUTO_STATUS_REPLY || "false", 13 | // make true if you want auto reply on status 14 | AUTO_STATUS_REACT: process.env.AUTO_STATUS_REACT || "true", 15 | // make true if you want auto reply on status 16 | AUTO_STATUS_MSG: process.env.AUTO_STATUS_MSG || "*SEEN YOUR STATUS BY TOHID_MD 🇮🇳*", 17 | // set the auto reply massage on status reply 18 | ANTI_DELETE: process.env.ANTI_DELETE || "true", 19 | // set true false for anti delete 20 | ANTI_DEL_PATH: process.env.ANTI_DEL_PATH || "inbox", 21 | // change it to 'same' if you want to resend deleted message in same chat 22 | WELCOME: process.env.WELCOME || "true", 23 | // true if want welcome and goodbye msg in groups 24 | ADMIN_EVENTS: process.env.ADMIN_EVENTS || "false", 25 | // make true to know who dismiss or promoted a member in group 26 | ANTI_LINK: process.env.ANTI_LINK || "true", 27 | // make anti link true,false for groups 28 | MENTION_REPLY: process.env.MENTION_REPLY || "false", 29 | // make true if want auto voice reply if someone menetion you 30 | MENU_IMAGE_URL: process.env.MENU_IMAGE_URL || "https://i.ibb.co/4ZSYvPTq/lordali.jpg", 31 | // add custom menu and mention reply image url 32 | PREFIX: process.env.PREFIX || ".", 33 | // add your prifix for bot 34 | BOT_NAME: process.env.BOT_NAME || "TOHID_MD", 35 | // add bot namw here for menu 36 | AUTO_STATUS_REACT: process.env.AUTO_STATUS_REACT || "true", 37 | // true to get auto status react 38 | STICKER_NAME: process.env.STICKER_NAME || "TOHID_MD", 39 | // type sticker pack name 40 | CUSTOM_REACT: process.env.CUSTOM_REACT || "false", 41 | // make this true for custum emoji react 42 | CUSTOM_REACT_EMOJIS: process.env.CUSTOM_REACT_EMOJIS || "💝,💖,💗,❤️‍🩹,❤️,🧡,💛,💚,💙,💜,🤎,🖤,🤍", 43 | // chose custom react emojis by yourself 44 | DELETE_LINKS: process.env.DELETE_LINKS || "false", 45 | // automatic delete links witho remove member 46 | OWNER_NUMBER: process.env.OWNER_NUMBER || "917849917350", 47 | // add your bot owner number 48 | OWNER_NAME: process.env.OWNER_NAME || "Mr Tohid", 49 | // add bot owner name 50 | DESCRIPTION: process.env.DESCRIPTION || "*©𝙿𝙾𝚆𝙴𝚁𝙴𝙳 𝙱𝚈 𝚃𝙾𝙷𝙸𝙳_𝙼𝙳*", 51 | // add bot owner name 52 | ALIVE_IMG: process.env.ALIVE_IMG || "https://i.ibb.co/4ZSYvPTq/lordali.jpg", 53 | // add img for alive msg 54 | LIVE_MSG: process.env.LIVE_MSG || "> I'm alive*TOHID_MD*🇮🇳", 55 | // add alive msg here 56 | READ_MESSAGE: process.env.READ_MESSAGE || "false", 57 | // Turn true or false for automatic read msgs 58 | AUTO_REACT: process.env.AUTO_REACT || "false", 59 | // make this true or false for auto react on all msgs 60 | ANTI_BAD: process.env.ANTI_BAD || "false", 61 | // false or true for anti bad words 62 | MODE: process.env.MODE || "public", 63 | // make bot public-private-inbox-group 64 | ANTI_LINK_KICK: process.env.ANTI_LINK_KICK || "false", 65 | // make anti link true,false for groups 66 | AUTO_STICKER: process.env.AUTO_STICKER || "false", 67 | // make true for automatic stickers 68 | AUTO_REPLY: process.env.AUTO_REPLY || "false", 69 | // make true or false automatic text reply 70 | ALWAYS_ONLINE: process.env.ALWAYS_ONLINE || "false", 71 | // maks true for always online 72 | PUBLIC_MODE: process.env.PUBLIC_MODE || "true", 73 | // make false if want private mod 74 | AUTO_TYPING: process.env.AUTO_TYPING || "false", 75 | // true for automatic show typing 76 | READ_CMD: process.env.READ_CMD || "false", 77 | // true if want mark commands as read 78 | DEV: process.env.DEV || "917849917350", 79 | //replace with your whatsapp number 80 | ANTI_VV: process.env.ANTI_VV || "true", 81 | // true for anti once view 82 | AUTO_RECORDING: process.env.AUTO_RECORDING || "false" 83 | // make it true for auto recoding 84 | }; 85 | -------------------------------------------------------------------------------- /plugins/group-tag.js: -------------------------------------------------------------------------------- 1 | const { cmd } = require('../command'); 2 | 3 | // Fixed & Created By JawadTechX 4 | cmd({ 5 | pattern: "hidetag", 6 | alias: ["tag", "h"], 7 | react: "🔊", 8 | desc: "To Tag all Members for Any Message/Media", 9 | category: "group", 10 | use: '.hidetag Hello', 11 | filename: __filename 12 | }, 13 | async (conn, mek, m, { 14 | from, q, isGroup, isCreator, isAdmins, 15 | participants, reply 16 | }) => { 17 | try { 18 | const isUrl = (url) => { 19 | return /https?:\/\/(www\.)?[\w\-@:%._\+~#=]{1,256}\.[a-zA-Z0-9()]{1,6}\b([\w\-@:%_\+.~#?&//=]*)/.test(url); 20 | }; 21 | 22 | if (!isGroup) return reply("❌ This command can only be used in groups."); 23 | if (!isAdmins && !isCreator) return reply("❌ Only group admins can use this command."); 24 | 25 | const mentionAll = { mentions: participants.map(u => u.id) }; 26 | 27 | // If no message or reply is provided 28 | if (!q && !m.quoted) { 29 | return reply("❌ Please provide a message or reply to a message to tag all members."); 30 | } 31 | 32 | // If a reply to a message 33 | if (m.quoted) { 34 | const type = m.quoted.mtype || ''; 35 | 36 | // If it's a text message (extendedTextMessage) 37 | if (type === 'extendedTextMessage') { 38 | return await conn.sendMessage(from, { 39 | text: m.quoted.text || 'No message content found.', 40 | ...mentionAll 41 | }, { quoted: mek }); 42 | } 43 | 44 | // Handle media messages 45 | if (['imageMessage', 'videoMessage', 'audioMessage', 'stickerMessage', 'documentMessage'].includes(type)) { 46 | try { 47 | const buffer = await m.quoted.download?.(); 48 | if (!buffer) return reply("❌ Failed to download the quoted media."); 49 | 50 | let content; 51 | switch (type) { 52 | case "imageMessage": 53 | content = { image: buffer, caption: m.quoted.text || "📷 Image", ...mentionAll }; 54 | break; 55 | case "videoMessage": 56 | content = { 57 | video: buffer, 58 | caption: m.quoted.text || "🎥 Video", 59 | gifPlayback: m.quoted.message?.videoMessage?.gifPlayback || false, 60 | ...mentionAll 61 | }; 62 | break; 63 | case "audioMessage": 64 | content = { 65 | audio: buffer, 66 | mimetype: "audio/mp4", 67 | ptt: m.quoted.message?.audioMessage?.ptt || false, 68 | ...mentionAll 69 | }; 70 | break; 71 | case "stickerMessage": 72 | content = { sticker: buffer, ...mentionAll }; 73 | break; 74 | case "documentMessage": 75 | content = { 76 | document: buffer, 77 | mimetype: m.quoted.message?.documentMessage?.mimetype || "application/octet-stream", 78 | fileName: m.quoted.message?.documentMessage?.fileName || "file", 79 | caption: m.quoted.text || "", 80 | ...mentionAll 81 | }; 82 | break; 83 | } 84 | 85 | if (content) { 86 | return await conn.sendMessage(from, content, { quoted: mek }); 87 | } 88 | } catch (e) { 89 | console.error("Media download/send error:", e); 90 | return reply("❌ Failed to process the media. Sending as text instead."); 91 | } 92 | } 93 | 94 | // Fallback for any other message type 95 | return await conn.sendMessage(from, { 96 | text: m.quoted.text || "📨 Message", 97 | ...mentionAll 98 | }, { quoted: mek }); 99 | } 100 | 101 | // If no quoted message, but a direct message is sent 102 | if (q) { 103 | // If the direct message is a URL, send it as a message 104 | if (isUrl(q)) { 105 | return await conn.sendMessage(from, { 106 | text: q, 107 | ...mentionAll 108 | }, { quoted: mek }); 109 | } 110 | 111 | // Otherwise, just send the text without the command name 112 | await conn.sendMessage(from, { 113 | text: q, // Sends the message without the command name 114 | ...mentionAll 115 | }, { quoted: mek }); 116 | } 117 | 118 | } catch (e) { 119 | console.error(e); 120 | reply(`❌ *Error Occurred !!*\n\n${e.message}`); 121 | } 122 | }); 123 | --------------------------------------------------------------------------------