Footer Description

Quizontal - Movie download + group commands plugins

 Movie download + group commands plugins



Quizontal Movie Download & Group Command Plugins are powerful automation tools designed to enhance the functionality of WhatsApp bots by delivering fast, organized, and user-friendly experiences. The movie download plugin allows users to search movies, view available qualities with file sizes, and securely download content from trusted sources in an efficient way. At the same time, the group command plugins help manage WhatsApp groups effortlessly by enabling features such as welcome messages, admin controls, user moderation, and interactive commands. Together, these plugins transform a simple bot into a smart multimedia and group-management assistant, making Quizontal an ideal platform for building modern, feature-rich WhatsApp bots with ease and flexibility.


1. group.js



const { cmd } = require("../command");
const { getGroupAdmins } = require("../lib/functions");
const { downloadMediaMessage } = require('@whiskeysockets/baileys');


function getTargetUser(mek, quoted, args) {
  if (mek.message?.extendedTextMessage?.contextInfo?.mentionedJid?.length) {
    return mek.message.extendedTextMessage.contextInfo.mentionedJid[0];
  } else if (quoted?.sender) {
    return quoted.sender;
  } else if (args[0]?.includes("@")) {
    return args[0].replace("@", "") + "@s.whatsapp.net";
  }
  return null;
}

cmd({
  pattern: "kick",
  react: "👢",
  desc: "Kick user from group",
  category: "group",
  filename: __filename,
}, async (danuwa, mek, m, { isGroup, isAdmins, reply, participants, quoted, args }) => {
  if (!isGroup || !isAdmins) 
    return reply("*Group only & both you and I must be admins.*");

  const target = getTargetUser(mek, quoted, args);
  if (!target) return reply("*Mention or reply to a user to kick.*");

  const groupAdmins = getGroupAdmins(participants);
  if (groupAdmins.includes(target)) 
    return reply("*I can't kick an admin.*");

  await danuwa.groupParticipantsUpdate(m.chat, [target], "remove");
  return reply(`*Kicked:* @${target.split("@")[0]}`, { mentions: [target] });
});

cmd({
  pattern: "tagall",
  react: "📢",
  desc: "Tag all group members",
  category: "group",
  filename: __filename,
}, async (danuwa, mek, m, { isGroup, isAdmins, reply, participants }) => {
  if (!isGroup) return reply("*This command can only be used in groups.*");
  if (!isAdmins) return reply("*Only group admins can use this command.*");

  let validParticipants = participants.filter(p => {
    const number = p.id.split("@")[0];
    return /^\d{9,15}$/.test(number);
  });

  if (validParticipants.length === 0) {
    return reply("*No valid phone numbers found to tag.*");
  }

  let mentions = validParticipants.map(p => p.id);

  let text = "*Attention everyone:*\n";

  let displayNumbers = validParticipants.map(p => {
    const number = p.id.split("@")[0];
    return `@+${number}`;
  });

  text += displayNumbers.join(" ");

  return reply(text, { mentions });
});

cmd({
  pattern: "setpp",
  desc: "Set group profile picture",
  category: "group",
  filename: __filename
}, async (danuwa, mek, m, { isGroup, isAdmins, reply, participants, args, quoted }) => {
  if (!isGroup) return reply("❌ This command can only be used in groups!");
  if (!isAdmins) return reply("❌ You must be a group admin to use this command!");

  if (!quoted?.message?.imageMessage) return reply("🖼️ Please reply to an image to set as the group profile photo.");

  try {
    const media = await downloadMediaMessage(quoted, 'buffer');
    await danuwa.updateProfilePicture(m.chat, media);
    reply("✅ Group profile picture updated!");
  } catch (e) {
    console.error("❌ Error downloading image:", e);
    reply("⚠️ Failed to set profile picture. Ensure the image is valid and try again.");
  }
});

