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

    Type Alias ButtonInput

    ButtonInput:
        | {
            disabled?: boolean;
            emoji?: string;
            label: string;
            style: "Link";
            url: string;
        }
        | {
            customId: string;
            disabled?: boolean;
            emoji?: string;
            label: string;
            style: "Primary"
            | "Secondary"
            | "Success"
            | "Danger"
            | "Premium";
        }

    Cấu hình đầu vào cho Button trong ComponentBuilder

    Có 2 nhóm button:

    • Bắt buộc có url
    • Không có customId
    • Không trigger interaction (chỉ redirect)
    • Bao gồm các style:
      • "Primary", "Secondary", "Success", "Danger", "Premium"
    • Bắt buộc có customId
    • Dùng để xử lý interaction khi user click

    ⚠️ Lưu ý:

    • Discord không cho phép button vừa có url vừa có customId
    • label tối đa ~80 ký tự
    • emoji có thể dùng unicode hoặc custom emoji

    Type Declaration

    • {
          disabled?: boolean;
          emoji?: string;
          label: string;
          style: "Link";
          url: string;
      }
      • Optionaldisabled?: boolean

        Trạng thái disable

      • Optionalemoji?: string

        Emoji hiển thị trên button

      • label: string

        Nội dung hiển thị trên button

      • style: "Link"

        Link Button (chuyển hướng URL)

      • url: string

        URL sẽ được mở khi click

        Bắt buộc với Link Button

    • {
          customId: string;
          disabled?: boolean;
          emoji?: string;
          label: string;
          style: "Primary" | "Secondary" | "Success" | "Danger" | "Premium";
      }
      • customId: string

        Custom ID để xử lý interaction

        Bắt buộc với button tương tác

      • Optionaldisabled?: boolean

        Trạng thái disable

      • Optionalemoji?: string

        Emoji hiển thị trên button

      • label: string

        Nội dung hiển thị trên button

      • style: "Primary" | "Secondary" | "Success" | "Danger" | "Premium"

        Kiểu button tương tác

    // Interactive button
    const button: ButtonInput = {
    style: "Primary",
    customId: "confirm",
    label: "Xác nhận"
    };
    // Link button
    const linkButton: ButtonInput = {
    style: "Link",
    label: "Google",
    url: "https://google.com"
    };
    const builder = new ComponentBuilder()
    .addButton([
    {
    style: "Success",
    customId: "ok",
    label: "OK"
    },
    {
    style: "Link",
    label: "Docs",
    url: "https://discord.js.org"
    }
    ]);

    ComponentBuilder