Represents the command this command is an alias of
Represents a list of commands that are identical to the original command, with different names
This command's category, if omitted, the command's origin file's parent folder name will be parsed and used
'file parent folder name'
Optional
clientPermissions required by the client to execute the command
Optional
collectionCommand cooldown/throttling configuration to apply to this command
Note: This is NOT persistent, for that, you should use your own persistent cooldown middleware
Command data to send off to the Discord API, resolved by builder
Defers the reply to run
interactions internally if possible
Is the command currently disabled? If so - it won't be available anywhere. Late API updates (users that see the command in their command overview after the API data update) are accounted for
false
Indicates if this command is available globally. If
NODE_ENV is production
it will default to true
. If NODE_ENV
is anything else, it will default to false
.
Is this command only available in guilds/servers, or also in DMs?
You should use InteractionUtils.requireAvailableGuild
in your
command/controller to assert the interaction type
true
Tries to (defer, edit, followUp, etc.) reply ephemerally if possible
Optional
managerMiddleware for this command
import { ChatInputMiddlewareFunction } from '../middleware/CommandMiddleware';
const requireDJRole: ChatInputMiddlewareFunction = async ({
next,
client,
command,
interaction,
previousResult,
nextMiddleware,
previousMiddleware,
}) => {
// Do something with available Context
next(); // Only continue to next middleware if next is called
};
export default new ChatInputCommand({
deferReply: true, // You should defer replies ASAP if you're using async middleware
permLevel: PermLevel.Developer,
middleware: [ requireDJRole ],
// OR
middleware: {
preRunChecks: [ requireDJRole ],
// Etc.
}
})
Is the command Not Safe For Work? If it is, it will only be available in channels that have the NSFW-flag set enabled
false
The permission level required to use the command
If higher than or equal to Administrator, data#setDefaultMemberPermissions(0)
is automatically called if not explicitly set
PermLevel.User
Represents a list of required resource IDs for a command
These are used to restrict command usage to specific resources, which is especially useful for private bots/functionality
Every parameter represents a oneOf list of IDs of which AT LEAST ONE is required to match If multiple parameters are provided, all of them must match
Internal permissions and availability/constraint checks still apply
The function to run when the command is executed
Permissions required by the user to execute the command
Make sure the command matches all constraints - things like required Discord permissions, internal permissions, NSFW channels, etc.
True if the command matches all constraints (should execute), false otherwise
Convenience method to reply to an interaction and set ephemeral state dynamically - it's nice not having to boilerplate import everywhere
Represents a command with chat input, aka: a Slash command (/)