const axios = require("axios"); const fs = require("fs-extra"); const path = require("path"); // ๐Ÿง  Smart Memory Array to track sent videos let usedVideos = []; module.exports = { config: { name: "redgirl", aliases: ["redgirlvideo", "rgirl"], version: "1.1", author: "Protik shah", countDown: 5, role: 0, shortDescription: { en: "Send a non-repeating Red Girl video from catbox collection." }, longDescription: { en: "Send a random non-repeating Red Girl video using Catbox links with custom reactions." }, category: "media", guide: { en: "{pn}" } }, onStart: async function ({ api, event }) { // ๐Ÿ›ก๏ธ AUTHOR VERIFICATION LOCK SYSTEM const allowedAuthors = ["Protik shah", "Protik Shah"]; const currentAuthor = this.config ? (this.config.author || this.config.credits || "") : ""; const isValidAuthor = allowedAuthors.some(author => currentAuthor.includes(author)); if (!isValidAuthor) { if (api && typeof api.setMessageReaction === "function") { api.setMessageReaction("โš ๏ธ", event.messageID, (err) => {}, true); } return api.sendMessage( "โš ๏ธ [ ๐‘บ๐‘ฌ๐‘ช๐‘ผ๐‘น๐‘ฐ๐‘ป๐‘’ ๐‘จ๐‘ณ๐‘ฌ๐‘น๐‘ป ] โš ๏ธ\n\n" + "โŒ ๐‘ˆ๐‘›๐‘Ž๐‘ข๐‘กโ„Ž๐‘œ๐‘Ÿ๐‘–๐‘ง๐‘’๐‘‘ ๐‘€๐‘œ๐‘‘๐‘–๐‘“๐‘–๐‘๐‘Ž๐‘ก๐‘–๐‘œ๐‘› ๐ท๐‘’๐‘ก๐‘’๐‘๐‘ก๐‘’๐‘‘!\n" + "๐‘‡โ„Ž๐‘–๐‘  ๐‘๐‘œ๐‘š๐‘š๐‘Ž๐‘›๐‘‘ โ„Ž๐‘Ž๐‘  ๐‘๐‘’๐‘’๐‘› ๐‘™๐‘œ๐‘๐‘˜๐‘’๐‘‘ ๐‘๐‘’๐‘๐‘Ž๐‘ข๐‘ ๐‘’ ๐‘กโ„Ž๐‘’ ๐‘œ๐‘Ÿ๐‘–๐‘”๐‘–๐‘›๐‘Ž ๐ด๐‘ข๐‘กโ„Ž๐‘œ๐‘Ÿ ๐‘๐‘Ÿ๐‘’๐‘‘๐‘–๐‘ก๐‘  ๐‘ค๐‘’๐‘Ÿ๐‘’ ๐‘Ž๐‘™๐‘ก๐‘’๐‘Ÿ๐‘’๐‘‘.\n\n" + "๐Ÿ‘‘ ๐‘ถ๐’“๐’Š๐’ˆ๐’Š๐’๐’‚๐’ ๐‘จ๐’–๐’•๐’‰๐’๐’“: Protik shah", event.threadID, event.messageID ); } // ๐Ÿ Loading reaction if (api && typeof api.setMessageReaction === "function") { api.setMessageReaction("๐Ÿ", event.messageID, (err) => {}, true); } const videos = [ "https://files.catbox.moe/xktox6.mp4", "https://files.catbox.moe/rw1vxd.mp4", "https://files.catbox.moe/8r5z4r.mp4", "https://files.catbox.moe/2otopk.mp4", "https://files.catbox.moe/sg6ag6.mp4", "https://files.catbox.moe/2n69yc.mp4", "https://files.catbox.moe/tqx4i3.mp4", "https://files.catbox.moe/u6ppwr.mp4", "https://files.catbox.moe/6picwc.mp4", "https://files.catbox.moe/fjp6eh.mp4", "https://files.catbox.moe/tt12v3.mp4", "https://files.catbox.moe/qjb65x.mp4", "https://files.catbox.moe/lgg303.mp4", "https://files.catbox.moe/2l5de7.mp4", "https://files.catbox.moe/1itbo4.mp4", "https://files.catbox.moe/b2e4co.mp4", "https://files.catbox.moe/784po9.mp4", "https://files.catbox.moe/uthj7a.mp4", "https://files.catbox.moe/qf3epm.mp4", "https://files.catbox.moe/bzex44.mp4", "https://files.catbox.moe/z0pq75.mp4", "https://files.catbox.moe/kg8lht.mp4", "https://files.catbox.moe/fbgztj.mp4", "https://files.catbox.moe/81s5ll.mp4", "https://files.catbox.moe/pcefyb.mp4", "https://files.catbox.moe/g87uij.mp4", "https://files.catbox.moe/t0m4fd.mp4", "https://files.catbox.moe/psnyvf.mp4", "https://files.catbox.moe/y9581k.mp4", "https://files.catbox.moe/50v589.mp4", "https://files.catbox.moe/r1f7r2.mp4", "https://files.catbox.moe/vbkw1k.mp4", "https://files.catbox.moe/tc0jzj.mp4", "https://files.catbox.moe/yajxkr.mp4", "https://files.catbox.moe/856809.mp4", "https://files.catbox.moe/biihbv.mp4", "https://files.catbox.moe/qv4pal.mp4" ]; // ๐ŸŽฏ Non-Repeating Unique Selection Logic let availableVideos = videos.filter(v => !usedVideos.includes(v)); if (availableVideos.length === 0) { usedVideos = []; availableVideos = [...videos]; } const url = availableVideos[Math.floor(Math.random() * availableVideos.length)]; usedVideos.push(url); const cacheDir = path.join(__dirname, "cache"); const cachePath = path.join(cacheDir, `redgirl_${Date.now()}.mp4`); try { await fs.ensureDir(cacheDir); const response = await axios({ method: "GET", url: url, responseType: "stream" }); const writer = fs.createWriteStream(cachePath); response.data.pipe(writer); await new Promise((resolve, reject) => { writer.on("finish", resolve); writer.on("error", reject); }); await api.sendMessage( { body: `๐Ÿโ”โ”โ”โ”[ ๐‘น๐‘ฌ๐‘ซ ๐‘ฎ๐‘ฐ๐‘‘๐‘ณ ๐‘ฝ๐‘ฐ๐‘ซ๐‘ฌ๐‘ถ ]โ”โ”โ”โ”๐Ÿ\n\n๐Ÿ‘‘ ๐‘จ๐’–๐’•๐’‰๐’๐’“: Protik shah\n๐ŸŽฌ ๐‘น๐’†๐’Ž๐’‚๐’Š๐’๐’Š๐’๐’ˆ ๐‘ผ๐’๐’Š๐’’๐’–๐’†: ${availableVideos.length - 1}/${videos.length}`, attachment: fs.createReadStream(cachePath) }, event.threadID, () => { // ๐ŸŒธ Success reaction if (api && typeof api.setMessageReaction === "function") { api.setMessageReaction("๐ŸŒธ", event.messageID, (err) => {}, true); } if (fs.existsSync(cachePath)) fs.unlinkSync(cachePath); }, event.messageID ); } catch (error) { console.error("Error sending Red Girl video:", error); if (fs.existsSync(cachePath)) fs.unlinkSync(cachePath); if (api && typeof api.setMessageReaction === "function") { api.setMessageReaction("โŒ", event.messageID, (err) => {}, true); } return api.sendMessage( "โŒ Couldn't load the video. Please try again.", event.threadID, event.messageID ); } } };