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
Modifier and TypeFieldDescriptionprotected final MessageCreateBuilder
protected final InteractionDefinition
protected boolean
protected boolean
protected final GenericInteractionCreateEvent
protected boolean
protected static final org.slf4j.Logger
-
Constructor Summary
ConstructorDescriptionMessageReply
(@NotNull MessageReply reply) Constructs a new MessageReply.MessageReply
(@NotNull GenericInteractionCreateEvent event, @NotNull InteractionDefinition definition, InteractionDefinition.ReplyConfig replyConfig) Constructs a new MessageReply. -
Method Summary
Modifier and TypeMethodDescriptionprotected @NotNull Message
complete()
Sends the reply to Discord and blocks the current thread until the message was sent.Acknowledgement of this event with a text message.reply
(@NotNull EmbedBuilder builder) Acknowledgement of this event with a text message.reply
(@NotNull MessageCreateData message) Acknowledgement of this event with a text message.
-
Field Details
-
log
protected static final org.slf4j.Logger log -
event
-
definition
-
builder
-
ephemeral
protected boolean ephemeral -
editReply
protected boolean editReply -
keepComponents
protected boolean keepComponents
-
-
Constructor Details
-
MessageReply
public MessageReply(@NotNull @NotNull 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
Description copied from interface:Reply
Acknowledgement of this event with a text message.- Specified by:
reply
in interfaceReply
- Parameters:
message
- theMessageCreateData
to send- Returns:
- the
Message
that got created
-
reply
Description copied from interface:Reply
Acknowledgement of this event with a text message.- Specified by:
reply
in interfaceReply
- Parameters:
builder
- theEmbedBuilder
to send- Returns:
- the
Message
that got created
-
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.
-