Class MessageReply
- Direct Known Subclasses:
ConfigurableReply, SendableReply
-
Field Summary
Fields -
Constructor Summary
ConstructorsConstructorDescriptionMessageReply(InteractionDefinition.ReplyConfig replyConfig) Constructs a new MessageReply.MessageReply(MessageReply reply) Constructs a new MessageReply. -
Method Summary
Modifier and TypeMethodDescriptionbuilder(Consumer<MessageCreateBuilder> consumer) Access the underlyingMessageCreateBuilderfor configuration steps not covered byConfigurableReply.components(Component<?, ?, ?, ?>... components) components(String... components) Adds anActionRowto the reply and adds the passed components to it.Acknowledgement of this event with one or moreEmbeds.Acknowledgement of this event with one or moreEmbeds.Acknowledgement of this event with anEmbed.Acknowledgement of this event with anEmbed.Acknowledgement of this event with a text message.protected ComponentReplacerresolver()
-
Field Details
-
replyAction
-
-
Constructor Details
-
MessageReply
Constructs a new MessageReply.- Parameters:
replyConfig- theInteractionDefinition.ReplyConfigto use
-
MessageReply
Constructs a new MessageReply.- Parameters:
reply- theMessageReplyto copy from
-
-
Method Details
-
reply
Acknowledgement of this event with a text message.- Parameters:
message- the message to send or the localization keyplaceholder- the placeholders to use to perform localization, see [I18n#localize(Locale , String, Entry...) ]- Returns:
- the
Messagethat got created - Implementation Requirements:
Internally this method must call
RestAction.complete(), thus theMessageobject can get returned directly.This might throw
RuntimeExceptions if JDA fails to send the message.
-
builder
Access the underlying
MessageCreateBuilderfor configuration steps not covered byConfigurableReply.This method exposes the internal
MessageCreateBuilderused by JDA-Commands. Modifying fields that are also manipulated by the Reply API, like content or embeds, may lead to unexpected behaviour.Example:
event.with().builder(builder -> builder.setFiles(myFile)).reply("Hello World!");- Parameters:
consumer- theConsumerto access theMessageCreateBuilder- Returns:
- this instance for fluent interface
-
embeds
Acknowledgement of this event with one or more
Embeds.Resolves the
Embeds based on the given names. SeeEmbedConfigfor more information.- Parameters:
embeds- the name of theEmbeds to send- Returns:
- this instance for fluent interface
-
embeds
Acknowledgement of this event with one or more
Embeds.See
EmbedConfigfor more information.- Parameters:
embeds- theEmbeds to send- Returns:
- this instance for fluent interface
-
embeds
Acknowledgement of this event with an
Embed.Resolves the
Embedbased on the given name. SeeEmbedConfigfor more information. -
embeds
Acknowledgement of this event with an
Embed.Resolves the
Embedbased on the given name. SeeEmbedConfigfor more information.- Parameters:
embed- the name of theEmbedto sendentry- the placeholders to use. SeeEmbed.placeholders(Entry...)entries- the placeholders to use. SeeEmbed.placeholders(Entry...)- Returns:
- this instance for fluent interface
-
components
Adds an
ActionRowto the reply and adds the passed components to it.The components will always be enabled and runtime-bound. Use
components(Component...)if you want to modify these settings.The components must be defined in the same class where this method gets called!
Example:
@Interaction public class ExampleCommand { @SlashCommand(value= "example command") public void onCommand(CommandEvent event){ event.with().components("onButton").reply("Hello World"); } @Button("Press me!") public void onButton(ComponentEvent event){ event.reply("You pressed me!"); } } -
components
Adds an
ActionRowto the reply and adds the passedComponentto it.Example:
@Interaction public class ExampleCommand { @SlashCommand(value= "example command") public void onCommand(CommandEvent event){ event.with().components(Components.disabled("onButton")).reply("Hello World"); } @Button("Press me!") public void onButton(ComponentEvent event){ event.reply("You pressed me!"); } }- See Also:
-
resolver
-