HandleCommand

Signature

export declare class HandleCommand

Properties

Methods

resolveByName(fullName: string, guildId?: string): CommandFromContent | undefined;

Resolves a message command by its full name. Guild-scoped commands require a matching `guildId`; without one, they intentionally resolve to `undefined`.

checkMemberPermissions(command: Command | SubCommand, _context: CommandContext, permissions: PermissionsBitField): Awaitable<PermissionStrings | undefined>;

Checks the member permissions required by a command.

Parameters
command
The command whose member permissions are being checked.
_context
The context of the command execution.
permissions
The permissions currently held by the member.
Returns

The missing permission names, or `undefined` when command execution can continue.

@remarksThis method runs for guild executions when the command declares `defaultMemberPermissions`. Override it to customize member permission checks; overrides can return synchronously or asynchronously. Thrown errors and rejected promises are routed through the command's internal error handler.
checkBotPermissions(command: Command | SubCommand | ContextMenuCommand | EntryPointCommand, _context: CommandContext | MenuCommandContext<any> | EntryPointContext, permissions: PermissionsBitField): Awaitable<PermissionStrings | undefined>;

Checks the bot permissions required by a command.

Parameters
command
The command whose bot permissions are being checked.
_context
The context of the command execution.
permissions
The permissions currently held by the bot.
Returns

The missing permission names, or `undefined` when command execution can continue.

@remarksThis method runs for guild executions when the command declares `botPermissions`. Override it to customize bot permission checks; overrides can return synchronously or asynchronously. Thrown errors and rejected promises are routed through the command's internal error handler.
checkPermissions(app: PermissionsBitField, bot: bigint): ("CreateInstantInvite" | "KickMembers" | "BanMembers" | "Administrator" | "ManageChannels" | "ManageGuild" | "AddReactions" | "ViewAuditLog" | "PrioritySpeaker" | "Stream" | "ViewChannel" | "SendMessages" | "SendTTSMessages" | "ManageMessages" | "EmbedLinks" | "AttachFiles" | "ReadMessageHistory" | "MentionEveryone" | "UseExternalEmojis" | "ViewGuildInsights" | "Connect" | "Speak" | "MuteMembers" | "DeafenMembers" | "MoveMembers" | "UseVAD" | "ChangeNickname" | "ManageNicknames" | "ManageRoles" | "ManageWebhooks" | "ManageGuildExpressions" | "UseApplicationCommands" | "RequestToSpeak" | "ManageEvents" | "ManageThreads" | "CreatePublicThreads" | "CreatePrivateThreads" | "UseExternalStickers" | "SendMessagesInThreads" | "UseEmbeddedActivities" | "ModerateMembers" | "ViewCreatorMonetizationAnalytics" | "UseSoundboard" | "CreateGuildExpressions" | "CreateEvents" | "UseExternalSounds" | "SendVoiceMessages" | "SetVoiceChannelStatus" | "SendPolls" | "UseExternalApps" | "PinMessages" | "BypassSlowmode")[] | undefined;