Command restriction helpers
This feature is currently available in development version of CommandKit only.
Command restriction helpers allow you to restrict commands based on various conditions. At the moment, only guildOnly
and dmOnly
restrictions are available.
guildOnly
The guildOnly
restriction allows you to restrict a command to be used only in guilds (servers) and not in direct messages. This is useful when your command is available both in guilds and direct messages, but you want to restrict it to guilds only for some reason.
import { guildOnly } from 'commandkit';
export async function run({ interaction }) {
guildOnly();
// Your command logic here
}
dmOnly
The dmOnly
restriction allows you to restrict a command to be used only in direct messages and not in guilds (servers). This is useful when your command is available both in guilds and direct messages, but you want to restrict it to direct messages only for some reason.
import { dmOnly } from 'commandkit';
export async function run({ interaction }) {
dmOnly();
// Your command logic here
}