GuardInterface
interface in meocord/interface Since 4.0.0
interface GuardInterfaceWhat 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
@UseGuardor@MeoCord({ guards })applies the class
Members
canActivate
canActivate(
context: BaseInteraction | Message | MessageReaction | unknown,
...args: any[]
): Promise<boolean> | booleanDecides whether the guarded handler runs.
Parameters
| Name | Type | Description |
|---|---|---|
context | | BaseInteraction
| Message
| MessageReaction
| unknown | The interaction, message or reaction being handled, or an event's first argument. |
...args | any[] | The handler's remaining arguments, such as the params parsed from a customId. |
Returns
Promise<boolean> | booleantrue to run the handler, false to skip it.
See also
- Guard
- UseGuard