Skip to content
GitHub

GuardInterface

interface in meocord/interface Since 4.0.0

interface GuardInterface

What a guard implements: canActivate, which decides whether the handler runs.

Implement it on a class marked with Guard, and apply the class with UseGuard.

Where it runs

  • Guards — where @UseGuard or @MeoCord({ guards }) applies the class

Members

canActivate

canActivate(
  context: BaseInteraction | Message | MessageReaction | unknown,
  ...args: any[]
): Promise<boolean> | boolean

Decides whether the guarded handler runs.

Parameters

NameTypeDescription
context| BaseInteraction | Message | MessageReaction | unknown

The interaction, message or reaction being handled, or an event's first argument.

...argsany[]

The handler's remaining arguments, such as the params parsed from a customId.

Returns

Promise<boolean> | boolean

true to run the handler, false to skip it.

See also

  • Guard
  • UseGuard