cmd({
  pattern: "admins",
  react: "👑",
  desc: "List all group admins",
  category: "group",
  filename: __filename,
}, async (danuwa, mek, m, { isGroup, reply, participants }) => {
  if (!isGroup) return reply("*This command is for groups only.*");

  const admins = participants.filter(p => p.admin).map(p => `@${p.id.split("@")[0]}`).join("\n");

  return reply(`*Group Admins:*\n${admins}`, { mentions: participants.filter(p => p.admin).map(a => a.id) });
});

cmd({
    pattern: "add",
    alias: ["invite"],
    react: "➕",
    desc: "Add a user to the group.",
    category: "group",
    filename: __filename
},
async (danuwa, mek, m, { from, isGroup, isAdmins, reply, args }) => {
    try {
        if (!isGroup) return reply("⚠️ This command can only be used in a group!");

        if (!isAdmins) return reply("⚠️ Only group admins can use this command!");

        if (!args[0]) return reply("⚠️ Please provide the phone number of the user to add!");

        const target = args[0].includes("@") ? args[0] : `${args[0]}@s.whatsapp.net`;

        await danuwa.groupParticipantsUpdate(from, [target], "add");

        return reply(`✅ Successfully added: @${target.split('@')[0]}`);
    } catch (e) {
        console.error("Add Error:", e);
        reply(`❌ Failed to add the user. Error: ${e.message}`);
    }
});


cmd({
  pattern: "promote",
  react: "⬆️",
  desc: "Promote user to admin",
  category: "group",
  filename: __filename,
}, async (danuwa, mek, m, { isGroup, isAdmins, reply, quoted, args }) => {
  if (!isGroup || !isAdmins) 
    return reply("*Group only & both you and I must be admins.*");

  const target = getTargetUser(mek, quoted, args);
  if (!target) return reply("*Mention or reply to a user to promote.*");

  await danuwa.groupParticipantsUpdate(m.chat, [target], "promote");
  return reply(`*Promoted:* @${target.split("@")[0]}`, { mentions: [target] });
});

cmd({
  pattern: "demote",
  react: "⬇️",
  desc: "Demote admin to member",
  category: "group",
  filename: __filename,
}, async (danuwa, mek, m, { isGroup, isAdmins, reply, quoted, args }) => {
  if (!isGroup || !isAdmins) 
    return reply("*Group only & both you and I must be admins.*");

  const target = getTargetUser(mek, quoted, args);
  if (!target) return reply("*Mention or reply to a user to demote.*");

  await danuwa.groupParticipantsUpdate(m.chat, [target], "demote");
  return reply(`*Demoted:* @${target.split("@")[0]}`, { mentions: [target] });
});

cmd({
    pattern: "open",
    alias: ["unmute"],
    react: "⚠️",
    desc: "Allow everyone to send messages in the group.",
    category: "group",
    filename: __filename
},
async (danuwa, mek, m, { from, isGroup, isAdmins, reply }) => {
    try {
        if (!isGroup) return reply("⚠️ This command can only be used in a group!");
        if (!isAdmins) return reply("⚠️ This command is only for group admins!");

        await danuwa.groupSettingUpdate(from, "not_announcement");

        return reply("✅ Group has been unmuted. Everyone can send messages now!");
    } catch (e) {
        console.error("Unmute Error:", e);
        reply(`❌ Failed to unmute the group. Error: ${e.message}`);
    }
});

cmd({
    pattern: "close",
    alias: ["mute", "lock"],
    react: "⚠️",
    desc: "Set group chat to admin-only messages.",
    category: "group",
    filename: __filename
},
async (danuwa, mek, m, { from, isGroup, isAdmins, reply }) => {
    try {
        if (!isGroup) return reply("⚠️ This command can only be used in a group!");

        if (!isAdmins) return reply("⚠️ This command is only for group admins!");

        await danuwa.groupSettingUpdate(from, "announcement");

        return reply("✅ Group has been muted. Only admins can send messages now!");
    } catch (e) {
        console.error("Mute Error:", e);
        reply(`❌ Failed to mute the group. Error: ${e.message}`);
    }
});

