goat
command
carvid
Send a non-repeating Car video from catbox collection.
0
views
0
likes
0
installs
Aliases: carvideo, car, ctavideo
raw source
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);
}
}
};