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

    Interface SlashCommandManagerOptions

    Cấu hình cho SlashCommandManager.

    interface SlashCommandManagerOptions {
        autoRegister?: boolean;
        commandFileExtensions?: readonly string[];
        directory: string;
        guildID?: string | string[];
        onError?: (data: { error: Error; file: string }) => void;
        onLoad?: (command: SlashCommandBuilder) => void;
        recursive?: boolean;
        reset?: { global?: boolean; guild?: boolean };
    }
    Index

    Properties

    autoRegister?: boolean

    Có tự động đăng ký commands sau khi load hay không.

    Nếu client chưa sẵn sàng, việc đăng ký sẽ được hoãn đến sự kiện ClientReady.

    true

    commandFileExtensions?: readonly string[]

    Các phần mở rộng file được xem là module slash command.

    File khai báo kiểu (.d.ts) luôn bị bỏ qua.

    [".js", ".ts"]

    directory: string

    Thư mục chứa các file slash command.

    guildID?: string | string[]

    Guild ID hoặc danh sách guild ID dùng để đăng ký guild commands.

    Nếu bỏ trống, commands sẽ được đăng ký global.

    onError?: (data: { error: Error; file: string }) => void

    Callback được gọi khi load file command hoặc đăng ký command thất bại.

    Type Declaration

      • (data: { error: Error; file: string }): void
      • Parameters

        • data: { error: Error; file: string }

          Dữ liệu lỗi.

          • error: Error

            Error object đã được chuẩn hóa.

          • file: string

            Đường dẫn file tuyệt đối hoặc tên thao tác bị lỗi.

        Returns void

    onLoad?: (command: SlashCommandBuilder) => void

    Callback được gọi sau khi một file command được load thành công.

    Type Declaration

    recursive?: boolean

    Có đọc đệ quy thư mục command hay không.

    true

    reset?: { global?: boolean; guild?: boolean }

    Tùy chọn dọn dẹp command trước khi đăng ký.

    Type Declaration

    • Optionalglobal?: boolean

      Xóa toàn bộ global commands trước khi đăng ký danh sách command hiện tại.

      false

    • Optionalguild?: boolean

      Xóa toàn bộ guild commands trước khi đăng ký danh sách command hiện tại.

      Chỉ có hiệu lực khi SlashCommandManagerOptions.guildID được cung cấp.

      false