cmd({
  pattern: "revoke",
  react: "♻️",
  desc: "Reset group invite link",
  category: "group",
  filename: __filename,
}, async (danuwa, mek, m, { isGroup, isAdmins, reply }) => {
  if (!isGroup || !isAdmins) 
    return reply("*Group only & both you and I must be admins.*");

  await danuwa.groupRevokeInvite(m.chat);
  return reply("*Group invite link has been reset.*");
});

cmd({
  pattern: "grouplink",
  alias: ["link"],
  react: "🔗",
  desc: "Get current invite link",
  category: "group",
  filename: __filename,
}, async (danuwa, mek, m, { isGroup, reply }) => {
  if (!isGroup) 
    return reply("*Group only & I must be an admin.*");

  const code = await danuwa.groupInviteCode(m.chat);
  return reply(`*Group Link:*\nhttps://chat.whatsapp.com/${code}`);
});

cmd({
  pattern: "setsubject",
  react: "✏️",
  desc: "Change group name",
  category: "group",
  filename: __filename,
}, async (danuwa, mek, m, { isGroup, isAdmins, args, reply }) => {
  if (!isGroup || !isAdmins) 
    return reply("*Group only & both you and I must be admins.*");

  if (!args[0]) return reply("*Give a new group name.*");

  await danuwa.groupUpdateSubject(m.chat, args.join(" "));
  return reply("*Group name updated.*");
});

cmd({
  pattern: "setdesc",
  react: "📝",
  desc: "Change group description",
  category: "group",
  filename: __filename,
}, async (danuwa, mek, m, { isGroup, isAdmins, args, reply }) => {
  if (!isGroup || !isAdmins) 
    return reply("*Group only & both you and I must be admins.*");

  if (!args[0]) return reply("*Give a new group description.*");

  await danuwa.groupUpdateDescription(m.chat, args.join(" "));
  return reply("*Group description updated.*");
});

cmd({
  pattern: "groupinfo",
  alias: ["ginfo"],
  react: "📄",
  desc: "Show group details",
  category: "group",
  filename: __filename,
}, async (danuwa, mek, m, { isGroup, reply }) => {
  if (!isGroup) return reply("*This command is for groups only.*");

  const metadata = await danuwa.groupMetadata(m.chat);
  const adminsCount = metadata.participants.filter(p => p.admin).length;
  const creation = new Date(metadata.creation * 1000).toLocaleString();
  const owner = metadata.owner || metadata.participants.find(p => p.admin === 'superadmin')?.id;
  const desc = metadata.desc || "No description.";

  let txt = `*👥 Group:* ${metadata.subject}\n`;
  txt += `*🆔 ID:* ${metadata.id}\n`;
  txt += `*🧑‍💼 Owner:* ${owner ? `@${owner.split("@")[0]}` : "Not found"}\n`;
  txt += `*📅 Created:* ${creation}\n`;
  txt += `*👤 Members:* ${metadata.participants.length}\n`;
  txt += `*🛡️ Admins:* ${adminsCount}\n`;
  txt += `*📝 Description:*\n${desc}`;

  return reply(txt, { mentions: owner ? [owner] : [] });
});


2. lib/functions.js


const fs = require('fs');
const axios = require('axios');
const path = './config.env';
const FormData = require("form-data");

async function empiretourl(path) {
  if (!fs.existsSync(path)) {
    throw new Error(`File not found: ${path}`);
  }

  const form = new FormData();
  const fileStream = fs.createReadStream(path);
  form.append("file", fileStream);
  const originalFileName = path.split("/").pop(); 
  form.append("originalFileName", originalFileName);

  try {
    const response = await axios.post("https://cdn.empiretech.biz.id/api/upload.php", form, {
      headers: {
        ...form.getHeaders(), 
      },
      maxContentLength: Infinity,
      maxBodyLength: Infinity,
    });
    return response.data;
  } catch (error) {
    if (error.response) {
      throw new Error(`API Error: ${error.response.status} - ${JSON.stringify(error.response.data)}`);
    } else if (error.request) {
      throw new Error("No response received from the server.");
    } else {
      throw new Error(`Request Error: ${error.message}`);
    }
  }
}

