// code from goatstore // api: https://store.agi.bd const axios = require("axios"); // ⚠️ এখানে তোমার Token বসাও। repo permission দিবা const GITHUB_TOKEN = "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"; const OWNER = "primemaruf7"; const REPO = "Prime2"; module.exports = { config: { name: "ghget", aliases: [], version: "2.1.0", author: "𝐌𝐚𝐑𝐮𝐅", countDown: 5, role: 0, description: { en: "Get code of any file from PRIVATE GitHub repository" }, category: "tools", guide: { en: "{pn} path/to/file.js\nEx: {pn} scripts/cmds/xdi.js" } }, onStart: async function ({ message, args }) { if(!args[0]) { return message.reply(`❌ Usage: \`/ghget path/to/file.js\`\nExample: \`/ghget config.json\``); } const filePath = args[0].trim(); if(GITHUB_TOKEN === "ghp_তোমারTOKENএখানে") { return message.reply("❌ আগে GITHUB_TOKEN বসাও code এ"); } const branches = ["main", "master"]; let res = null; let usedBranch = ""; for(const branch of branches) { try { const url = `https://api.github.com/repos/${OWNER}/${REPO}/contents/${filePath}?ref=${branch}`; res = await axios.get(url, { headers: { Authorization: `token ${GITHUB_TOKEN}` }, timeout: 15000 }); usedBranch = branch; break; } catch {} } if(!res || res.data.type!== "file") { return message.reply(`❌ File not found\n📦 Repo: ${OWNER}/${REPO}\n📁 Path: ${filePath}`); } // GitHub API base64 করে দেয়, তাই decode করতে হবে const code = Buffer.from(res.data.content, 'base64').toString('utf8'); let finalCode = code; if(code.length > 4000) { finalCode = code.substring(0, 4000) + `\n\n...File too big. Total: ${code.length} characters`; } const ext = filePath.split('.').pop(); const msg = `📄 | 𝐅𝐢𝐥𝐞: "${filePath}"\n📦 𝐑𝐞𝐩𝐨: ${OWNER}/${REPO}@${usedBranch} 🔒\n\n\`\`\`${ext}\n${finalCode}\n\`\`\``; return message.reply(msg); } };