Class ConfigurableReply
- All Implemented Interfaces:
Reply
- Direct Known Subclasses:
ComponentReply
Subtype of MessageReply
that supports adding components to messages and changing the ReplyConfig
.
Example:
@Interaction
public class ExampleCommand {
@SlashCommand(value = "example command")
public void onCommand(CommandEvent event) {
event.with().components(buttons("onButton")).reply("Hello World");
}
@Button("Press me!")
public void onButton(ComponentEvent event) {
event.reply("You pressed me!");
}
}
-
Field Summary
Fields inherited from class com.github.kaktushose.jda.commands.dispatching.reply.MessageReply
builder, definition, editReply, ephemeral, event, keepComponents, log
-
Constructor Summary
ConstructorDescriptionConfigurableReply
(@NotNull ConfigurableReply reply) Constructs a new ConfigurableReply.ConfigurableReply
(@NotNull MessageReply reply, @NotNull InteractionRegistry registry, @NotNull String runtimeId) Constructs a new ConfigurableReply. -
Method Summary
Modifier and TypeMethodDescription@NotNull ComponentReply
components
(@NotNull Component... components) @NotNull ComponentReply
components
(@NotNull String... components) Adds anActionRow
to the reply and adds the passed components to it.@NotNull ConfigurableReply
editReply
(boolean editReply) Whether to keep the original components when editing a message.@NotNull ConfigurableReply
ephemeral
(boolean ephemeral) Whether to send ephemeral replies.@NotNull ConfigurableReply
keepComponents
(boolean keepComponents) Whether to edit the original message or to send a new one.Methods inherited from class com.github.kaktushose.jda.commands.dispatching.reply.MessageReply
complete, reply, reply, reply
-
Field Details
-
registry
-
runtimeId
-
-
Constructor Details
-
ConfigurableReply
public ConfigurableReply(@NotNull @NotNull MessageReply reply, @NotNull @NotNull InteractionRegistry registry, @NotNull @NotNull String runtimeId) Constructs a new ConfigurableReply.- Parameters:
reply
- the underlyingMessageReply
registry
- the correspondingInteractionRegistry
runtimeId
- the correspondingRuntime
-
ConfigurableReply
Constructs a new ConfigurableReply.- Parameters:
reply
- theConfigurableReply
to copy
-
-
Method Details
-
ephemeral
Whether to send ephemeral replies. Default value is
false
.Ephemeral messages have some limitations and will be removed once the user restarts their client. Limitations:
- Cannot contain any files/ attachments
- Cannot be reacted to
- Cannot be retrieved
**This will override both
invalid reference
GlobalReplyConfig
ReplyConfig
annotation!**- Parameters:
ephemeral
-true
if to send ephemeral replies- Returns:
- the current instance for fluent interface
-
editReply
Whether to keep the original components when editing a message. Default value is
true
.More formally, if editing a message and
keepComponents
istrue
, the original message will first be queried and its components get added to the reply before it is sent.**This will override both
invalid reference
GlobalReplyConfig
ReplyConfig
annotation!**- Parameters:
editReply
-true
if to keep the original components- Returns:
- the current instance for fluent interface
-
keepComponents
Whether to edit the original message or to send a new one. Default value is
true
.The original message is always the very first reply that was sent. E.g. for a slash command event, which was replied to with a text message and a button, the original message is that very reply.
Subsequent replies to the same slash command event or the button event cannot be edited.
**This will override both
invalid reference
GlobalReplyConfig
ReplyConfig
annotation!**- Parameters:
keepComponents
-true
if to edit the original method- Returns:
- the current instance for fluent interface
-
components
Adds an
ActionRow
to 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!"); } }
- Parameters:
components
- the name of the components to add- Returns:
- the current instance for fluent interface
-
components
Adds an
ActionRow
to the reply and adds the passedComponent
to it.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(Components.disabled("onButton")).reply("Hello World"); } @Button("Press me!") public void onButton(ComponentEvent event) { event.reply("You pressed me!"); } }
- Parameters:
components
- theComponent
to add- Returns:
- the current instance for fluent interface
- See Also:
-