// code from goatstore // api: https://store.agi.bd module.exports = { config: { name: "join", aliases: ["grouplink", "invite"], version: "1.0.0", author: "𝐌𝐚𝐑𝐮𝐅", countDown: 5, role: 2, description: { en: "Get the invite link of a Facebook group using its group ID." }, category: "admin", guide: { en: "{pn} " } }, onStart: async function ({ api, args, message }) { const threadID = args[0]; if (!threadID) { return message.reply( "❌ Please provide a group ID.\n\nExample:\njoin 123456789012345" ); } if (!/^\d+$/.test(threadID)) { return message.reply("❌ Invalid group ID."); } try { const info = await api.getThreadInfo(threadID); if (!info) { return message.reply("❌ Unable to access this group."); } const groupName = info.threadName || "Unknown Group"; const inviteLink = info.inviteLink || info.threadInviteLink || info.invite_link || null; if (!inviteLink) { return message.reply( `❌ Invite link is not available for this group.\n\n` + `📌 Group: ${groupName}\n` + `🆔 ID: ${threadID}\n\n` + `Make sure the bot has permission to access the group's invite information.` ); } return message.reply( `✅ Group Invite Link\n\n` + `📌 Group: ${groupName}\n` + `🆔 ID: ${threadID}\n\n` + `🔗 ${inviteLink}` ); } catch (error) { console.error("JOIN LINK ERROR:", error); return message.reply( "❌ Failed to get the group invite link.\n\n" + "Make sure the group ID is correct and the bot can access that group." ); } } };