Skip to main content
Version: 1.x

EventFlagContext

EventFlagContext​

Context for evaluating event flags in CommandKit.

Signature
interface EventFlagContext {
client: Client<true>;
commandkit: CommandKit;
event: {
/**
* The parsed event data, which contains the raw data from the event.
* This can include information like user IDs, channel IDs, and other relevant data.
*/
data: ParsedEvent;
/**
* The name of the event being processed.
* This is the string identifier for the event, such as 'messageCreate' or 'guildMemberAdd'.
*/
event: string;
/**
* The namespace of the event, if applicable.
* This can be used to group related events or commands together.
* It is null if the event does not belong to a specific namespace.
*/
namespace: string | null;
/**
* The arguments passed to the event handler.
* This is an array of arguments that were passed when the event was triggered.
* It can be used to access specific data related to the event.
*/
arguments: any[];
/**
* A function to retrieve the arguments for a specific event type.
* This allows for type-safe access to the arguments based on the event name.
* @param event - The name of the event to retrieve arguments for.
*/
argumentsAs<E extends keyof ClientEvents>(event: E): ClientEvents[E];
};
command: 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.

event​

property
{ /** * The parsed event data, which contains the raw data from the event. * This can include information like user IDs, channel IDs, and other relevant data. */ data: ParsedEvent; /** * The name of the event being processed. * This is the string identifier for the event, such as 'messageCreate' or 'guildMemberAdd'. */ event: string; /** * The namespace of the event, if applicable. * This can be used to group related events or commands together. * It is null if the event does not belong to a specific namespace. */ namespace: string | null; /** * The arguments passed to the event handler. * This is an array of arguments that were passed when the event was triggered. * It can be used to access specific data related to the event. */ arguments: any[]; /** * A function to retrieve the arguments for a specific event type. * This allows for type-safe access to the arguments based on the event name. * @param event - The name of the event to retrieve arguments for. */ argumentsAs<E extends keyof ClientEvents>(event: E): ClientEvents[E]; }

The event context, which includes information about the event being processed. This can include the parsed event data, the event name, and the namespace if applicable.

command​

property
null

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