Skip to main content
Version: 1.x

CommandFlagContext

CommandFlagContext​

Context for evaluating command flags in CommandKit.

Signature
interface CommandFlagContext {
client: Client<true>;
commandkit: CommandKit;
command: {
/**
* The interaction object if the command was invoked via an interaction.
* This can be a ChatInputCommandInteraction, AutocompleteInteraction, or ContextMenuCommandInteraction.
*/
interaction?:
| ChatInputCommandInteraction
| AutocompleteInteraction
| ContextMenuCommandInteraction;
/**
* The message object if the command was invoked via a message.
*/
message?: Message;
/**
* The guild where the command was invoked, if applicable.
* This will be null for commands invoked in DMs.
*/
guild: Guild | null;
/**
* The channel where the command was invoked.
* This can be a text channel, DM channel, or any other type of text-based channel.
*/
channel: TextBasedChannel | null;
/**
* The loaded command instance that is being executed.
* This contains the command's metadata and logic.
*/
command: LoadedCommand;
};
event: null;
}

client​

property
Client<true>

The Discord client instance. This is the main entry point for interacting with the Discord API.

commandkit​

property

The CommandKit instance, which provides access to the command framework. This includes commands, events, and other features of CommandKit.

command​

property
{ /** * The interaction object if the command was invoked via an interaction. * This can be a ChatInputCommandInteraction, AutocompleteInteraction, or ContextMenuCommandInteraction. */ interaction?: | ChatInputCommandInteraction | AutocompleteInteraction | ContextMenuCommandInteraction; /** * The message object if the command was invoked via a message. */ message?: Message; /** * The guild where the command was invoked, if applicable. * This will be null for commands invoked in DMs. */ guild: Guild | null; /** * The channel where the command was invoked. * This can be a text channel, DM channel, or any other type of text-based channel. */ channel: TextBasedChannel | null; /** * The loaded command instance that is being executed. * This contains the command's metadata and logic. */ command: LoadedCommand; }

The command context, which includes information about the command being executed. This can include the interaction, message, guild, channel, and the loaded command.

event​

property
null

The event context is null for command flags, as they are not tied to a specific event. This is used to differentiate between command and event flags.