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

    Class CommandBuilder

    Builder class dùng để định nghĩa message command.

    CommandBuilder cung cấp API chainable để cấu hình command và tự động xử lý:

    • Permission validation
    • Cooldown system
    • Command execution
    const pingCommand = new CommandBuilder()
    .setName("ping")
    .setDescription("Ping command")
    .setExecute((client, message, args) => {
    message.reply("Pong!");
    });
    const pingCommand = new CommandBuilder({
    commandName: "ping",
    description: "Ping command",
    execute: (client, message, args) => {
    message.reply("Pong!");
    }
    });
    Index

    Constructors

    Properties

    aliases: string[] = []

    Danh sách alias của command.

    category?: string

    Category của command.

    commandName: string

    Tên command chính.

    cooldown?: CooldownConfig<"message">

    Cấu hình cooldown.

    description: string = "không có mô tả"

    Mô tả command.

    usage?: string

    Hướng dẫn sử dụng command.

    userPermission?: CommandPermissionConfig

    Cấu hình permission user.

    Methods

    • Thực thi command.

      Quy trình:

      1. Kiểm tra permission
      2. Kiểm tra cooldown
      3. Thực thi command handler

      Parameters

      • client: Client

        Discord client

      • message: Message<true>

        Message trigger command

      • args: string[]

        Command arguments

      Returns any

    • Đặt command execution handler.

      Parameters

      • handler: (client: Client, message: Message<true>, args: string[]) => any

      Returns CommandBuilder