registerHandler method

void registerHandler(
  1. SlashCommandHandler handler
)

Registers handler for command. Note command cannot have handler if there are options present

Implementation

void registerHandler(SlashCommandHandler handler) {
  if (options.any((element) => element.type == CommandOptionType.subCommand || element.type == CommandOptionType.subCommandGroup)) {
    throw ArgumentError("Cannot register handler for slash command if command have subcommand or subcommandgroup");
  }

  this.handler = handler;
}