Skip to content

Commit 51e3149

Browse files
committed
generateRoleOptions: remove unnecessary parameter
As it currently is, the helper method `generateRoleOptions` takes one `SlashCommandData` parameter and is used once throughout the entire project, specifically in the same class it is defined. In that one case, `generateRoleOptions` would take in `getData()` as its input, a method that is accessible through the entire class due to the simple fact that `CreateRoleApplicationCommand` inherits methods from `SlashCommandAdapter`. Modify the `generateRoleOptions` helper method to take no input and inside it, store a reference of `getData()` for the method to make use of. Suggested-by: Zabuzard <zabuza.dev@gmail.com> Signed-off-by: Chris Sdogkos <work@chris-sdogkos.com>
1 parent b6db802 commit 51e3149

File tree

1 file changed

+6
-5
lines changed

1 file changed

+6
-5
lines changed

application/src/main/java/org/togetherjava/tjbot/features/roleapplication/CreateRoleApplicationCommand.java

Lines changed: 6 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -66,16 +66,17 @@ public CreateRoleApplicationCommand(Config config) {
6666

6767
this.config = config.getRoleApplicationSystemConfig();
6868

69-
generateRoleOptions(getData());
69+
generateRoleOptions();
7070
handler = new RoleApplicationHandler(this.config);
7171
}
7272

7373
/**
74-
* Populates a {@link SlashCommandData} object with the proper arguments.
75-
*
76-
* @param data the object to populate
74+
* Populates this command's instance {@link SlashCommandData} object with the proper arguments
75+
* for this command.
7776
*/
78-
private void generateRoleOptions(SlashCommandData data) {
77+
private void generateRoleOptions() {
78+
final SlashCommandData data = getData();
79+
7980
IntStream.range(1, OPTIONAL_ROLES_AMOUNT + 1).forEach(index -> {
8081
data.addOption(OptionType.STRING, generateOptionId("title", index),
8182
"The title of the role");

0 commit comments

Comments
 (0)