Created
July 9, 2025 19:59
-
-
Save dipto-008/3002179b476576e84f9b005719b1f996 to your computer and use it in GitHub Desktop.
Hey noob ππ
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
const axios = require("axios"); | |
module.exports = { | |
config: { | |
name: "album", | |
version: "1.0", | |
role: 0, | |
author: "Bokkor", | |
category: "media", | |
guide: { en: "" } | |
}, | |
onStart: async function ({ api, event, args }) { | |
const base = "https://album-x69.onrender.com/api/album"; | |
const fuck = async () => { | |
try { | |
let fileUrl = event.messageReply.attachments[0]?.url; | |
const x = "https://noobs-api.top/dipto"; | |
const res = await axios.get(`${x}/drive?url=${encodeURIComponent(fileUrl)}`); | |
out(fileUrl); | |
return res.data.downloadLink; | |
} catch (err) { | |
console.log(err); | |
} | |
}; | |
if (args[0] === "add") { | |
const category = args[1]; | |
let videoUrl = event.messageReply?.attachments?.[0]?.url || args[2]; | |
if (!category || !videoUrl) | |
return api.sendMessage( | |
"β Provide category and video URL or reply with a video", | |
event.threadID, | |
event.messageID | |
); | |
if (event.messageReply?.attachments[0]?.url) { | |
try { | |
api.sendMessage("β³ Uploading please wait...", event.threadID); | |
videoUrl = await fuck(); | |
} catch (err) { | |
return api.sendMessage("β Failed to upload video to Drive", event.threadID, event.messageID); | |
} | |
} | |
const res = await axios.get(`${base}/add/${category}?url=${encodeURIComponent(videoUrl)}`); | |
if (res.data?.error) | |
return api.sendMessage(res.data.error, event.threadID, event.messageID); | |
return api.sendMessage( | |
`β Video successfully added to category: ${category}`, | |
event.threadID, | |
event.messageID | |
); | |
} | |
if (!args[0] || args[0] === "list") { | |
try { | |
const res = await axios.get(`${base}/list`); | |
const data = res.data?.data || {}; | |
if (Object.keys(data).length === 0) | |
return api.sendMessage("β No categories found", event.threadID, event.messageID); | |
let msg = "π€ x69's Album Categories π€\n\n"; | |
let index = 1; | |
function capitalize(str) { | |
return str.charAt(0).toUpperCase() + str.slice(1); | |
} | |
for (const [cat, count] of Object.entries(data)) { | |
msg += `${index}. ${capitalize(cat)}\n π₯ Videos: ${count}\n\n`; | |
index++; | |
} | |
const time = new Date().toLocaleString("en-US", { | |
timeZone: "Asia/Dhaka", | |
hour12: true, | |
year: "numeric", | |
month: "2-digit", | |
day: "2-digit", | |
hour: "2-digit", | |
minute: "2-digit", | |
}); | |
msg += `β° Updated: ${time}`; | |
return api.sendMessage(msg.trim(), event.threadID, event.messageID); | |
} catch { | |
return api.sendMessage("β Error fetching list", event.threadID, event.messageID); | |
} | |
} | |
// Get video from category | |
try { | |
const res = await axios.get(`${base}/${args[0]}`); | |
if (!res?.data?.video) | |
return api.sendMessage("β Not found", event.threadID, event.messageID); | |
const msg = `ππ¦π³π¦ π π°πΆπ³ ${res.data.category} ππͺπ₯π¦π° π£π£πΊ π`; | |
const videoStream = await global.utils.getStreamFromURL(res.data.video); | |
return api.sendMessage( | |
{ body: msg, attachment: videoStream }, | |
event.threadID, | |
event.messageID | |
); | |
} catch { | |
return api.sendMessage("β Error fetching video", event.threadID, event.messageID); | |
} | |
} | |
}; |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment