mirror of
https://github.com/Sheldan/abstracto.git
synced 2026-04-14 19:56:29 +00:00
Compare commits
22 Commits
release-20
...
release-20
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
d078b3fa87 | ||
|
|
71b7dd2383 | ||
|
|
ea0384490e | ||
|
|
b5dbc0b1ed | ||
|
|
e265eb6760 | ||
|
|
2f18b7431d | ||
|
|
2d8827fa81 | ||
|
|
dddeb15127 | ||
|
|
78fbe0723b | ||
|
|
e1d4a41d60 | ||
|
|
354a82f806 | ||
|
|
ff3e3d85ba | ||
|
|
46bf4fbc42 | ||
|
|
97ac25dbb6 | ||
|
|
ef4bdb2ab2 | ||
|
|
433fdb7068 | ||
|
|
e59b6269e1 | ||
|
|
8077501584 | ||
|
|
cb9ab8f542 | ||
|
|
f513f8890b | ||
|
|
6f02834b75 | ||
|
|
75456b45c9 |
2
.env
2
.env
@@ -1,2 +1,2 @@
|
|||||||
REGISTRY_PREFIX=harbor.sheldan.dev/abstracto/
|
REGISTRY_PREFIX=harbor.sheldan.dev/abstracto/
|
||||||
VERSION=1.6.9
|
VERSION=1.6.14
|
||||||
@@ -3,7 +3,7 @@
|
|||||||
<parent>
|
<parent>
|
||||||
<artifactId>anti-raid</artifactId>
|
<artifactId>anti-raid</artifactId>
|
||||||
<groupId>dev.sheldan.abstracto.modules</groupId>
|
<groupId>dev.sheldan.abstracto.modules</groupId>
|
||||||
<version>1.6.10-SNAPSHOT</version>
|
<version>1.6.15-SNAPSHOT</version>
|
||||||
</parent>
|
</parent>
|
||||||
<modelVersion>4.0.0</modelVersion>
|
<modelVersion>4.0.0</modelVersion>
|
||||||
|
|
||||||
|
|||||||
@@ -3,7 +3,7 @@
|
|||||||
<parent>
|
<parent>
|
||||||
<artifactId>anti-raid</artifactId>
|
<artifactId>anti-raid</artifactId>
|
||||||
<groupId>dev.sheldan.abstracto.modules</groupId>
|
<groupId>dev.sheldan.abstracto.modules</groupId>
|
||||||
<version>1.6.10-SNAPSHOT</version>
|
<version>1.6.15-SNAPSHOT</version>
|
||||||
</parent>
|
</parent>
|
||||||
<modelVersion>4.0.0</modelVersion>
|
<modelVersion>4.0.0</modelVersion>
|
||||||
|
|
||||||
|
|||||||
@@ -3,7 +3,7 @@
|
|||||||
<parent>
|
<parent>
|
||||||
<artifactId>abstracto-modules</artifactId>
|
<artifactId>abstracto-modules</artifactId>
|
||||||
<groupId>dev.sheldan.abstracto.modules</groupId>
|
<groupId>dev.sheldan.abstracto.modules</groupId>
|
||||||
<version>1.6.10-SNAPSHOT</version>
|
<version>1.6.15-SNAPSHOT</version>
|
||||||
</parent>
|
</parent>
|
||||||
<modelVersion>4.0.0</modelVersion>
|
<modelVersion>4.0.0</modelVersion>
|
||||||
|
|
||||||
|
|||||||
@@ -3,7 +3,7 @@
|
|||||||
<parent>
|
<parent>
|
||||||
<groupId>dev.sheldan.abstracto.modules</groupId>
|
<groupId>dev.sheldan.abstracto.modules</groupId>
|
||||||
<artifactId>assignable-roles</artifactId>
|
<artifactId>assignable-roles</artifactId>
|
||||||
<version>1.6.10-SNAPSHOT</version>
|
<version>1.6.15-SNAPSHOT</version>
|
||||||
</parent>
|
</parent>
|
||||||
<modelVersion>4.0.0</modelVersion>
|
<modelVersion>4.0.0</modelVersion>
|
||||||
|
|
||||||
|
|||||||
@@ -74,7 +74,7 @@ public class CreateAssignableRolePlace extends AbstractConditionableCommand {
|
|||||||
|
|
||||||
@Override
|
@Override
|
||||||
public CommandConfiguration getConfiguration() {
|
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
|
Parameter rolePostName = Parameter
|
||||||
.builder()
|
.builder()
|
||||||
.name(ASSIGNABLE_ROLE_PLACE_NAME_PARAMETER)
|
.name(ASSIGNABLE_ROLE_PLACE_NAME_PARAMETER)
|
||||||
@@ -95,7 +95,7 @@ public class CreateAssignableRolePlace extends AbstractConditionableCommand {
|
|||||||
.templated(true)
|
.templated(true)
|
||||||
.optional(true)
|
.optional(true)
|
||||||
.build();
|
.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
|
Parameter text = Parameter
|
||||||
.builder()
|
.builder()
|
||||||
.name(ASSIGNABLE_ROLE_PLACE_TEXT_PARAMETER)
|
.name(ASSIGNABLE_ROLE_PLACE_TEXT_PARAMETER)
|
||||||
|
|||||||
@@ -3,7 +3,7 @@
|
|||||||
<parent>
|
<parent>
|
||||||
<groupId>dev.sheldan.abstracto.modules</groupId>
|
<groupId>dev.sheldan.abstracto.modules</groupId>
|
||||||
<artifactId>assignable-roles</artifactId>
|
<artifactId>assignable-roles</artifactId>
|
||||||
<version>1.6.10-SNAPSHOT</version>
|
<version>1.6.15-SNAPSHOT</version>
|
||||||
</parent>
|
</parent>
|
||||||
<modelVersion>4.0.0</modelVersion>
|
<modelVersion>4.0.0</modelVersion>
|
||||||
<artifactId>assignable-roles-int</artifactId>
|
<artifactId>assignable-roles-int</artifactId>
|
||||||
|
|||||||
@@ -3,7 +3,7 @@
|
|||||||
<parent>
|
<parent>
|
||||||
<groupId>dev.sheldan.abstracto.modules</groupId>
|
<groupId>dev.sheldan.abstracto.modules</groupId>
|
||||||
<artifactId>abstracto-modules</artifactId>
|
<artifactId>abstracto-modules</artifactId>
|
||||||
<version>1.6.10-SNAPSHOT</version>
|
<version>1.6.15-SNAPSHOT</version>
|
||||||
</parent>
|
</parent>
|
||||||
<modelVersion>4.0.0</modelVersion>
|
<modelVersion>4.0.0</modelVersion>
|
||||||
|
|
||||||
|
|||||||
@@ -3,7 +3,7 @@
|
|||||||
<parent>
|
<parent>
|
||||||
<groupId>dev.sheldan.abstracto.modules</groupId>
|
<groupId>dev.sheldan.abstracto.modules</groupId>
|
||||||
<artifactId>custom-command</artifactId>
|
<artifactId>custom-command</artifactId>
|
||||||
<version>1.6.10-SNAPSHOT</version>
|
<version>1.6.15-SNAPSHOT</version>
|
||||||
</parent>
|
</parent>
|
||||||
<modelVersion>4.0.0</modelVersion>
|
<modelVersion>4.0.0</modelVersion>
|
||||||
|
|
||||||
|
|||||||
@@ -3,7 +3,7 @@
|
|||||||
<parent>
|
<parent>
|
||||||
<groupId>dev.sheldan.abstracto.modules</groupId>
|
<groupId>dev.sheldan.abstracto.modules</groupId>
|
||||||
<artifactId>custom-command</artifactId>
|
<artifactId>custom-command</artifactId>
|
||||||
<version>1.6.10-SNAPSHOT</version>
|
<version>1.6.15-SNAPSHOT</version>
|
||||||
</parent>
|
</parent>
|
||||||
<modelVersion>4.0.0</modelVersion>
|
<modelVersion>4.0.0</modelVersion>
|
||||||
|
|
||||||
|
|||||||
@@ -3,7 +3,7 @@
|
|||||||
<parent>
|
<parent>
|
||||||
<artifactId>abstracto-modules</artifactId>
|
<artifactId>abstracto-modules</artifactId>
|
||||||
<groupId>dev.sheldan.abstracto.modules</groupId>
|
<groupId>dev.sheldan.abstracto.modules</groupId>
|
||||||
<version>1.6.10-SNAPSHOT</version>
|
<version>1.6.15-SNAPSHOT</version>
|
||||||
</parent>
|
</parent>
|
||||||
<modelVersion>4.0.0</modelVersion>
|
<modelVersion>4.0.0</modelVersion>
|
||||||
|
|
||||||
|
|||||||
@@ -3,7 +3,7 @@
|
|||||||
<parent>
|
<parent>
|
||||||
<groupId>dev.sheldan.abstracto.modules</groupId>
|
<groupId>dev.sheldan.abstracto.modules</groupId>
|
||||||
<artifactId>dynamic-activity</artifactId>
|
<artifactId>dynamic-activity</artifactId>
|
||||||
<version>1.6.10-SNAPSHOT</version>
|
<version>1.6.15-SNAPSHOT</version>
|
||||||
</parent>
|
</parent>
|
||||||
<modelVersion>4.0.0</modelVersion>
|
<modelVersion>4.0.0</modelVersion>
|
||||||
|
|
||||||
|
|||||||
@@ -3,7 +3,7 @@
|
|||||||
<parent>
|
<parent>
|
||||||
<artifactId>dynamic-activity</artifactId>
|
<artifactId>dynamic-activity</artifactId>
|
||||||
<groupId>dev.sheldan.abstracto.modules</groupId>
|
<groupId>dev.sheldan.abstracto.modules</groupId>
|
||||||
<version>1.6.10-SNAPSHOT</version>
|
<version>1.6.15-SNAPSHOT</version>
|
||||||
</parent>
|
</parent>
|
||||||
<modelVersion>4.0.0</modelVersion>
|
<modelVersion>4.0.0</modelVersion>
|
||||||
|
|
||||||
|
|||||||
@@ -3,7 +3,7 @@
|
|||||||
<parent>
|
<parent>
|
||||||
<artifactId>abstracto-modules</artifactId>
|
<artifactId>abstracto-modules</artifactId>
|
||||||
<groupId>dev.sheldan.abstracto.modules</groupId>
|
<groupId>dev.sheldan.abstracto.modules</groupId>
|
||||||
<version>1.6.10-SNAPSHOT</version>
|
<version>1.6.15-SNAPSHOT</version>
|
||||||
</parent>
|
</parent>
|
||||||
<modelVersion>4.0.0</modelVersion>
|
<modelVersion>4.0.0</modelVersion>
|
||||||
|
|
||||||
|
|||||||
@@ -3,7 +3,7 @@
|
|||||||
<parent>
|
<parent>
|
||||||
<artifactId>entertainment</artifactId>
|
<artifactId>entertainment</artifactId>
|
||||||
<groupId>dev.sheldan.abstracto.modules</groupId>
|
<groupId>dev.sheldan.abstracto.modules</groupId>
|
||||||
<version>1.6.10-SNAPSHOT</version>
|
<version>1.6.15-SNAPSHOT</version>
|
||||||
</parent>
|
</parent>
|
||||||
<modelVersion>4.0.0</modelVersion>
|
<modelVersion>4.0.0</modelVersion>
|
||||||
|
|
||||||
|
|||||||
@@ -3,7 +3,7 @@
|
|||||||
<parent>
|
<parent>
|
||||||
<artifactId>entertainment</artifactId>
|
<artifactId>entertainment</artifactId>
|
||||||
<groupId>dev.sheldan.abstracto.modules</groupId>
|
<groupId>dev.sheldan.abstracto.modules</groupId>
|
||||||
<version>1.6.10-SNAPSHOT</version>
|
<version>1.6.15-SNAPSHOT</version>
|
||||||
</parent>
|
</parent>
|
||||||
<modelVersion>4.0.0</modelVersion>
|
<modelVersion>4.0.0</modelVersion>
|
||||||
|
|
||||||
|
|||||||
@@ -3,7 +3,7 @@
|
|||||||
<parent>
|
<parent>
|
||||||
<artifactId>abstracto-modules</artifactId>
|
<artifactId>abstracto-modules</artifactId>
|
||||||
<groupId>dev.sheldan.abstracto.modules</groupId>
|
<groupId>dev.sheldan.abstracto.modules</groupId>
|
||||||
<version>1.6.10-SNAPSHOT</version>
|
<version>1.6.15-SNAPSHOT</version>
|
||||||
</parent>
|
</parent>
|
||||||
<modelVersion>4.0.0</modelVersion>
|
<modelVersion>4.0.0</modelVersion>
|
||||||
|
|
||||||
|
|||||||
@@ -3,7 +3,7 @@
|
|||||||
<parent>
|
<parent>
|
||||||
<groupId>dev.sheldan.abstracto.modules</groupId>
|
<groupId>dev.sheldan.abstracto.modules</groupId>
|
||||||
<artifactId>experience-tracking</artifactId>
|
<artifactId>experience-tracking</artifactId>
|
||||||
<version>1.6.10-SNAPSHOT</version>
|
<version>1.6.15-SNAPSHOT</version>
|
||||||
</parent>
|
</parent>
|
||||||
<modelVersion>4.0.0</modelVersion>
|
<modelVersion>4.0.0</modelVersion>
|
||||||
|
|
||||||
|
|||||||
@@ -158,7 +158,6 @@ public class LeaderBoardCommand extends AbstractConditionableCommand {
|
|||||||
Parameter focusMe = Parameter
|
Parameter focusMe = Parameter
|
||||||
.builder()
|
.builder()
|
||||||
.name(FOCUS_PARAMETER)
|
.name(FOCUS_PARAMETER)
|
||||||
.validators(leaderBoardPageValidators)
|
|
||||||
.optional(true)
|
.optional(true)
|
||||||
.slashCommandOnly(true)
|
.slashCommandOnly(true)
|
||||||
.templated(true)
|
.templated(true)
|
||||||
|
|||||||
@@ -3,7 +3,7 @@
|
|||||||
<parent>
|
<parent>
|
||||||
<groupId>dev.sheldan.abstracto.modules</groupId>
|
<groupId>dev.sheldan.abstracto.modules</groupId>
|
||||||
<artifactId>experience-tracking</artifactId>
|
<artifactId>experience-tracking</artifactId>
|
||||||
<version>1.6.10-SNAPSHOT</version>
|
<version>1.6.15-SNAPSHOT</version>
|
||||||
</parent>
|
</parent>
|
||||||
<modelVersion>4.0.0</modelVersion>
|
<modelVersion>4.0.0</modelVersion>
|
||||||
|
|
||||||
|
|||||||
@@ -3,7 +3,7 @@
|
|||||||
<parent>
|
<parent>
|
||||||
<groupId>dev.sheldan.abstracto.modules</groupId>
|
<groupId>dev.sheldan.abstracto.modules</groupId>
|
||||||
<artifactId>abstracto-modules</artifactId>
|
<artifactId>abstracto-modules</artifactId>
|
||||||
<version>1.6.10-SNAPSHOT</version>
|
<version>1.6.15-SNAPSHOT</version>
|
||||||
</parent>
|
</parent>
|
||||||
<modelVersion>4.0.0</modelVersion>
|
<modelVersion>4.0.0</modelVersion>
|
||||||
|
|
||||||
|
|||||||
@@ -4,7 +4,7 @@
|
|||||||
<parent>
|
<parent>
|
||||||
<groupId>dev.sheldan.abstracto.modules</groupId>
|
<groupId>dev.sheldan.abstracto.modules</groupId>
|
||||||
<artifactId>giveaway</artifactId>
|
<artifactId>giveaway</artifactId>
|
||||||
<version>1.6.10-SNAPSHOT</version>
|
<version>1.6.15-SNAPSHOT</version>
|
||||||
</parent>
|
</parent>
|
||||||
|
|
||||||
<artifactId>giveaway-impl</artifactId>
|
<artifactId>giveaway-impl</artifactId>
|
||||||
|
|||||||
@@ -155,7 +155,7 @@ public class GiveawayServiceBean implements GiveawayService {
|
|||||||
Long giveawayId = giveaway.getGiveawayId().getId();
|
Long giveawayId = giveaway.getGiveawayId().getId();
|
||||||
log.info("Adding giveaway participating of user {} to giveaway {} in server {}.", member.getIdLong(), giveawayId, member.getGuild().getIdLong());
|
log.info("Adding giveaway participating of user {} to giveaway {} in server {}.", member.getIdLong(), giveawayId, member.getGuild().getIdLong());
|
||||||
MessageToSend messageToSend = templateService.renderEmbedTemplate(GIVEAWAY_MESSAGE_TEMPLATE_KEY, giveawayMessageModel, member.getGuild().getIdLong());
|
MessageToSend messageToSend = templateService.renderEmbedTemplate(GIVEAWAY_MESSAGE_TEMPLATE_KEY, giveawayMessageModel, member.getGuild().getIdLong());
|
||||||
return channelService.editEmbedMessageInAChannel(messageToSend.getEmbeds().get(0), messageChannel, giveaway.getMessageId())
|
return channelService.editMessageInAChannelFuture(messageToSend, messageChannel, giveaway.getMessageId())
|
||||||
.thenAccept(message -> {
|
.thenAccept(message -> {
|
||||||
self.persistAddedParticipant(member, giveawayId);
|
self.persistAddedParticipant(member, giveawayId);
|
||||||
});
|
});
|
||||||
|
|||||||
@@ -4,7 +4,7 @@
|
|||||||
<parent>
|
<parent>
|
||||||
<groupId>dev.sheldan.abstracto.modules</groupId>
|
<groupId>dev.sheldan.abstracto.modules</groupId>
|
||||||
<artifactId>giveaway</artifactId>
|
<artifactId>giveaway</artifactId>
|
||||||
<version>1.6.10-SNAPSHOT</version>
|
<version>1.6.15-SNAPSHOT</version>
|
||||||
</parent>
|
</parent>
|
||||||
|
|
||||||
<artifactId>giveaway-int</artifactId>
|
<artifactId>giveaway-int</artifactId>
|
||||||
|
|||||||
@@ -4,7 +4,7 @@
|
|||||||
<parent>
|
<parent>
|
||||||
<groupId>dev.sheldan.abstracto.modules</groupId>
|
<groupId>dev.sheldan.abstracto.modules</groupId>
|
||||||
<artifactId>abstracto-modules</artifactId>
|
<artifactId>abstracto-modules</artifactId>
|
||||||
<version>1.6.10-SNAPSHOT</version>
|
<version>1.6.15-SNAPSHOT</version>
|
||||||
</parent>
|
</parent>
|
||||||
|
|
||||||
<artifactId>giveaway</artifactId>
|
<artifactId>giveaway</artifactId>
|
||||||
|
|||||||
@@ -4,7 +4,7 @@
|
|||||||
<parent>
|
<parent>
|
||||||
<artifactId>image-generation</artifactId>
|
<artifactId>image-generation</artifactId>
|
||||||
<groupId>dev.sheldan.abstracto.modules</groupId>
|
<groupId>dev.sheldan.abstracto.modules</groupId>
|
||||||
<version>1.6.10-SNAPSHOT</version>
|
<version>1.6.15-SNAPSHOT</version>
|
||||||
</parent>
|
</parent>
|
||||||
|
|
||||||
<artifactId>image-generation-impl</artifactId>
|
<artifactId>image-generation-impl</artifactId>
|
||||||
|
|||||||
@@ -4,7 +4,7 @@
|
|||||||
<parent>
|
<parent>
|
||||||
<artifactId>image-generation</artifactId>
|
<artifactId>image-generation</artifactId>
|
||||||
<groupId>dev.sheldan.abstracto.modules</groupId>
|
<groupId>dev.sheldan.abstracto.modules</groupId>
|
||||||
<version>1.6.10-SNAPSHOT</version>
|
<version>1.6.15-SNAPSHOT</version>
|
||||||
</parent>
|
</parent>
|
||||||
|
|
||||||
<artifactId>image-generation-int</artifactId>
|
<artifactId>image-generation-int</artifactId>
|
||||||
|
|||||||
@@ -4,7 +4,7 @@
|
|||||||
<parent>
|
<parent>
|
||||||
<groupId>dev.sheldan.abstracto.modules</groupId>
|
<groupId>dev.sheldan.abstracto.modules</groupId>
|
||||||
<artifactId>abstracto-modules</artifactId>
|
<artifactId>abstracto-modules</artifactId>
|
||||||
<version>1.6.10-SNAPSHOT</version>
|
<version>1.6.15-SNAPSHOT</version>
|
||||||
</parent>
|
</parent>
|
||||||
|
|
||||||
<artifactId>image-generation</artifactId>
|
<artifactId>image-generation</artifactId>
|
||||||
|
|||||||
@@ -3,7 +3,7 @@
|
|||||||
<parent>
|
<parent>
|
||||||
<artifactId>invite-filter</artifactId>
|
<artifactId>invite-filter</artifactId>
|
||||||
<groupId>dev.sheldan.abstracto.modules</groupId>
|
<groupId>dev.sheldan.abstracto.modules</groupId>
|
||||||
<version>1.6.10-SNAPSHOT</version>
|
<version>1.6.15-SNAPSHOT</version>
|
||||||
</parent>
|
</parent>
|
||||||
<modelVersion>4.0.0</modelVersion>
|
<modelVersion>4.0.0</modelVersion>
|
||||||
|
|
||||||
|
|||||||
@@ -3,7 +3,7 @@
|
|||||||
<parent>
|
<parent>
|
||||||
<artifactId>invite-filter</artifactId>
|
<artifactId>invite-filter</artifactId>
|
||||||
<groupId>dev.sheldan.abstracto.modules</groupId>
|
<groupId>dev.sheldan.abstracto.modules</groupId>
|
||||||
<version>1.6.10-SNAPSHOT</version>
|
<version>1.6.15-SNAPSHOT</version>
|
||||||
</parent>
|
</parent>
|
||||||
<modelVersion>4.0.0</modelVersion>
|
<modelVersion>4.0.0</modelVersion>
|
||||||
|
|
||||||
@@ -18,7 +18,7 @@
|
|||||||
<dependency>
|
<dependency>
|
||||||
<groupId>dev.sheldan.abstracto.modules</groupId>
|
<groupId>dev.sheldan.abstracto.modules</groupId>
|
||||||
<artifactId>moderation-int</artifactId>
|
<artifactId>moderation-int</artifactId>
|
||||||
<version>1.6.10-SNAPSHOT</version>
|
<version>1.6.15-SNAPSHOT</version>
|
||||||
<scope>compile</scope>
|
<scope>compile</scope>
|
||||||
</dependency>
|
</dependency>
|
||||||
</dependencies>
|
</dependencies>
|
||||||
|
|||||||
@@ -3,7 +3,7 @@
|
|||||||
<parent>
|
<parent>
|
||||||
<artifactId>abstracto-modules</artifactId>
|
<artifactId>abstracto-modules</artifactId>
|
||||||
<groupId>dev.sheldan.abstracto.modules</groupId>
|
<groupId>dev.sheldan.abstracto.modules</groupId>
|
||||||
<version>1.6.10-SNAPSHOT</version>
|
<version>1.6.15-SNAPSHOT</version>
|
||||||
</parent>
|
</parent>
|
||||||
<modelVersion>4.0.0</modelVersion>
|
<modelVersion>4.0.0</modelVersion>
|
||||||
|
|
||||||
|
|||||||
@@ -3,7 +3,7 @@
|
|||||||
<parent>
|
<parent>
|
||||||
<artifactId>link-embed</artifactId>
|
<artifactId>link-embed</artifactId>
|
||||||
<groupId>dev.sheldan.abstracto.modules</groupId>
|
<groupId>dev.sheldan.abstracto.modules</groupId>
|
||||||
<version>1.6.10-SNAPSHOT</version>
|
<version>1.6.15-SNAPSHOT</version>
|
||||||
</parent>
|
</parent>
|
||||||
<modelVersion>4.0.0</modelVersion>
|
<modelVersion>4.0.0</modelVersion>
|
||||||
|
|
||||||
|
|||||||
@@ -3,7 +3,7 @@
|
|||||||
<parent>
|
<parent>
|
||||||
<artifactId>link-embed</artifactId>
|
<artifactId>link-embed</artifactId>
|
||||||
<groupId>dev.sheldan.abstracto.modules</groupId>
|
<groupId>dev.sheldan.abstracto.modules</groupId>
|
||||||
<version>1.6.10-SNAPSHOT</version>
|
<version>1.6.15-SNAPSHOT</version>
|
||||||
</parent>
|
</parent>
|
||||||
<modelVersion>4.0.0</modelVersion>
|
<modelVersion>4.0.0</modelVersion>
|
||||||
|
|
||||||
|
|||||||
@@ -3,7 +3,7 @@
|
|||||||
<parent>
|
<parent>
|
||||||
<artifactId>abstracto-modules</artifactId>
|
<artifactId>abstracto-modules</artifactId>
|
||||||
<groupId>dev.sheldan.abstracto.modules</groupId>
|
<groupId>dev.sheldan.abstracto.modules</groupId>
|
||||||
<version>1.6.10-SNAPSHOT</version>
|
<version>1.6.15-SNAPSHOT</version>
|
||||||
</parent>
|
</parent>
|
||||||
<modelVersion>4.0.0</modelVersion>
|
<modelVersion>4.0.0</modelVersion>
|
||||||
|
|
||||||
|
|||||||
@@ -3,7 +3,7 @@
|
|||||||
<parent>
|
<parent>
|
||||||
<artifactId>logging</artifactId>
|
<artifactId>logging</artifactId>
|
||||||
<groupId>dev.sheldan.abstracto.modules</groupId>
|
<groupId>dev.sheldan.abstracto.modules</groupId>
|
||||||
<version>1.6.10-SNAPSHOT</version>
|
<version>1.6.15-SNAPSHOT</version>
|
||||||
</parent>
|
</parent>
|
||||||
<modelVersion>4.0.0</modelVersion>
|
<modelVersion>4.0.0</modelVersion>
|
||||||
|
|
||||||
|
|||||||
@@ -3,7 +3,7 @@
|
|||||||
<parent>
|
<parent>
|
||||||
<artifactId>logging</artifactId>
|
<artifactId>logging</artifactId>
|
||||||
<groupId>dev.sheldan.abstracto.modules</groupId>
|
<groupId>dev.sheldan.abstracto.modules</groupId>
|
||||||
<version>1.6.10-SNAPSHOT</version>
|
<version>1.6.15-SNAPSHOT</version>
|
||||||
</parent>
|
</parent>
|
||||||
<modelVersion>4.0.0</modelVersion>
|
<modelVersion>4.0.0</modelVersion>
|
||||||
|
|
||||||
|
|||||||
@@ -3,7 +3,7 @@
|
|||||||
<parent>
|
<parent>
|
||||||
<artifactId>abstracto-modules</artifactId>
|
<artifactId>abstracto-modules</artifactId>
|
||||||
<groupId>dev.sheldan.abstracto.modules</groupId>
|
<groupId>dev.sheldan.abstracto.modules</groupId>
|
||||||
<version>1.6.10-SNAPSHOT</version>
|
<version>1.6.15-SNAPSHOT</version>
|
||||||
</parent>
|
</parent>
|
||||||
<modelVersion>4.0.0</modelVersion>
|
<modelVersion>4.0.0</modelVersion>
|
||||||
|
|
||||||
|
|||||||
@@ -3,7 +3,7 @@
|
|||||||
<parent>
|
<parent>
|
||||||
<groupId>dev.sheldan.abstracto.modules</groupId>
|
<groupId>dev.sheldan.abstracto.modules</groupId>
|
||||||
<artifactId>moderation</artifactId>
|
<artifactId>moderation</artifactId>
|
||||||
<version>1.6.10-SNAPSHOT</version>
|
<version>1.6.15-SNAPSHOT</version>
|
||||||
</parent>
|
</parent>
|
||||||
<modelVersion>4.0.0</modelVersion>
|
<modelVersion>4.0.0</modelVersion>
|
||||||
|
|
||||||
|
|||||||
@@ -23,7 +23,6 @@ import net.dv8tion.jda.api.entities.Member;
|
|||||||
import net.dv8tion.jda.api.entities.User;
|
import net.dv8tion.jda.api.entities.User;
|
||||||
import net.dv8tion.jda.api.events.interaction.command.SlashCommandInteractionEvent;
|
import net.dv8tion.jda.api.events.interaction.command.SlashCommandInteractionEvent;
|
||||||
import net.dv8tion.jda.api.interactions.InteractionHook;
|
import net.dv8tion.jda.api.interactions.InteractionHook;
|
||||||
import net.dv8tion.jda.api.interactions.commands.OptionType;
|
|
||||||
import org.springframework.beans.factory.annotation.Autowired;
|
import org.springframework.beans.factory.annotation.Autowired;
|
||||||
import org.springframework.stereotype.Component;
|
import org.springframework.stereotype.Component;
|
||||||
|
|
||||||
@@ -76,16 +75,15 @@ public class Ban extends AbstractConditionableCommand {
|
|||||||
duration = null;
|
duration = null;
|
||||||
}
|
}
|
||||||
|
|
||||||
if(slashCommandParameterService.hasCommandOptionWithFullType(USER_PARAMETER, event, OptionType.USER)) {
|
Member member = slashCommandParameterService.getCommandOption(USER_PARAMETER, event, User.class, Member.class);
|
||||||
Member member = slashCommandParameterService.getCommandOption(USER_PARAMETER, event, User.class, Member.class);
|
if(member != null) {
|
||||||
return event.deferReply().submit()
|
return event.deferReply().submit()
|
||||||
.thenCompose((hook) -> self.banMember(event, member, reason, duration, hook))
|
.thenCompose((hook) -> self.banMember(event, member, reason, duration, hook))
|
||||||
.thenApply(commandResult -> CommandResult.fromSuccess());
|
.thenApply(commandResult -> CommandResult.fromSuccess());
|
||||||
} else {
|
} else {
|
||||||
String userIdStr = slashCommandParameterService.getCommandOption(USER_PARAMETER, event, User.class, String.class);
|
User user = slashCommandParameterService.getCommandOption(USER_PARAMETER, event, User.class, User.class);
|
||||||
Long userId = Long.parseLong(userIdStr);
|
|
||||||
return event.deferReply().submit()
|
return event.deferReply().submit()
|
||||||
.thenCompose((hook) -> self.banViaUserId(event, userId, reason, duration, hook))
|
.thenCompose((hook) -> self.banViaUserId(event, user.getIdLong(), reason, duration, hook))
|
||||||
.thenApply(commandResult -> CommandResult.fromSuccess());
|
.thenApply(commandResult -> CommandResult.fromSuccess());
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -33,7 +33,6 @@ import net.dv8tion.jda.api.entities.Member;
|
|||||||
import net.dv8tion.jda.api.entities.User;
|
import net.dv8tion.jda.api.entities.User;
|
||||||
import net.dv8tion.jda.api.events.interaction.command.SlashCommandInteractionEvent;
|
import net.dv8tion.jda.api.events.interaction.command.SlashCommandInteractionEvent;
|
||||||
import net.dv8tion.jda.api.interactions.InteractionHook;
|
import net.dv8tion.jda.api.interactions.InteractionHook;
|
||||||
import net.dv8tion.jda.api.interactions.commands.OptionType;
|
|
||||||
import org.springframework.beans.factory.annotation.Autowired;
|
import org.springframework.beans.factory.annotation.Autowired;
|
||||||
import org.springframework.stereotype.Component;
|
import org.springframework.stereotype.Component;
|
||||||
|
|
||||||
@@ -86,16 +85,15 @@ public class Infractions extends AbstractConditionableCommand {
|
|||||||
public CompletableFuture<CommandResult> showInfractions(InteractionHook hook, SlashCommandInteractionEvent event) {
|
public CompletableFuture<CommandResult> showInfractions(InteractionHook hook, SlashCommandInteractionEvent event) {
|
||||||
List<Infraction> infractions;
|
List<Infraction> infractions;
|
||||||
Guild guild = hook.getInteraction().getGuild();
|
Guild guild = hook.getInteraction().getGuild();
|
||||||
if(slashCommandParameterService.hasCommandOptionWithFullType(USER_PARAMETER, event, OptionType.USER)) {
|
Member member = slashCommandParameterService.getCommandOption(USER_PARAMETER, event, User.class, Member.class);
|
||||||
Member member = slashCommandParameterService.getCommandOption(USER_PARAMETER, event, User.class, Member.class);
|
User user = slashCommandParameterService.getCommandOption(USER_PARAMETER, event, User.class, User.class);
|
||||||
|
if(member != null) {
|
||||||
if(!member.getGuild().equals(guild)) {
|
if(!member.getGuild().equals(guild)) {
|
||||||
throw new EntityGuildMismatchException();
|
throw new EntityGuildMismatchException();
|
||||||
}
|
}
|
||||||
infractions = infractionManagementService.getInfractionsForUser(userInServerManagementService.loadOrCreateUser(member));
|
infractions = infractionManagementService.getInfractionsForUser(userInServerManagementService.loadOrCreateUser(member));
|
||||||
} else if(slashCommandParameterService.hasCommandOptionWithFullType(USER_PARAMETER, event, OptionType.STRING)){
|
} else if(user != null){
|
||||||
String userIdStr = slashCommandParameterService.getCommandOption(USER_PARAMETER, event, User.class, String.class);
|
AUserInAServer userInServer = userInServerManagementService.loadOrCreateUser(guild.getIdLong(), user.getIdLong());
|
||||||
Long userId = Long.parseLong(userIdStr);
|
|
||||||
AUserInAServer userInServer = userInServerManagementService.loadOrCreateUser(guild.getIdLong(), userId);
|
|
||||||
infractions = infractionManagementService.getInfractionsForUser(userInServer);
|
infractions = infractionManagementService.getInfractionsForUser(userInServer);
|
||||||
|
|
||||||
} else {
|
} else {
|
||||||
|
|||||||
@@ -3,7 +3,7 @@
|
|||||||
<parent>
|
<parent>
|
||||||
<groupId>dev.sheldan.abstracto.modules</groupId>
|
<groupId>dev.sheldan.abstracto.modules</groupId>
|
||||||
<artifactId>moderation</artifactId>
|
<artifactId>moderation</artifactId>
|
||||||
<version>1.6.10-SNAPSHOT</version>
|
<version>1.6.15-SNAPSHOT</version>
|
||||||
</parent>
|
</parent>
|
||||||
<modelVersion>4.0.0</modelVersion>
|
<modelVersion>4.0.0</modelVersion>
|
||||||
|
|
||||||
|
|||||||
@@ -3,7 +3,7 @@
|
|||||||
<parent>
|
<parent>
|
||||||
<groupId>dev.sheldan.abstracto.modules</groupId>
|
<groupId>dev.sheldan.abstracto.modules</groupId>
|
||||||
<artifactId>abstracto-modules</artifactId>
|
<artifactId>abstracto-modules</artifactId>
|
||||||
<version>1.6.10-SNAPSHOT</version>
|
<version>1.6.15-SNAPSHOT</version>
|
||||||
</parent>
|
</parent>
|
||||||
<modelVersion>4.0.0</modelVersion>
|
<modelVersion>4.0.0</modelVersion>
|
||||||
|
|
||||||
|
|||||||
@@ -3,7 +3,7 @@
|
|||||||
<parent>
|
<parent>
|
||||||
<groupId>dev.sheldan.abstracto.modules</groupId>
|
<groupId>dev.sheldan.abstracto.modules</groupId>
|
||||||
<artifactId>modmail</artifactId>
|
<artifactId>modmail</artifactId>
|
||||||
<version>1.6.10-SNAPSHOT</version>
|
<version>1.6.15-SNAPSHOT</version>
|
||||||
</parent>
|
</parent>
|
||||||
<modelVersion>4.0.0</modelVersion>
|
<modelVersion>4.0.0</modelVersion>
|
||||||
|
|
||||||
|
|||||||
@@ -3,7 +3,7 @@
|
|||||||
<parent>
|
<parent>
|
||||||
<groupId>dev.sheldan.abstracto.modules</groupId>
|
<groupId>dev.sheldan.abstracto.modules</groupId>
|
||||||
<artifactId>modmail</artifactId>
|
<artifactId>modmail</artifactId>
|
||||||
<version>1.6.10-SNAPSHOT</version>
|
<version>1.6.15-SNAPSHOT</version>
|
||||||
</parent>
|
</parent>
|
||||||
<modelVersion>4.0.0</modelVersion>
|
<modelVersion>4.0.0</modelVersion>
|
||||||
|
|
||||||
|
|||||||
@@ -3,7 +3,7 @@
|
|||||||
<parent>
|
<parent>
|
||||||
<groupId>dev.sheldan.abstracto.modules</groupId>
|
<groupId>dev.sheldan.abstracto.modules</groupId>
|
||||||
<artifactId>abstracto-modules</artifactId>
|
<artifactId>abstracto-modules</artifactId>
|
||||||
<version>1.6.10-SNAPSHOT</version>
|
<version>1.6.15-SNAPSHOT</version>
|
||||||
</parent>
|
</parent>
|
||||||
<modelVersion>4.0.0</modelVersion>
|
<modelVersion>4.0.0</modelVersion>
|
||||||
|
|
||||||
|
|||||||
@@ -3,7 +3,7 @@
|
|||||||
<parent>
|
<parent>
|
||||||
<groupId>dev.sheldan.abstracto</groupId>
|
<groupId>dev.sheldan.abstracto</groupId>
|
||||||
<artifactId>abstracto-application</artifactId>
|
<artifactId>abstracto-application</artifactId>
|
||||||
<version>1.6.10-SNAPSHOT</version>
|
<version>1.6.15-SNAPSHOT</version>
|
||||||
</parent>
|
</parent>
|
||||||
<modelVersion>4.0.0</modelVersion>
|
<modelVersion>4.0.0</modelVersion>
|
||||||
|
|
||||||
|
|||||||
@@ -3,7 +3,7 @@
|
|||||||
<parent>
|
<parent>
|
||||||
<artifactId>abstracto-modules</artifactId>
|
<artifactId>abstracto-modules</artifactId>
|
||||||
<groupId>dev.sheldan.abstracto.modules</groupId>
|
<groupId>dev.sheldan.abstracto.modules</groupId>
|
||||||
<version>1.6.10-SNAPSHOT</version>
|
<version>1.6.15-SNAPSHOT</version>
|
||||||
</parent>
|
</parent>
|
||||||
<modelVersion>4.0.0</modelVersion>
|
<modelVersion>4.0.0</modelVersion>
|
||||||
|
|
||||||
|
|||||||
@@ -3,7 +3,7 @@
|
|||||||
<parent>
|
<parent>
|
||||||
<artifactId>profanity-filter</artifactId>
|
<artifactId>profanity-filter</artifactId>
|
||||||
<groupId>dev.sheldan.abstracto.modules</groupId>
|
<groupId>dev.sheldan.abstracto.modules</groupId>
|
||||||
<version>1.6.10-SNAPSHOT</version>
|
<version>1.6.15-SNAPSHOT</version>
|
||||||
</parent>
|
</parent>
|
||||||
<modelVersion>4.0.0</modelVersion>
|
<modelVersion>4.0.0</modelVersion>
|
||||||
|
|
||||||
|
|||||||
@@ -3,7 +3,7 @@
|
|||||||
<parent>
|
<parent>
|
||||||
<groupId>dev.sheldan.abstracto.modules</groupId>
|
<groupId>dev.sheldan.abstracto.modules</groupId>
|
||||||
<artifactId>profanity-filter</artifactId>
|
<artifactId>profanity-filter</artifactId>
|
||||||
<version>1.6.10-SNAPSHOT</version>
|
<version>1.6.15-SNAPSHOT</version>
|
||||||
</parent>
|
</parent>
|
||||||
<modelVersion>4.0.0</modelVersion>
|
<modelVersion>4.0.0</modelVersion>
|
||||||
|
|
||||||
|
|||||||
@@ -3,7 +3,7 @@
|
|||||||
<parent>
|
<parent>
|
||||||
<artifactId>abstracto-modules</artifactId>
|
<artifactId>abstracto-modules</artifactId>
|
||||||
<groupId>dev.sheldan.abstracto.modules</groupId>
|
<groupId>dev.sheldan.abstracto.modules</groupId>
|
||||||
<version>1.6.10-SNAPSHOT</version>
|
<version>1.6.15-SNAPSHOT</version>
|
||||||
</parent>
|
</parent>
|
||||||
<modelVersion>4.0.0</modelVersion>
|
<modelVersion>4.0.0</modelVersion>
|
||||||
|
|
||||||
|
|||||||
@@ -3,7 +3,7 @@
|
|||||||
<parent>
|
<parent>
|
||||||
<artifactId>remind</artifactId>
|
<artifactId>remind</artifactId>
|
||||||
<groupId>dev.sheldan.abstracto.modules</groupId>
|
<groupId>dev.sheldan.abstracto.modules</groupId>
|
||||||
<version>1.6.10-SNAPSHOT</version>
|
<version>1.6.15-SNAPSHOT</version>
|
||||||
</parent>
|
</parent>
|
||||||
<modelVersion>4.0.0</modelVersion>
|
<modelVersion>4.0.0</modelVersion>
|
||||||
|
|
||||||
|
|||||||
@@ -223,6 +223,9 @@ public class RemindServiceBean implements ReminderService {
|
|||||||
.builder()
|
.builder()
|
||||||
.reminderParticipants(participantsDisplays)
|
.reminderParticipants(participantsDisplays)
|
||||||
.reminderDisplay(reminderDisplay)
|
.reminderDisplay(reminderDisplay)
|
||||||
|
.serverId(reminder.getServer().getId())
|
||||||
|
.channelId(reminder.getChannel().getId())
|
||||||
|
.messageId(reminder.getMessageId())
|
||||||
.userDisplay(UserDisplay.fromUser(member.getUser()))
|
.userDisplay(UserDisplay.fromUser(member.getUser()))
|
||||||
.duration(Duration.between(reminder.getReminderDate(), reminder.getTargetDate()))
|
.duration(Duration.between(reminder.getReminderDate(), reminder.getTargetDate()))
|
||||||
.build();
|
.build();
|
||||||
|
|||||||
@@ -3,7 +3,7 @@
|
|||||||
<parent>
|
<parent>
|
||||||
<artifactId>remind</artifactId>
|
<artifactId>remind</artifactId>
|
||||||
<groupId>dev.sheldan.abstracto.modules</groupId>
|
<groupId>dev.sheldan.abstracto.modules</groupId>
|
||||||
<version>1.6.10-SNAPSHOT</version>
|
<version>1.6.15-SNAPSHOT</version>
|
||||||
</parent>
|
</parent>
|
||||||
<modelVersion>4.0.0</modelVersion>
|
<modelVersion>4.0.0</modelVersion>
|
||||||
|
|
||||||
|
|||||||
@@ -3,7 +3,7 @@
|
|||||||
<parent>
|
<parent>
|
||||||
<artifactId>abstracto-modules</artifactId>
|
<artifactId>abstracto-modules</artifactId>
|
||||||
<groupId>dev.sheldan.abstracto.modules</groupId>
|
<groupId>dev.sheldan.abstracto.modules</groupId>
|
||||||
<version>1.6.10-SNAPSHOT</version>
|
<version>1.6.15-SNAPSHOT</version>
|
||||||
</parent>
|
</parent>
|
||||||
<modelVersion>4.0.0</modelVersion>
|
<modelVersion>4.0.0</modelVersion>
|
||||||
|
|
||||||
|
|||||||
@@ -3,7 +3,7 @@
|
|||||||
<parent>
|
<parent>
|
||||||
<artifactId>repost-detection</artifactId>
|
<artifactId>repost-detection</artifactId>
|
||||||
<groupId>dev.sheldan.abstracto.modules</groupId>
|
<groupId>dev.sheldan.abstracto.modules</groupId>
|
||||||
<version>1.6.10-SNAPSHOT</version>
|
<version>1.6.15-SNAPSHOT</version>
|
||||||
</parent>
|
</parent>
|
||||||
<modelVersion>4.0.0</modelVersion>
|
<modelVersion>4.0.0</modelVersion>
|
||||||
|
|
||||||
|
|||||||
@@ -3,7 +3,7 @@
|
|||||||
<parent>
|
<parent>
|
||||||
<artifactId>repost-detection</artifactId>
|
<artifactId>repost-detection</artifactId>
|
||||||
<groupId>dev.sheldan.abstracto.modules</groupId>
|
<groupId>dev.sheldan.abstracto.modules</groupId>
|
||||||
<version>1.6.10-SNAPSHOT</version>
|
<version>1.6.15-SNAPSHOT</version>
|
||||||
</parent>
|
</parent>
|
||||||
<modelVersion>4.0.0</modelVersion>
|
<modelVersion>4.0.0</modelVersion>
|
||||||
|
|
||||||
|
|||||||
@@ -3,7 +3,7 @@
|
|||||||
<parent>
|
<parent>
|
||||||
<artifactId>abstracto-modules</artifactId>
|
<artifactId>abstracto-modules</artifactId>
|
||||||
<groupId>dev.sheldan.abstracto.modules</groupId>
|
<groupId>dev.sheldan.abstracto.modules</groupId>
|
||||||
<version>1.6.10-SNAPSHOT</version>
|
<version>1.6.15-SNAPSHOT</version>
|
||||||
</parent>
|
</parent>
|
||||||
<modelVersion>4.0.0</modelVersion>
|
<modelVersion>4.0.0</modelVersion>
|
||||||
|
|
||||||
|
|||||||
@@ -3,7 +3,7 @@
|
|||||||
<parent>
|
<parent>
|
||||||
<artifactId>starboard</artifactId>
|
<artifactId>starboard</artifactId>
|
||||||
<groupId>dev.sheldan.abstracto.modules</groupId>
|
<groupId>dev.sheldan.abstracto.modules</groupId>
|
||||||
<version>1.6.10-SNAPSHOT</version>
|
<version>1.6.15-SNAPSHOT</version>
|
||||||
</parent>
|
</parent>
|
||||||
<modelVersion>4.0.0</modelVersion>
|
<modelVersion>4.0.0</modelVersion>
|
||||||
|
|
||||||
|
|||||||
@@ -3,7 +3,7 @@
|
|||||||
<parent>
|
<parent>
|
||||||
<artifactId>starboard</artifactId>
|
<artifactId>starboard</artifactId>
|
||||||
<groupId>dev.sheldan.abstracto.modules</groupId>
|
<groupId>dev.sheldan.abstracto.modules</groupId>
|
||||||
<version>1.6.10-SNAPSHOT</version>
|
<version>1.6.15-SNAPSHOT</version>
|
||||||
</parent>
|
</parent>
|
||||||
<modelVersion>4.0.0</modelVersion>
|
<modelVersion>4.0.0</modelVersion>
|
||||||
|
|
||||||
|
|||||||
@@ -3,7 +3,7 @@
|
|||||||
<parent>
|
<parent>
|
||||||
<groupId>dev.sheldan.abstracto.modules</groupId>
|
<groupId>dev.sheldan.abstracto.modules</groupId>
|
||||||
<artifactId>abstracto-modules</artifactId>
|
<artifactId>abstracto-modules</artifactId>
|
||||||
<version>1.6.10-SNAPSHOT</version>
|
<version>1.6.15-SNAPSHOT</version>
|
||||||
</parent>
|
</parent>
|
||||||
<modelVersion>4.0.0</modelVersion>
|
<modelVersion>4.0.0</modelVersion>
|
||||||
|
|
||||||
|
|||||||
@@ -3,7 +3,7 @@
|
|||||||
<parent>
|
<parent>
|
||||||
<groupId>dev.sheldan.abstracto.modules</groupId>
|
<groupId>dev.sheldan.abstracto.modules</groupId>
|
||||||
<artifactId>statistic</artifactId>
|
<artifactId>statistic</artifactId>
|
||||||
<version>1.6.10-SNAPSHOT</version>
|
<version>1.6.15-SNAPSHOT</version>
|
||||||
</parent>
|
</parent>
|
||||||
<modelVersion>4.0.0</modelVersion>
|
<modelVersion>4.0.0</modelVersion>
|
||||||
|
|
||||||
|
|||||||
@@ -3,7 +3,7 @@
|
|||||||
<parent>
|
<parent>
|
||||||
<groupId>dev.sheldan.abstracto.modules</groupId>
|
<groupId>dev.sheldan.abstracto.modules</groupId>
|
||||||
<artifactId>statistic</artifactId>
|
<artifactId>statistic</artifactId>
|
||||||
<version>1.6.10-SNAPSHOT</version>
|
<version>1.6.15-SNAPSHOT</version>
|
||||||
</parent>
|
</parent>
|
||||||
<modelVersion>4.0.0</modelVersion>
|
<modelVersion>4.0.0</modelVersion>
|
||||||
|
|
||||||
|
|||||||
@@ -3,7 +3,7 @@
|
|||||||
<parent>
|
<parent>
|
||||||
<artifactId>abstracto-modules</artifactId>
|
<artifactId>abstracto-modules</artifactId>
|
||||||
<groupId>dev.sheldan.abstracto.modules</groupId>
|
<groupId>dev.sheldan.abstracto.modules</groupId>
|
||||||
<version>1.6.10-SNAPSHOT</version>
|
<version>1.6.15-SNAPSHOT</version>
|
||||||
</parent>
|
</parent>
|
||||||
<modelVersion>4.0.0</modelVersion>
|
<modelVersion>4.0.0</modelVersion>
|
||||||
|
|
||||||
|
|||||||
@@ -4,7 +4,7 @@
|
|||||||
<parent>
|
<parent>
|
||||||
<groupId>dev.sheldan.abstracto.modules</groupId>
|
<groupId>dev.sheldan.abstracto.modules</groupId>
|
||||||
<artifactId>sticky-roles</artifactId>
|
<artifactId>sticky-roles</artifactId>
|
||||||
<version>1.6.10-SNAPSHOT</version>
|
<version>1.6.15-SNAPSHOT</version>
|
||||||
</parent>
|
</parent>
|
||||||
|
|
||||||
<artifactId>sticky-roles-impl</artifactId>
|
<artifactId>sticky-roles-impl</artifactId>
|
||||||
|
|||||||
@@ -11,7 +11,6 @@ import dev.sheldan.abstracto.core.interaction.InteractionService;
|
|||||||
import dev.sheldan.abstracto.core.interaction.slash.SlashCommandConfig;
|
import dev.sheldan.abstracto.core.interaction.slash.SlashCommandConfig;
|
||||||
import dev.sheldan.abstracto.core.interaction.slash.SlashCommandPrivilegeLevels;
|
import dev.sheldan.abstracto.core.interaction.slash.SlashCommandPrivilegeLevels;
|
||||||
import dev.sheldan.abstracto.core.interaction.slash.parameter.SlashCommandParameterService;
|
import dev.sheldan.abstracto.core.interaction.slash.parameter.SlashCommandParameterService;
|
||||||
import dev.sheldan.abstracto.core.service.UserService;
|
|
||||||
import dev.sheldan.abstracto.stickyroles.config.StickyRolesFeatureDefinition;
|
import dev.sheldan.abstracto.stickyroles.config.StickyRolesFeatureDefinition;
|
||||||
import dev.sheldan.abstracto.stickyroles.config.StickyRolesSlashCommandNames;
|
import dev.sheldan.abstracto.stickyroles.config.StickyRolesSlashCommandNames;
|
||||||
import dev.sheldan.abstracto.stickyroles.service.StickyRoleService;
|
import dev.sheldan.abstracto.stickyroles.service.StickyRoleService;
|
||||||
@@ -19,10 +18,8 @@ import lombok.extern.slf4j.Slf4j;
|
|||||||
import net.dv8tion.jda.api.entities.Member;
|
import net.dv8tion.jda.api.entities.Member;
|
||||||
import net.dv8tion.jda.api.entities.User;
|
import net.dv8tion.jda.api.entities.User;
|
||||||
import net.dv8tion.jda.api.events.interaction.command.SlashCommandInteractionEvent;
|
import net.dv8tion.jda.api.events.interaction.command.SlashCommandInteractionEvent;
|
||||||
import net.dv8tion.jda.api.interactions.commands.OptionType;
|
|
||||||
import org.springframework.beans.factory.annotation.Autowired;
|
import org.springframework.beans.factory.annotation.Autowired;
|
||||||
import org.springframework.stereotype.Component;
|
import org.springframework.stereotype.Component;
|
||||||
import org.springframework.transaction.annotation.Transactional;
|
|
||||||
|
|
||||||
import java.util.Arrays;
|
import java.util.Arrays;
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
@@ -47,34 +44,18 @@ public class ToggleStickinessManagement extends AbstractConditionableCommand {
|
|||||||
@Autowired
|
@Autowired
|
||||||
private StickyRoleService stickyRoleService;
|
private StickyRoleService stickyRoleService;
|
||||||
|
|
||||||
@Autowired
|
|
||||||
private UserService userService;
|
|
||||||
|
|
||||||
@Autowired
|
|
||||||
private ToggleStickinessManagement self;
|
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public CompletableFuture<CommandResult> executeSlash(SlashCommandInteractionEvent event) {
|
public CompletableFuture<CommandResult> executeSlash(SlashCommandInteractionEvent event) {
|
||||||
Boolean newState = slashCommandParameterService.getCommandOption(STICKY_PARAMETER_NAME, event, Boolean.class);
|
Boolean newState = slashCommandParameterService.getCommandOption(STICKY_PARAMETER_NAME, event, Boolean.class);
|
||||||
if(slashCommandParameterService.hasCommandOptionWithFullType(MEMBER_PARAMETER_NAME, event, OptionType.USER)) {
|
Member targetMember = slashCommandParameterService.getCommandOption(MEMBER_PARAMETER_NAME, event, User.class, Member.class);
|
||||||
Member targetMember = slashCommandParameterService.getCommandOption(MEMBER_PARAMETER_NAME, event, User.class, Member.class);
|
User targetUser = slashCommandParameterService.getCommandOption(MEMBER_PARAMETER_NAME, event, User.class, User.class);
|
||||||
|
if(targetMember != null) {
|
||||||
stickyRoleService.setStickiness(targetMember, newState);
|
stickyRoleService.setStickiness(targetMember, newState);
|
||||||
return interactionService.replyEmbed(RESPONSE_TEMPLATE, event)
|
|
||||||
.thenApply(interactionHook -> CommandResult.fromSuccess());
|
|
||||||
} else {
|
} else {
|
||||||
String userIdStr = slashCommandParameterService.getCommandOption(MEMBER_PARAMETER_NAME, event, User.class, String.class);
|
stickyRoleService.setStickiness(targetUser, event.getGuild(), newState);
|
||||||
Long userId = Long.parseLong(userIdStr);
|
|
||||||
return userService.retrieveUserForId(userId).thenCompose(user -> {
|
|
||||||
self.callService(event, user, newState);
|
|
||||||
return interactionService.replyEmbed(RESPONSE_TEMPLATE, event);
|
|
||||||
}).thenApply(interactionHook -> CommandResult.fromSuccess());
|
|
||||||
}
|
}
|
||||||
}
|
return interactionService.replyEmbed(RESPONSE_TEMPLATE, event)
|
||||||
|
.thenApply(interactionHook -> CommandResult.fromSuccess());
|
||||||
|
|
||||||
@Transactional
|
|
||||||
public void callService(SlashCommandInteractionEvent event, User user, Boolean newState) {
|
|
||||||
stickyRoleService.setStickiness(user, event.getGuild(), newState);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
|
|||||||
@@ -4,7 +4,7 @@
|
|||||||
<parent>
|
<parent>
|
||||||
<groupId>dev.sheldan.abstracto.modules</groupId>
|
<groupId>dev.sheldan.abstracto.modules</groupId>
|
||||||
<artifactId>sticky-roles</artifactId>
|
<artifactId>sticky-roles</artifactId>
|
||||||
<version>1.6.10-SNAPSHOT</version>
|
<version>1.6.15-SNAPSHOT</version>
|
||||||
</parent>
|
</parent>
|
||||||
|
|
||||||
<artifactId>sticky-roles-int</artifactId>
|
<artifactId>sticky-roles-int</artifactId>
|
||||||
|
|||||||
@@ -3,7 +3,7 @@
|
|||||||
<parent>
|
<parent>
|
||||||
<artifactId>abstracto-modules</artifactId>
|
<artifactId>abstracto-modules</artifactId>
|
||||||
<groupId>dev.sheldan.abstracto.modules</groupId>
|
<groupId>dev.sheldan.abstracto.modules</groupId>
|
||||||
<version>1.6.10-SNAPSHOT</version>
|
<version>1.6.15-SNAPSHOT</version>
|
||||||
</parent>
|
</parent>
|
||||||
<modelVersion>4.0.0</modelVersion>
|
<modelVersion>4.0.0</modelVersion>
|
||||||
|
|
||||||
|
|||||||
@@ -3,7 +3,7 @@
|
|||||||
<parent>
|
<parent>
|
||||||
<artifactId>suggestion</artifactId>
|
<artifactId>suggestion</artifactId>
|
||||||
<groupId>dev.sheldan.abstracto.modules</groupId>
|
<groupId>dev.sheldan.abstracto.modules</groupId>
|
||||||
<version>1.6.10-SNAPSHOT</version>
|
<version>1.6.15-SNAPSHOT</version>
|
||||||
</parent>
|
</parent>
|
||||||
<modelVersion>4.0.0</modelVersion>
|
<modelVersion>4.0.0</modelVersion>
|
||||||
|
|
||||||
|
|||||||
@@ -3,7 +3,7 @@
|
|||||||
<parent>
|
<parent>
|
||||||
<artifactId>suggestion</artifactId>
|
<artifactId>suggestion</artifactId>
|
||||||
<groupId>dev.sheldan.abstracto.modules</groupId>
|
<groupId>dev.sheldan.abstracto.modules</groupId>
|
||||||
<version>1.6.10-SNAPSHOT</version>
|
<version>1.6.15-SNAPSHOT</version>
|
||||||
</parent>
|
</parent>
|
||||||
<modelVersion>4.0.0</modelVersion>
|
<modelVersion>4.0.0</modelVersion>
|
||||||
|
|
||||||
|
|||||||
@@ -3,7 +3,7 @@
|
|||||||
<parent>
|
<parent>
|
||||||
<artifactId>abstracto-modules</artifactId>
|
<artifactId>abstracto-modules</artifactId>
|
||||||
<groupId>dev.sheldan.abstracto.modules</groupId>
|
<groupId>dev.sheldan.abstracto.modules</groupId>
|
||||||
<version>1.6.10-SNAPSHOT</version>
|
<version>1.6.15-SNAPSHOT</version>
|
||||||
</parent>
|
</parent>
|
||||||
<modelVersion>4.0.0</modelVersion>
|
<modelVersion>4.0.0</modelVersion>
|
||||||
|
|
||||||
|
|||||||
@@ -3,7 +3,7 @@
|
|||||||
<parent>
|
<parent>
|
||||||
<artifactId>twitch</artifactId>
|
<artifactId>twitch</artifactId>
|
||||||
<groupId>dev.sheldan.abstracto.modules</groupId>
|
<groupId>dev.sheldan.abstracto.modules</groupId>
|
||||||
<version>1.6.10-SNAPSHOT</version>
|
<version>1.6.15-SNAPSHOT</version>
|
||||||
</parent>
|
</parent>
|
||||||
<modelVersion>4.0.0</modelVersion>
|
<modelVersion>4.0.0</modelVersion>
|
||||||
|
|
||||||
|
|||||||
@@ -3,7 +3,7 @@
|
|||||||
<parent>
|
<parent>
|
||||||
<groupId>dev.sheldan.abstracto.modules</groupId>
|
<groupId>dev.sheldan.abstracto.modules</groupId>
|
||||||
<artifactId>twitch</artifactId>
|
<artifactId>twitch</artifactId>
|
||||||
<version>1.6.10-SNAPSHOT</version>
|
<version>1.6.15-SNAPSHOT</version>
|
||||||
</parent>
|
</parent>
|
||||||
<modelVersion>4.0.0</modelVersion>
|
<modelVersion>4.0.0</modelVersion>
|
||||||
|
|
||||||
|
|||||||
@@ -3,7 +3,7 @@
|
|||||||
<parent>
|
<parent>
|
||||||
<groupId>dev.sheldan.abstracto.modules</groupId>
|
<groupId>dev.sheldan.abstracto.modules</groupId>
|
||||||
<artifactId>abstracto-modules</artifactId>
|
<artifactId>abstracto-modules</artifactId>
|
||||||
<version>1.6.10-SNAPSHOT</version>
|
<version>1.6.15-SNAPSHOT</version>
|
||||||
</parent>
|
</parent>
|
||||||
<modelVersion>4.0.0</modelVersion>
|
<modelVersion>4.0.0</modelVersion>
|
||||||
|
|
||||||
|
|||||||
@@ -3,7 +3,7 @@
|
|||||||
<parent>
|
<parent>
|
||||||
<groupId>dev.sheldan.abstracto.modules</groupId>
|
<groupId>dev.sheldan.abstracto.modules</groupId>
|
||||||
<artifactId>utility</artifactId>
|
<artifactId>utility</artifactId>
|
||||||
<version>1.6.10-SNAPSHOT</version>
|
<version>1.6.15-SNAPSHOT</version>
|
||||||
</parent>
|
</parent>
|
||||||
<modelVersion>4.0.0</modelVersion>
|
<modelVersion>4.0.0</modelVersion>
|
||||||
|
|
||||||
|
|||||||
@@ -3,7 +3,7 @@
|
|||||||
<parent>
|
<parent>
|
||||||
<groupId>dev.sheldan.abstracto.modules</groupId>
|
<groupId>dev.sheldan.abstracto.modules</groupId>
|
||||||
<artifactId>utility</artifactId>
|
<artifactId>utility</artifactId>
|
||||||
<version>1.6.10-SNAPSHOT</version>
|
<version>1.6.15-SNAPSHOT</version>
|
||||||
</parent>
|
</parent>
|
||||||
<modelVersion>4.0.0</modelVersion>
|
<modelVersion>4.0.0</modelVersion>
|
||||||
|
|
||||||
|
|||||||
@@ -3,7 +3,7 @@
|
|||||||
<parent>
|
<parent>
|
||||||
<artifactId>abstracto-modules</artifactId>
|
<artifactId>abstracto-modules</artifactId>
|
||||||
<groupId>dev.sheldan.abstracto.modules</groupId>
|
<groupId>dev.sheldan.abstracto.modules</groupId>
|
||||||
<version>1.6.10-SNAPSHOT</version>
|
<version>1.6.15-SNAPSHOT</version>
|
||||||
</parent>
|
</parent>
|
||||||
<modelVersion>4.0.0</modelVersion>
|
<modelVersion>4.0.0</modelVersion>
|
||||||
|
|
||||||
|
|||||||
@@ -3,7 +3,7 @@
|
|||||||
<parent>
|
<parent>
|
||||||
<groupId>dev.sheldan.abstracto.modules</groupId>
|
<groupId>dev.sheldan.abstracto.modules</groupId>
|
||||||
<artifactId>voice-channel-context</artifactId>
|
<artifactId>voice-channel-context</artifactId>
|
||||||
<version>1.6.10-SNAPSHOT</version>
|
<version>1.6.15-SNAPSHOT</version>
|
||||||
</parent>
|
</parent>
|
||||||
<modelVersion>4.0.0</modelVersion>
|
<modelVersion>4.0.0</modelVersion>
|
||||||
|
|
||||||
|
|||||||
@@ -3,7 +3,7 @@
|
|||||||
<parent>
|
<parent>
|
||||||
<groupId>dev.sheldan.abstracto.modules</groupId>
|
<groupId>dev.sheldan.abstracto.modules</groupId>
|
||||||
<artifactId>voice-channel-context</artifactId>
|
<artifactId>voice-channel-context</artifactId>
|
||||||
<version>1.6.10-SNAPSHOT</version>
|
<version>1.6.15-SNAPSHOT</version>
|
||||||
</parent>
|
</parent>
|
||||||
<modelVersion>4.0.0</modelVersion>
|
<modelVersion>4.0.0</modelVersion>
|
||||||
|
|
||||||
|
|||||||
@@ -3,7 +3,7 @@
|
|||||||
<parent>
|
<parent>
|
||||||
<groupId>dev.sheldan.abstracto.modules</groupId>
|
<groupId>dev.sheldan.abstracto.modules</groupId>
|
||||||
<artifactId>abstracto-modules</artifactId>
|
<artifactId>abstracto-modules</artifactId>
|
||||||
<version>1.6.10-SNAPSHOT</version>
|
<version>1.6.15-SNAPSHOT</version>
|
||||||
</parent>
|
</parent>
|
||||||
<modelVersion>4.0.0</modelVersion>
|
<modelVersion>4.0.0</modelVersion>
|
||||||
|
|
||||||
|
|||||||
@@ -3,7 +3,7 @@
|
|||||||
<parent>
|
<parent>
|
||||||
<groupId>dev.sheldan.abstracto.modules</groupId>
|
<groupId>dev.sheldan.abstracto.modules</groupId>
|
||||||
<artifactId>webservices</artifactId>
|
<artifactId>webservices</artifactId>
|
||||||
<version>1.6.10-SNAPSHOT</version>
|
<version>1.6.15-SNAPSHOT</version>
|
||||||
</parent>
|
</parent>
|
||||||
<modelVersion>4.0.0</modelVersion>
|
<modelVersion>4.0.0</modelVersion>
|
||||||
|
|
||||||
|
|||||||
@@ -39,7 +39,7 @@ public class WikipediaServiceBean implements WikipediaService {
|
|||||||
Response response = okHttpClient.newCall(request).execute();
|
Response response = okHttpClient.newCall(request).execute();
|
||||||
if(!response.isSuccessful()) {
|
if(!response.isSuccessful()) {
|
||||||
if(log.isDebugEnabled()) {
|
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());
|
response.code(), response.body());
|
||||||
}
|
}
|
||||||
throw new WikipediaRequestException(response.code());
|
throw new WikipediaRequestException(response.code());
|
||||||
|
|||||||
@@ -3,7 +3,7 @@
|
|||||||
<parent>
|
<parent>
|
||||||
<groupId>dev.sheldan.abstracto.modules</groupId>
|
<groupId>dev.sheldan.abstracto.modules</groupId>
|
||||||
<artifactId>webservices</artifactId>
|
<artifactId>webservices</artifactId>
|
||||||
<version>1.6.10-SNAPSHOT</version>
|
<version>1.6.15-SNAPSHOT</version>
|
||||||
</parent>
|
</parent>
|
||||||
<modelVersion>4.0.0</modelVersion>
|
<modelVersion>4.0.0</modelVersion>
|
||||||
|
|
||||||
|
|||||||
@@ -3,7 +3,7 @@
|
|||||||
<parent>
|
<parent>
|
||||||
<groupId>dev.sheldan.abstracto</groupId>
|
<groupId>dev.sheldan.abstracto</groupId>
|
||||||
<artifactId>abstracto-application</artifactId>
|
<artifactId>abstracto-application</artifactId>
|
||||||
<version>1.6.10-SNAPSHOT</version>
|
<version>1.6.15-SNAPSHOT</version>
|
||||||
</parent>
|
</parent>
|
||||||
<modelVersion>4.0.0</modelVersion>
|
<modelVersion>4.0.0</modelVersion>
|
||||||
|
|
||||||
|
|||||||
@@ -3,7 +3,7 @@
|
|||||||
<parent>
|
<parent>
|
||||||
<groupId>dev.sheldan.abstracto.core</groupId>
|
<groupId>dev.sheldan.abstracto.core</groupId>
|
||||||
<artifactId>core</artifactId>
|
<artifactId>core</artifactId>
|
||||||
<version>1.6.10-SNAPSHOT</version>
|
<version>1.6.15-SNAPSHOT</version>
|
||||||
</parent>
|
</parent>
|
||||||
<modelVersion>4.0.0</modelVersion>
|
<modelVersion>4.0.0</modelVersion>
|
||||||
<packaging>jar</packaging>
|
<packaging>jar</packaging>
|
||||||
|
|||||||
@@ -182,10 +182,8 @@ public class CommandReceivedHandler extends ListenerAdapter {
|
|||||||
}
|
}
|
||||||
|
|
||||||
public UnParsedCommandResult getUnparsedCommandResult(Message message) {
|
public UnParsedCommandResult getUnparsedCommandResult(Message message) {
|
||||||
String contentStripped = message.getContentRaw();
|
String commandName = getCommandName(message);
|
||||||
List<String> parameters = Arrays.asList(contentStripped.split(" "));
|
UnParsedCommandParameter unParsedParameter = new UnParsedCommandParameter(message.getContentRaw(), message);
|
||||||
UnParsedCommandParameter unParsedParameter = new UnParsedCommandParameter(contentStripped, message);
|
|
||||||
String commandName = commandManager.getCommandName(parameters.get(0), message.getGuild().getIdLong());
|
|
||||||
Command foundCommand = commandManager.findCommandByParameters(commandName, unParsedParameter, message.getGuild().getIdLong()).orElse(null);
|
Command foundCommand = commandManager.findCommandByParameters(commandName, unParsedParameter, message.getGuild().getIdLong()).orElse(null);
|
||||||
return UnParsedCommandResult
|
return UnParsedCommandResult
|
||||||
.builder()
|
.builder()
|
||||||
@@ -194,13 +192,9 @@ public class CommandReceivedHandler extends ListenerAdapter {
|
|||||||
.build();
|
.build();
|
||||||
}
|
}
|
||||||
|
|
||||||
public CompletableFuture<CommandParseResult> getParametersFromMessage(Message message) {
|
public String getCommandName(Message message) {
|
||||||
UnParsedCommandResult result = getUnparsedCommandResult(message);
|
List<String> parameters = Arrays.asList( message.getContentRaw().split(" "));
|
||||||
return getParsedParameters(result.getParameter(), result.getCommand(), message).thenApply(foundParameters -> CommandParseResult
|
return commandManager.getCommandName(parameters.get(0), message.getGuild().getIdLong());
|
||||||
.builder()
|
|
||||||
.command(result.getCommand())
|
|
||||||
.parameters(foundParameters)
|
|
||||||
.build());
|
|
||||||
}
|
}
|
||||||
|
|
||||||
public CompletableFuture<CommandParseResult> getParametersFromMessage(Message message, UnParsedCommandResult result) {
|
public CompletableFuture<CommandParseResult> getParametersFromMessage(Message message, UnParsedCommandResult result) {
|
||||||
|
|||||||
@@ -32,7 +32,7 @@ public class SetPrefix extends AbstractConditionableCommand {
|
|||||||
|
|
||||||
@Override
|
@Override
|
||||||
public CommandConfiguration getConfiguration() {
|
public CommandConfiguration getConfiguration() {
|
||||||
List<ParameterValidator> validators = Arrays.asList(MaxStringLengthValidator.max(10L));
|
List<ParameterValidator> validators = Arrays.asList(MaxStringLengthValidator.max(10));
|
||||||
Parameter newPrefixParameter = Parameter
|
Parameter newPrefixParameter = Parameter
|
||||||
.builder()
|
.builder()
|
||||||
.name("prefix")
|
.name("prefix")
|
||||||
|
|||||||
@@ -14,14 +14,18 @@ import dev.sheldan.abstracto.core.config.FeatureConfig;
|
|||||||
import dev.sheldan.abstracto.core.config.FeatureDefinition;
|
import dev.sheldan.abstracto.core.config.FeatureDefinition;
|
||||||
import dev.sheldan.abstracto.core.interaction.InteractionService;
|
import dev.sheldan.abstracto.core.interaction.InteractionService;
|
||||||
import dev.sheldan.abstracto.core.interaction.slash.SlashCommandPrivilegeLevels;
|
import dev.sheldan.abstracto.core.interaction.slash.SlashCommandPrivilegeLevels;
|
||||||
|
import dev.sheldan.abstracto.core.interaction.slash.parameter.SlashCommandAutoCompleteService;
|
||||||
|
import dev.sheldan.abstracto.core.models.database.AFeatureFlag;
|
||||||
import dev.sheldan.abstracto.core.models.database.AServer;
|
import dev.sheldan.abstracto.core.models.database.AServer;
|
||||||
import dev.sheldan.abstracto.core.models.template.commands.FeatureSwitchModel;
|
import dev.sheldan.abstracto.core.models.template.commands.FeatureSwitchModel;
|
||||||
import dev.sheldan.abstracto.core.service.FeatureConfigService;
|
import dev.sheldan.abstracto.core.service.FeatureConfigService;
|
||||||
import dev.sheldan.abstracto.core.service.FeatureFlagService;
|
import dev.sheldan.abstracto.core.service.FeatureFlagService;
|
||||||
import dev.sheldan.abstracto.core.interaction.slash.parameter.SlashCommandParameterService;
|
import dev.sheldan.abstracto.core.interaction.slash.parameter.SlashCommandParameterService;
|
||||||
|
import dev.sheldan.abstracto.core.service.management.FeatureFlagManagementService;
|
||||||
import dev.sheldan.abstracto.core.service.management.ServerManagementService;
|
import dev.sheldan.abstracto.core.service.management.ServerManagementService;
|
||||||
import dev.sheldan.abstracto.core.templating.model.MessageToSend;
|
import dev.sheldan.abstracto.core.templating.model.MessageToSend;
|
||||||
import dev.sheldan.abstracto.core.templating.service.TemplateService;
|
import dev.sheldan.abstracto.core.templating.service.TemplateService;
|
||||||
|
import net.dv8tion.jda.api.events.interaction.command.CommandAutoCompleteInteractionEvent;
|
||||||
import net.dv8tion.jda.api.events.interaction.command.SlashCommandInteractionEvent;
|
import net.dv8tion.jda.api.events.interaction.command.SlashCommandInteractionEvent;
|
||||||
import org.springframework.beans.factory.annotation.Autowired;
|
import org.springframework.beans.factory.annotation.Autowired;
|
||||||
import org.springframework.stereotype.Component;
|
import org.springframework.stereotype.Component;
|
||||||
@@ -54,6 +58,12 @@ public class DisableFeature extends AbstractConditionableCommand {
|
|||||||
@Autowired
|
@Autowired
|
||||||
private InteractionService interactionService;
|
private InteractionService interactionService;
|
||||||
|
|
||||||
|
@Autowired
|
||||||
|
private SlashCommandAutoCompleteService slashCommandAutoCompleteService;
|
||||||
|
|
||||||
|
@Autowired
|
||||||
|
private FeatureFlagManagementService featureFlagManagementService;
|
||||||
|
|
||||||
private static final String DISABLE_FEATURE_DEPENDENCIES_RESPONSE_TEMPLATE_KEY = "disableFeature_feature_dependencies_response";
|
private static final String DISABLE_FEATURE_DEPENDENCIES_RESPONSE_TEMPLATE_KEY = "disableFeature_feature_dependencies_response";
|
||||||
private static final String DISABLE_FEATURE_RESPONSE_TEMPLATE_KEY = "disableFeature_response";
|
private static final String DISABLE_FEATURE_RESPONSE_TEMPLATE_KEY = "disableFeature_response";
|
||||||
private static final String FEATURE_NAME_PARAMETER = "featureName";
|
private static final String FEATURE_NAME_PARAMETER = "featureName";
|
||||||
@@ -99,6 +109,21 @@ public class DisableFeature extends AbstractConditionableCommand {
|
|||||||
return featureDependencies;
|
return featureDependencies;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public List<String> performAutoComplete(CommandAutoCompleteInteractionEvent event) {
|
||||||
|
if(slashCommandAutoCompleteService.matchesParameter(event.getFocusedOption(), FEATURE_NAME_PARAMETER)) {
|
||||||
|
String input = event.getFocusedOption().getValue().toLowerCase();
|
||||||
|
AServer server = serverManagementService.loadServer(event.getGuild());
|
||||||
|
return featureFlagManagementService.getFeatureFlagsOfServer(server)
|
||||||
|
.stream()
|
||||||
|
.filter(AFeatureFlag::isEnabled)
|
||||||
|
.map(aFeatureFlag -> aFeatureFlag.getFeature().getKey().toLowerCase())
|
||||||
|
.filter(featureName -> featureName.toLowerCase().startsWith(input))
|
||||||
|
.toList();
|
||||||
|
}
|
||||||
|
return new ArrayList<>();
|
||||||
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public CommandConfiguration getConfiguration() {
|
public CommandConfiguration getConfiguration() {
|
||||||
Parameter featureName = Parameter
|
Parameter featureName = Parameter
|
||||||
@@ -106,6 +131,7 @@ public class DisableFeature extends AbstractConditionableCommand {
|
|||||||
.name(FEATURE_NAME_PARAMETER)
|
.name(FEATURE_NAME_PARAMETER)
|
||||||
.templated(true)
|
.templated(true)
|
||||||
.type(String.class)
|
.type(String.class)
|
||||||
|
.supportsAutoComplete(true)
|
||||||
.build();
|
.build();
|
||||||
List<Parameter> parameters = Arrays.asList(featureName);
|
List<Parameter> parameters = Arrays.asList(featureName);
|
||||||
|
|
||||||
|
|||||||
@@ -1,5 +1,6 @@
|
|||||||
package dev.sheldan.abstracto.core.commands.config.features;
|
package dev.sheldan.abstracto.core.commands.config.features;
|
||||||
|
|
||||||
|
import dev.sheldan.abstracto.core.command.service.management.FeatureManagementService;
|
||||||
import dev.sheldan.abstracto.core.interaction.slash.CoreSlashCommandNames;
|
import dev.sheldan.abstracto.core.interaction.slash.CoreSlashCommandNames;
|
||||||
import dev.sheldan.abstracto.core.command.condition.AbstractConditionableCommand;
|
import dev.sheldan.abstracto.core.command.condition.AbstractConditionableCommand;
|
||||||
import dev.sheldan.abstracto.core.command.config.CommandConfiguration;
|
import dev.sheldan.abstracto.core.command.config.CommandConfiguration;
|
||||||
@@ -13,11 +14,19 @@ import dev.sheldan.abstracto.core.config.FeatureDefinition;
|
|||||||
import dev.sheldan.abstracto.core.config.FeatureMode;
|
import dev.sheldan.abstracto.core.config.FeatureMode;
|
||||||
import dev.sheldan.abstracto.core.interaction.InteractionService;
|
import dev.sheldan.abstracto.core.interaction.InteractionService;
|
||||||
import dev.sheldan.abstracto.core.interaction.slash.SlashCommandPrivilegeLevels;
|
import dev.sheldan.abstracto.core.interaction.slash.SlashCommandPrivilegeLevels;
|
||||||
|
import dev.sheldan.abstracto.core.interaction.slash.parameter.SlashCommandAutoCompleteService;
|
||||||
|
import dev.sheldan.abstracto.core.models.database.AFeature;
|
||||||
|
import dev.sheldan.abstracto.core.models.database.AFeatureFlag;
|
||||||
|
import dev.sheldan.abstracto.core.models.database.AFeatureMode;
|
||||||
import dev.sheldan.abstracto.core.models.database.AServer;
|
import dev.sheldan.abstracto.core.models.database.AServer;
|
||||||
import dev.sheldan.abstracto.core.service.FeatureConfigService;
|
import dev.sheldan.abstracto.core.service.FeatureConfigService;
|
||||||
import dev.sheldan.abstracto.core.service.FeatureModeService;
|
import dev.sheldan.abstracto.core.service.FeatureModeService;
|
||||||
import dev.sheldan.abstracto.core.interaction.slash.parameter.SlashCommandParameterService;
|
import dev.sheldan.abstracto.core.interaction.slash.parameter.SlashCommandParameterService;
|
||||||
|
import dev.sheldan.abstracto.core.service.management.FeatureFlagManagementService;
|
||||||
|
import dev.sheldan.abstracto.core.service.management.FeatureModeManagementService;
|
||||||
import dev.sheldan.abstracto.core.service.management.ServerManagementService;
|
import dev.sheldan.abstracto.core.service.management.ServerManagementService;
|
||||||
|
import java.util.ArrayList;
|
||||||
|
import net.dv8tion.jda.api.events.interaction.command.CommandAutoCompleteInteractionEvent;
|
||||||
import net.dv8tion.jda.api.events.interaction.command.SlashCommandInteractionEvent;
|
import net.dv8tion.jda.api.events.interaction.command.SlashCommandInteractionEvent;
|
||||||
import org.springframework.beans.factory.annotation.Autowired;
|
import org.springframework.beans.factory.annotation.Autowired;
|
||||||
import org.springframework.stereotype.Component;
|
import org.springframework.stereotype.Component;
|
||||||
@@ -44,6 +53,18 @@ public class DisableMode extends AbstractConditionableCommand {
|
|||||||
@Autowired
|
@Autowired
|
||||||
private InteractionService interactionService;
|
private InteractionService interactionService;
|
||||||
|
|
||||||
|
@Autowired
|
||||||
|
private SlashCommandAutoCompleteService slashCommandAutoCompleteService;
|
||||||
|
|
||||||
|
@Autowired
|
||||||
|
private FeatureFlagManagementService featureFlagManagementService;
|
||||||
|
|
||||||
|
@Autowired
|
||||||
|
private FeatureModeManagementService featureModeManagementService;
|
||||||
|
|
||||||
|
@Autowired
|
||||||
|
private FeatureManagementService featureManagementService;
|
||||||
|
|
||||||
private static final String DISABLE_MODE_RESPONSE_KEY = "disableMode_response";
|
private static final String DISABLE_MODE_RESPONSE_KEY = "disableMode_response";
|
||||||
private static final String FEATURE_PARAMETER = "feature";
|
private static final String FEATURE_PARAMETER = "feature";
|
||||||
private static final String MODE_PARAMETER = "mode";
|
private static final String MODE_PARAMETER = "mode";
|
||||||
@@ -61,12 +82,41 @@ public class DisableMode extends AbstractConditionableCommand {
|
|||||||
.thenApply(interactionHook -> CommandResult.fromSuccess());
|
.thenApply(interactionHook -> CommandResult.fromSuccess());
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public List<String> performAutoComplete(CommandAutoCompleteInteractionEvent event) {
|
||||||
|
String input = event.getFocusedOption().getValue().toLowerCase();
|
||||||
|
AServer server = serverManagementService.loadServer(event.getGuild());
|
||||||
|
if(slashCommandAutoCompleteService.matchesParameter(event.getFocusedOption(), FEATURE_PARAMETER)) {
|
||||||
|
return featureFlagManagementService.getFeatureFlagsOfServer(server)
|
||||||
|
.stream()
|
||||||
|
.filter(AFeatureFlag::isEnabled)
|
||||||
|
.map(aFeatureFlag -> aFeatureFlag.getFeature().getKey().toLowerCase())
|
||||||
|
.filter(featureName -> featureName.toLowerCase().startsWith(input))
|
||||||
|
.toList();
|
||||||
|
} else if(slashCommandAutoCompleteService.matchesParameter(event.getFocusedOption(), MODE_PARAMETER)) {
|
||||||
|
String featureName = slashCommandParameterService.getCommandOption(FEATURE_PARAMETER, event, String.class);
|
||||||
|
if(featureName.isBlank()) {
|
||||||
|
return new ArrayList<>();
|
||||||
|
}
|
||||||
|
FeatureDefinition featureDefinition = featureConfigService.getFeatureEnum(featureName);
|
||||||
|
AFeature feature = featureManagementService.getFeature(featureDefinition.getKey());
|
||||||
|
List<AFeatureMode> modes = featureModeManagementService.getFeatureModesOfFeatureInServer(server, feature);
|
||||||
|
return modes
|
||||||
|
.stream()
|
||||||
|
.map(mode -> mode.getFeatureMode().toLowerCase())
|
||||||
|
.filter(string -> string.startsWith(input))
|
||||||
|
.toList();
|
||||||
|
}
|
||||||
|
return new ArrayList<>();
|
||||||
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public CommandConfiguration getConfiguration() {
|
public CommandConfiguration getConfiguration() {
|
||||||
Parameter featureName = Parameter
|
Parameter featureName = Parameter
|
||||||
.builder()
|
.builder()
|
||||||
.name(FEATURE_PARAMETER)
|
.name(FEATURE_PARAMETER)
|
||||||
.type(String.class)
|
.type(String.class)
|
||||||
|
.supportsAutoComplete(true)
|
||||||
.templated(true)
|
.templated(true)
|
||||||
.build();
|
.build();
|
||||||
|
|
||||||
@@ -74,6 +124,7 @@ public class DisableMode extends AbstractConditionableCommand {
|
|||||||
.builder()
|
.builder()
|
||||||
.name(MODE_PARAMETER)
|
.name(MODE_PARAMETER)
|
||||||
.type(String.class)
|
.type(String.class)
|
||||||
|
.supportsAutoComplete(true)
|
||||||
.templated(true)
|
.templated(true)
|
||||||
.build();
|
.build();
|
||||||
List<Parameter> parameters = Arrays.asList(featureName, mode);
|
List<Parameter> parameters = Arrays.asList(featureName, mode);
|
||||||
|
|||||||
@@ -14,6 +14,7 @@ import dev.sheldan.abstracto.core.config.FeatureConfig;
|
|||||||
import dev.sheldan.abstracto.core.config.FeatureDefinition;
|
import dev.sheldan.abstracto.core.config.FeatureDefinition;
|
||||||
import dev.sheldan.abstracto.core.interaction.InteractionService;
|
import dev.sheldan.abstracto.core.interaction.InteractionService;
|
||||||
import dev.sheldan.abstracto.core.interaction.slash.SlashCommandPrivilegeLevels;
|
import dev.sheldan.abstracto.core.interaction.slash.SlashCommandPrivilegeLevels;
|
||||||
|
import dev.sheldan.abstracto.core.interaction.slash.parameter.SlashCommandAutoCompleteService;
|
||||||
import dev.sheldan.abstracto.core.models.FeatureValidationResult;
|
import dev.sheldan.abstracto.core.models.FeatureValidationResult;
|
||||||
import dev.sheldan.abstracto.core.models.database.AServer;
|
import dev.sheldan.abstracto.core.models.database.AServer;
|
||||||
import dev.sheldan.abstracto.core.models.template.commands.FeatureSwitchModel;
|
import dev.sheldan.abstracto.core.models.template.commands.FeatureSwitchModel;
|
||||||
@@ -24,6 +25,7 @@ import dev.sheldan.abstracto.core.service.management.ServerManagementService;
|
|||||||
import dev.sheldan.abstracto.core.templating.model.MessageToSend;
|
import dev.sheldan.abstracto.core.templating.model.MessageToSend;
|
||||||
import dev.sheldan.abstracto.core.templating.service.TemplateService;
|
import dev.sheldan.abstracto.core.templating.service.TemplateService;
|
||||||
import lombok.extern.slf4j.Slf4j;
|
import lombok.extern.slf4j.Slf4j;
|
||||||
|
import net.dv8tion.jda.api.events.interaction.command.CommandAutoCompleteInteractionEvent;
|
||||||
import net.dv8tion.jda.api.events.interaction.command.SlashCommandInteractionEvent;
|
import net.dv8tion.jda.api.events.interaction.command.SlashCommandInteractionEvent;
|
||||||
import org.springframework.beans.factory.annotation.Autowired;
|
import org.springframework.beans.factory.annotation.Autowired;
|
||||||
import org.springframework.stereotype.Component;
|
import org.springframework.stereotype.Component;
|
||||||
@@ -56,6 +58,9 @@ public class EnableFeature extends AbstractConditionableCommand {
|
|||||||
@Autowired
|
@Autowired
|
||||||
private InteractionService interactionService;
|
private InteractionService interactionService;
|
||||||
|
|
||||||
|
@Autowired
|
||||||
|
private SlashCommandAutoCompleteService slashCommandAutoCompleteService;
|
||||||
|
|
||||||
private static final String ENABLE_FEATURE_DEPENDENCIES_RESPONSE_TEMPLATE_KEY = "enableFeature_feature_dependencies_response";
|
private static final String ENABLE_FEATURE_DEPENDENCIES_RESPONSE_TEMPLATE_KEY = "enableFeature_feature_dependencies_response";
|
||||||
private static final String ENABLE_FEATURE_RESPONSE_TEMPLATE_KEY = "enableFeature_response";
|
private static final String ENABLE_FEATURE_RESPONSE_TEMPLATE_KEY = "enableFeature_response";
|
||||||
private static final String FEATURE_NAME_PARAMETER = "featureName";
|
private static final String FEATURE_NAME_PARAMETER = "featureName";
|
||||||
@@ -114,12 +119,26 @@ public class EnableFeature extends AbstractConditionableCommand {
|
|||||||
return result;
|
return result;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public List<String> performAutoComplete(CommandAutoCompleteInteractionEvent event) {
|
||||||
|
if(slashCommandAutoCompleteService.matchesParameter(event.getFocusedOption(), FEATURE_NAME_PARAMETER)) {
|
||||||
|
String input = event.getFocusedOption().getValue().toLowerCase();
|
||||||
|
return featureConfigService.getAllFeatures()
|
||||||
|
.stream()
|
||||||
|
.map(String::toLowerCase)
|
||||||
|
.filter(lowerCase -> lowerCase.startsWith(input))
|
||||||
|
.toList();
|
||||||
|
}
|
||||||
|
return new ArrayList<>();
|
||||||
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public CommandConfiguration getConfiguration() {
|
public CommandConfiguration getConfiguration() {
|
||||||
Parameter featureName = Parameter
|
Parameter featureName = Parameter
|
||||||
.builder()
|
.builder()
|
||||||
.name(FEATURE_NAME_PARAMETER)
|
.name(FEATURE_NAME_PARAMETER)
|
||||||
.type(String.class)
|
.type(String.class)
|
||||||
|
.supportsAutoComplete(true)
|
||||||
.templated(true)
|
.templated(true)
|
||||||
.build();
|
.build();
|
||||||
List<Parameter> parameters = Arrays.asList(featureName);
|
List<Parameter> parameters = Arrays.asList(featureName);
|
||||||
|
|||||||
@@ -1,5 +1,6 @@
|
|||||||
package dev.sheldan.abstracto.core.commands.config.features;
|
package dev.sheldan.abstracto.core.commands.config.features;
|
||||||
|
|
||||||
|
import dev.sheldan.abstracto.core.command.service.management.FeatureManagementService;
|
||||||
import dev.sheldan.abstracto.core.interaction.slash.CoreSlashCommandNames;
|
import dev.sheldan.abstracto.core.interaction.slash.CoreSlashCommandNames;
|
||||||
import dev.sheldan.abstracto.core.command.condition.AbstractConditionableCommand;
|
import dev.sheldan.abstracto.core.command.condition.AbstractConditionableCommand;
|
||||||
import dev.sheldan.abstracto.core.command.config.CommandConfiguration;
|
import dev.sheldan.abstracto.core.command.config.CommandConfiguration;
|
||||||
@@ -13,11 +14,19 @@ import dev.sheldan.abstracto.core.config.FeatureDefinition;
|
|||||||
import dev.sheldan.abstracto.core.config.FeatureMode;
|
import dev.sheldan.abstracto.core.config.FeatureMode;
|
||||||
import dev.sheldan.abstracto.core.interaction.InteractionService;
|
import dev.sheldan.abstracto.core.interaction.InteractionService;
|
||||||
import dev.sheldan.abstracto.core.interaction.slash.SlashCommandPrivilegeLevels;
|
import dev.sheldan.abstracto.core.interaction.slash.SlashCommandPrivilegeLevels;
|
||||||
|
import dev.sheldan.abstracto.core.interaction.slash.parameter.SlashCommandAutoCompleteService;
|
||||||
|
import dev.sheldan.abstracto.core.models.database.AFeature;
|
||||||
|
import dev.sheldan.abstracto.core.models.database.AFeatureFlag;
|
||||||
|
import dev.sheldan.abstracto.core.models.database.AFeatureMode;
|
||||||
import dev.sheldan.abstracto.core.models.database.AServer;
|
import dev.sheldan.abstracto.core.models.database.AServer;
|
||||||
import dev.sheldan.abstracto.core.service.FeatureConfigService;
|
import dev.sheldan.abstracto.core.service.FeatureConfigService;
|
||||||
import dev.sheldan.abstracto.core.service.FeatureModeService;
|
import dev.sheldan.abstracto.core.service.FeatureModeService;
|
||||||
import dev.sheldan.abstracto.core.interaction.slash.parameter.SlashCommandParameterService;
|
import dev.sheldan.abstracto.core.interaction.slash.parameter.SlashCommandParameterService;
|
||||||
|
import dev.sheldan.abstracto.core.service.management.FeatureFlagManagementService;
|
||||||
|
import dev.sheldan.abstracto.core.service.management.FeatureModeManagementService;
|
||||||
import dev.sheldan.abstracto.core.service.management.ServerManagementService;
|
import dev.sheldan.abstracto.core.service.management.ServerManagementService;
|
||||||
|
import java.util.ArrayList;
|
||||||
|
import net.dv8tion.jda.api.events.interaction.command.CommandAutoCompleteInteractionEvent;
|
||||||
import net.dv8tion.jda.api.events.interaction.command.SlashCommandInteractionEvent;
|
import net.dv8tion.jda.api.events.interaction.command.SlashCommandInteractionEvent;
|
||||||
import org.springframework.beans.factory.annotation.Autowired;
|
import org.springframework.beans.factory.annotation.Autowired;
|
||||||
import org.springframework.stereotype.Component;
|
import org.springframework.stereotype.Component;
|
||||||
@@ -44,6 +53,18 @@ public class EnableMode extends AbstractConditionableCommand {
|
|||||||
@Autowired
|
@Autowired
|
||||||
private ServerManagementService serverManagementService;
|
private ServerManagementService serverManagementService;
|
||||||
|
|
||||||
|
@Autowired
|
||||||
|
private SlashCommandAutoCompleteService slashCommandAutoCompleteService;
|
||||||
|
|
||||||
|
@Autowired
|
||||||
|
private FeatureFlagManagementService featureFlagManagementService;
|
||||||
|
|
||||||
|
@Autowired
|
||||||
|
private FeatureModeManagementService featureModeManagementService;
|
||||||
|
|
||||||
|
@Autowired
|
||||||
|
private FeatureManagementService featureManagementService;
|
||||||
|
|
||||||
private static final String ENABLE_MODE_RESPONSE_KEY = "enableMode_response";
|
private static final String ENABLE_MODE_RESPONSE_KEY = "enableMode_response";
|
||||||
private static final String FEATURE_PARAMETER = "feature";
|
private static final String FEATURE_PARAMETER = "feature";
|
||||||
private static final String MODE_PARAMETER = "mode";
|
private static final String MODE_PARAMETER = "mode";
|
||||||
@@ -61,16 +82,49 @@ public class EnableMode extends AbstractConditionableCommand {
|
|||||||
.thenApply(interactionHook -> CommandResult.fromSuccess());
|
.thenApply(interactionHook -> CommandResult.fromSuccess());
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public List<String> performAutoComplete(CommandAutoCompleteInteractionEvent event) {
|
||||||
|
AServer server = serverManagementService.loadServer(event.getGuild());
|
||||||
|
String input = event.getFocusedOption().getValue().toLowerCase();
|
||||||
|
if(slashCommandAutoCompleteService.matchesParameter(event.getFocusedOption(), FEATURE_PARAMETER)) {
|
||||||
|
return featureFlagManagementService.getFeatureFlagsOfServer(server)
|
||||||
|
.stream()
|
||||||
|
.filter(AFeatureFlag::isEnabled)
|
||||||
|
.map(aFeatureFlag -> aFeatureFlag.getFeature().getKey().toLowerCase())
|
||||||
|
.filter(featureName -> featureName.toLowerCase().startsWith(input))
|
||||||
|
.toList();
|
||||||
|
} else if(slashCommandAutoCompleteService.matchesParameter(event.getFocusedOption(), MODE_PARAMETER)) {
|
||||||
|
String featureName = slashCommandParameterService.getCommandOption(FEATURE_PARAMETER, event, String.class);
|
||||||
|
if(featureName.isBlank()) {
|
||||||
|
return new ArrayList<>();
|
||||||
|
}
|
||||||
|
FeatureDefinition featureDefinition = featureConfigService.getFeatureEnum(featureName);
|
||||||
|
AFeature feature = featureManagementService.getFeature(featureDefinition.getKey());
|
||||||
|
List<AFeatureMode> modes = featureModeManagementService.getFeatureModesOfFeatureInServer(server, feature);
|
||||||
|
return modes
|
||||||
|
.stream()
|
||||||
|
.map(mode -> mode.getFeatureMode().toLowerCase())
|
||||||
|
.filter(string -> string.startsWith(input))
|
||||||
|
.toList();
|
||||||
|
}
|
||||||
|
return new ArrayList<>();
|
||||||
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public CommandConfiguration getConfiguration() {
|
public CommandConfiguration getConfiguration() {
|
||||||
Parameter featureName = Parameter
|
Parameter featureName = Parameter
|
||||||
.builder()
|
.builder()
|
||||||
.name(FEATURE_PARAMETER)
|
.name(FEATURE_PARAMETER)
|
||||||
.type(String.class)
|
.type(String.class)
|
||||||
.templated(true).build();
|
.supportsAutoComplete(true)
|
||||||
|
.templated(true)
|
||||||
|
.build();
|
||||||
|
|
||||||
Parameter mode = Parameter
|
Parameter mode = Parameter
|
||||||
.builder().name(MODE_PARAMETER)
|
.builder()
|
||||||
|
.name(MODE_PARAMETER)
|
||||||
.type(String.class)
|
.type(String.class)
|
||||||
|
.supportsAutoComplete(true)
|
||||||
.templated(true)
|
.templated(true)
|
||||||
.build();
|
.build();
|
||||||
|
|
||||||
|
|||||||
@@ -13,14 +13,19 @@ import dev.sheldan.abstracto.core.commands.config.ConfigModuleDefinition;
|
|||||||
import dev.sheldan.abstracto.core.config.FeatureDefinition;
|
import dev.sheldan.abstracto.core.config.FeatureDefinition;
|
||||||
import dev.sheldan.abstracto.core.interaction.InteractionService;
|
import dev.sheldan.abstracto.core.interaction.InteractionService;
|
||||||
import dev.sheldan.abstracto.core.interaction.slash.SlashCommandPrivilegeLevels;
|
import dev.sheldan.abstracto.core.interaction.slash.SlashCommandPrivilegeLevels;
|
||||||
|
import dev.sheldan.abstracto.core.interaction.slash.parameter.SlashCommandAutoCompleteService;
|
||||||
import dev.sheldan.abstracto.core.models.database.AFeature;
|
import dev.sheldan.abstracto.core.models.database.AFeature;
|
||||||
|
import dev.sheldan.abstracto.core.models.database.AFeatureFlag;
|
||||||
import dev.sheldan.abstracto.core.models.database.AServer;
|
import dev.sheldan.abstracto.core.models.database.AServer;
|
||||||
import dev.sheldan.abstracto.core.models.template.commands.FeatureModeDisplay;
|
import dev.sheldan.abstracto.core.models.template.commands.FeatureModeDisplay;
|
||||||
import dev.sheldan.abstracto.core.models.template.commands.FeatureModesModel;
|
import dev.sheldan.abstracto.core.models.template.commands.FeatureModesModel;
|
||||||
import dev.sheldan.abstracto.core.service.FeatureConfigService;
|
import dev.sheldan.abstracto.core.service.FeatureConfigService;
|
||||||
import dev.sheldan.abstracto.core.service.FeatureModeService;
|
import dev.sheldan.abstracto.core.service.FeatureModeService;
|
||||||
import dev.sheldan.abstracto.core.interaction.slash.parameter.SlashCommandParameterService;
|
import dev.sheldan.abstracto.core.interaction.slash.parameter.SlashCommandParameterService;
|
||||||
|
import dev.sheldan.abstracto.core.service.management.FeatureFlagManagementService;
|
||||||
import dev.sheldan.abstracto.core.service.management.ServerManagementService;
|
import dev.sheldan.abstracto.core.service.management.ServerManagementService;
|
||||||
|
import java.util.ArrayList;
|
||||||
|
import net.dv8tion.jda.api.events.interaction.command.CommandAutoCompleteInteractionEvent;
|
||||||
import net.dv8tion.jda.api.events.interaction.command.SlashCommandInteractionEvent;
|
import net.dv8tion.jda.api.events.interaction.command.SlashCommandInteractionEvent;
|
||||||
import org.springframework.beans.factory.annotation.Autowired;
|
import org.springframework.beans.factory.annotation.Autowired;
|
||||||
import org.springframework.stereotype.Component;
|
import org.springframework.stereotype.Component;
|
||||||
@@ -53,6 +58,12 @@ public class FeatureModes extends AbstractConditionableCommand {
|
|||||||
@Autowired
|
@Autowired
|
||||||
private SlashCommandParameterService slashCommandParameterService;
|
private SlashCommandParameterService slashCommandParameterService;
|
||||||
|
|
||||||
|
@Autowired
|
||||||
|
private SlashCommandAutoCompleteService slashCommandAutoCompleteService;
|
||||||
|
|
||||||
|
@Autowired
|
||||||
|
private FeatureFlagManagementService featureFlagManagementService;
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public CompletableFuture<CommandResult> executeSlash(SlashCommandInteractionEvent event) {
|
public CompletableFuture<CommandResult> executeSlash(SlashCommandInteractionEvent event) {
|
||||||
List<FeatureModeDisplay> featureModes;
|
List<FeatureModeDisplay> featureModes;
|
||||||
@@ -73,12 +84,28 @@ public class FeatureModes extends AbstractConditionableCommand {
|
|||||||
.thenApply(interactionHook -> CommandResult.fromSuccess());
|
.thenApply(interactionHook -> CommandResult.fromSuccess());
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public List<String> performAutoComplete(CommandAutoCompleteInteractionEvent event) {
|
||||||
|
if(slashCommandAutoCompleteService.matchesParameter(event.getFocusedOption(), FEATURE_PARAMETER)) {
|
||||||
|
String input = event.getFocusedOption().getValue().toLowerCase();
|
||||||
|
AServer server = serverManagementService.loadServer(event.getGuild());
|
||||||
|
return featureFlagManagementService.getFeatureFlagsOfServer(server)
|
||||||
|
.stream()
|
||||||
|
.filter(AFeatureFlag::isEnabled)
|
||||||
|
.map(aFeatureFlag -> aFeatureFlag.getFeature().getKey().toLowerCase())
|
||||||
|
.filter(featureName -> featureName.toLowerCase().startsWith(input))
|
||||||
|
.toList();
|
||||||
|
}
|
||||||
|
return new ArrayList<>();
|
||||||
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public CommandConfiguration getConfiguration() {
|
public CommandConfiguration getConfiguration() {
|
||||||
Parameter featureName = Parameter
|
Parameter featureName = Parameter
|
||||||
.builder()
|
.builder()
|
||||||
.name(FEATURE_PARAMETER)
|
.name(FEATURE_PARAMETER)
|
||||||
.type(String.class)
|
.type(String.class)
|
||||||
|
.supportsAutoComplete(true)
|
||||||
.optional(true)
|
.optional(true)
|
||||||
.templated(true)
|
.templated(true)
|
||||||
.build();
|
.build();
|
||||||
|
|||||||
@@ -50,7 +50,7 @@ public class SetEmote extends AbstractConditionableCommand {
|
|||||||
|
|
||||||
@Override
|
@Override
|
||||||
public CommandConfiguration getConfiguration() {
|
public CommandConfiguration getConfiguration() {
|
||||||
List<ParameterValidator> emoteKeyValidators = Arrays.asList(MaxStringLengthValidator.max(255L));
|
List<ParameterValidator> emoteKeyValidators = Arrays.asList(MaxStringLengthValidator.max(255));
|
||||||
Parameter emoteKey = Parameter
|
Parameter emoteKey = Parameter
|
||||||
.builder()
|
.builder()
|
||||||
.name(EMOTE_KEY_PARAMETER)
|
.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 com.google.gson.typeadapters.RuntimeTypeAdapterFactory;
|
||||||
import dev.sheldan.abstracto.core.logging.OkHttpLogger;
|
import dev.sheldan.abstracto.core.logging.OkHttpLogger;
|
||||||
import dev.sheldan.abstracto.core.metric.OkHttpMetrics;
|
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.ActionRowButtonConfig;
|
||||||
import dev.sheldan.abstracto.core.templating.model.messagecomponents.ActionRowItemConfig;
|
import dev.sheldan.abstracto.core.templating.model.messagecomponents.ActionRowItemConfig;
|
||||||
import dev.sheldan.abstracto.core.templating.model.messagecomponents.ComponentConfig;
|
import dev.sheldan.abstracto.core.templating.model.messagecomponents.ComponentConfig;
|
||||||
@@ -37,15 +36,15 @@ import java.util.List;
|
|||||||
@Configuration
|
@Configuration
|
||||||
public class CoreConfig {
|
public class CoreConfig {
|
||||||
|
|
||||||
@Autowired
|
|
||||||
private BotService botService;
|
|
||||||
|
|
||||||
@Autowired
|
@Autowired
|
||||||
private OkHttpMetrics okHttpMetrics;
|
private OkHttpMetrics okHttpMetrics;
|
||||||
|
|
||||||
@Autowired
|
@Autowired
|
||||||
private OkHttpLogger okHttpLogger;
|
private OkHttpLogger okHttpLogger;
|
||||||
|
|
||||||
|
@Autowired
|
||||||
|
private OkHttpUserAgentSetter okHttpUserAgentSetter;
|
||||||
|
|
||||||
@Autowired
|
@Autowired
|
||||||
private List<CustomJsonSerializer> customJsonSerializers;
|
private List<CustomJsonSerializer> customJsonSerializers;
|
||||||
|
|
||||||
@@ -95,6 +94,7 @@ public class CoreConfig {
|
|||||||
return new OkHttpClient.Builder()
|
return new OkHttpClient.Builder()
|
||||||
.addInterceptor(okHttpMetrics)
|
.addInterceptor(okHttpMetrics)
|
||||||
.addInterceptor(okHttpLogger)
|
.addInterceptor(okHttpLogger)
|
||||||
|
.addInterceptor(okHttpUserAgentSetter)
|
||||||
.build();
|
.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.CommandConfiguration;
|
||||||
import dev.sheldan.abstracto.core.command.config.Parameter;
|
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.CommandParameterKey;
|
||||||
import dev.sheldan.abstracto.core.command.execution.CommandResult;
|
import dev.sheldan.abstracto.core.command.execution.CommandResult;
|
||||||
import dev.sheldan.abstracto.core.command.config.UserCommandConfig;
|
import dev.sheldan.abstracto.core.command.config.UserCommandConfig;
|
||||||
@@ -184,6 +188,39 @@ public class SlashCommandServiceBean implements SlashCommandService {
|
|||||||
convertCommandConfigToCommandData(commandConfiguration, existingCommands, null, false);
|
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) {
|
private List<OptionData> getParameters(CommandConfiguration commandConfiguration, boolean isTemplated, String internalCommandName, Long serverId, boolean userCommandsOnly) {
|
||||||
List<OptionData> requiredParameters = new ArrayList<>();
|
List<OptionData> requiredParameters = new ArrayList<>();
|
||||||
List<OptionData> optionalParameters = new ArrayList<>();
|
List<OptionData> optionalParameters = new ArrayList<>();
|
||||||
@@ -195,6 +232,10 @@ public class SlashCommandServiceBean implements SlashCommandService {
|
|||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
List<OptionType> types = slashCommandParameterService.getTypesFromParameter(parameter);
|
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(types.size() > 1) {
|
||||||
if(parameter.isListParam()) {
|
if(parameter.isListParam()) {
|
||||||
for (int i = 0; i < parameter.getListSize(); i++) {
|
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();
|
String parameterDescription = isTemplated ? templateService.renderSimpleTemplate(internalCommandName + "_parameter_" + parameter.getName(), serverId) : parameter.getDescription();
|
||||||
OptionData optionData = new OptionData(type, parameterName, parameterDescription, false);
|
OptionData optionData = new OptionData(type, parameterName, parameterDescription, false);
|
||||||
addChoices(optionData, parameter, internalCommandName, isTemplated, serverId);
|
addChoices(optionData, parameter, internalCommandName, isTemplated, serverId);
|
||||||
|
setMaxLength(maxLengthOptional, optionData);
|
||||||
|
setMinLength(minLengthOptional, optionData);
|
||||||
|
setMaxValue(maxValueOptional, optionData);
|
||||||
|
setMinValue(minValueOptional, optionData);
|
||||||
optionalParameters.add(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();
|
String parameterDescription = isTemplated ? templateService.renderSimpleTemplate(internalCommandName + "_parameter_" + parameter.getName(), serverId) : parameter.getDescription();
|
||||||
OptionData optionData = new OptionData(type, parameterName, parameterDescription, false);
|
OptionData optionData = new OptionData(type, parameterName, parameterDescription, false);
|
||||||
addChoices(optionData, parameter, internalCommandName, isTemplated, serverId);
|
addChoices(optionData, parameter, internalCommandName, isTemplated, serverId);
|
||||||
|
setMaxLength(maxLengthOptional, optionData);
|
||||||
|
setMinLength(minLengthOptional, optionData);
|
||||||
|
setMaxValue(maxValueOptional, optionData);
|
||||||
|
setMinValue(minValueOptional, optionData);
|
||||||
optionalParameters.add(optionData);
|
optionalParameters.add(optionData);
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
@@ -222,11 +271,19 @@ public class SlashCommandServiceBean implements SlashCommandService {
|
|||||||
for (int i = 0; i < parameter.getListSize(); i++) {
|
for (int i = 0; i < parameter.getListSize(); i++) {
|
||||||
OptionData optionData = new OptionData(type, parameter.getSlashCompatibleName() + "_" + i, parameterDescription, false);
|
OptionData optionData = new OptionData(type, parameter.getSlashCompatibleName() + "_" + i, parameterDescription, false);
|
||||||
addChoices(optionData, parameter, internalCommandName, isTemplated, serverId);
|
addChoices(optionData, parameter, internalCommandName, isTemplated, serverId);
|
||||||
|
setMaxLength(maxLengthOptional, optionData);
|
||||||
|
setMinLength(minLengthOptional, optionData);
|
||||||
|
setMaxValue(maxValueOptional, optionData);
|
||||||
|
setMinValue(minValueOptional, optionData);
|
||||||
optionalParameters.add(optionData);
|
optionalParameters.add(optionData);
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
OptionData optionData = new OptionData(type, parameter.getSlashCompatibleName(), parameterDescription, !parameter.isOptional(), parameter.getSupportsAutoComplete());
|
OptionData optionData = new OptionData(type, parameter.getSlashCompatibleName(), parameterDescription, !parameter.isOptional(), parameter.getSupportsAutoComplete());
|
||||||
addChoices(optionData, parameter, internalCommandName, isTemplated, serverId);
|
addChoices(optionData, parameter, internalCommandName, isTemplated, serverId);
|
||||||
|
setMaxLength(maxLengthOptional, optionData);
|
||||||
|
setMinLength(minLengthOptional, optionData);
|
||||||
|
setMaxValue(maxValueOptional, optionData);
|
||||||
|
setMinValue(minValueOptional, optionData);
|
||||||
requiredParameters.add(optionData);
|
requiredParameters.add(optionData);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -235,6 +292,22 @@ public class SlashCommandServiceBean implements SlashCommandService {
|
|||||||
return requiredParameters;
|
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) {
|
private void addChoices(OptionData optionData, Parameter parameter, String commandName, boolean isTemplated, Long serverId) {
|
||||||
if(CommandParameterKey.class.isAssignableFrom(parameter.getType())) {
|
if(CommandParameterKey.class.isAssignableFrom(parameter.getType())) {
|
||||||
parameter.setChoices(CommandParameterKey.getKeys(parameter.getType()));
|
parameter.setChoices(CommandParameterKey.getKeys(parameter.getType()));
|
||||||
|
|||||||
@@ -42,7 +42,7 @@ public class SlashCommandFeatureActivationListener implements FeatureActivationL
|
|||||||
List<Command> incomingSlashCommands = slashCommandListenerBean.getSlashCommands()
|
List<Command> incomingSlashCommands = slashCommandListenerBean.getSlashCommands()
|
||||||
.stream()
|
.stream()
|
||||||
.filter(command -> command.getFeature().getKey().equals(model.getFeatureName()))
|
.filter(command -> command.getFeature().getKey().equals(model.getFeatureName()))
|
||||||
.collect(Collectors.toList());
|
.toList();
|
||||||
if(incomingSlashCommands.isEmpty()) {
|
if(incomingSlashCommands.isEmpty()) {
|
||||||
return DefaultListenerResult.IGNORED;
|
return DefaultListenerResult.IGNORED;
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -16,7 +16,7 @@ public class UserSlashCommandParameterProvider implements SlashCommandParameterP
|
|||||||
return SlashCommandOptionTypeMapping
|
return SlashCommandOptionTypeMapping
|
||||||
.builder()
|
.builder()
|
||||||
.type(User.class)
|
.type(User.class)
|
||||||
.optionTypes(Arrays.asList(OptionType.USER, OptionType.STRING))
|
.optionTypes(Arrays.asList(OptionType.USER))
|
||||||
.strictTypes(List.of(OptionType.USER))
|
.strictTypes(List.of(OptionType.USER))
|
||||||
.build();
|
.build();
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -13,6 +13,7 @@ public class ButtonConfig {
|
|||||||
private String id;
|
private String id;
|
||||||
private String url;
|
private String url;
|
||||||
private Boolean disabled;
|
private Boolean disabled;
|
||||||
|
private Integer uniqueId;
|
||||||
private String emoteMarkdown;
|
private String emoteMarkdown;
|
||||||
private ButtonStyleConfig buttonStyle;
|
private ButtonStyleConfig buttonStyle;
|
||||||
private String buttonPayload;
|
private String buttonPayload;
|
||||||
|
|||||||
@@ -0,0 +1,20 @@
|
|||||||
|
package dev.sheldan.abstracto.core.templating.model.messagecomponents;
|
||||||
|
|
||||||
|
|
||||||
|
import java.awt.Color;
|
||||||
|
import lombok.Builder;
|
||||||
|
import lombok.Getter;
|
||||||
|
import lombok.Setter;
|
||||||
|
|
||||||
|
@Builder
|
||||||
|
@Getter
|
||||||
|
@Setter
|
||||||
|
public class ContainerColor {
|
||||||
|
private Integer r;
|
||||||
|
private Integer g;
|
||||||
|
private Integer b;
|
||||||
|
|
||||||
|
public Color toColor() {
|
||||||
|
return new Color(r, g, b);
|
||||||
|
}
|
||||||
|
}
|
||||||
Some files were not shown because too many files have changed in this diff Show More
Reference in New Issue
Block a user