Skip to content

Latest commit

 

History

History
32 lines (26 loc) · 769 Bytes

command.decorator.md

File metadata and controls

32 lines (26 loc) · 769 Bytes

#Command decorator

The examples bellow are the same

class T {
  constructor() {
    RegisterCommand('chatCommand1', this.chatCommandHandler1.bind(this), false)
    RegisterCommand('chatCommand2', this.chatCommandHandler2.bind(this), true)
  }

  private chatCommandHandler1(...args: unknown[]): void {}
  private chatCommandHandler2(...args: unknown[]): void {}
}
import { Command } from "./command.decorator";
import { Controller } from "./controller.decorator";

@Controller('T')
class T {
  @Command('chatCommand1', false)
  private chatCommandHandler1(...args: unknown[]): void {
  }

  // 2nd param is optional, false by default
  @Command('chatCommand2', true)
  private chatCommandHandler2(...args: unknown[]): void {
  }
}