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 TypeMethodDescriptionallowedMentions(@Nullable Collection<Message.MentionType> allowedMentions) Sets theMessage.MentionTypes to be parsed.ephemeral(boolean ephemeral) Whether to send ephemeral replies.mention(Collection<IMentionable> mentions) Used to provide a whitelist for Users, Members and Roles that should be pinged.mention(IMentionable... mentions) Used to provide a whitelist for Users, Members and Roles that should be pinged.reply(Collection<MessageTopLevelComponent> components, Entry... placeholder) Acknowledgement of this event with V2 Components.reply(MessageTopLevelComponent component, Entry... placeholder) Acknowledgement of this event with V2 Components.silent(boolean silent) Whether to suppress notifications of this message.Methods inherited from class MessageReply
builder, components, components, embeds, embeds, embeds, embeds, reply, resolver
-
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
-
silent
Whether to suppress notifications of this message. Defaults to
false.This will override both
JDACBuilder.globalReplyConfig(InteractionDefinition.ReplyConfig)and anyReplyConfigannotation!- Returns:
- the current instance for fluent interface
- See Also:
-
allowedMentions
Sets the
Message.MentionTypes to be parsed.This will override
JDACBuilder.globalReplyConfig(InteractionDefinition.ReplyConfig), anyReplyConfigannotation as well as previous method calls!If
nullis provided to this method, then all Types will be mentionable (unless whitelisting viamention(IMentionable...)ormention(Collection)).- Parameters:
allowedMentions-Message.MentionTypes that are allowed to be parsed and mentioned. All other mention types will not be mentioned by this message. You can passnullorEnumSet.allOf(MentionType.class)to allow all mentions.- Returns:
- the current instance for fluent interface
- See Also:
-
mention
Used to provide a whitelist for Users, Members and Roles that should be pinged. See the JDA docs for details.
This will add up to previous method calls.
- Parameters:
mentions- Users, Members and Roles that should be explicitly whitelisted to be pingable.- Returns:
- the current instance for fluent interface
- See Also:
-
mention
Used to provide a whitelist for Users, Members and Roles that should be pinged. See the JDA docs for details.
This will add up to previous method calls.
- Parameters:
mentions- Users, Members and Roles that should be explicitly whitelisted to be pingable.- Returns:
- the current instance for fluent interface
- See Also:
-
reply
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)
- Parameters:
component- theMessageTopLevelComponentto reply withplaceholder- the placeholders to use. SeePlaceholderResolver
-
reply
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)
- Parameters:
components- aCollectionofMessageTopLevelComponents to reply withplaceholder- the placeholders to use. SeePlaceholderResolver
-