Class ApplicationCommand

    • Field Detail

      • MAX_NAME_LENGTH

        public static final int MAX_NAME_LENGTH
        The maximum amount of characters that can be in an application command name.
        See Also:
        Constant Field Values
      • MAX_DESCRIPTION_LENGTH

        public static final int MAX_DESCRIPTION_LENGTH
        The maximum amount of characters that can be in an application command description.
        See Also:
        Constant Field Values
    • Constructor Detail

      • ApplicationCommand

        public ApplicationCommand​(GatewayDiscordClient gateway,
                                  discord4j.discordjson.json.ApplicationCommandData data)
        Constructs an ApplicationCommand with an associated GatewayDiscordClient and Discord data.
        Parameters:
        gateway - The GatewayDiscordClient associated to this object, must be non-null.
        data - The raw data as represented by Discord, must be non-null.
    • Method Detail

      • getId

        public Snowflake getId()
        Gets unique id of the command.
        Returns:
        The unique id of the command.
      • getVersion

        public Snowflake getVersion()
        Gets the version of the command.
        Returns:
        The version of the command
      • getGuildId

        public Optional<Snowflake> getGuildId()
        Gets the id of the guild if the command is guild scoped.
        Returns:
        The id of the guild
      • getType

        public ApplicationCommand.Type getType()
        Gets the type of the command.
        Returns:
        The type of the command.
      • getApplicationId

        public Snowflake getApplicationId()
        Gets the unique id of the parent application.
        Returns:
        The unique id of the parent application.
      • getName

        public String getName()
        Gets the name of the command.
        Returns:
        The name of the command.
      • getLocalizedNames

        public Map<Locale,​String> getLocalizedNames()
        Gets the Locale and name of the command.
        Returns:
        The locales and names of the command.
      • getDescription

        public String getDescription()
        Gets description of the command.
        Returns:
        The description of the command.
      • getLocalizedDescriptions

        public Map<Locale,​String> getLocalizedDescriptions()
        Gets the Locale and description of the command.
        Returns:
        The locales and descriptions of the command.
      • getDefaultMemberPermissions

        public PermissionSet getDefaultMemberPermissions()
        Gets the default permissions assigned to this Application Command for member.
        Returns:
        The permissions assigned to this Application Command.
      • getOption

        public Optional<ApplicationCommandOption> getOption​(String name)
        Gets the option corresponding to the provided name, if present.
        Parameters:
        name - The name of the option.
        Returns:
        The option corresponding to the provided name, if present.
      • isAvailableInDM

        public boolean isAvailableInDM()
        Gets if the command is available in DM, this only for global commands.
        Returns:
        true if the command is available in DM, false otherwise.