Repository navigation
Added ComponentIdInteractor delegate #588
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Merged
Zabuzard
merged 6 commits into
develop
from
feature/simplify_user_interactor_without_adapter
Oct 13, 2022
Merged
Changes from all commits
Commits
Show all changes
6 commits
Select commit
Hold shift + click to select a range
3ba31db
Added ComponentIdInteractor as delegate
Zabuzard 0cfe275
use delegate in adapter
Zabuzard 2cb36fd
minor adjustment
Zabuzard 6de2bea
renamed getType() to getInteractionType()
Zabuzard 0c4816e
CR improvements (Tais)
Zabuzard 0f0832c
spotless
Zabuzard File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
61 changes: 61 additions & 0 deletions
61
application/src/main/java/org/togetherjava/tjbot/commands/UserInteractionType.java
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,61 @@ | ||
| package org.togetherjava.tjbot.commands; | ||
|
|
||
| /** | ||
| * Different types of user interactions. | ||
| * <p> | ||
| * Also allows user interactors of different type to have the same name. | ||
| */ | ||
| public enum UserInteractionType { | ||
| /** | ||
| * User types a command leaded by a slash, such as {@code /ping}. | ||
| */ | ||
| SLASH_COMMAND(SlashCommand.class, "s-"), | ||
| /** | ||
| * User right-clicks a message and selects a command. | ||
| */ | ||
| MESSAGE_CONTEXT_COMMAND(MessageContextCommand.class, "mc-"), | ||
| /** | ||
| * User right-clicks a user and selects a command. | ||
| */ | ||
| USER_CONTEXT_COMMAND(UserContextCommand.class, "uc-"), | ||
| /** | ||
| * Other types of interactions, for example a routine that offers buttons to click on. | ||
| */ | ||
| OTHER(UserInteractor.class, ""); | ||
|
|
||
| private final Class<? extends UserInteractor> classType; | ||
| private final String prefix; | ||
|
|
||
| UserInteractionType(Class<? extends UserInteractor> classType, final String prefix) { | ||
| this.classType = classType; | ||
| this.prefix = prefix; | ||
| } | ||
|
|
||
| /** | ||
| * The prefix for the command | ||
| * | ||
| * @return the command's prefix | ||
| */ | ||
| public String getPrefix() { | ||
| return prefix; | ||
| } | ||
|
|
||
| /** | ||
| * Returns the name, attached with the prefix in front of it. | ||
| * | ||
| * @param name the name | ||
| * @return the name, with the prefix in front of it. | ||
| */ | ||
| public String getPrefixedName(String name) { | ||
| return prefix + name; | ||
| } | ||
|
|
||
| /** | ||
| * The class type that should receive the prefix | ||
| * | ||
| * @return a {@link Class} instance of the type | ||
| */ | ||
| public Class<? extends UserInteractor> getClassType() { | ||
| return classType; | ||
| } | ||
| } |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
118 changes: 0 additions & 118 deletions
118
application/src/main/java/org/togetherjava/tjbot/commands/UserInteractorPrefix.java
This file was deleted.
Oops, something went wrong.
Oops, something went wrong.
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.
Uh oh!
There was an error while loading. Please reload this page.