npm package discovery and stats viewer.

Discover Tips

  • General search

    [free text search, go nuts!]

  • Package details

    pkg:[package-name]

  • User packages

    @[username]

Sponsor

Optimize Toolset

I’ve always been into building performant and accessible sites, but lately I’ve been taking it extremely seriously. So much so that I’ve been building a tool to help me optimize and monitor the sites that I build to make sure that I’m making an attempt to offer the best experience to those who visit them. If you’re into performant, accessible and SEO friendly sites, you might like it too! You can check it out at Optimize Toolset.

About

Hi, 👋, I’m Ryan Hefner  and I built this site for me, and you! The goal of this site was to provide an easy way for me to check the stats on my npm packages, both for prioritizing issues and updates, and to give me a little kick in the pants to keep up on stuff.

As I was building it, I realized that I was actually using the tool to build the tool, and figured I might as well put this out there and hopefully others will find it to be a fast and useful way to search and browse npm packages as I have.

If you’re interested in other things I’m working on, follow me on Twitter or check out the open source projects I’ve been publishing on GitHub.

I am also working on a Twitter bot for this site to tweet the most popular, newest, random packages from npm. Please follow that account now and it will start sending out packages soon–ish.

Open Software & Tools

This site wouldn’t be possible without the immense generosity and tireless efforts from the people who make contributions to the world and share their work via open source initiatives. Thank you 🙏

© 2026 – Pkg Stats / Ryan Hefner

embed-brb

v0.0.5

Published

Thư viện tạo embed cho Discord bot với cú pháp thân thiện tiếng Việt.

Readme

📘 embed-brb

Thư viện tạo Embed cho Discord bot với cú pháp tiếng Việt cực kỳ thân thiện và dễ nhớ.

Dành riêng cho cộng đồng Việt Nam phát triển bot Discord bằng discord.js.

phiên bản npm lượt tải xuống giấy phép

✨ Tính năng nổi bật

Dễ đọc, dễ nhớ với cú pháp thân thiện tiếng Việt.

Hỗ trợ method chaining.

Hỗ trợ tạo Embed từ interaction.options tự động.

Tùy biến màu, tiêu đề, mô tả, ảnh, trường...

💖 Đóng góp

Chào đón PR, góp ý và phản hồi! Liên hệ tác giả tại: Facebook - Cơn Mưa Lạ

⚙️ Cài đặt

npm install embed-brb

Yêu cầu:

  • Node.js v16.9.0 hoặc cao hơn
    (Khuyến nghị: Node.js >= 18 để tương thích tốt nhất với discord.js và các thư viện khác)

  • discord.js v14 hoặc cao hơn (Khuyến nghị: [email protected] trở lên để đảm bảo đầy đủ tính năng)

  • Bot cần có quyền sử dụng Embed Links trong kênh để gửi embed.

  • Các lệnh cần được xây dựng bằng Slash Commands (hỗ trợ interaction).

  • Tùy chọn: Để dùng .AutoFromUsers().AutoAllOptions(), bạn cần tạo lệnh có các UserOption, StringOption, ChannelOption, v.v.

📦 cách dùng


1. Khởi tạo EmbedBRB

const { EmbedBRB } = require('embed-brb');

2. Tạo embed cơ bản

const embed = new EmbedBRB(interaction)
    .Mau('xanh') // Màu: tên tiếng Việt, tiếng Anh, HEX hoặc số
    .Tieude('Chào mừng!') // Tiêu đề
    .Noidung('Đây là một ví dụ embed cơ bản') // Nội dung
    .Chantrang('BRB Studio'); // Chân trang

3. Thêm ảnh đại diện (Avatar) và ảnh lớn (Anh)

const embed = new EmbedBRB(interaction)
    .Avatar('https://example.com/avatar.jpg') // Hình nhỏ bên phải
    .Anh('https://example.com/banner.jpg');   // Hình lớn bên dưới

4. Thêm tác giả (Tg)

const embed = new EmbedBRB(interaction)
    .Tacgia(bot.displayName, bot.displayAvatarURL()); // hoặc thay bằng thông tin người dùng, là nd thay bot

5. Thêm trường thông tin (Tr)

const embed = new EmbedBRB(interaction)
    .Truong(
        { name: 'Người chơi', value: 'Cơn Mưa Lạ', inline: true },
        { name: 'Trạng thái', value: 'Đang chiến đấu', inline: true }
    );

6. Thêm thời gian (tg_guitn)

const embed = new EmbedBRB(interaction)
    .tg_guitn(); // tg_guitn = .setTimestamp()

7. Dùng màu tiếng Việt hoặc HEX

    .Mau('hồng');
    .Mau('#ff9900');
    .Mau(0xff0000);

