forked from VryptLab/EternityBot
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathdmn.js
More file actions
17 lines (15 loc) · 658 Bytes
/
Copy pathdmn.js
File metadata and controls
17 lines (15 loc) · 658 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
export default {
name: "mdn",
category: "developer",
command: ["mdn"],
run: async (conn, m) => {
const query = m.text.trim();
if (!query) return m.reply("📘 Contoh: .mdn Array.prototype.map");
const res = await fetch(`https://developer.mozilla.org/api/v1/search?q=${encodeURIComponent(query)}&locale=en-US`);
const data = await res.json();
if (!data.documents?.length) return m.reply("❌ Tidak ada hasil.");
const doc = data.documents[0];
const caption = `📚 *${doc.title}*\n\n${doc.summary}\n\n🔗 https://developer.mozilla.org${doc.mdn_url}`;
m.reply(caption);
}
}