Class ConfigurableReply
- Direct Known Subclasses:
EditableConfigurableReply
Builder for sending messages based on a GenericInteractionCreateEvent that supports adding components to
messages and changing the InteractionDefinition.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 MessageReply
replyAction -
Constructor Summary
ConstructorsConstructorDescriptionConfigurableReply(InteractionDefinition.ReplyConfig replyConfig) Constructs a new ConfigurableReply. -
Method Summary
Modifier and TypeMethodDescriptionephemeral(boolean ephemeral) Whether to send ephemeral replies.net.dv8tion.jda.api.entities.Messagereply(net.dv8tion.jda.api.components.MessageTopLevelComponent component, net.dv8tion.jda.api.components.MessageTopLevelComponent... components) Acknowledgement of this event with V2 Components.Methods inherited from class MessageReply
builder, components, components, embeds, embeds, embeds, embeds, reply, resolve
-
Constructor Details
-
ConfigurableReply
Constructs a new ConfigurableReply.- Parameters:
replyConfig- the underlyingInteractionDefinition.ReplyConfig
-
-
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
JDACBuilder.globalReplyConfig(InteractionDefinition.ReplyConfig)and anyReplyConfigannotation!- Parameters:
ephemeral-trueif to send ephemeral replies- Returns:
- the current instance for fluent interface
-
reply
public net.dv8tion.jda.api.entities.Message reply(net.dv8tion.jda.api.components.MessageTopLevelComponent component, net.dv8tion.jda.api.components.MessageTopLevelComponent... components) Acknowledgement of this event with V2 Components.
Using V2 components removes the top-level component limit, and allows more components in total (40).
They also allow you to use a larger choice of components, such as any component extending
MessageTopLevelComponent, as long as they are compatible.The character limit for the messages also gets changed to 4000.
This, however, comes with a few drawbacks:
- You cannot send content, embeds, polls or stickers
- It does not support voice messages
- It does not support previewing files
- URLs don't create embeds
- You cannot switch this message back to not using Components V2 (you can however upgrade a message to V2)
-