forked from VryptLab/EternityBot
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathcolor.js
More file actions
19 lines (17 loc) · 711 Bytes
/
Copy pathcolor.js
File metadata and controls
19 lines (17 loc) · 711 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
export default {
name: "color",
category: "developer",
command: ["color", "hex"],
run: async (conn, m) => {
const hex = m.text.replace("#", "").trim();
if (!/^([A-Fa-f0-9]{6}|[A-Fa-f0-9]{3})$/.test(hex))
return m.reply("🎨 Masukkan kode hex valid.\nContoh: .color #00ff99");
const bigint = parseInt(hex, 16);
const r = (bigint >> 16) & 255;
const g = (bigint >> 8) & 255;
const b = bigint & 255;
const rgb = `rgb(${r}, ${g}, ${b})`;
const url = `https://singlecolorimage.com/get/${hex}/300x150`;
await conn.sendMessage(m.chat, { image: { url }, caption: `🎨 *HEX:* #${hex}\n🌈 *RGB:* ${rgb}` });
}
}