forked from JDA-Applications/JDA-Utilities
-
-
Notifications
You must be signed in to change notification settings - Fork 23
Tutorial: Slash Command Reply with Pagination
Olivia edited this page Apr 20, 2022
·
1 revision
Pagination is a very nice thing. How do we do it as a reply to slash commands? Follow these steps:
First, send a deferred reply or a "loading" reply.
We need to get an interaction so we can send this to the paginator to edit. Do something like this:
event.replyEmbeds(new EmbedBuilder().setDescription("Retrieving answers...").build()).queue(interactionHook -> {
interactionHook.retrieveOriginal().queue(message -> {
// Code goes here
});
});
We opened up a lambda because now we can actually do our work. Inside, we can build our paginator.
Once built, you can send it!
event.replyEmbeds(new EmbedBuilder().setDescription("Retrieving answers...").build()).queue(interactionHook -> {
interactionHook.retrieveOriginal().queue(message -> {
Paginator paginator = new Paginator.Builder().build();
paginator.paginate(message, 1);
});
});
- SlashCommands in JDA-Chewtils
- Context Menus in JDA-Chewtils (Chewtils 2.0+)
- User-Installed Apps (Chewtils 2.1-SNAPSHOT)