Skip to content
Functioncorev0.14.0

GuildOnly

Passes inside a guild, else refuses.

Agnostic. Attaches to any handler kind. Often paired with RequirePermissions in an and.

See also:the @Gated decorator from your transport package

GuildOnly(
    options?: GateNoticeOptions
): Gate<GateContextBase, "GuildOnly">
import { PermissionFlagsBits } from 'discord.js';

\@Gated(GuildOnly(), RequirePermissions([PermissionFlagsBits.Administrator]))
\@SlashRoute('maintenance')
class Maintenance extends SlashHandler<'maintenance'> {
    async execute() {
        // ...
    }
}

options?

Replace the refusal with a Notice class as notice.