📄
Advanced-Command-Handler Guide
  • Home
  • Concepts
    • CommandHandler
    • Commands
      • Commands Templates
      • CommandContext
      • SubCommands
    • Events
  • Default Commands & Events
  • Utilities
    • BetterEmbed & Embed Templates
    • Logger
    • Miscellaneous
  • v2 to v3 Migration Guide
  • Discord Support
  • Documentation
  • GitHub
Powered by GitBook
On this page
  • SubCommandContext
  • Documentation

Was this helpful?

  1. Concepts
  2. Commands

CommandContext

PreviousCommands TemplatesNextSubCommands

Last updated 3 years ago

Was this helpful?

The CommandContext is a class used in the run method of the commands to include all the properties you need, it also includes a lot of getters and useful methods to shorten your code.

// from a command
async run(ctx) {
    ctx.send(`${ctx.commandName} executed by ${ctx.user} in ${ctx.channel} !`);
    ctx.react('👍');
    ctx.send('I will now destroy your message in 10 seconds...');
    ctx.deleteMessage(10000);
}

From within the ctx argument in the callback is an instance of the SubCommandContext class which includes some other fields related to the SubCommand itself.

SubCommandContext
SubCommands
Documentation