mirror of
https://github.com/Sheldan/abstracto.git
synced 2026-01-01 07:27:35 +00:00
Compare commits
12 Commits
e1d4a41d60
...
b4ffea341c
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
b4ffea341c | ||
|
|
507c755809 | ||
|
|
9e0e92a530 | ||
|
|
d078b3fa87 | ||
|
|
71b7dd2383 | ||
|
|
ea0384490e | ||
|
|
b5dbc0b1ed | ||
|
|
e265eb6760 | ||
|
|
2f18b7431d | ||
|
|
2d8827fa81 | ||
|
|
dddeb15127 | ||
|
|
78fbe0723b |
2
.env
2
.env
@@ -1,2 +1,2 @@
|
||||
REGISTRY_PREFIX=harbor.sheldan.dev/abstracto/
|
||||
VERSION=1.6.12
|
||||
VERSION=1.6.15
|
||||
@@ -3,7 +3,7 @@
|
||||
<parent>
|
||||
<artifactId>anti-raid</artifactId>
|
||||
<groupId>dev.sheldan.abstracto.modules</groupId>
|
||||
<version>1.6.13-SNAPSHOT</version>
|
||||
<version>1.6.16-SNAPSHOT</version>
|
||||
</parent>
|
||||
<modelVersion>4.0.0</modelVersion>
|
||||
|
||||
|
||||
@@ -3,7 +3,7 @@
|
||||
<parent>
|
||||
<artifactId>anti-raid</artifactId>
|
||||
<groupId>dev.sheldan.abstracto.modules</groupId>
|
||||
<version>1.6.13-SNAPSHOT</version>
|
||||
<version>1.6.16-SNAPSHOT</version>
|
||||
</parent>
|
||||
<modelVersion>4.0.0</modelVersion>
|
||||
|
||||
|
||||
@@ -3,7 +3,7 @@
|
||||
<parent>
|
||||
<artifactId>abstracto-modules</artifactId>
|
||||
<groupId>dev.sheldan.abstracto.modules</groupId>
|
||||
<version>1.6.13-SNAPSHOT</version>
|
||||
<version>1.6.16-SNAPSHOT</version>
|
||||
</parent>
|
||||
<modelVersion>4.0.0</modelVersion>
|
||||
|
||||
|
||||
@@ -3,7 +3,7 @@
|
||||
<parent>
|
||||
<groupId>dev.sheldan.abstracto.modules</groupId>
|
||||
<artifactId>assignable-roles</artifactId>
|
||||
<version>1.6.13-SNAPSHOT</version>
|
||||
<version>1.6.16-SNAPSHOT</version>
|
||||
</parent>
|
||||
<modelVersion>4.0.0</modelVersion>
|
||||
|
||||
|
||||
@@ -74,7 +74,7 @@ public class CreateAssignableRolePlace extends AbstractConditionableCommand {
|
||||
|
||||
@Override
|
||||
public CommandConfiguration getConfiguration() {
|
||||
List<ParameterValidator> rolePlaceNameValidator = Arrays.asList(MaxStringLengthValidator.max(AssignableRolePlace.ASSIGNABLE_PLACE_NAME_LIMIT));
|
||||
List<ParameterValidator> rolePlaceNameValidator = Arrays.asList(MaxStringLengthValidator.max(AssignableRolePlace.ASSIGNABLE_PLACE_NAME_LIMIT.intValue()));
|
||||
Parameter rolePostName = Parameter
|
||||
.builder()
|
||||
.name(ASSIGNABLE_ROLE_PLACE_NAME_PARAMETER)
|
||||
@@ -95,7 +95,7 @@ public class CreateAssignableRolePlace extends AbstractConditionableCommand {
|
||||
.templated(true)
|
||||
.optional(true)
|
||||
.build();
|
||||
List<ParameterValidator> rolePlaceDescriptionValidator = Arrays.asList(MaxStringLengthValidator.max(AssignableRolePlace.ASSIGNABLE_PLACE_NAME_LIMIT));
|
||||
List<ParameterValidator> rolePlaceDescriptionValidator = Arrays.asList(MaxStringLengthValidator.max(AssignableRolePlace.ASSIGNABLE_PLACE_NAME_LIMIT.intValue()));
|
||||
Parameter text = Parameter
|
||||
.builder()
|
||||
.name(ASSIGNABLE_ROLE_PLACE_TEXT_PARAMETER)
|
||||
|
||||
@@ -3,7 +3,7 @@
|
||||
<parent>
|
||||
<groupId>dev.sheldan.abstracto.modules</groupId>
|
||||
<artifactId>assignable-roles</artifactId>
|
||||
<version>1.6.13-SNAPSHOT</version>
|
||||
<version>1.6.16-SNAPSHOT</version>
|
||||
</parent>
|
||||
<modelVersion>4.0.0</modelVersion>
|
||||
<artifactId>assignable-roles-int</artifactId>
|
||||
|
||||
@@ -3,7 +3,7 @@
|
||||
<parent>
|
||||
<groupId>dev.sheldan.abstracto.modules</groupId>
|
||||
<artifactId>abstracto-modules</artifactId>
|
||||
<version>1.6.13-SNAPSHOT</version>
|
||||
<version>1.6.16-SNAPSHOT</version>
|
||||
</parent>
|
||||
<modelVersion>4.0.0</modelVersion>
|
||||
|
||||
|
||||
@@ -3,7 +3,7 @@
|
||||
<parent>
|
||||
<groupId>dev.sheldan.abstracto.modules</groupId>
|
||||
<artifactId>custom-command</artifactId>
|
||||
<version>1.6.13-SNAPSHOT</version>
|
||||
<version>1.6.16-SNAPSHOT</version>
|
||||
</parent>
|
||||
<modelVersion>4.0.0</modelVersion>
|
||||
|
||||
|
||||
@@ -3,7 +3,7 @@
|
||||
<parent>
|
||||
<groupId>dev.sheldan.abstracto.modules</groupId>
|
||||
<artifactId>custom-command</artifactId>
|
||||
<version>1.6.13-SNAPSHOT</version>
|
||||
<version>1.6.16-SNAPSHOT</version>
|
||||
</parent>
|
||||
<modelVersion>4.0.0</modelVersion>
|
||||
|
||||
|
||||
@@ -3,7 +3,7 @@
|
||||
<parent>
|
||||
<artifactId>abstracto-modules</artifactId>
|
||||
<groupId>dev.sheldan.abstracto.modules</groupId>
|
||||
<version>1.6.13-SNAPSHOT</version>
|
||||
<version>1.6.16-SNAPSHOT</version>
|
||||
</parent>
|
||||
<modelVersion>4.0.0</modelVersion>
|
||||
|
||||
|
||||
@@ -3,7 +3,7 @@
|
||||
<parent>
|
||||
<groupId>dev.sheldan.abstracto.modules</groupId>
|
||||
<artifactId>dynamic-activity</artifactId>
|
||||
<version>1.6.13-SNAPSHOT</version>
|
||||
<version>1.6.16-SNAPSHOT</version>
|
||||
</parent>
|
||||
<modelVersion>4.0.0</modelVersion>
|
||||
|
||||
|
||||
@@ -3,7 +3,7 @@
|
||||
<parent>
|
||||
<artifactId>dynamic-activity</artifactId>
|
||||
<groupId>dev.sheldan.abstracto.modules</groupId>
|
||||
<version>1.6.13-SNAPSHOT</version>
|
||||
<version>1.6.16-SNAPSHOT</version>
|
||||
</parent>
|
||||
<modelVersion>4.0.0</modelVersion>
|
||||
|
||||
|
||||
@@ -3,7 +3,7 @@
|
||||
<parent>
|
||||
<artifactId>abstracto-modules</artifactId>
|
||||
<groupId>dev.sheldan.abstracto.modules</groupId>
|
||||
<version>1.6.13-SNAPSHOT</version>
|
||||
<version>1.6.16-SNAPSHOT</version>
|
||||
</parent>
|
||||
<modelVersion>4.0.0</modelVersion>
|
||||
|
||||
|
||||
@@ -3,7 +3,7 @@
|
||||
<parent>
|
||||
<artifactId>entertainment</artifactId>
|
||||
<groupId>dev.sheldan.abstracto.modules</groupId>
|
||||
<version>1.6.13-SNAPSHOT</version>
|
||||
<version>1.6.16-SNAPSHOT</version>
|
||||
</parent>
|
||||
<modelVersion>4.0.0</modelVersion>
|
||||
|
||||
|
||||
@@ -3,7 +3,7 @@
|
||||
<parent>
|
||||
<artifactId>entertainment</artifactId>
|
||||
<groupId>dev.sheldan.abstracto.modules</groupId>
|
||||
<version>1.6.13-SNAPSHOT</version>
|
||||
<version>1.6.16-SNAPSHOT</version>
|
||||
</parent>
|
||||
<modelVersion>4.0.0</modelVersion>
|
||||
|
||||
|
||||
@@ -3,7 +3,7 @@
|
||||
<parent>
|
||||
<artifactId>abstracto-modules</artifactId>
|
||||
<groupId>dev.sheldan.abstracto.modules</groupId>
|
||||
<version>1.6.13-SNAPSHOT</version>
|
||||
<version>1.6.16-SNAPSHOT</version>
|
||||
</parent>
|
||||
<modelVersion>4.0.0</modelVersion>
|
||||
|
||||
|
||||
@@ -3,7 +3,7 @@
|
||||
<parent>
|
||||
<groupId>dev.sheldan.abstracto.modules</groupId>
|
||||
<artifactId>experience-tracking</artifactId>
|
||||
<version>1.6.13-SNAPSHOT</version>
|
||||
<version>1.6.16-SNAPSHOT</version>
|
||||
</parent>
|
||||
<modelVersion>4.0.0</modelVersion>
|
||||
|
||||
|
||||
@@ -158,7 +158,6 @@ public class LeaderBoardCommand extends AbstractConditionableCommand {
|
||||
Parameter focusMe = Parameter
|
||||
.builder()
|
||||
.name(FOCUS_PARAMETER)
|
||||
.validators(leaderBoardPageValidators)
|
||||
.optional(true)
|
||||
.slashCommandOnly(true)
|
||||
.templated(true)
|
||||
|
||||
@@ -3,7 +3,7 @@
|
||||
<parent>
|
||||
<groupId>dev.sheldan.abstracto.modules</groupId>
|
||||
<artifactId>experience-tracking</artifactId>
|
||||
<version>1.6.13-SNAPSHOT</version>
|
||||
<version>1.6.16-SNAPSHOT</version>
|
||||
</parent>
|
||||
<modelVersion>4.0.0</modelVersion>
|
||||
|
||||
|
||||
@@ -3,7 +3,7 @@
|
||||
<parent>
|
||||
<groupId>dev.sheldan.abstracto.modules</groupId>
|
||||
<artifactId>abstracto-modules</artifactId>
|
||||
<version>1.6.13-SNAPSHOT</version>
|
||||
<version>1.6.16-SNAPSHOT</version>
|
||||
</parent>
|
||||
<modelVersion>4.0.0</modelVersion>
|
||||
|
||||
|
||||
@@ -4,7 +4,7 @@
|
||||
<parent>
|
||||
<groupId>dev.sheldan.abstracto.modules</groupId>
|
||||
<artifactId>giveaway</artifactId>
|
||||
<version>1.6.13-SNAPSHOT</version>
|
||||
<version>1.6.16-SNAPSHOT</version>
|
||||
</parent>
|
||||
|
||||
<artifactId>giveaway-impl</artifactId>
|
||||
|
||||
@@ -4,7 +4,7 @@
|
||||
<parent>
|
||||
<groupId>dev.sheldan.abstracto.modules</groupId>
|
||||
<artifactId>giveaway</artifactId>
|
||||
<version>1.6.13-SNAPSHOT</version>
|
||||
<version>1.6.16-SNAPSHOT</version>
|
||||
</parent>
|
||||
|
||||
<artifactId>giveaway-int</artifactId>
|
||||
|
||||
@@ -4,7 +4,7 @@
|
||||
<parent>
|
||||
<groupId>dev.sheldan.abstracto.modules</groupId>
|
||||
<artifactId>abstracto-modules</artifactId>
|
||||
<version>1.6.13-SNAPSHOT</version>
|
||||
<version>1.6.16-SNAPSHOT</version>
|
||||
</parent>
|
||||
|
||||
<artifactId>giveaway</artifactId>
|
||||
|
||||
@@ -4,7 +4,7 @@
|
||||
<parent>
|
||||
<artifactId>image-generation</artifactId>
|
||||
<groupId>dev.sheldan.abstracto.modules</groupId>
|
||||
<version>1.6.13-SNAPSHOT</version>
|
||||
<version>1.6.16-SNAPSHOT</version>
|
||||
</parent>
|
||||
|
||||
<artifactId>image-generation-impl</artifactId>
|
||||
|
||||
@@ -4,7 +4,7 @@
|
||||
<parent>
|
||||
<artifactId>image-generation</artifactId>
|
||||
<groupId>dev.sheldan.abstracto.modules</groupId>
|
||||
<version>1.6.13-SNAPSHOT</version>
|
||||
<version>1.6.16-SNAPSHOT</version>
|
||||
</parent>
|
||||
|
||||
<artifactId>image-generation-int</artifactId>
|
||||
|
||||
@@ -4,7 +4,7 @@
|
||||
<parent>
|
||||
<groupId>dev.sheldan.abstracto.modules</groupId>
|
||||
<artifactId>abstracto-modules</artifactId>
|
||||
<version>1.6.13-SNAPSHOT</version>
|
||||
<version>1.6.16-SNAPSHOT</version>
|
||||
</parent>
|
||||
|
||||
<artifactId>image-generation</artifactId>
|
||||
|
||||
@@ -3,7 +3,7 @@
|
||||
<parent>
|
||||
<artifactId>invite-filter</artifactId>
|
||||
<groupId>dev.sheldan.abstracto.modules</groupId>
|
||||
<version>1.6.13-SNAPSHOT</version>
|
||||
<version>1.6.16-SNAPSHOT</version>
|
||||
</parent>
|
||||
<modelVersion>4.0.0</modelVersion>
|
||||
|
||||
|
||||
@@ -3,7 +3,7 @@
|
||||
<parent>
|
||||
<artifactId>invite-filter</artifactId>
|
||||
<groupId>dev.sheldan.abstracto.modules</groupId>
|
||||
<version>1.6.13-SNAPSHOT</version>
|
||||
<version>1.6.16-SNAPSHOT</version>
|
||||
</parent>
|
||||
<modelVersion>4.0.0</modelVersion>
|
||||
|
||||
@@ -18,7 +18,7 @@
|
||||
<dependency>
|
||||
<groupId>dev.sheldan.abstracto.modules</groupId>
|
||||
<artifactId>moderation-int</artifactId>
|
||||
<version>1.6.13-SNAPSHOT</version>
|
||||
<version>1.6.16-SNAPSHOT</version>
|
||||
<scope>compile</scope>
|
||||
</dependency>
|
||||
</dependencies>
|
||||
|
||||
@@ -3,7 +3,7 @@
|
||||
<parent>
|
||||
<artifactId>abstracto-modules</artifactId>
|
||||
<groupId>dev.sheldan.abstracto.modules</groupId>
|
||||
<version>1.6.13-SNAPSHOT</version>
|
||||
<version>1.6.16-SNAPSHOT</version>
|
||||
</parent>
|
||||
<modelVersion>4.0.0</modelVersion>
|
||||
|
||||
|
||||
@@ -3,7 +3,7 @@
|
||||
<parent>
|
||||
<artifactId>link-embed</artifactId>
|
||||
<groupId>dev.sheldan.abstracto.modules</groupId>
|
||||
<version>1.6.13-SNAPSHOT</version>
|
||||
<version>1.6.16-SNAPSHOT</version>
|
||||
</parent>
|
||||
<modelVersion>4.0.0</modelVersion>
|
||||
|
||||
|
||||
@@ -3,7 +3,7 @@
|
||||
<parent>
|
||||
<artifactId>link-embed</artifactId>
|
||||
<groupId>dev.sheldan.abstracto.modules</groupId>
|
||||
<version>1.6.13-SNAPSHOT</version>
|
||||
<version>1.6.16-SNAPSHOT</version>
|
||||
</parent>
|
||||
<modelVersion>4.0.0</modelVersion>
|
||||
|
||||
|
||||
@@ -3,7 +3,7 @@
|
||||
<parent>
|
||||
<artifactId>abstracto-modules</artifactId>
|
||||
<groupId>dev.sheldan.abstracto.modules</groupId>
|
||||
<version>1.6.13-SNAPSHOT</version>
|
||||
<version>1.6.16-SNAPSHOT</version>
|
||||
</parent>
|
||||
<modelVersion>4.0.0</modelVersion>
|
||||
|
||||
|
||||
@@ -3,7 +3,7 @@
|
||||
<parent>
|
||||
<artifactId>logging</artifactId>
|
||||
<groupId>dev.sheldan.abstracto.modules</groupId>
|
||||
<version>1.6.13-SNAPSHOT</version>
|
||||
<version>1.6.16-SNAPSHOT</version>
|
||||
</parent>
|
||||
<modelVersion>4.0.0</modelVersion>
|
||||
|
||||
|
||||
@@ -3,7 +3,7 @@
|
||||
<parent>
|
||||
<artifactId>logging</artifactId>
|
||||
<groupId>dev.sheldan.abstracto.modules</groupId>
|
||||
<version>1.6.13-SNAPSHOT</version>
|
||||
<version>1.6.16-SNAPSHOT</version>
|
||||
</parent>
|
||||
<modelVersion>4.0.0</modelVersion>
|
||||
|
||||
|
||||
@@ -3,7 +3,7 @@
|
||||
<parent>
|
||||
<artifactId>abstracto-modules</artifactId>
|
||||
<groupId>dev.sheldan.abstracto.modules</groupId>
|
||||
<version>1.6.13-SNAPSHOT</version>
|
||||
<version>1.6.16-SNAPSHOT</version>
|
||||
</parent>
|
||||
<modelVersion>4.0.0</modelVersion>
|
||||
|
||||
|
||||
@@ -3,7 +3,7 @@
|
||||
<parent>
|
||||
<groupId>dev.sheldan.abstracto.modules</groupId>
|
||||
<artifactId>moderation</artifactId>
|
||||
<version>1.6.13-SNAPSHOT</version>
|
||||
<version>1.6.16-SNAPSHOT</version>
|
||||
</parent>
|
||||
<modelVersion>4.0.0</modelVersion>
|
||||
|
||||
|
||||
@@ -3,7 +3,7 @@
|
||||
<parent>
|
||||
<groupId>dev.sheldan.abstracto.modules</groupId>
|
||||
<artifactId>moderation</artifactId>
|
||||
<version>1.6.13-SNAPSHOT</version>
|
||||
<version>1.6.16-SNAPSHOT</version>
|
||||
</parent>
|
||||
<modelVersion>4.0.0</modelVersion>
|
||||
|
||||
|
||||
@@ -3,7 +3,7 @@
|
||||
<parent>
|
||||
<groupId>dev.sheldan.abstracto.modules</groupId>
|
||||
<artifactId>abstracto-modules</artifactId>
|
||||
<version>1.6.13-SNAPSHOT</version>
|
||||
<version>1.6.16-SNAPSHOT</version>
|
||||
</parent>
|
||||
<modelVersion>4.0.0</modelVersion>
|
||||
|
||||
|
||||
@@ -3,7 +3,7 @@
|
||||
<parent>
|
||||
<groupId>dev.sheldan.abstracto.modules</groupId>
|
||||
<artifactId>modmail</artifactId>
|
||||
<version>1.6.13-SNAPSHOT</version>
|
||||
<version>1.6.16-SNAPSHOT</version>
|
||||
</parent>
|
||||
<modelVersion>4.0.0</modelVersion>
|
||||
|
||||
|
||||
@@ -3,7 +3,7 @@
|
||||
<parent>
|
||||
<groupId>dev.sheldan.abstracto.modules</groupId>
|
||||
<artifactId>modmail</artifactId>
|
||||
<version>1.6.13-SNAPSHOT</version>
|
||||
<version>1.6.16-SNAPSHOT</version>
|
||||
</parent>
|
||||
<modelVersion>4.0.0</modelVersion>
|
||||
|
||||
|
||||
@@ -3,7 +3,7 @@
|
||||
<parent>
|
||||
<groupId>dev.sheldan.abstracto.modules</groupId>
|
||||
<artifactId>abstracto-modules</artifactId>
|
||||
<version>1.6.13-SNAPSHOT</version>
|
||||
<version>1.6.16-SNAPSHOT</version>
|
||||
</parent>
|
||||
<modelVersion>4.0.0</modelVersion>
|
||||
|
||||
|
||||
@@ -3,7 +3,7 @@
|
||||
<parent>
|
||||
<groupId>dev.sheldan.abstracto</groupId>
|
||||
<artifactId>abstracto-application</artifactId>
|
||||
<version>1.6.13-SNAPSHOT</version>
|
||||
<version>1.6.16-SNAPSHOT</version>
|
||||
</parent>
|
||||
<modelVersion>4.0.0</modelVersion>
|
||||
|
||||
|
||||
@@ -3,7 +3,7 @@
|
||||
<parent>
|
||||
<artifactId>abstracto-modules</artifactId>
|
||||
<groupId>dev.sheldan.abstracto.modules</groupId>
|
||||
<version>1.6.13-SNAPSHOT</version>
|
||||
<version>1.6.16-SNAPSHOT</version>
|
||||
</parent>
|
||||
<modelVersion>4.0.0</modelVersion>
|
||||
|
||||
|
||||
@@ -3,7 +3,7 @@
|
||||
<parent>
|
||||
<artifactId>profanity-filter</artifactId>
|
||||
<groupId>dev.sheldan.abstracto.modules</groupId>
|
||||
<version>1.6.13-SNAPSHOT</version>
|
||||
<version>1.6.16-SNAPSHOT</version>
|
||||
</parent>
|
||||
<modelVersion>4.0.0</modelVersion>
|
||||
|
||||
|
||||
@@ -3,7 +3,7 @@
|
||||
<parent>
|
||||
<groupId>dev.sheldan.abstracto.modules</groupId>
|
||||
<artifactId>profanity-filter</artifactId>
|
||||
<version>1.6.13-SNAPSHOT</version>
|
||||
<version>1.6.16-SNAPSHOT</version>
|
||||
</parent>
|
||||
<modelVersion>4.0.0</modelVersion>
|
||||
|
||||
|
||||
@@ -3,7 +3,7 @@
|
||||
<parent>
|
||||
<artifactId>abstracto-modules</artifactId>
|
||||
<groupId>dev.sheldan.abstracto.modules</groupId>
|
||||
<version>1.6.13-SNAPSHOT</version>
|
||||
<version>1.6.16-SNAPSHOT</version>
|
||||
</parent>
|
||||
<modelVersion>4.0.0</modelVersion>
|
||||
|
||||
|
||||
@@ -3,7 +3,7 @@
|
||||
<parent>
|
||||
<artifactId>remind</artifactId>
|
||||
<groupId>dev.sheldan.abstracto.modules</groupId>
|
||||
<version>1.6.13-SNAPSHOT</version>
|
||||
<version>1.6.16-SNAPSHOT</version>
|
||||
</parent>
|
||||
<modelVersion>4.0.0</modelVersion>
|
||||
|
||||
|
||||
@@ -3,7 +3,7 @@
|
||||
<parent>
|
||||
<artifactId>remind</artifactId>
|
||||
<groupId>dev.sheldan.abstracto.modules</groupId>
|
||||
<version>1.6.13-SNAPSHOT</version>
|
||||
<version>1.6.16-SNAPSHOT</version>
|
||||
</parent>
|
||||
<modelVersion>4.0.0</modelVersion>
|
||||
|
||||
|
||||
@@ -3,7 +3,7 @@
|
||||
<parent>
|
||||
<artifactId>abstracto-modules</artifactId>
|
||||
<groupId>dev.sheldan.abstracto.modules</groupId>
|
||||
<version>1.6.13-SNAPSHOT</version>
|
||||
<version>1.6.16-SNAPSHOT</version>
|
||||
</parent>
|
||||
<modelVersion>4.0.0</modelVersion>
|
||||
|
||||
|
||||
@@ -3,7 +3,7 @@
|
||||
<parent>
|
||||
<artifactId>repost-detection</artifactId>
|
||||
<groupId>dev.sheldan.abstracto.modules</groupId>
|
||||
<version>1.6.13-SNAPSHOT</version>
|
||||
<version>1.6.16-SNAPSHOT</version>
|
||||
</parent>
|
||||
<modelVersion>4.0.0</modelVersion>
|
||||
|
||||
|
||||
@@ -3,7 +3,7 @@
|
||||
<parent>
|
||||
<artifactId>repost-detection</artifactId>
|
||||
<groupId>dev.sheldan.abstracto.modules</groupId>
|
||||
<version>1.6.13-SNAPSHOT</version>
|
||||
<version>1.6.16-SNAPSHOT</version>
|
||||
</parent>
|
||||
<modelVersion>4.0.0</modelVersion>
|
||||
|
||||
|
||||
@@ -3,7 +3,7 @@
|
||||
<parent>
|
||||
<artifactId>abstracto-modules</artifactId>
|
||||
<groupId>dev.sheldan.abstracto.modules</groupId>
|
||||
<version>1.6.13-SNAPSHOT</version>
|
||||
<version>1.6.16-SNAPSHOT</version>
|
||||
</parent>
|
||||
<modelVersion>4.0.0</modelVersion>
|
||||
|
||||
|
||||
@@ -3,7 +3,7 @@
|
||||
<parent>
|
||||
<artifactId>starboard</artifactId>
|
||||
<groupId>dev.sheldan.abstracto.modules</groupId>
|
||||
<version>1.6.13-SNAPSHOT</version>
|
||||
<version>1.6.16-SNAPSHOT</version>
|
||||
</parent>
|
||||
<modelVersion>4.0.0</modelVersion>
|
||||
|
||||
|
||||
@@ -3,7 +3,7 @@
|
||||
<parent>
|
||||
<artifactId>starboard</artifactId>
|
||||
<groupId>dev.sheldan.abstracto.modules</groupId>
|
||||
<version>1.6.13-SNAPSHOT</version>
|
||||
<version>1.6.16-SNAPSHOT</version>
|
||||
</parent>
|
||||
<modelVersion>4.0.0</modelVersion>
|
||||
|
||||
|
||||
@@ -3,7 +3,7 @@
|
||||
<parent>
|
||||
<groupId>dev.sheldan.abstracto.modules</groupId>
|
||||
<artifactId>abstracto-modules</artifactId>
|
||||
<version>1.6.13-SNAPSHOT</version>
|
||||
<version>1.6.16-SNAPSHOT</version>
|
||||
</parent>
|
||||
<modelVersion>4.0.0</modelVersion>
|
||||
|
||||
|
||||
@@ -3,7 +3,7 @@
|
||||
<parent>
|
||||
<groupId>dev.sheldan.abstracto.modules</groupId>
|
||||
<artifactId>statistic</artifactId>
|
||||
<version>1.6.13-SNAPSHOT</version>
|
||||
<version>1.6.16-SNAPSHOT</version>
|
||||
</parent>
|
||||
<modelVersion>4.0.0</modelVersion>
|
||||
|
||||
|
||||
@@ -3,7 +3,7 @@
|
||||
<parent>
|
||||
<groupId>dev.sheldan.abstracto.modules</groupId>
|
||||
<artifactId>statistic</artifactId>
|
||||
<version>1.6.13-SNAPSHOT</version>
|
||||
<version>1.6.16-SNAPSHOT</version>
|
||||
</parent>
|
||||
<modelVersion>4.0.0</modelVersion>
|
||||
|
||||
|
||||
@@ -3,7 +3,7 @@
|
||||
<parent>
|
||||
<artifactId>abstracto-modules</artifactId>
|
||||
<groupId>dev.sheldan.abstracto.modules</groupId>
|
||||
<version>1.6.13-SNAPSHOT</version>
|
||||
<version>1.6.16-SNAPSHOT</version>
|
||||
</parent>
|
||||
<modelVersion>4.0.0</modelVersion>
|
||||
|
||||
|
||||
@@ -4,7 +4,7 @@
|
||||
<parent>
|
||||
<groupId>dev.sheldan.abstracto.modules</groupId>
|
||||
<artifactId>sticky-roles</artifactId>
|
||||
<version>1.6.13-SNAPSHOT</version>
|
||||
<version>1.6.16-SNAPSHOT</version>
|
||||
</parent>
|
||||
|
||||
<artifactId>sticky-roles-impl</artifactId>
|
||||
|
||||
@@ -4,7 +4,7 @@
|
||||
<parent>
|
||||
<groupId>dev.sheldan.abstracto.modules</groupId>
|
||||
<artifactId>sticky-roles</artifactId>
|
||||
<version>1.6.13-SNAPSHOT</version>
|
||||
<version>1.6.16-SNAPSHOT</version>
|
||||
</parent>
|
||||
|
||||
<artifactId>sticky-roles-int</artifactId>
|
||||
|
||||
@@ -3,7 +3,7 @@
|
||||
<parent>
|
||||
<artifactId>abstracto-modules</artifactId>
|
||||
<groupId>dev.sheldan.abstracto.modules</groupId>
|
||||
<version>1.6.13-SNAPSHOT</version>
|
||||
<version>1.6.16-SNAPSHOT</version>
|
||||
</parent>
|
||||
<modelVersion>4.0.0</modelVersion>
|
||||
|
||||
|
||||
@@ -3,7 +3,7 @@
|
||||
<parent>
|
||||
<artifactId>suggestion</artifactId>
|
||||
<groupId>dev.sheldan.abstracto.modules</groupId>
|
||||
<version>1.6.13-SNAPSHOT</version>
|
||||
<version>1.6.16-SNAPSHOT</version>
|
||||
</parent>
|
||||
<modelVersion>4.0.0</modelVersion>
|
||||
|
||||
|
||||
@@ -3,7 +3,7 @@
|
||||
<parent>
|
||||
<artifactId>suggestion</artifactId>
|
||||
<groupId>dev.sheldan.abstracto.modules</groupId>
|
||||
<version>1.6.13-SNAPSHOT</version>
|
||||
<version>1.6.16-SNAPSHOT</version>
|
||||
</parent>
|
||||
<modelVersion>4.0.0</modelVersion>
|
||||
|
||||
|
||||
@@ -3,7 +3,7 @@
|
||||
<parent>
|
||||
<artifactId>abstracto-modules</artifactId>
|
||||
<groupId>dev.sheldan.abstracto.modules</groupId>
|
||||
<version>1.6.13-SNAPSHOT</version>
|
||||
<version>1.6.16-SNAPSHOT</version>
|
||||
</parent>
|
||||
<modelVersion>4.0.0</modelVersion>
|
||||
|
||||
|
||||
@@ -3,7 +3,7 @@
|
||||
<parent>
|
||||
<artifactId>twitch</artifactId>
|
||||
<groupId>dev.sheldan.abstracto.modules</groupId>
|
||||
<version>1.6.13-SNAPSHOT</version>
|
||||
<version>1.6.16-SNAPSHOT</version>
|
||||
</parent>
|
||||
<modelVersion>4.0.0</modelVersion>
|
||||
|
||||
|
||||
@@ -3,7 +3,7 @@
|
||||
<parent>
|
||||
<groupId>dev.sheldan.abstracto.modules</groupId>
|
||||
<artifactId>twitch</artifactId>
|
||||
<version>1.6.13-SNAPSHOT</version>
|
||||
<version>1.6.16-SNAPSHOT</version>
|
||||
</parent>
|
||||
<modelVersion>4.0.0</modelVersion>
|
||||
|
||||
|
||||
@@ -3,7 +3,7 @@
|
||||
<parent>
|
||||
<groupId>dev.sheldan.abstracto.modules</groupId>
|
||||
<artifactId>abstracto-modules</artifactId>
|
||||
<version>1.6.13-SNAPSHOT</version>
|
||||
<version>1.6.16-SNAPSHOT</version>
|
||||
</parent>
|
||||
<modelVersion>4.0.0</modelVersion>
|
||||
|
||||
|
||||
@@ -3,7 +3,7 @@
|
||||
<parent>
|
||||
<groupId>dev.sheldan.abstracto.modules</groupId>
|
||||
<artifactId>utility</artifactId>
|
||||
<version>1.6.13-SNAPSHOT</version>
|
||||
<version>1.6.16-SNAPSHOT</version>
|
||||
</parent>
|
||||
<modelVersion>4.0.0</modelVersion>
|
||||
|
||||
|
||||
@@ -3,7 +3,7 @@
|
||||
<parent>
|
||||
<groupId>dev.sheldan.abstracto.modules</groupId>
|
||||
<artifactId>utility</artifactId>
|
||||
<version>1.6.13-SNAPSHOT</version>
|
||||
<version>1.6.16-SNAPSHOT</version>
|
||||
</parent>
|
||||
<modelVersion>4.0.0</modelVersion>
|
||||
|
||||
|
||||
@@ -3,7 +3,7 @@
|
||||
<parent>
|
||||
<artifactId>abstracto-modules</artifactId>
|
||||
<groupId>dev.sheldan.abstracto.modules</groupId>
|
||||
<version>1.6.13-SNAPSHOT</version>
|
||||
<version>1.6.16-SNAPSHOT</version>
|
||||
</parent>
|
||||
<modelVersion>4.0.0</modelVersion>
|
||||
|
||||
|
||||
@@ -3,7 +3,7 @@
|
||||
<parent>
|
||||
<groupId>dev.sheldan.abstracto.modules</groupId>
|
||||
<artifactId>voice-channel-context</artifactId>
|
||||
<version>1.6.13-SNAPSHOT</version>
|
||||
<version>1.6.16-SNAPSHOT</version>
|
||||
</parent>
|
||||
<modelVersion>4.0.0</modelVersion>
|
||||
|
||||
|
||||
@@ -3,7 +3,7 @@
|
||||
<parent>
|
||||
<groupId>dev.sheldan.abstracto.modules</groupId>
|
||||
<artifactId>voice-channel-context</artifactId>
|
||||
<version>1.6.13-SNAPSHOT</version>
|
||||
<version>1.6.16-SNAPSHOT</version>
|
||||
</parent>
|
||||
<modelVersion>4.0.0</modelVersion>
|
||||
|
||||
|
||||
@@ -3,7 +3,7 @@
|
||||
<parent>
|
||||
<groupId>dev.sheldan.abstracto.modules</groupId>
|
||||
<artifactId>abstracto-modules</artifactId>
|
||||
<version>1.6.13-SNAPSHOT</version>
|
||||
<version>1.6.16-SNAPSHOT</version>
|
||||
</parent>
|
||||
<modelVersion>4.0.0</modelVersion>
|
||||
|
||||
|
||||
@@ -3,7 +3,7 @@
|
||||
<parent>
|
||||
<groupId>dev.sheldan.abstracto.modules</groupId>
|
||||
<artifactId>webservices</artifactId>
|
||||
<version>1.6.13-SNAPSHOT</version>
|
||||
<version>1.6.16-SNAPSHOT</version>
|
||||
</parent>
|
||||
<modelVersion>4.0.0</modelVersion>
|
||||
|
||||
|
||||
@@ -39,7 +39,7 @@ public class WikipediaServiceBean implements WikipediaService {
|
||||
Response response = okHttpClient.newCall(request).execute();
|
||||
if(!response.isSuccessful()) {
|
||||
if(log.isDebugEnabled()) {
|
||||
log.error("Failed to retrieve wikipedia summary. Response had code {} with body {}.",
|
||||
log.debug("Failed to retrieve wikipedia summary. Response had code {} with body {}.",
|
||||
response.code(), response.body());
|
||||
}
|
||||
throw new WikipediaRequestException(response.code());
|
||||
|
||||
@@ -3,7 +3,7 @@
|
||||
<parent>
|
||||
<groupId>dev.sheldan.abstracto.modules</groupId>
|
||||
<artifactId>webservices</artifactId>
|
||||
<version>1.6.13-SNAPSHOT</version>
|
||||
<version>1.6.16-SNAPSHOT</version>
|
||||
</parent>
|
||||
<modelVersion>4.0.0</modelVersion>
|
||||
|
||||
|
||||
@@ -3,7 +3,7 @@
|
||||
<parent>
|
||||
<groupId>dev.sheldan.abstracto</groupId>
|
||||
<artifactId>abstracto-application</artifactId>
|
||||
<version>1.6.13-SNAPSHOT</version>
|
||||
<version>1.6.16-SNAPSHOT</version>
|
||||
</parent>
|
||||
<modelVersion>4.0.0</modelVersion>
|
||||
|
||||
|
||||
@@ -3,7 +3,7 @@
|
||||
<parent>
|
||||
<groupId>dev.sheldan.abstracto.core</groupId>
|
||||
<artifactId>core</artifactId>
|
||||
<version>1.6.13-SNAPSHOT</version>
|
||||
<version>1.6.16-SNAPSHOT</version>
|
||||
</parent>
|
||||
<modelVersion>4.0.0</modelVersion>
|
||||
<packaging>jar</packaging>
|
||||
|
||||
@@ -182,10 +182,8 @@ public class CommandReceivedHandler extends ListenerAdapter {
|
||||
}
|
||||
|
||||
public UnParsedCommandResult getUnparsedCommandResult(Message message) {
|
||||
String contentStripped = message.getContentRaw();
|
||||
List<String> parameters = Arrays.asList(contentStripped.split(" "));
|
||||
UnParsedCommandParameter unParsedParameter = new UnParsedCommandParameter(contentStripped, message);
|
||||
String commandName = commandManager.getCommandName(parameters.get(0), message.getGuild().getIdLong());
|
||||
String commandName = getCommandName(message);
|
||||
UnParsedCommandParameter unParsedParameter = new UnParsedCommandParameter(message.getContentRaw(), message);
|
||||
Command foundCommand = commandManager.findCommandByParameters(commandName, unParsedParameter, message.getGuild().getIdLong()).orElse(null);
|
||||
return UnParsedCommandResult
|
||||
.builder()
|
||||
@@ -194,13 +192,9 @@ public class CommandReceivedHandler extends ListenerAdapter {
|
||||
.build();
|
||||
}
|
||||
|
||||
public CompletableFuture<CommandParseResult> getParametersFromMessage(Message message) {
|
||||
UnParsedCommandResult result = getUnparsedCommandResult(message);
|
||||
return getParsedParameters(result.getParameter(), result.getCommand(), message).thenApply(foundParameters -> CommandParseResult
|
||||
.builder()
|
||||
.command(result.getCommand())
|
||||
.parameters(foundParameters)
|
||||
.build());
|
||||
public String getCommandName(Message message) {
|
||||
List<String> parameters = Arrays.asList( message.getContentRaw().split(" "));
|
||||
return commandManager.getCommandName(parameters.get(0), message.getGuild().getIdLong());
|
||||
}
|
||||
|
||||
public CompletableFuture<CommandParseResult> getParametersFromMessage(Message message, UnParsedCommandResult result) {
|
||||
|
||||
@@ -32,7 +32,7 @@ public class SetPrefix extends AbstractConditionableCommand {
|
||||
|
||||
@Override
|
||||
public CommandConfiguration getConfiguration() {
|
||||
List<ParameterValidator> validators = Arrays.asList(MaxStringLengthValidator.max(10L));
|
||||
List<ParameterValidator> validators = Arrays.asList(MaxStringLengthValidator.max(10));
|
||||
Parameter newPrefixParameter = Parameter
|
||||
.builder()
|
||||
.name("prefix")
|
||||
|
||||
@@ -50,7 +50,7 @@ public class SetEmote extends AbstractConditionableCommand {
|
||||
|
||||
@Override
|
||||
public CommandConfiguration getConfiguration() {
|
||||
List<ParameterValidator> emoteKeyValidators = Arrays.asList(MaxStringLengthValidator.max(255L));
|
||||
List<ParameterValidator> emoteKeyValidators = Arrays.asList(MaxStringLengthValidator.max(255));
|
||||
Parameter emoteKey = Parameter
|
||||
.builder()
|
||||
.name(EMOTE_KEY_PARAMETER)
|
||||
|
||||
@@ -0,0 +1,110 @@
|
||||
package dev.sheldan.abstracto.core.commands.utility;
|
||||
|
||||
import dev.sheldan.abstracto.core.command.Command;
|
||||
import dev.sheldan.abstracto.core.command.CommandAlternative;
|
||||
import dev.sheldan.abstracto.core.command.CommandReceivedHandler;
|
||||
import dev.sheldan.abstracto.core.command.config.features.CoreFeatureDefinition;
|
||||
import dev.sheldan.abstracto.core.command.config.features.CoreFeatureMode;
|
||||
import dev.sheldan.abstracto.core.command.execution.UnParsedCommandParameter;
|
||||
import dev.sheldan.abstracto.core.command.service.CommandManager;
|
||||
import dev.sheldan.abstracto.core.config.FeatureMode;
|
||||
import dev.sheldan.abstracto.core.config.ListenerPriority;
|
||||
import dev.sheldan.abstracto.core.models.template.commands.SlashCommandSuggestionModel;
|
||||
import dev.sheldan.abstracto.core.service.ChannelService;
|
||||
import dev.sheldan.abstracto.core.service.FeatureFlagService;
|
||||
import dev.sheldan.abstracto.core.service.FeatureModeService;
|
||||
import dev.sheldan.abstracto.core.templating.model.MessageToSend;
|
||||
import dev.sheldan.abstracto.core.templating.service.TemplateService;
|
||||
import dev.sheldan.abstracto.core.utils.FutureUtils;
|
||||
import java.util.Optional;
|
||||
import lombok.extern.slf4j.Slf4j;
|
||||
import net.dv8tion.jda.api.entities.Guild;
|
||||
import net.dv8tion.jda.api.entities.Message;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.stereotype.Component;
|
||||
|
||||
@Component
|
||||
@Slf4j
|
||||
public class SlashCommandSuggestor implements CommandAlternative {
|
||||
|
||||
@Autowired
|
||||
private FeatureModeService featureModeService;
|
||||
|
||||
@Autowired
|
||||
private CommandManager commandManager;
|
||||
|
||||
@Autowired
|
||||
private CommandReceivedHandler commandReceivedHandler;
|
||||
|
||||
@Autowired
|
||||
private FeatureFlagService featureFlagService;
|
||||
|
||||
@Autowired
|
||||
private TemplateService templateService;
|
||||
|
||||
@Autowired
|
||||
private ChannelService channelService;
|
||||
|
||||
public static final String SUGGESTION_TEMPLATE_KEY = "slash_command_suggestion";
|
||||
|
||||
@Override
|
||||
public Integer getPriority() {
|
||||
return ListenerPriority.MEDIUM;
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean shouldExecute(UnParsedCommandParameter parameter, Guild guild, Message message) {
|
||||
boolean featureModeActive = featureModeService.featureModeActive(CoreFeatureDefinition.CORE_FEATURE, guild.getIdLong(), CoreFeatureMode.SUGGEST_SLASH_COMMANDS);
|
||||
if(!featureModeActive) {
|
||||
return false;
|
||||
}
|
||||
String commandName = commandReceivedHandler.getCommandName(message);
|
||||
Long guildId = message.getGuildIdLong();
|
||||
Optional<Command> potentialCommand = commandManager.getCommandByNameOptional(commandName, true, guildId);
|
||||
return potentialCommand.isPresent() && potentialCommand.get().getConfiguration().isSlashCommandOnly();
|
||||
}
|
||||
|
||||
@Override
|
||||
public void execute(UnParsedCommandParameter parameter, Message message) {
|
||||
String commandName = commandReceivedHandler.getCommandName(message);
|
||||
Long guildId = message.getGuildIdLong();
|
||||
Optional<Command> potentialCommand = commandManager.getCommandByNameOptional(commandName, true, guildId);
|
||||
// limitation to not check conditions if command is executable, I dont want to completely built the entire command context, as that would require
|
||||
// to parse the parameters, therefore the major checks should suffice
|
||||
if(potentialCommand.isPresent()) {
|
||||
Command command = potentialCommand.get();
|
||||
if(command.getConfiguration().isSlashCommandOnly()) {
|
||||
boolean featureAvailable = featureFlagService.getFeatureFlagValue(command.getFeature(), guildId);
|
||||
if(featureAvailable) {
|
||||
boolean shouldNotifyUser = command.getFeatureModeLimitations().isEmpty();
|
||||
for (FeatureMode featureModeLimitation : command.getFeatureModeLimitations()) {
|
||||
if(featureModeService.featureModeActive(command.getFeature(), guildId, featureModeLimitation)) {
|
||||
shouldNotifyUser = true;
|
||||
}
|
||||
}
|
||||
if(shouldNotifyUser) {
|
||||
notifyUser(message, command, commandName, guildId);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
private void notifyUser(Message message, Command command, String commandName, Long guildId) {
|
||||
String path = command.getConfiguration().getSlashCommandConfig().getSlashCommandPath();
|
||||
SlashCommandSuggestionModel model = SlashCommandSuggestionModel
|
||||
.builder()
|
||||
.slashCommandPath(path)
|
||||
.build();
|
||||
Long userId = message.getAuthor().getIdLong();
|
||||
log.info("Suggesting slash command for command {} to user {}.", commandName, userId);
|
||||
MessageToSend messageToSend = templateService.renderEmbedTemplate(SUGGESTION_TEMPLATE_KEY, model, guildId);
|
||||
FutureUtils.toSingleFutureGeneric(channelService.sendMessageToSendToChannel(messageToSend, message.getChannel()))
|
||||
.thenAccept(unused -> {
|
||||
log.debug("Successfully suggested command.");
|
||||
}).exceptionally(throwable -> {
|
||||
log.warn("Failed to suggest slash command for command {} to user {}", commandName, userId);
|
||||
return null;
|
||||
});
|
||||
}
|
||||
}
|
||||
@@ -6,7 +6,6 @@ import com.google.gson.GsonBuilder;
|
||||
import com.google.gson.typeadapters.RuntimeTypeAdapterFactory;
|
||||
import dev.sheldan.abstracto.core.logging.OkHttpLogger;
|
||||
import dev.sheldan.abstracto.core.metric.OkHttpMetrics;
|
||||
import dev.sheldan.abstracto.core.service.BotService;
|
||||
import dev.sheldan.abstracto.core.templating.model.messagecomponents.ActionRowButtonConfig;
|
||||
import dev.sheldan.abstracto.core.templating.model.messagecomponents.ActionRowItemConfig;
|
||||
import dev.sheldan.abstracto.core.templating.model.messagecomponents.ComponentConfig;
|
||||
@@ -37,15 +36,15 @@ import java.util.List;
|
||||
@Configuration
|
||||
public class CoreConfig {
|
||||
|
||||
@Autowired
|
||||
private BotService botService;
|
||||
|
||||
@Autowired
|
||||
private OkHttpMetrics okHttpMetrics;
|
||||
|
||||
@Autowired
|
||||
private OkHttpLogger okHttpLogger;
|
||||
|
||||
@Autowired
|
||||
private OkHttpUserAgentSetter okHttpUserAgentSetter;
|
||||
|
||||
@Autowired
|
||||
private List<CustomJsonSerializer> customJsonSerializers;
|
||||
|
||||
@@ -95,6 +94,7 @@ public class CoreConfig {
|
||||
return new OkHttpClient.Builder()
|
||||
.addInterceptor(okHttpMetrics)
|
||||
.addInterceptor(okHttpLogger)
|
||||
.addInterceptor(okHttpUserAgentSetter)
|
||||
.build();
|
||||
}
|
||||
|
||||
|
||||
@@ -0,0 +1,26 @@
|
||||
package dev.sheldan.abstracto.core.config;
|
||||
|
||||
import java.io.IOException;
|
||||
import okhttp3.Interceptor;
|
||||
import okhttp3.Request;
|
||||
import okhttp3.Response;
|
||||
import org.jetbrains.annotations.NotNull;
|
||||
import org.springframework.beans.factory.annotation.Value;
|
||||
import org.springframework.stereotype.Component;
|
||||
|
||||
@Component
|
||||
public class OkHttpUserAgentSetter implements Interceptor {
|
||||
|
||||
@Value("${abstracto.okhttp.useragent}")
|
||||
private String userAgent;
|
||||
|
||||
@NotNull
|
||||
@Override
|
||||
public Response intercept(@NotNull Chain chain) throws IOException {
|
||||
Request originalRequest = chain.request();
|
||||
Request requestWithUserAgent = originalRequest.newBuilder()
|
||||
.header("User-Agent", userAgent)
|
||||
.build();
|
||||
return chain.proceed(requestWithUserAgent);
|
||||
}
|
||||
}
|
||||
@@ -2,6 +2,10 @@ package dev.sheldan.abstracto.core.interaction.slash;
|
||||
|
||||
import dev.sheldan.abstracto.core.command.config.CommandConfiguration;
|
||||
import dev.sheldan.abstracto.core.command.config.Parameter;
|
||||
import dev.sheldan.abstracto.core.command.config.validator.MaxIntegerValueValidator;
|
||||
import dev.sheldan.abstracto.core.command.config.validator.MaxStringLengthValidator;
|
||||
import dev.sheldan.abstracto.core.command.config.validator.MinIntegerValueValidator;
|
||||
import dev.sheldan.abstracto.core.command.config.validator.MinStringLengthValidator;
|
||||
import dev.sheldan.abstracto.core.command.execution.CommandParameterKey;
|
||||
import dev.sheldan.abstracto.core.command.execution.CommandResult;
|
||||
import dev.sheldan.abstracto.core.command.config.UserCommandConfig;
|
||||
@@ -184,6 +188,39 @@ public class SlashCommandServiceBean implements SlashCommandService {
|
||||
convertCommandConfigToCommandData(commandConfiguration, existingCommands, null, false);
|
||||
}
|
||||
|
||||
// TODO at some point replace this with more "native" solutions than using a validator instance
|
||||
private Optional<Integer> getMaxLengthOfParameter(Parameter parameter) {
|
||||
return parameter
|
||||
.getValidators()
|
||||
.stream().filter(parameterValidator -> parameterValidator instanceof MaxStringLengthValidator)
|
||||
.findFirst().map(MaxStringLengthValidator.class::cast)
|
||||
.map(MaxStringLengthValidator::getMaxLength);
|
||||
}
|
||||
|
||||
private Optional<Long> getMaxValueOfParameter(Parameter parameter) {
|
||||
return parameter
|
||||
.getValidators()
|
||||
.stream().filter(parameterValidator -> parameterValidator instanceof MaxIntegerValueValidator)
|
||||
.findFirst().map(MaxIntegerValueValidator.class::cast)
|
||||
.map(MaxIntegerValueValidator::getMaxValue);
|
||||
}
|
||||
|
||||
private Optional<Long> getMinValueOfParameter(Parameter parameter) {
|
||||
return parameter
|
||||
.getValidators()
|
||||
.stream().filter(parameterValidator -> parameterValidator instanceof MinIntegerValueValidator)
|
||||
.findFirst().map(MinIntegerValueValidator.class::cast)
|
||||
.map(MinIntegerValueValidator::getMinValue);
|
||||
}
|
||||
|
||||
private Optional<Integer> getMinLengthOfParameter(Parameter parameter) {
|
||||
return parameter
|
||||
.getValidators()
|
||||
.stream().filter(parameterValidator -> parameterValidator instanceof MinStringLengthValidator)
|
||||
.findFirst().map(MinStringLengthValidator.class::cast)
|
||||
.map(MinStringLengthValidator::getMinLength);
|
||||
}
|
||||
|
||||
private List<OptionData> getParameters(CommandConfiguration commandConfiguration, boolean isTemplated, String internalCommandName, Long serverId, boolean userCommandsOnly) {
|
||||
List<OptionData> requiredParameters = new ArrayList<>();
|
||||
List<OptionData> optionalParameters = new ArrayList<>();
|
||||
@@ -195,6 +232,10 @@ public class SlashCommandServiceBean implements SlashCommandService {
|
||||
return;
|
||||
}
|
||||
List<OptionType> types = slashCommandParameterService.getTypesFromParameter(parameter);
|
||||
Optional<Integer> maxLengthOptional = getMaxLengthOfParameter(parameter);
|
||||
Optional<Long> maxValueOptional = getMaxValueOfParameter(parameter);
|
||||
Optional<Long> minValueOptional = getMinValueOfParameter(parameter);
|
||||
Optional<Integer> minLengthOptional = getMinLengthOfParameter(parameter);
|
||||
if(types.size() > 1) {
|
||||
if(parameter.isListParam()) {
|
||||
for (int i = 0; i < parameter.getListSize(); i++) {
|
||||
@@ -203,6 +244,10 @@ public class SlashCommandServiceBean implements SlashCommandService {
|
||||
String parameterDescription = isTemplated ? templateService.renderSimpleTemplate(internalCommandName + "_parameter_" + parameter.getName(), serverId) : parameter.getDescription();
|
||||
OptionData optionData = new OptionData(type, parameterName, parameterDescription, false);
|
||||
addChoices(optionData, parameter, internalCommandName, isTemplated, serverId);
|
||||
setMaxLength(maxLengthOptional, optionData);
|
||||
setMinLength(minLengthOptional, optionData);
|
||||
setMaxValue(maxValueOptional, optionData);
|
||||
setMinValue(minValueOptional, optionData);
|
||||
optionalParameters.add(optionData);
|
||||
}
|
||||
}
|
||||
@@ -212,6 +257,10 @@ public class SlashCommandServiceBean implements SlashCommandService {
|
||||
String parameterDescription = isTemplated ? templateService.renderSimpleTemplate(internalCommandName + "_parameter_" + parameter.getName(), serverId) : parameter.getDescription();
|
||||
OptionData optionData = new OptionData(type, parameterName, parameterDescription, false);
|
||||
addChoices(optionData, parameter, internalCommandName, isTemplated, serverId);
|
||||
setMaxLength(maxLengthOptional, optionData);
|
||||
setMinLength(minLengthOptional, optionData);
|
||||
setMaxValue(maxValueOptional, optionData);
|
||||
setMinValue(minValueOptional, optionData);
|
||||
optionalParameters.add(optionData);
|
||||
});
|
||||
}
|
||||
@@ -222,11 +271,19 @@ public class SlashCommandServiceBean implements SlashCommandService {
|
||||
for (int i = 0; i < parameter.getListSize(); i++) {
|
||||
OptionData optionData = new OptionData(type, parameter.getSlashCompatibleName() + "_" + i, parameterDescription, false);
|
||||
addChoices(optionData, parameter, internalCommandName, isTemplated, serverId);
|
||||
setMaxLength(maxLengthOptional, optionData);
|
||||
setMinLength(minLengthOptional, optionData);
|
||||
setMaxValue(maxValueOptional, optionData);
|
||||
setMinValue(minValueOptional, optionData);
|
||||
optionalParameters.add(optionData);
|
||||
}
|
||||
} else {
|
||||
OptionData optionData = new OptionData(type, parameter.getSlashCompatibleName(), parameterDescription, !parameter.isOptional(), parameter.getSupportsAutoComplete());
|
||||
addChoices(optionData, parameter, internalCommandName, isTemplated, serverId);
|
||||
setMaxLength(maxLengthOptional, optionData);
|
||||
setMinLength(minLengthOptional, optionData);
|
||||
setMaxValue(maxValueOptional, optionData);
|
||||
setMinValue(minValueOptional, optionData);
|
||||
requiredParameters.add(optionData);
|
||||
}
|
||||
}
|
||||
@@ -235,6 +292,22 @@ public class SlashCommandServiceBean implements SlashCommandService {
|
||||
return requiredParameters;
|
||||
}
|
||||
|
||||
private void setMaxLength(Optional<Integer> maxLengthOptional, OptionData optionData) {
|
||||
maxLengthOptional.ifPresent(optionData::setMaxLength);
|
||||
}
|
||||
|
||||
private void setMaxValue(Optional<Long> maxValueOptional, OptionData optionData) {
|
||||
maxValueOptional.ifPresent(optionData::setMaxValue);
|
||||
}
|
||||
|
||||
private void setMinLength(Optional<Integer> minLengthOptional, OptionData optionData) {
|
||||
minLengthOptional.ifPresent(optionData::setMinLength);
|
||||
}
|
||||
|
||||
private void setMinValue(Optional<Long> minValueOptional, OptionData optionData) {
|
||||
minValueOptional.ifPresent(optionData::setMinValue);
|
||||
}
|
||||
|
||||
private void addChoices(OptionData optionData, Parameter parameter, String commandName, boolean isTemplated, Long serverId) {
|
||||
if(CommandParameterKey.class.isAssignableFrom(parameter.getType())) {
|
||||
parameter.setChoices(CommandParameterKey.getKeys(parameter.getType()));
|
||||
|
||||
@@ -42,7 +42,7 @@ public class SlashCommandFeatureActivationListener implements FeatureActivationL
|
||||
List<Command> incomingSlashCommands = slashCommandListenerBean.getSlashCommands()
|
||||
.stream()
|
||||
.filter(command -> command.getFeature().getKey().equals(model.getFeatureName()))
|
||||
.collect(Collectors.toList());
|
||||
.toList();
|
||||
if(incomingSlashCommands.isEmpty()) {
|
||||
return DefaultListenerResult.IGNORED;
|
||||
}
|
||||
|
||||
@@ -21,5 +21,11 @@ abstracto.systemConfigs.confirmationTimeout.longValue=120
|
||||
abstracto.systemConfigs.maxMessages.name=maxMessages
|
||||
abstracto.systemConfigs.maxMessages.longValue=3
|
||||
|
||||
abstracto.featureModes.suggestSlashCommands.featureName=core
|
||||
abstracto.featureModes.suggestSlashCommands.mode=suggestSlashCommands
|
||||
abstracto.featureModes.suggestSlashCommands.enabled=true
|
||||
|
||||
abstracto.featureFlags.core.featureName=core
|
||||
abstracto.featureFlags.core.enabled=true
|
||||
|
||||
abstracto.okhttp.useragent=abstracto (https://github.com/Sheldan/)
|
||||
@@ -0,0 +1,169 @@
|
||||
package dev.sheldan.abstracto.core.commands.utility;
|
||||
|
||||
import static dev.sheldan.abstracto.core.commands.utility.SlashCommandSuggestor.SUGGESTION_TEMPLATE_KEY;
|
||||
import static org.assertj.core.api.Assertions.assertThat;
|
||||
import static org.mockito.ArgumentMatchers.any;
|
||||
import static org.mockito.ArgumentMatchers.eq;
|
||||
import static org.mockito.Mockito.times;
|
||||
import static org.mockito.Mockito.verify;
|
||||
import static org.mockito.Mockito.when;
|
||||
|
||||
import dev.sheldan.abstracto.core.command.Command;
|
||||
import dev.sheldan.abstracto.core.command.CommandReceivedHandler;
|
||||
import dev.sheldan.abstracto.core.command.config.CommandConfiguration;
|
||||
import dev.sheldan.abstracto.core.command.config.features.CoreFeatureDefinition;
|
||||
import dev.sheldan.abstracto.core.command.config.features.CoreFeatureMode;
|
||||
import dev.sheldan.abstracto.core.command.service.CommandManager;
|
||||
import dev.sheldan.abstracto.core.config.FeatureMode;
|
||||
import dev.sheldan.abstracto.core.service.ChannelService;
|
||||
import dev.sheldan.abstracto.core.service.FeatureFlagService;
|
||||
import dev.sheldan.abstracto.core.service.FeatureModeService;
|
||||
import dev.sheldan.abstracto.core.templating.service.TemplateService;
|
||||
import java.util.ArrayList;
|
||||
import java.util.Collections;
|
||||
import java.util.Optional;
|
||||
import net.dv8tion.jda.api.entities.Guild;
|
||||
import net.dv8tion.jda.api.entities.Message;
|
||||
import net.dv8tion.jda.api.entities.User;
|
||||
import net.dv8tion.jda.api.entities.channel.unions.MessageChannelUnion;
|
||||
import org.junit.Before;
|
||||
import org.junit.Test;
|
||||
import org.junit.runner.RunWith;
|
||||
import org.mockito.InjectMocks;
|
||||
import org.mockito.Mock;
|
||||
import org.mockito.Mockito;
|
||||
import org.mockito.junit.MockitoJUnitRunner;
|
||||
|
||||
@RunWith(MockitoJUnitRunner.class)
|
||||
public class SlashCommandSuggestorTest {
|
||||
|
||||
@InjectMocks
|
||||
private SlashCommandSuggestor unitUnderTest;
|
||||
|
||||
@Mock
|
||||
private FeatureModeService featureModeService;
|
||||
|
||||
@Mock
|
||||
private CommandReceivedHandler commandReceivedHandler;
|
||||
|
||||
@Mock
|
||||
private CommandManager commandManager;
|
||||
|
||||
@Mock
|
||||
private FeatureFlagService featureFlagService;
|
||||
|
||||
@Mock
|
||||
private TemplateService templateService;
|
||||
|
||||
@Mock
|
||||
private ChannelService channelService;
|
||||
|
||||
@Mock
|
||||
private Guild guild;
|
||||
|
||||
@Mock
|
||||
private Message message;
|
||||
|
||||
@Mock
|
||||
private Command command;
|
||||
|
||||
@Mock
|
||||
private FeatureMode featureMode;
|
||||
|
||||
private static final Long SERVER_ID = 1L;
|
||||
private static final String COMMAND_NAME = "commandName";
|
||||
|
||||
@Before
|
||||
public void setup() {
|
||||
when(guild.getIdLong()).thenReturn(SERVER_ID);
|
||||
when(message.getGuildIdLong()).thenReturn(SERVER_ID);
|
||||
when(message.getAuthor()).thenReturn(Mockito.mock(User.class));
|
||||
when(message.getChannel()).thenReturn(Mockito.mock(MessageChannelUnion.class));
|
||||
}
|
||||
|
||||
@Test
|
||||
public void shouldNotExecute_DueToFeatureMode() {
|
||||
when(featureModeService.featureModeActive(CoreFeatureDefinition.CORE_FEATURE, SERVER_ID, CoreFeatureMode.SUGGEST_SLASH_COMMANDS)).thenReturn(false);
|
||||
boolean shouldExecute = unitUnderTest.shouldExecute(null, guild, message);
|
||||
assertThat(shouldExecute).isFalse();
|
||||
}
|
||||
|
||||
@Test
|
||||
public void shouldNotExecute_DueToNotFoundCommand() {
|
||||
when(featureModeService.featureModeActive(CoreFeatureDefinition.CORE_FEATURE, SERVER_ID, CoreFeatureMode.SUGGEST_SLASH_COMMANDS)).thenReturn(true);
|
||||
commandFound(null);
|
||||
boolean shouldExecute = unitUnderTest.shouldExecute(null, guild, message);
|
||||
assertThat(shouldExecute).isFalse();
|
||||
}
|
||||
|
||||
@Test
|
||||
public void shouldNotExecute_DueToFoundCommandWhichIsNotSlashCommandOnly() {
|
||||
when(featureModeService.featureModeActive(CoreFeatureDefinition.CORE_FEATURE, SERVER_ID, CoreFeatureMode.SUGGEST_SLASH_COMMANDS)).thenReturn(true);
|
||||
commandSetup(false);
|
||||
boolean shouldExecute = unitUnderTest.shouldExecute(null, guild, message);
|
||||
assertThat(shouldExecute).isFalse();
|
||||
}
|
||||
|
||||
@Test
|
||||
public void shouldExecute_DueToFoundCommandWhichIsSlashCommandOnly() {
|
||||
when(featureModeService.featureModeActive(CoreFeatureDefinition.CORE_FEATURE, SERVER_ID, CoreFeatureMode.SUGGEST_SLASH_COMMANDS)).thenReturn(true);
|
||||
commandSetup(true);
|
||||
boolean shouldExecute = unitUnderTest.shouldExecute(null, guild, message);
|
||||
assertThat(shouldExecute).isTrue();
|
||||
}
|
||||
|
||||
@Test
|
||||
public void shouldNotFindCommand() {
|
||||
commandFound(null);
|
||||
unitUnderTest.execute(null, message);
|
||||
verify(templateService, times(0)).renderEmbedTemplate(eq(SUGGESTION_TEMPLATE_KEY), any(), any());
|
||||
}
|
||||
|
||||
@Test
|
||||
public void foundCommandIsNotSlashCommandOnly() {
|
||||
commandSetup(false);
|
||||
unitUnderTest.execute(null, message);
|
||||
verify(templateService, times(0)).renderEmbedTemplate(eq(SUGGESTION_TEMPLATE_KEY), any(), any());
|
||||
}
|
||||
|
||||
@Test
|
||||
public void featureNotEnabled() {
|
||||
commandSetup(true);
|
||||
when(featureFlagService.getFeatureFlagValue(any(), eq(SERVER_ID))).thenReturn(false);
|
||||
unitUnderTest.execute(null, message);
|
||||
verify(templateService, times(0)).renderEmbedTemplate(eq(SUGGESTION_TEMPLATE_KEY), any(), any());
|
||||
}
|
||||
|
||||
@Test
|
||||
public void noFeatureModesAvailable() {
|
||||
commandSetup(true);
|
||||
when(command.getFeatureModeLimitations()).thenReturn(new ArrayList<>());
|
||||
when(featureFlagService.getFeatureFlagValue(any(), eq(SERVER_ID))).thenReturn(true);
|
||||
unitUnderTest.execute(null, message);
|
||||
verify(templateService).renderEmbedTemplate(eq(SUGGESTION_TEMPLATE_KEY), any(), any());
|
||||
}
|
||||
|
||||
@Test
|
||||
public void featureModesAvailable() {
|
||||
commandSetup(true);
|
||||
when(command.getFeatureModeLimitations()).thenReturn(Collections.singletonList(featureMode));
|
||||
when(featureFlagService.getFeatureFlagValue(any(), eq(SERVER_ID))).thenReturn(true);
|
||||
when(featureModeService.featureModeActive(any(), eq(SERVER_ID), any())).thenReturn(true);
|
||||
unitUnderTest.execute(null, message);
|
||||
verify(templateService).renderEmbedTemplate(eq(SUGGESTION_TEMPLATE_KEY), any(), any());
|
||||
}
|
||||
|
||||
private void commandSetup(boolean slashCommandOnly) {
|
||||
commandFound(command);
|
||||
CommandConfiguration commandConfiguration = CommandConfiguration
|
||||
.builder()
|
||||
.slashCommandOnly(slashCommandOnly)
|
||||
.build();
|
||||
when(command.getConfiguration()).thenReturn(commandConfiguration);
|
||||
}
|
||||
|
||||
private void commandFound(Command command) {
|
||||
when(commandReceivedHandler.getCommandName(message)).thenReturn(COMMAND_NAME);
|
||||
when(commandManager.getCommandByNameOptional(COMMAND_NAME, true, SERVER_ID)).thenReturn(Optional.ofNullable(command));
|
||||
}
|
||||
}
|
||||
@@ -3,7 +3,7 @@
|
||||
<parent>
|
||||
<groupId>dev.sheldan.abstracto.core</groupId>
|
||||
<artifactId>core</artifactId>
|
||||
<version>1.6.13-SNAPSHOT</version>
|
||||
<version>1.6.16-SNAPSHOT</version>
|
||||
</parent>
|
||||
<modelVersion>4.0.0</modelVersion>
|
||||
<packaging>jar</packaging>
|
||||
|
||||
@@ -0,0 +1,15 @@
|
||||
package dev.sheldan.abstracto.core.command.config.features;
|
||||
|
||||
import dev.sheldan.abstracto.core.config.FeatureMode;
|
||||
import lombok.Getter;
|
||||
|
||||
@Getter
|
||||
public enum CoreFeatureMode implements FeatureMode {
|
||||
SUGGEST_SLASH_COMMANDS("suggestSlashCommands");
|
||||
|
||||
private final String key;
|
||||
|
||||
CoreFeatureMode(String key) {
|
||||
this.key = key;
|
||||
}
|
||||
}
|
||||
@@ -14,7 +14,7 @@ import java.util.List;
|
||||
@Builder
|
||||
public class MaxStringLengthValidator implements ParameterValidator {
|
||||
|
||||
private Long maxLength;
|
||||
private Integer maxLength;
|
||||
|
||||
@Override
|
||||
public boolean validate(Object value) {
|
||||
@@ -33,7 +33,7 @@ public class MaxStringLengthValidator implements ParameterValidator {
|
||||
public List<ValidatorParam> getParameters() {
|
||||
SingleNumberValidatorParam param = SingleNumberValidatorParam
|
||||
.builder()
|
||||
.number(maxLength)
|
||||
.number(maxLength.longValue())
|
||||
.build();
|
||||
return Arrays.asList(param);
|
||||
}
|
||||
@@ -43,7 +43,7 @@ public class MaxStringLengthValidator implements ParameterValidator {
|
||||
return "command_parameter_validation_string_too_long";
|
||||
}
|
||||
|
||||
public static MaxStringLengthValidator max(Long number) {
|
||||
public static MaxStringLengthValidator max(Integer number) {
|
||||
return MaxStringLengthValidator
|
||||
.builder()
|
||||
.maxLength(number)
|
||||
|
||||
@@ -14,7 +14,7 @@ import java.util.List;
|
||||
@Builder
|
||||
public class MinStringLengthValidator implements ParameterValidator {
|
||||
|
||||
private Long minLength;
|
||||
private Integer minLength;
|
||||
|
||||
@Override
|
||||
public boolean validate(Object value) {
|
||||
@@ -33,7 +33,7 @@ public class MinStringLengthValidator implements ParameterValidator {
|
||||
public List<ValidatorParam> getParameters() {
|
||||
SingleNumberValidatorParam param = SingleNumberValidatorParam
|
||||
.builder()
|
||||
.number(minLength)
|
||||
.number(minLength.longValue())
|
||||
.build();
|
||||
return Arrays.asList(param);
|
||||
}
|
||||
|
||||
@@ -32,12 +32,12 @@ public class UnParsedCommandParameter {
|
||||
}
|
||||
if (m.group(1) != null) {
|
||||
String group = m.group(1);
|
||||
if(!group.equals("")) {
|
||||
if(!group.isEmpty()) {
|
||||
this.parameters.add(UnparsedCommandParameterPiece.builder().value(group).build());
|
||||
}
|
||||
} else {
|
||||
String group = m.group(2);
|
||||
if(!group.equals("")) {
|
||||
if(!group.isEmpty()) {
|
||||
this.parameters.add(UnparsedCommandParameterPiece.builder().value(group).build());
|
||||
}
|
||||
}
|
||||
|
||||
@@ -2,6 +2,10 @@ package dev.sheldan.abstracto.core.interaction.slash;
|
||||
|
||||
import dev.sheldan.abstracto.core.command.config.UserCommandConfig;
|
||||
import dev.sheldan.abstracto.core.utils.ContextUtils;
|
||||
import java.util.Arrays;
|
||||
import java.util.Objects;
|
||||
import java.util.stream.Collectors;
|
||||
import java.util.stream.Stream;
|
||||
import lombok.Builder;
|
||||
import lombok.EqualsAndHashCode;
|
||||
import lombok.Getter;
|
||||
@@ -67,4 +71,13 @@ public class SlashCommandConfig {
|
||||
public String getUserSlashCompatibleCommandName() {
|
||||
return userCommandName != null ? userCommandName.toLowerCase(Locale.ROOT) : null;
|
||||
}
|
||||
|
||||
public String getSlashCommandPath() {
|
||||
String root = getSlashCompatibleRootName();
|
||||
String group = getSlashCompatibleGroupName();
|
||||
String command = getSlashCompatibleCommandName();
|
||||
return Stream.of(root, group, command)
|
||||
.filter(Objects::nonNull)
|
||||
.collect(Collectors.joining(" "));
|
||||
}
|
||||
}
|
||||
|
||||
@@ -0,0 +1,10 @@
|
||||
package dev.sheldan.abstracto.core.models.template.commands;
|
||||
|
||||
import lombok.Builder;
|
||||
import lombok.Getter;
|
||||
|
||||
@Getter
|
||||
@Builder
|
||||
public class SlashCommandSuggestionModel {
|
||||
private String slashCommandPath;
|
||||
}
|
||||
@@ -16,7 +16,7 @@ public class MaxStringLengthValidatorTest {
|
||||
|
||||
@Before
|
||||
public void setup() {
|
||||
validator.setMaxLength(4L);
|
||||
validator.setMaxLength(4);
|
||||
}
|
||||
|
||||
@Test(expected = ValidatorConfigException.class)
|
||||
|
||||
@@ -16,7 +16,7 @@ public class MinStringLengthValidatorTest {
|
||||
|
||||
@Before
|
||||
public void setup() {
|
||||
validator.setMinLength(4L);
|
||||
validator.setMinLength(4);
|
||||
}
|
||||
|
||||
@Test(expected = ValidatorConfigException.class)
|
||||
|
||||
@@ -3,7 +3,7 @@
|
||||
<parent>
|
||||
<artifactId>core</artifactId>
|
||||
<groupId>dev.sheldan.abstracto.core</groupId>
|
||||
<version>1.6.13-SNAPSHOT</version>
|
||||
<version>1.6.16-SNAPSHOT</version>
|
||||
</parent>
|
||||
<modelVersion>4.0.0</modelVersion>
|
||||
|
||||
|
||||
@@ -3,7 +3,7 @@
|
||||
<parent>
|
||||
<artifactId>core</artifactId>
|
||||
<groupId>dev.sheldan.abstracto.core</groupId>
|
||||
<version>1.6.13-SNAPSHOT</version>
|
||||
<version>1.6.16-SNAPSHOT</version>
|
||||
</parent>
|
||||
<modelVersion>4.0.0</modelVersion>
|
||||
|
||||
|
||||
Some files were not shown because too many files have changed in this diff Show More
Reference in New Issue
Block a user