Selection menu enhancement - Added abstract SelectionMenu and ScrollSelection #76
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Pull Request
Pull Request Checklist
Please follow the following steps before opening this PR.
PRs that do not complete the checklist will be subject to denial for
missing information.
or merged features/bug fixes.
Pull Request Information
Check and fill in the blanks for all that apply:
menu
module of the JDA-Utilities library.______
.Description
This PR re-structures the SelectionDialog.
There is a new abstract class called
SelectionMenu
that allows easier implementations for menus with selections. The code forSelectionMenu
is mainly taken from the formerSelectionDialog
, as everySelectionMenu
basically works like it.When making new extensions of
SelectionMenu
, the only difference should be the Builder and therender(int)
method, which is declared abstract inSelectionMenu
. It is also possible to overwrite the new methodgetNewSelection(Message, String, int)
for other possible reactions. Configuring the reactions is not up to the user yet, however you have to pass a List of Strings (the unicode emojis) to theSelectionMenu
constructor to set the reactions that are available. Currently, this is done internally.In this PR, a new
SelectionMenu
is already included: theScrollSelection
.The
ScrollSelection
is similar toSelectionDialog
, but it only shows the currently selected entry. Also, the content of the embed description is configurable with a format String.I also added a new method for all
SelectionMenu
Builders,setChoices(List<String>)
.The contents of Kantenkugel's recent PR are also included and function correctly.
All of this is fully mergeable with the current master branch. Existing code will still work, too.
, with one exception: The.public static final String
s inSelectionDialog
are gone, they are now inSelectionMenu
. They can still be added again and immediately deprecated to avoid any inconvenienceUpdate: Added them again for convenience