Skip to content
Functioncorev0.14.0

OwnerOnly

Passes only for a user id listed in config.ownerIds, else refuses.

Agnostic, so it attaches to interaction and event handlers alike. With no ownerIds configured it refuses every caller. Pass a Notice class as notice to replace the refusal.

See also:the @Gated decorator from your transport package

OwnerOnly(
    options?: GateNoticeOptions
): Gate<GateContextBase, "OwnerOnly">
\@Gated(OwnerOnly())
\@SlashRoute('shutdown')
class ShutdownHandler extends SlashHandler<'shutdown'> {
    async execute() {
        // ...
    }
}
// OwnersOnly is your own Notice class
OwnerOnly({ notice: OwnersOnly });

options?

Replace the refusal with a Notice class as notice.