Interface ICommandReference

All Superinterfaces:
Formattable, IMentionable, ISnowflake
All Known Subinterfaces:
Command
All Known Implementing Classes:
Command.Subcommand, Command.SubcommandGroup, SlashCommandReference

public interface ICommandReference extends IMentionable
Represents a mentionable slash command.
  • Method Details

    • getName

      @Nonnull String getName()
      Returns the name of the slash command.
      If used on a subcommand, it returns the subcommand name. And when used on a subcommand group, it returns the group name.
      You can use getFullCommandName() to get the full name including base command and group.
      Returns:
      the name of the slash command
    • getFullCommandName

      @Nonnull String getFullCommandName()
      Returns the full command name, including possible subcommand name and subcommand group name.
      This is the name shown on messages or when writing the command in the text input.

      Examples:

      • When used on a normal base command, the full name is the name itself, as in the name "ban" is equal to the full name "ban".
      • When used on a subcommand "ban", of the base command "mod", the full name resolves to "mod ban"
      • When the subcommand is part of a subcommand group, "action" it resolves to "mod action ban"
      Returns:
      the full command name
    • getAsMention

      @Nonnull default String getAsMention()
      Retrieve a Mention for this Entity. For the public Role (@everyone), this will return the literal string "@everyone".

      This will only work on slash commands!

      Specified by:
      getAsMention in interface IMentionable
      Returns:
      A resolvable mention.
      Throws:
      IllegalStateException - If the command is not a slash command (i.e. not of type Command.Type.SLASH)