Interface ReplyManager

All Known Implementing Classes:
MessageReplyManager

public interface ReplyManager
Manages the replies sent by a command.

Note that if a reply specification has the CommandReplySpec.privately() field as absent, the default for the command will be used. Furthermore, if the initial reply of the command is deferred, the value of that field on the first reply is ignored and the default is used instead (further replies are unaffected).

Since:
1.0
Version:
1.0
Implementation Requirements:
Implementations are required to be concurrency-safe.
  • Field Details

    • NO_RESPONSE_ERROR

      static final String NO_RESPONSE_ERROR
      Error message used when trying to access the initial reply before sending one.
      See Also:
  • Method Details

    • add

      Sends a new reply.
      Parameters:
      spec - The reply specification.
      Returns:
      The created reply.
    • add

      default CommandReplyMono add()
      Sends a new reply.
      Returns:
      A reply builder Mono that can be configured with the target reply then subscribed to send the reply.
    • add

      default Mono<Reply> add(MessageCreateSpec spec)
      Sends a new reply.
      Parameters:
      spec - The message specification.
      Returns:
      The created reply.
      See Also:
    • add

      Sends a new reply.
      Parameters:
      spec - The message specification.
      Returns:
      The created reply.
      See Also:
    • add

      Sends a new reply.
      Parameters:
      spec - The message specification.
      Returns:
      The created reply.
      See Also:
    • add

      default Mono<Reply> add(String content)
      Sends a new reply.
      Parameters:
      content - The message content.
      Returns:
      The created reply.
    • add

      default Mono<Reply> add(EmbedCreateSpec... embeds)
      Sends a new reply.
      Parameters:
      embeds - The message embeds.
      Returns:
      The created reply.
    • get

      Reply get(int index) throws IndexOutOfBoundsException
      Retrieves a reply.
      Parameters:
      index - The reply index.
      Returns:
      The reply.
      Throws:
      IndexOutOfBoundsException - if there is no reply with that index.
    • get

      default Reply get() throws IllegalStateException
      Retrieves the initial reply.
      Returns:
      The reply.
      Throws:
      IllegalStateException - if an initial reply was not sent yet.
    • longTerm

      ReplyManager longTerm()
      Obtains a manager that is a continuation of this one and has the same configuration, but is guaranteed to continue working long-term by using alternate sending methods if necessary (for example, it might use regular messages instead of interaction replies).

      Note that, while the existing replies are still accessible (by using get(int)), editing them may not be possible (for example, an interaction-ephemeral response).

      There is no guarantee that the returned manager is independent from this one; using this manager after calling this method causes undefined behavior.

      Returns:
      The long-term manager.