Skip to content
This repository has been archived by the owner on Feb 4, 2025. It is now read-only.

Selection menu enhancement - Added abstract SelectionMenu and ScrollSelection #76

Open
wants to merge 9 commits into
base: master
Choose a base branch
from

Conversation

JohnnyJayJay
Copy link
Contributor

@JohnnyJayJay JohnnyJayJay commented Oct 11, 2018

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.

Pull Request Information

Check and fill in the blanks for all that apply:

  • My PR fixes a bug, error, or other issue with the library's codebase.
  • My PR is for the menu module of the JDA-Utilities library.
  • My PR creates a new module for 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 for SelectionMenu is mainly taken from the former SelectionDialog, as every SelectionMenu basically works like it.

When making new extensions of SelectionMenu, the only difference should be the Builder and the render(int) method, which is declared abstract in SelectionMenu. It is also possible to overwrite the new method getNewSelection(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 the SelectionMenu constructor to set the reactions that are available. Currently, this is done internally.

In this PR, a new SelectionMenu is already included: the ScrollSelection.
The ScrollSelection is similar to SelectionDialog, 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 Strings in SelectionDialog are gone, they are now in SelectionMenu. They can still be added again and immediately deprecated to avoid any inconvenience.
Update: Added them again for convenience

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants