A thin wrapper that normalises common operations between interaction-based commands and message-based commands.
Use this class when implementing commands to avoid branching on whether the caller is an interaction or a message.
// Interactionconst ctx = new CommandContext(interaction);await ctx.deferReply();await ctx.reply("Done");// Messageconst ctx2 = new CommandContext(message);await ctx2.reply("Hello from message"); Copy
// Interactionconst ctx = new CommandContext(interaction);await ctx.deferReply();await ctx.reply("Done");// Messageconst ctx2 = new CommandContext(message);await ctx2.reply("Hello from message");
Optional
A thin wrapper that normalises common operations between interaction-based commands and message-based commands.
Use this class when implementing commands to avoid branching on whether the caller is an interaction or a message.
Example