Skip to content

CIRCE / DOCUMENTATION

CommandContext

What execute receives in a command or subcommand.

Documentation menu
On this page
interface CommandContext {
  readonly interaction: ChatInputCommandInteraction;
  readonly client: Client;
  readonly guild: Guild | null;
  readonly member: GuildMember | null;
  readonly user: User;
  readonly logger: Logger;
  readonly correlationId: string | undefined;
  readonly t: Translator;
}
Field Notes
interaction The untouched discord.js object.
client The logged-in client.
guild · member null in DMs, and member also when uncached.
user Who triggered it.
logger Scoped, with debug, info, warn, error. Carries the correlation ID.
correlationId UUID v4, same as in logs and errors.
t(key, params?) Translator for the interaction’s locale. See Localization.

Used by commands, subcommands and as the type of a command Guard.

Replying

Circe does not change replies: respond once, or defer then edit. Use flags: MessageFlags.Ephemeral instead of ephemeral: true. A reply to an expired interaction is absorbed instead of crashing the handler.