Skip to content
This repository has been archived by the owner on Aug 22, 2024. It is now read-only.

@Infos @Description

Adam Pine edited this page May 18, 2021 · 1 revision

ℹ️ @Infos / @Description

It would be useful to be able to specify order information, for example to display a help command (!help) in your application. For the one you have two useful decorators which are @Infos and @Description.

@Description is a shortcut for @Infos({ description: "..." })

import {
  ClassCommand,
  Command,
  CommandMessage
} from "@typeit/discord";

@Discord("!")
@Description("Admin commands")
@Infos({ forAdmins: true })
export abstract class Bye {
  @Command("ciao")
  @Description("say ciao")
  async ciao(command: CommandMessage) {
    command.reply("Ciao!");
  }
}

To retrieve these informations, you can use the Client static methods:

import { Client } from "@typeit/discord";

Client.getCommands();         // @Command
Client.getCommandsNotFound(); // @CommandNotFound
Client.getEvents();           // @On
Client.getDiscords();         // @Discord