// Fetch a buffer from a URL
const getBuffer = async (url, options) => {
    try {
        options = options || {};
        const res = await axios({
            method: 'get',
            url,
            headers: {
                'DNT': 1,
                'Upgrade-Insecure-Request': 1
            },
            ...options,
            responseType: 'arraybuffer'
        });
        return res.data;
    } catch (e) {
        console.error(e);
        return null;
    }
};

// Get admin participants from a group
const getGroupAdmins = (participants) => {
    const admins = [];
    for (let participant of participants) {
        if (participant.admin !== null) admins.push(participant.id);
    }
    return admins;
};

// Generate a random string with an extension
const getRandom = (ext) => {
    return `${Math.floor(Math.random() * 10000)}${ext}`;
};

// Format large numbers with suffixes (e.g., K, M, B)
const h2k = (eco) => {
    const lyrik = ['', 'K', 'M', 'B', 'T', 'P', 'E'];
    const ma = Math.floor(Math.log10(Math.abs(eco)) / 3);
    if (ma === 0) return eco.toString();
    const scale = Math.pow(10, ma * 3);
    const scaled = eco / scale;
    const formatted = scaled.toFixed(1).replace(/\.0$/, '');
    return formatted + lyrik[ma];
};

// Check if a string is a URL
const isUrl = (url) => {
    return url.match(
        /https?:\/\/(www\.)?[-a-zA-Z0-9@:%.+~#=]{1,256}\.[a-zA-Z0-9()]{1,6}\b([-a-zA-Z0-9()@:%+.~#?&/=]*)/
    );
};

// Convert a JavaScript object or array to a JSON string
const Json = (string) => {
    return JSON.stringify(string, null, 2);
};

// Function to calculate and format uptime
const runtime = (seconds) => {
    seconds = Math.floor(seconds);
    const d = Math.floor(seconds / (24 * 60 * 60));
    seconds %= 24 * 60 * 60;
    const h = Math.floor(seconds / (60 * 60));
    seconds %= 60 * 60;
    const m = Math.floor(seconds / 60);
    const s = Math.floor(seconds % 60);

    if (d > 0) return `${d}d ${h}h ${m}m ${s}s`;
    if (h > 0) return `${h}h ${m}m ${s}s`;
    if (m > 0) return `${m}m ${s}s`;
    return `${s}s`;
};
// Delay execution for a specified time
const sleep = async (ms) => {
    return new Promise((resolve) => setTimeout(resolve, ms));
};

// Fetch JSON from a URL
const fetchJson = async (url, options) => {
    try {
        options = options || {};
        const res = await axios({
            method: 'GET',
            url: url,
            headers: {
                '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'
            },
            ...options
        });
        return res.data;
    } catch (err) {
        console.error(err);
        return null;
    }
};
// Save config settings
const saveConfig = (key, value) => {
    let configData = fs.existsSync(path) ? fs.readFileSync(path, 'utf8').split('\n') : [];
    let found = false;

    configData = configData.map(line => {
        if (line.startsWith(`${key}=`)) {
            found = true;
            return `${key}=${value}`;
        }
        return line;
    });

    if (!found) configData.push(`${key}=${value}`);

    fs.writeFileSync(path, configData.join('\n'), 'utf8');

    // Reload updated environment variables
    require('dotenv').config({ path });
};

module.exports = { 
    getBuffer, 
    getGroupAdmins, 
    getRandom, 
    h2k, 
    isUrl, 
    Json, 
    runtime, 
    sleep, 
    fetchJson,
    saveConfig,
    empiretourl
};
                         


3. movie.js

Post a Comment

0 Comments