Class MessageReply
java.lang.Object
com.github.kaktushose.jda.commands.dispatching.reply.MessageReply
- All Implemented Interfaces:
Reply
- Direct Known Subclasses:
ConfigurableReply
Simple builder for sending text messages based on a GenericInteractionCreateEvent
.
More formally, can be used to
send an arbitrary amount of message replies to the text channel the GenericInteractionCreateEvent
was executed in.
Example:
new MessageReply(event, definition, new ReplyConfig()).reply(errorMessage);
- See Also:
-
Field Summary
FieldsModifier and TypeFieldDescriptionprotected final net.dv8tion.jda.api.utils.messages.MessageCreateBuilder
protected final InteractionDefinition
protected boolean
protected boolean
protected final net.dv8tion.jda.api.events.interaction.GenericInteractionCreateEvent
protected boolean
protected static final org.slf4j.Logger
-
Constructor Summary
ConstructorsConstructorDescriptionMessageReply
(@NotNull MessageReply reply) Constructs a new MessageReply.MessageReply
(@NotNull net.dv8tion.jda.api.events.interaction.GenericInteractionCreateEvent event, @NotNull InteractionDefinition definition, InteractionDefinition.ReplyConfig replyConfig) Constructs a new MessageReply. -
Method Summary
Modifier and TypeMethodDescriptionprotected @NotNull net.dv8tion.jda.api.entities.Message
complete()
Sends the reply to Discord and blocks the current thread until the message was sent.net.dv8tion.jda.api.entities.Message
Acknowledgement of this event with a text message.net.dv8tion.jda.api.entities.Message
reply
(@NotNull net.dv8tion.jda.api.EmbedBuilder builder) Acknowledgement of this event with a text message.net.dv8tion.jda.api.entities.Message
reply
(@NotNull net.dv8tion.jda.api.utils.messages.MessageCreateData message) Acknowledgement of this event with a text message.
-
Field Details
-
log
protected static final org.slf4j.Logger log -
event
protected final net.dv8tion.jda.api.events.interaction.GenericInteractionCreateEvent event -
definition
-
builder
protected final net.dv8tion.jda.api.utils.messages.MessageCreateBuilder builder -
ephemeral
protected boolean ephemeral -
editReply
protected boolean editReply -
keepComponents
protected boolean keepComponents
-
-
Constructor Details
-
MessageReply
public MessageReply(@NotNull @NotNull net.dv8tion.jda.api.events.interaction.GenericInteractionCreateEvent event, @NotNull @NotNull InteractionDefinition definition, @NotNull InteractionDefinition.ReplyConfig replyConfig) Constructs a new MessageReply.- Parameters:
event
- the correspondingGenericInteractionCreateEvent
definition
- the correspondingInteractionDefinition
. This is mostly needed by theConfigurableReply
replyConfig
- theInteractionDefinition.ReplyConfig
to use
-
MessageReply
Constructs a new MessageReply.- Parameters:
reply
- theMessageReply
to copy
-
-
Method Details
-
reply
-
reply
public net.dv8tion.jda.api.entities.Message reply(@NotNull @NotNull net.dv8tion.jda.api.utils.messages.MessageCreateData message) Description copied from interface:Reply
Acknowledgement of this event with a text message. -
reply
public net.dv8tion.jda.api.entities.Message reply(@NotNull @NotNull net.dv8tion.jda.api.EmbedBuilder builder) Description copied from interface:Reply
Acknowledgement of this event with a text message. -
complete
@NotNull protected @NotNull net.dv8tion.jda.api.entities.Message complete()Sends the reply to Discord and blocks the current thread until the message was sent.- Returns:
- the
Message
that got created - Implementation Note:
This method can handle both message replies and message edits. it will check if the interaction got acknowledged and will acknowledge it if necessary before sending or editing a message. After that,
WebhookClient.sendMessage(MessageCreateData)
or respectivelyInteractionHook.editOriginal(MessageEditData)
will be called.If editing a message and
keepComponents
istrue
, queries the original message first and adds its components to the reply before sending it.
-