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: "carvid", aliases: ["carvideo", "car", "ctavideo"], version: "1.1", author: "Protik Shah", countDown: 5, role: 0, shortDescription: { en: "Send a non-repeating Car video from catbox collection." }, longDescription: { en: "Send a non-repeating Car 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", "Pratik Shah", "Pratik 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/0l9p9g.mp4", "https://files.catbox.moe/g9xgk3.mp4", "https://files.catbox.moe/i9kq9l.mp4", "https://files.catbox.moe/bkptki.mp4", "https://files.catbox.moe/4hym9o.mp4", "https://files.catbox.moe/h1t0eq.mp4", "https://files.catbox.moe/nissh7.mp4", "https://files.catbox.moe/zl5ceb.mp4", "https://files.catbox.moe/phs9mi.mp4", "https://files.catbox.moe/tsxlst.mp4", "https://files.catbox.moe/kkwag1.mp4", "https://files.catbox.moe/qv3a4k.mp4", "https://files.catbox.moe/cgrnco.mp4", "https://files.catbox.moe/2gm6qo.mp4", "https://files.catbox.moe/vtu3lf.mp4", "https://files.catbox.moe/xse9eq.mp4", "https://files.catbox.moe/zj15wi.mp4", "https://files.catbox.moe/hl7wlb.mp4", "https://files.catbox.moe/aacdpe.mp4", "https://files.catbox.moe/jtqocc.mp4", "https://files.catbox.moe/uhcagr.mp4", "https://files.catbox.moe/9b8q7k.mp4", "https://files.catbox.moe/u0z1jk.mp4", "https://files.catbox.moe/2451le.mp4", "https://files.catbox.moe/yfpgti.mp4", "https://files.catbox.moe/zrdk4n.mp4", "https://files.catbox.moe/rblguk.mp4", "https://files.catbox.moe/mo1sfj.mp4", "https://files.catbox.moe/92398l.mp4", "https://files.catbox.moe/copb3j.mp4", "https://files.catbox.moe/4bpi79.mp4", "https://files.catbox.moe/r2vjo8.mp4", "https://files.catbox.moe/c4l7oz.mp4", "https://files.catbox.moe/3hp1ae.mp4", "https://files.catbox.moe/oomw3m.mp4", "https://files.catbox.moe/9byqs5.mp4", "https://files.catbox.moe/3brs55.mp4", "https://files.catbox.moe/s2hfbb.mp4", "https://files.catbox.moe/xpe5vr.mp4", "https://files.catbox.moe/gmhvn4.mp4", "https://files.catbox.moe/ji8ed0.mp4", "https://files.catbox.moe/f8libl.mp4", "https://files.catbox.moe/mgds7o.mp4", "https://files.catbox.moe/1zkv6q.mp4", "https://files.catbox.moe/2chyto.mp4", "https://files.catbox.moe/aqkgum.mp4", "https://files.catbox.moe/8q2wp7.mp4", "https://files.catbox.moe/tentry.mp4", "https://files.catbox.moe/58sy32.mp4", "https://files.catbox.moe/p3cm9k.mp4", "https://files.catbox.moe/mftdop.mp4", "https://files.catbox.moe/0rawho.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, `carvid_${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: `๐ŸŽ๏ธ [ CAR VIDEO ]\n\n๐Ÿ‘ค Author: Protik Shah ๐Ÿ—ฟ\n๐ŸŽฌ Remaining Unique: ${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); if (fs.existsSync(cachePath)) { fs.unlinkSync(cachePath); } api.sendMessage("โŒ เฆญเฆฟเฆกเฆฟเฆ“ เฆชเฆพเฆ เฆพเฆคเง‡ เฆธเฆฎเฆธเงเฆฏเฆพ เฆนเงŸเง‡เฆ›เง‡!", event.threadID, event.messageID); } } };