Interface EntitySelectMenuHandler
public interface EntitySelectMenuHandler
An interface that contains the method that should be executed when a user interacts with a
EntitySelectMenu
.-
Method Summary
Modifier and TypeMethodDescriptionvoid
handleEntitySelectMenu
(net.dv8tion.jda.api.events.interaction.component.EntitySelectInteractionEvent event, List<net.dv8tion.jda.api.entities.IMentionable> values) Method that must be overridden for all classes that handleEntitySelectInteraction
All select menus that match the identifier will execute this class's implementation of the handleEntitySelectMenu method.
-
Method Details
-
handleEntitySelectMenu
void handleEntitySelectMenu(@Nonnull net.dv8tion.jda.api.events.interaction.component.EntitySelectInteractionEvent event, @Nonnull List<net.dv8tion.jda.api.entities.IMentionable> values) Method that must be overridden for all classes that handleEntitySelectInteraction
All select menus that match the identifier will execute this class's implementation of the handleEntitySelectMenu method. This is best used with theComponentIdBuilder
.public class TestCommand extends SlashCommand implements EntitySelectMenuHandler { public TestCommand() { setCommandData(Commands.slash("test", "test description")); } @Override public void execute(SlashCommandInteractionEvent event) { //Build your select menu here. } @Override public void handleEntitySelectMenu(EntitySelectInteractionEvent event, List<IMentionable> values) { for (IMentionable entity : values) { event.getChannel().sendMessage(String.format("Mention: %s", entity.getAsMention()) } } }
dih4JDA.addEntitySelectMenuMappings(IdMapping.of(new TestCommand(), "test-entity-select-menu"));
- Parameters:
event
- theEntitySelectInteractionEvent
instance.values
- the values that you could select.
-