Skip to content
GitHub

Decorators at a glance

Every decorator, how it is called and what it does, by what it applies to.

App

DecoratorWhat it does
@MeoCord(options)

Declares the application class: its controllers, services, client options and what applies to every handler.

@Service()

Marks a class as a service, which controllers and other services inject by its type.

Controllers

DecoratorWhat it does
@Controller(options?)

Marks a class as a controller, whose methods handle commands, components, messages, reactions or events.

@UseTheme(theme)

Sets part of the theme for a controller's handlers, or for one handler.

Handlers

DecoratorWhat it does
@Autocomplete(commandPath, optionName?)

Suggests values for an option of a chat input command as the user types.

@Command(name, builderOrType)

Routes a command, a component or a modal submission to the method it decorates.

@CommandBuilder(commandType, options?)

Marks a class as a command's builder, which describes the command MeoCord registers with Discord.

@MessageHandler() @MessageHandler(pattern, options?)

Runs the method it decorates for every message a user sends, whatever it says.

@On(event)

Handles a discord.js client event every time it is emitted, on a controller or a service.

@Once(event)

Handles a discord.js client event the first time it is emitted only, on a controller or a service.

@ReactionHandler(emoji?, settings?) @ReactionHandler(settings)

Runs the method it decorates when a reaction with an emoji is added to or removed from a message.

Params

DecoratorWhat it does
@Inject(token)

Injects what a token provides into a constructor parameter.

Pipeline stages

DecoratorWhat it does
@Catch(...errorTypes)

Marks a class as an exception filter for the given error types.

@Cooldown(options)

Limits how often a handler runs, counted per user, server, channel or for everyone.

@Defer(options?)

Acknowledges an interaction for its handler, then locks a component's message while the handler runs.

@Guard(options?)

Marks a class as a guard, which decides whether a handler runs.

@Interceptor(options?)

Marks a class as an interceptor, which wraps a handler to act before and after it.

@Observer(options?)

Marks a class as a dispatch observer, told about every call once it has settled, for metrics and audit logs.

@Pipe()

Marks a class as a pipe, which turns one input value into what the handler works with.

@UseFilter(...filters)

Applies exception filters to a handler, or to every handler of a controller.

@UseGuard(...entries)

Runs guards before a handler, or before every handler of a controller.

@UseInterceptor(...interceptors)

Runs interceptors around a handler, or around every handler of a controller.

@UsePipe(key, ...pipes)

Runs pipes on one value of a handler's input, to turn it into what the handler works with.

@Validate(schema, options?)

Validates a handler's input with a Standard Schema before it runs.