// code from goatstore // api: https://store.agi.bd const { MongoClient } = require("mongodb"); module.exports = { config: { name: "mongodbcheck", version: "1.0.0", author: "Azadx69x → GoatBot V2", countDown: 5, role: 0, category: "system", guide: { en: "{pn} " }, aliases: ["mdbck"] }, onStart: async function ({ api, event, args }) { const url = args[0]; if (!url) { return api.sendMessage( "⛔ | MongoDB URL দিন!\n\nExample:\n.mongodbcheck mongodb://localhost:27017", event.threadID, event.messageID ); } let client; try { client = new MongoClient(url, { serverSelectionTimeoutMS: 10000 }); await client.connect(); // MongoDB server check await client.db().admin().serverInfo(); return api.sendMessage( "✅ | MongoDB Successfully Working\n\n🟢 Connection: Active\n🟢 Server: Online", event.threadID, event.messageID ); } catch (error) { return api.sendMessage( "❌ | MongoDB Not Working\n\n🔴 Connection failed or MongoDB URL is invalid.", event.threadID, event.messageID ); } finally { // Always close connection if (client) { try { await client.close(); } catch (e) {} } } } };