8. Tự động lấy tất cả user option từ interaction (AutoFromUsers)

    const embed = new EmbedBRB(interaction)
        .AutoFromUsers(); // Tự thêm các option người dùng vào embed (stringOptions)

9. Tự động lấy mọi loại option (AutoAllOptions)

    const embed = new EmbedBRB(interaction)
        .AutoAllOptions(); // Gồm: string, number, boolean, user, role, channel,...

10. Dùng .ThemLuaChon() để thêm key–value tùy ý

    const thongDiep = int.options.getString('thongdiep');
    const embed = new EmbedBRB(int)
    .Mau('blue')
    .Tieude('Tiêu đề ví dụ 1')
    .ThemLuaChon('Thời gian', new Date().toLocaleString()) // Embed sẽ tự động .addFields: Thời gian
    .ThemLuaChon('Nội dung', thongDiep) // Embed sẽ tự động .addFields: Nội dung.
    .tg_guitn();


    const embed = new EmbedBRB(interaction)
        .ThemLuaChon('ví dụ 2', 'viết trực tiếp vào đây, không cần các string, number, boolean, user, role, channel,...');


11. Trả về kết quả

    await interaction.reply({
            tnn: [embed]
        });

    await interaction.editReply({
            tnn: [embed]
        });

12. Ví dụ hoàn chỉnh

const { SlashCommandBuilder } = require('discord.js');
const { EmbedBRB } = require('embed-brb');

/*
    trong đó:

        .Mau(color: string|number) – thiết lập màu (hỗ trợ tiếng Việt/Anh, hex, 0x…).

        .Tieude(title: string) – tiêu đề.

        .Noidung(description: string) – nội dung chính.

        .Truong(...fields) – thêm trường (fields).

        .Tacgia(name, iconURL, url?) – thiết lập tác giả.

        .Avatar(url), .Anh(url) – thiết lập thumbnail và ảnh lớn.

        .Chantrang(text, iconURL?) – footer.

        .tg_guitn() – tự thêm timestamp.

        .ThemLuaChon(key, value) – thêm thủ công trường tên/key.

        .AutoFromUsers() – tự get & hiển thị tất cả UserOption (mention + tên hiển thị).

        .AutoAllOptions() – tự get & hiển thị bất kỳ option nào converter thành string.

        (Viết nội dung embed ngắn gọn, dễ hiểu hơn thay vì interaction.user, interaction.guild, interaction.member, v.v.)
        bot = interaction.client.user;  // Bot hiện tại
        nd = interaction.user;          // Người dùng (người gọi lệnh)
        mc = interaction.guild;         // Máy chủ (guild)
        ndsv = interaction.member;      // Member trong server (có roles, permissions...)

*/

module.exports = {
    data: new SlashCommandBuilder()
        .setName('vidu')
        .setDescription('cách sử dụng thư viện embed-brb'),

    async execute(interaction) {

        await interaction.deferReply({ ephemeral: true });

        // Sử dụng EmbedBRB
        const embed = new EmbedBRB(interaction)
            .Mau(`xanh_đẹp`) // màu sắc có thể viết tiếng Việt hoặc tiếng Anh. ví dụ: 'xanh_đẹp' hoặc 'cyan'
            .Tieude(`Tiêu đề`) // Tiêu đề
            .Noidung(`Bot ${bot.username} chào bạn ${nd.username} đến với máy chủ ${mc.name}!`) // Nội dung
            .Truong(
                { name: `Người chơi`, value: `Cơn Mưa Lạ`, inline: true },
                { name: `Trạng thái`, value: `Đang chiến đấu`, inline: true }
            ) // Trường thông tin
            .Tacgia(bot.displayName, bot.displayAvatarURL()) // Tác giả
            .Avatar(nd.displayAvatarURL({ dynamic: true })) // Hình ảnh nhỏ của người dùng (có thể thay bằng link ảnh)
            .Anh(mc.iconURL({ dynamic: true, size: 512 })) // Hình ảnh lớn (ảnh máy chủ hoặc link ảnh)
            .Chantrang(`BRB Studio • Valheim Server`) // Chân trang tuỳ biến
            .tg_guitn(); // Thêm timestamp
            
        await interaction.editReply({
            tnn: [embed],
        });
    }
};

☕ Ủng hộ tác giả

Nếu bạn thấy dự án này hữu ích hoặc muốn mình có thêm động lực để phát triển nhiều tính năng hơn nữa, hãy ủng hộ mình một ly cà phê tại:

👉 Ủng hộ tác giả một ly cà phê tại đây

Mỗi ly cà phê là một lời cảm ơn quý giá giúp mình tiếp tục sáng tạo, cải tiến bot, và duy trì cộng đồng BRB Studio mạnh mẽ hơn! 💙

📝 Giấy phép

Bản quyền © 2019 Cơn Gió Lạ. Dự án này được cấp phép MIT.