blackcat.js-discord - v1.0.10
    Preparing search index...

    Type Alias ComponentInput

    ComponentInput: { options: ButtonInput[]; type: "button" } | SelectMenu

    Định nghĩa cấu hình đầu vào cho ComponentBuilder

    Type Declaration

    • { options: ButtonInput[]; type: "button" }
      • options: ButtonInput[]

        Danh sách cấu hình button

        • Tối đa 5 button trên mỗi ActionRow
        • Nếu vượt quá, builder sẽ tự động chia thành nhiều row
      • type: "button"

        Loại component: Button

        Đại diện cho một nhóm button sẽ được render trong cùng ActionRow.

    • SelectMenu

    ComponentInput là union type đại diện cho tất cả các loại component mà ComponentBuilder hỗ trợ.

    Nó bao gồm:

    • Button (dạng nhiều button trong một ActionRow)
    • Các loại Select Menu (thông qua SelectMenu)

    Type này được sử dụng trong:

    • Constructor của ComponentBuilder
    • addRow
    • replace
    • Các method build component khác

    Mỗi phần tử trong ComponentInput[] sẽ được convert thành một hoặc nhiều ActionRowBuilder tương ứng.

    ⚠️ Lưu ý:

    • Với type: "button":

      • Có thể chứa nhiều button
      • Tự động chia thành nhiều ActionRow (tối đa 5 button / row)
    • Với SelectMenu:

      • Mỗi config tương ứng đúng 1 ActionRow
    const components: ComponentInput[] = [
    {
    type: "button",
    options: [
    { customId: "a", label: "A", style: "Primary" },
    { customId: "b", label: "B", style: "Secondary" }
    ]
    },
    {
    type: "stringmenu",
    options: {
    customId: "menu",
    options: [
    { label: "Option 1", value: "1" }
    ]
    }
    }
    ];
    // Sử dụng với builder
    const builder = new ComponentBuilder(components);

    await message.reply({
    components: builder.build()
    });