// code from goatstore // api: https://store.agi.bd module.exports = { config: { name: "report", version: "2.0.0", author: "Mohammad SHiblu → Goat Bot V2", countDown: 5, role: 0, shortDescription: { en: "Report a problem to bot admin" }, longDescription: { en: "Send feedback, problems or suggestions directly to bot admins." }, category: "utility", guide: { en: "{pn} [your report]" } }, // ═════════════════════════════════════════════ // 🚨 SEND REPORT // ═════════════════════════════════════════════ onStart: async function ({ api, event, args, usersData }) { const { threadID, senderID, messageID } = event; // Check report text if (!args.length) { return api.sendMessage( "❌ Please write the problem or feedback you want to report.\n\nExample:\nreport bot is not working", threadID, messageID ); } // Get user name let name = "Unknown User"; try { name = await usersData.getName(senderID); } catch (e) { try { const userInfo = await api.getUserInfo(senderID); name = userInfo[senderID]?.name || name; } catch (err) {} } // Get thread information let threadName = "Unknown Group"; try { const threadInfo = await api.getThreadInfo(threadID); threadName = threadInfo?.name || "Private Chat"; } catch (e) {} // Bangladesh time const now = new Date(); const time = new Intl.DateTimeFormat("en-GB", { timeZone: "Asia/Dhaka", day: "2-digit", month: "2-digit", year: "numeric", hour: "2-digit", minute: "2-digit", second: "2-digit", hour12: false }).format(now); const reportText = args.join(" "); // Get admin list const admins = global.GoatBot?.config?.adminBot || []; if (!admins.length) { return api.sendMessage( "❌ Bot admin list পাওয়া যায়নি।\n\n`adminBot` configuration check করুন।", threadID, messageID ); } // Sending status await api.sendMessage( "📨 Your report is being sent to the bot admin...", threadID, messageID ); // ═════════════════════════════════════════════ // 📩 SEND REPORT TO ALL ADMINS // ═════════════════════════════════════════════ for (const adminID of admins) { try { const sentMessage = await api.sendMessage( { body: `🗣️ REPORT FROM: ${name} 👤 User ID: ${senderID} 👨‍👩‍👦 BOX: ${threadName} 📌 BOX ID: ${threadID} ━━━━━━━━━━━━━━━━━━ ➡️ REPORT: ${reportText} ━━━━━━━━━━━━━━━━━━ ⌚ TIME: ${time} 💬 Reply to this message to respond to the user.`, mentions: [ { id: senderID, tag: name } ] }, adminID ); // Register reply if ( sentMessage?.messageID && global.GoatBot?.onReply ) { global.GoatBot.onReply.set(sentMessage.messageID, { commandName: this.config.name, type: "adminReply", // User information userID: senderID, userName: name, // Original group/chat threadID: threadID, // Original report message originalMessageID: messageID }); } } catch (error) { console.error( `Report send error for admin ${adminID}:`, error ); } } return; }, // ═════════════════════════════════════════════ // 💬 ADMIN REPLY // ═════════════════════════════════════════════ onReply: async function ({ api, event, Reply }) { if (!Reply) return; const { userID, userName, threadID, originalMessageID } = Reply; // Admin's reply const replyText = event.body?.trim(); if (!replyText) return; try { // Send admin response back to original user/chat const sentMessage = await api.sendMessage( { body: `📩 REPLY FROM BOT ADMIN 👤 To: ${userName} ━━━━━━━━━━━━━━━━━━ 💬 ${replyText} ━━━━━━━━━━━━━━━━━━ 👨‍💻 Bot Admin`, mentions: [ { id: userID, tag: userName } ] }, threadID, originalMessageID ); // Register user's next reply if ( sentMessage?.messageID && global.GoatBot?.onReply ) { global.GoatBot.onReply.set(sentMessage.messageID, { commandName: this.config.name, type: "userReply", userID: userID, userName: userName, threadID: threadID, originalMessageID: originalMessageID }); } } catch (error) { console.error("Report reply error:", error); return api.sendMessage( "❌ Failed to send the reply to the user.", event.threadID ); } } };