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
    • 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