Class ConfigurableReply

java.lang.Object
io.github.kaktushose.jdac.dispatching.reply.MessageReply
io.github.kaktushose.jdac.dispatching.reply.ConfigurableReply
Direct Known Subclasses:
EditableConfigurableReply

public sealed class ConfigurableReply extends MessageReply permits 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!");
    }
}
  • Constructor Details

  • Method Details

    • ephemeral

      public ConfigurableReply ephemeral(boolean 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 any ReplyConfig annotation!

      Parameters:
      ephemeral - true if to send ephemeral replies
      Returns:
      the current instance for fluent interface
    • silent

      public ConfigurableReply silent(boolean silent)

      Whether to suppress notifications of this message. Defaults to false.

      This will override both JDACBuilder.globalReplyConfig(InteractionDefinition.ReplyConfig) and any ReplyConfig annotation!

      Returns:
      the current instance for fluent interface
      See Also:
      • MessageCreateRequest.setSuppressedNotifications(boolean)
    • allowedMentions

      public ConfigurableReply allowedMentions(@Nullable Collection<net.dv8tion.jda.api.entities.Message.MentionType> allowedMentions)

      Sets the Message.MentionTypes to be parsed.

      This will override JDACBuilder.globalReplyConfig(InteractionDefinition.ReplyConfig), any ReplyConfig annotation as well as previous method calls!

      If null is provided to this method, then all Types will be mentionable (unless whitelisting via mention(IMentionable...) or mention(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 pass null or EnumSet.allOf(MentionType.class) to allow all mentions.
      Returns:
      the current instance for fluent interface
      See Also:
      • MessageRequest.setAllowedMentions(Collection)
    • mention

      public ConfigurableReply mention(net.dv8tion.jda.api.entities.IMentionable... mentions)

      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:
      • MessageRequest.mention(IMentionable...)
    • mention

      public ConfigurableReply mention(Collection<net.dv8tion.jda.api.entities.IMentionable> mentions)

      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:
      • MessageRequest.mention(Collection)
    • reply

      public net.dv8tion.jda.api.entities.Message reply(net.dv8tion.jda.api.components.MessageTopLevelComponent component, Entry... placeholder)

      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 - the MessageTopLevelComponent to reply with
      placeholder - the placeholders to use. See PlaceholderResolver
    • reply

      public net.dv8tion.jda.api.entities.Message reply(Collection<net.dv8tion.jda.api.components.MessageTopLevelComponent> components, Entry... placeholder)

      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 - a Collection of MessageTopLevelComponents to reply with
      placeholder - the placeholders to use. See PlaceholderResolver