forked from VryptLab/EternityBot
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathnpm.js
More file actions
24 lines (21 loc) · 874 Bytes
/
Copy pathnpm.js
File metadata and controls
24 lines (21 loc) · 874 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
export default {
name: "npm",
category: "developer",
command: ["npm", "npmjs"],
run: async (conn, m) => {
const query = m.text.trim();
if (!query) return m.reply("📦 Masukkan nama package npm.\nContoh: .npm express");
const res = await fetch(`https://registry.npmjs.org/${encodeURIComponent(query)}`);
if (res.status !== 200) return m.reply("❌ Package tidak ditemukan.");
const data = await res.json();
const latest = data["dist-tags"]?.latest;
const version = data.versions[latest];
const info = `📦 *${data.name}* (${latest})
🧩 Versi: ${latest}
👤 Author: ${version.author?.name || "-"}
📄 Deskripsi: ${data.description || "-"}
🕒 Terbit: ${new Date(data.time[latest]).toLocaleString("id-ID")}
🔗 https://www.npmjs.com/package/${data.name}`;
m.reply(info);
}
}