Skip to content

CommandContext

Defined in: packages/core/src/commands.ts:188

What a command handler gets, whether it was run as /name or as !name.

M extends OptionMap = OptionMap

bot: Client

Defined in: packages/core/src/commands.ts:189


channelId: string | undefined

Defined in: packages/core/src/commands.ts:195


guildId: string | undefined

Defined in: packages/core/src/commands.ts:194


interaction: CommandInteraction | undefined

Defined in: packages/core/src/commands.ts:201

The slash interaction, when source is "slash".


member: GuildMember | null

Defined in: packages/core/src/commands.ts:199

The person who ran it as a guild member, when it ran in a guild.


message: Message | undefined

Defined in: packages/core/src/commands.ts:203

The message, when source is "prefix".


options: OptionValues<M>

Defined in: packages/core/src/commands.ts:191

The command’s options, typed from its definition.


source: "slash" | "prefix"

Defined in: packages/core/src/commands.ts:193

How it was run.


userId: string

Defined in: packages/core/src/commands.ts:197

The id of whoever ran it.

defer(options?): Promise<void>

Defined in: packages/core/src/commands.ts:211

Tells Discord the answer will take a while (slash commands only; a no-op for prefix commands).

boolean

Promise<void>


reply(content): Promise<void>

Defined in: packages/core/src/commands.ts:209

Answers the command: an interaction reply for a slash command (a first reply, an edit after defer(), then follow-ups), a message reply for a prefix command. ephemeral only means something for slash commands.

string | InteractionReplyOptions

Promise<void>