Interface ReplyManager
- All Known Implementing Classes:
MessageReplyManager
All methods capture the state of the manager at the time of calling; for example,
add(MessageCreateSpec) will use the configuration that is in place at the time it
is called, not at the time the returned Mono is subscribed; and methods like
edit(MessageEditSpec) expect the referenced reply to have already been sent.
- Since:
- 1.0
- Version:
- 1.0
-
Nested Class Summary
Nested ClassesModifier and TypeInterfaceDescriptionstatic enumSpecifies a type of emphemeral response. -
Field Summary
FieldsModifier and TypeFieldDescriptionstatic final StringError message used when trying to access the initial reply before sending one. -
Method Summary
Modifier and TypeMethodDescriptionadd(EmbedCreateSpec... embeds) Adds a reply to the chain (either initial or followup).add(MessageCreateSpec spec) Adds a reply to the chain (either initial or followup).Adds a reply to the chain (either initial or followup).defer()Defers initial response, indicating to the user that the response is being processed.delete()Deletes the initial reply.delete(int index) Deletes a reply.edit(int index, EmbedCreateSpec... embeds) Edits a reply.edit(int index, MessageEditSpec spec) Edits a reply.Edits a reply.edit(EmbedCreateSpec... embeds) Edits the initial reply.edit(MessageEditSpec spec) Edits the initial reply.Edits the initial reply.get()Retrieves the initial reply.get(int index) Retrieves a reply.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).reply(EmbedCreateSpec... embeds) Sends an initial reply.reply(MessageCreateSpec spec) Sends an initial reply.Sends an initial reply.setDeleteDelay(Duration delay) Sets the delay before deleting new replies, if they aretimed.setEphemeral(ReplyManager.EphemeralType ephemeral) Sets whether new replies should be ephemeral.setPrivate(boolean priv) Sets whether new replies should be sent in DMs.
-
Field Details
-
NO_RESPONSE_ERROR
Error message used when trying to access the initial reply before sending one.- See Also:
-
-
Method Details
-
setPrivate
Sets whether new replies should be sent in DMs.Existing replies are not affected.
- Parameters:
priv- If new replies should be sent in a private channel.- Returns:
- This.
-
setEphemeral
Sets whether new replies should be ephemeral.Existing replies are not affected.
- Parameters:
ephemeral- The ephemeral type for new replies.- Returns:
- This.
-
setDeleteDelay
Sets the delay before deleting new replies, if they aretimed.Existing replies are not affected.
- Parameters:
delay- The delay.- Returns:
- This.
-
defer
Defers initial response, indicating to the user that the response is being processed.- Returns:
- A Mono that completes after deferral is processed.
-
reply
Sends an initial reply.- Parameters:
spec- The message specification.- Returns:
- A Mono that completes after the reply is sent.
- Throws:
IllegalStateException- if an initial reply was already made.
-
reply
Sends an initial reply.- Parameters:
content- The message content.- Returns:
- A Mono that completes after the reply is sent.
- Throws:
IllegalStateException- if an initial reply was already made.
-
reply
Sends an initial reply.- Parameters:
embeds- The message embeds.- Returns:
- A Mono that completes after the reply is sent.
- Throws:
IllegalStateException- if an initial reply was already made.
-
add
Adds a reply to the chain (either initial or followup).- Parameters:
spec- The message specification.- Returns:
- The created message and its index.
-
add
Adds a reply to the chain (either initial or followup).- Parameters:
content- The message content.- Returns:
- The created message and its index.
-
add
Adds a reply to the chain (either initial or followup).- Parameters:
embeds- The message embeds.- Returns:
- The created message and its index.
-
edit
Edits the initial reply.- Parameters:
spec- The edit specification.- Returns:
- The edited message. Fails with an
IllegalStateExceptionif the initial reply was deleted. - Throws:
IllegalStateException- if an initial reply was not sent yet.
-
edit
Edits the initial reply.- Parameters:
content- The message content.- Returns:
- The edited message. Fails with an
IllegalStateExceptionif the initial reply was deleted. - Throws:
IllegalStateException- if an initial reply was not sent yet.
-
edit
Edits the initial reply.- Parameters:
embeds- The message embeds.- Returns:
- The edited message. Fails with an
IllegalStateExceptionif the initial reply was deleted. - Throws:
IllegalStateException- if an initial reply was not sent yet.
-
edit
Edits a reply.- Parameters:
index- The reply index.spec- The edit specification.- Returns:
- The edited message. Fails with an
IllegalStateExceptionif the initial reply was deleted. - Throws:
IndexOutOfBoundsException- if there is no reply with that index.
-
edit
Edits a reply.- Parameters:
index- The reply index.content- The message content.- Returns:
- The edited message. Fails with an
IllegalStateExceptionif the initial reply was deleted. - Throws:
IndexOutOfBoundsException- if there is no reply with that index.
-
edit
Edits a reply.- Parameters:
index- The reply index.embeds- The message embeds.- Returns:
- The edited message. Fails with an
IllegalStateExceptionif the initial reply was deleted. - Throws:
IndexOutOfBoundsException- if there is no reply with that index.
-
get
Retrieves a reply.- Parameters:
index- The reply index.- Returns:
- The reply. Fails with an
IllegalStateExceptionif the reply was deleted. - Throws:
IndexOutOfBoundsException- if there is no reply with that index.
-
get
Retrieves the initial reply.- Returns:
- The reply. Fails with an
IllegalStateExceptionif the initial reply was deleted. - Throws:
IllegalStateException- if an initial reply was not sent yet.
-
delete
Deletes a reply.Note that this does not change the index of other replies within this manager.
- Parameters:
index- The reply index.- Returns:
- A Mono that completes when the reply is deleted. Fails with an
IllegalStateExceptionif the reply was already deleted. - Throws:
IndexOutOfBoundsException- if there is no reply with that index.
-
delete
Deletes the initial reply.Note that this does not change the index of other replies within this manager.
- Returns:
- A Mono that completes when the reply is deleted. Fails with an
IllegalStateExceptionif the initial reply was already deleted. - 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.
-