Skip to content
GitHub

GuardOptions

interface in meocord/interface Since 4.1.0

interface GuardOptions

What @Guard takes: the context types the guard runs for.

Members

types

types?: readonly ExecutionContextType[]

The context types the guard runs for, as ExecutionContext.getType() reports them; it is skipped for any other call. An autocomplete is its own type, 'autocomplete', so a guard limited to 'interaction' doesn't run before @Autocomplete handlers. A subclass inherits them unless it declares its own. A global guard also runs before @On handlers, unless the app sets globalStagesOnEvents: false, so one that reads an interaction declares ['interaction'], or ['interaction', 'autocomplete'] to run before autocomplete handlers too. A guard that runs before an autocomplete answers nothing there: return false to show no choices.

Default: every type

See also

  • Guard