Compare commits

...

11 Commits

Author SHA1 Message Date
Sheldan
1ba8219d7b [AB-xxx] fixing using wrong parameter for unSuggest command 2023-11-15 01:06:30 +01:00
Sheldan
60d2c669a2 [maven-release-plugin] prepare for next development iteration 2023-10-29 18:23:09 +01:00
Sheldan
3a122a72e5 [maven-release-plugin] prepare release v1.5.12 2023-10-29 18:23:03 +01:00
Sheldan
d53126e5a5 [AB-xxx] actively limiting auto complete responses to the max allowed values
changing interface of slash command parameter service to be more applicable
adding utility functions to slash command auto complete service bean
2023-10-29 18:21:29 +01:00
Sheldan
208d9a28ed [maven-release-plugin] prepare for next development iteration 2023-10-23 01:27:29 +02:00
Sheldan
6643359953 [maven-release-plugin] prepare release v1.5.11 2023-10-23 01:27:22 +02:00
Sheldan
bd7149d159 [AB-xxx] prepare for release 2023-10-23 01:26:12 +02:00
Sheldan
c0b6a19bca [AB-82] adding instant for cooldown exception model
removing not needed models for payday and slots cooldown exceptions
2023-10-04 23:34:16 +02:00
Sheldan
58eece0814 [AB-xxx] setting duration to zero if it was not provided, for infraction storage 2023-10-04 22:45:51 +02:00
Sheldan
abfd2c9591 [AB-xxx] ignore slash command only commands for message commands 2023-09-26 23:37:04 +02:00
Sheldan
a71a448b4b [maven-release-plugin] prepare for next development iteration 2023-09-26 22:51:02 +02:00
87 changed files with 137 additions and 122 deletions

View File

@@ -3,7 +3,7 @@
<parent>
<artifactId>anti-raid</artifactId>
<groupId>dev.sheldan.abstracto.modules</groupId>
<version>1.5.10</version>
<version>1.5.13-SNAPSHOT</version>
</parent>
<modelVersion>4.0.0</modelVersion>

View File

@@ -3,7 +3,7 @@
<parent>
<artifactId>anti-raid</artifactId>
<groupId>dev.sheldan.abstracto.modules</groupId>
<version>1.5.10</version>
<version>1.5.13-SNAPSHOT</version>
</parent>
<modelVersion>4.0.0</modelVersion>

View File

@@ -3,7 +3,7 @@
<parent>
<artifactId>abstracto-modules</artifactId>
<groupId>dev.sheldan.abstracto.modules</groupId>
<version>1.5.10</version>
<version>1.5.13-SNAPSHOT</version>
</parent>
<modelVersion>4.0.0</modelVersion>

View File

@@ -3,7 +3,7 @@
<parent>
<groupId>dev.sheldan.abstracto.modules</groupId>
<artifactId>assignable-roles</artifactId>
<version>1.5.10</version>
<version>1.5.13-SNAPSHOT</version>
</parent>
<modelVersion>4.0.0</modelVersion>

View File

@@ -3,7 +3,7 @@
<parent>
<groupId>dev.sheldan.abstracto.modules</groupId>
<artifactId>assignable-roles</artifactId>
<version>1.5.10</version>
<version>1.5.13-SNAPSHOT</version>
</parent>
<modelVersion>4.0.0</modelVersion>
<artifactId>assignable-roles-int</artifactId>

View File

@@ -3,7 +3,7 @@
<parent>
<groupId>dev.sheldan.abstracto.modules</groupId>
<artifactId>abstracto-modules</artifactId>
<version>1.5.10</version>
<version>1.5.13-SNAPSHOT</version>
</parent>
<modelVersion>4.0.0</modelVersion>

View File

@@ -3,7 +3,7 @@
<parent>
<groupId>dev.sheldan.abstracto.modules</groupId>
<artifactId>custom-command</artifactId>
<version>1.5.10</version>
<version>1.5.13-SNAPSHOT</version>
</parent>
<modelVersion>4.0.0</modelVersion>

View File

@@ -3,7 +3,7 @@
<parent>
<groupId>dev.sheldan.abstracto.modules</groupId>
<artifactId>custom-command</artifactId>
<version>1.5.10</version>
<version>1.5.13-SNAPSHOT</version>
</parent>
<modelVersion>4.0.0</modelVersion>

View File

@@ -3,7 +3,7 @@
<parent>
<artifactId>abstracto-modules</artifactId>
<groupId>dev.sheldan.abstracto.modules</groupId>
<version>1.5.10</version>
<version>1.5.13-SNAPSHOT</version>
</parent>
<modelVersion>4.0.0</modelVersion>

View File

@@ -3,7 +3,7 @@
<parent>
<groupId>dev.sheldan.abstracto.modules</groupId>
<artifactId>dynamic-activity</artifactId>
<version>1.5.10</version>
<version>1.5.13-SNAPSHOT</version>
</parent>
<modelVersion>4.0.0</modelVersion>

View File

@@ -3,7 +3,7 @@
<parent>
<artifactId>dynamic-activity</artifactId>
<groupId>dev.sheldan.abstracto.modules</groupId>
<version>1.5.10</version>
<version>1.5.13-SNAPSHOT</version>
</parent>
<modelVersion>4.0.0</modelVersion>

View File

@@ -3,7 +3,7 @@
<parent>
<artifactId>abstracto-modules</artifactId>
<groupId>dev.sheldan.abstracto.modules</groupId>
<version>1.5.10</version>
<version>1.5.13-SNAPSHOT</version>
</parent>
<modelVersion>4.0.0</modelVersion>

View File

@@ -3,7 +3,7 @@
<parent>
<artifactId>entertainment</artifactId>
<groupId>dev.sheldan.abstracto.modules</groupId>
<version>1.5.10</version>
<version>1.5.13-SNAPSHOT</version>
</parent>
<modelVersion>4.0.0</modelVersion>

View File

@@ -3,7 +3,7 @@
<parent>
<artifactId>entertainment</artifactId>
<groupId>dev.sheldan.abstracto.modules</groupId>
<version>1.5.10</version>
<version>1.5.13-SNAPSHOT</version>
</parent>
<modelVersion>4.0.0</modelVersion>

View File

@@ -1,12 +0,0 @@
package dev.sheldan.abstracto.entertainment.model.exception;
import lombok.Builder;
import lombok.Getter;
import java.time.Duration;
@Builder
@Getter
public class PayDayCooldownExceptionModel {
private Duration tryAgainDuration;
}

View File

@@ -1,12 +0,0 @@
package dev.sheldan.abstracto.entertainment.model.exception;
import lombok.Builder;
import lombok.Getter;
import java.time.Duration;
@Builder
@Getter
public class SlotsCooldownExceptionModel {
private Duration tryAgainDuration;
}

View File

@@ -3,7 +3,7 @@
<parent>
<artifactId>abstracto-modules</artifactId>
<groupId>dev.sheldan.abstracto.modules</groupId>
<version>1.5.10</version>
<version>1.5.13-SNAPSHOT</version>
</parent>
<modelVersion>4.0.0</modelVersion>

View File

@@ -3,7 +3,7 @@
<parent>
<groupId>dev.sheldan.abstracto.modules</groupId>
<artifactId>experience-tracking</artifactId>
<version>1.5.10</version>
<version>1.5.13-SNAPSHOT</version>
</parent>
<modelVersion>4.0.0</modelVersion>

View File

@@ -3,7 +3,7 @@
<parent>
<groupId>dev.sheldan.abstracto.modules</groupId>
<artifactId>experience-tracking</artifactId>
<version>1.5.10</version>
<version>1.5.13-SNAPSHOT</version>
</parent>
<modelVersion>4.0.0</modelVersion>

View File

@@ -3,7 +3,7 @@
<parent>
<groupId>dev.sheldan.abstracto.modules</groupId>
<artifactId>abstracto-modules</artifactId>
<version>1.5.10</version>
<version>1.5.13-SNAPSHOT</version>
</parent>
<modelVersion>4.0.0</modelVersion>

View File

@@ -3,7 +3,7 @@
<parent>
<artifactId>invite-filter</artifactId>
<groupId>dev.sheldan.abstracto.modules</groupId>
<version>1.5.10</version>
<version>1.5.13-SNAPSHOT</version>
</parent>
<modelVersion>4.0.0</modelVersion>

View File

@@ -3,7 +3,7 @@
<parent>
<artifactId>invite-filter</artifactId>
<groupId>dev.sheldan.abstracto.modules</groupId>
<version>1.5.10</version>
<version>1.5.13-SNAPSHOT</version>
</parent>
<modelVersion>4.0.0</modelVersion>

View File

@@ -3,7 +3,7 @@
<parent>
<artifactId>abstracto-modules</artifactId>
<groupId>dev.sheldan.abstracto.modules</groupId>
<version>1.5.10</version>
<version>1.5.13-SNAPSHOT</version>
</parent>
<modelVersion>4.0.0</modelVersion>

View File

@@ -3,7 +3,7 @@
<parent>
<artifactId>link-embed</artifactId>
<groupId>dev.sheldan.abstracto.modules</groupId>
<version>1.5.10</version>
<version>1.5.13-SNAPSHOT</version>
</parent>
<modelVersion>4.0.0</modelVersion>

View File

@@ -3,7 +3,7 @@
<parent>
<artifactId>link-embed</artifactId>
<groupId>dev.sheldan.abstracto.modules</groupId>
<version>1.5.10</version>
<version>1.5.13-SNAPSHOT</version>
</parent>
<modelVersion>4.0.0</modelVersion>

View File

@@ -3,7 +3,7 @@
<parent>
<artifactId>abstracto-modules</artifactId>
<groupId>dev.sheldan.abstracto.modules</groupId>
<version>1.5.10</version>
<version>1.5.13-SNAPSHOT</version>
</parent>
<modelVersion>4.0.0</modelVersion>

View File

@@ -3,7 +3,7 @@
<parent>
<artifactId>logging</artifactId>
<groupId>dev.sheldan.abstracto.modules</groupId>
<version>1.5.10</version>
<version>1.5.13-SNAPSHOT</version>
</parent>
<modelVersion>4.0.0</modelVersion>

View File

@@ -3,7 +3,7 @@
<parent>
<artifactId>logging</artifactId>
<groupId>dev.sheldan.abstracto.modules</groupId>
<version>1.5.10</version>
<version>1.5.13-SNAPSHOT</version>
</parent>
<modelVersion>4.0.0</modelVersion>

View File

@@ -3,7 +3,7 @@
<parent>
<artifactId>abstracto-modules</artifactId>
<groupId>dev.sheldan.abstracto.modules</groupId>
<version>1.5.10</version>
<version>1.5.13-SNAPSHOT</version>
</parent>
<modelVersion>4.0.0</modelVersion>

View File

@@ -3,7 +3,7 @@
<parent>
<groupId>dev.sheldan.abstracto.modules</groupId>
<artifactId>moderation</artifactId>
<version>1.5.10</version>
<version>1.5.13-SNAPSHOT</version>
</parent>
<modelVersion>4.0.0</modelVersion>

View File

@@ -88,6 +88,9 @@ public class BanServiceBean implements BanService {
AUserInAServer bannedUser = userInServerManagementService.loadOrCreateUser(guild.getIdLong(), user.getIdLong());
AUserInAServer banningUser = userInServerManagementService.loadOrCreateUser(banningMember);
Map<String, String> parameters = new HashMap<>();
if(deletionDuration == null) {
deletionDuration = Duration.ZERO;
}
parameters.put(INFRACTION_PARAMETER_DELETION_DURATION_KEY, deletionDuration.toString());
return infractionService.createInfractionWithNotification(bannedUser, infractionPoints, BAN_INFRACTION_TYPE, reason, banningUser, parameters, banLogMessage)
.thenApply(Infraction::getId);

View File

@@ -3,7 +3,7 @@
<parent>
<groupId>dev.sheldan.abstracto.modules</groupId>
<artifactId>moderation</artifactId>
<version>1.5.10</version>
<version>1.5.13-SNAPSHOT</version>
</parent>
<modelVersion>4.0.0</modelVersion>

View File

@@ -3,7 +3,7 @@
<parent>
<groupId>dev.sheldan.abstracto.modules</groupId>
<artifactId>abstracto-modules</artifactId>
<version>1.5.10</version>
<version>1.5.13-SNAPSHOT</version>
</parent>
<modelVersion>4.0.0</modelVersion>

View File

@@ -3,7 +3,7 @@
<parent>
<groupId>dev.sheldan.abstracto.modules</groupId>
<artifactId>modmail</artifactId>
<version>1.5.10</version>
<version>1.5.13-SNAPSHOT</version>
</parent>
<modelVersion>4.0.0</modelVersion>

View File

@@ -3,7 +3,7 @@
<parent>
<groupId>dev.sheldan.abstracto.modules</groupId>
<artifactId>modmail</artifactId>
<version>1.5.10</version>
<version>1.5.13-SNAPSHOT</version>
</parent>
<modelVersion>4.0.0</modelVersion>

View File

@@ -3,7 +3,7 @@
<parent>
<groupId>dev.sheldan.abstracto.modules</groupId>
<artifactId>abstracto-modules</artifactId>
<version>1.5.10</version>
<version>1.5.13-SNAPSHOT</version>
</parent>
<modelVersion>4.0.0</modelVersion>

View File

@@ -3,7 +3,7 @@
<parent>
<groupId>dev.sheldan.abstracto</groupId>
<artifactId>abstracto-application</artifactId>
<version>1.5.10</version>
<version>1.5.13-SNAPSHOT</version>
</parent>
<modelVersion>4.0.0</modelVersion>

View File

@@ -3,7 +3,7 @@
<parent>
<artifactId>abstracto-modules</artifactId>
<groupId>dev.sheldan.abstracto.modules</groupId>
<version>1.5.10</version>
<version>1.5.13-SNAPSHOT</version>
</parent>
<modelVersion>4.0.0</modelVersion>

View File

@@ -3,7 +3,7 @@
<parent>
<artifactId>profanity-filter</artifactId>
<groupId>dev.sheldan.abstracto.modules</groupId>
<version>1.5.10</version>
<version>1.5.13-SNAPSHOT</version>
</parent>
<modelVersion>4.0.0</modelVersion>

View File

@@ -3,7 +3,7 @@
<parent>
<groupId>dev.sheldan.abstracto.modules</groupId>
<artifactId>profanity-filter</artifactId>
<version>1.5.10</version>
<version>1.5.13-SNAPSHOT</version>
</parent>
<modelVersion>4.0.0</modelVersion>

View File

@@ -3,7 +3,7 @@
<parent>
<artifactId>abstracto-modules</artifactId>
<groupId>dev.sheldan.abstracto.modules</groupId>
<version>1.5.10</version>
<version>1.5.13-SNAPSHOT</version>
</parent>
<modelVersion>4.0.0</modelVersion>

View File

@@ -3,7 +3,7 @@
<parent>
<artifactId>remind</artifactId>
<groupId>dev.sheldan.abstracto.modules</groupId>
<version>1.5.10</version>
<version>1.5.13-SNAPSHOT</version>
</parent>
<modelVersion>4.0.0</modelVersion>

View File

@@ -3,7 +3,7 @@
<parent>
<artifactId>remind</artifactId>
<groupId>dev.sheldan.abstracto.modules</groupId>
<version>1.5.10</version>
<version>1.5.13-SNAPSHOT</version>
</parent>
<modelVersion>4.0.0</modelVersion>

View File

@@ -3,7 +3,7 @@
<parent>
<artifactId>abstracto-modules</artifactId>
<groupId>dev.sheldan.abstracto.modules</groupId>
<version>1.5.10</version>
<version>1.5.13-SNAPSHOT</version>
</parent>
<modelVersion>4.0.0</modelVersion>

View File

@@ -3,7 +3,7 @@
<parent>
<artifactId>repost-detection</artifactId>
<groupId>dev.sheldan.abstracto.modules</groupId>
<version>1.5.10</version>
<version>1.5.13-SNAPSHOT</version>
</parent>
<modelVersion>4.0.0</modelVersion>

View File

@@ -3,7 +3,7 @@
<parent>
<artifactId>repost-detection</artifactId>
<groupId>dev.sheldan.abstracto.modules</groupId>
<version>1.5.10</version>
<version>1.5.13-SNAPSHOT</version>
</parent>
<modelVersion>4.0.0</modelVersion>

View File

@@ -3,7 +3,7 @@
<parent>
<artifactId>abstracto-modules</artifactId>
<groupId>dev.sheldan.abstracto.modules</groupId>
<version>1.5.10</version>
<version>1.5.13-SNAPSHOT</version>
</parent>
<modelVersion>4.0.0</modelVersion>

View File

@@ -3,7 +3,7 @@
<parent>
<artifactId>starboard</artifactId>
<groupId>dev.sheldan.abstracto.modules</groupId>
<version>1.5.10</version>
<version>1.5.13-SNAPSHOT</version>
</parent>
<modelVersion>4.0.0</modelVersion>

View File

@@ -3,7 +3,7 @@
<parent>
<artifactId>starboard</artifactId>
<groupId>dev.sheldan.abstracto.modules</groupId>
<version>1.5.10</version>
<version>1.5.13-SNAPSHOT</version>
</parent>
<modelVersion>4.0.0</modelVersion>

View File

@@ -3,7 +3,7 @@
<parent>
<groupId>dev.sheldan.abstracto.modules</groupId>
<artifactId>abstracto-modules</artifactId>
<version>1.5.10</version>
<version>1.5.13-SNAPSHOT</version>
</parent>
<modelVersion>4.0.0</modelVersion>

View File

@@ -3,7 +3,7 @@
<parent>
<groupId>dev.sheldan.abstracto.modules</groupId>
<artifactId>statistic</artifactId>
<version>1.5.10</version>
<version>1.5.13-SNAPSHOT</version>
</parent>
<modelVersion>4.0.0</modelVersion>

View File

@@ -3,7 +3,7 @@
<parent>
<groupId>dev.sheldan.abstracto.modules</groupId>
<artifactId>statistic</artifactId>
<version>1.5.10</version>
<version>1.5.13-SNAPSHOT</version>
</parent>
<modelVersion>4.0.0</modelVersion>

View File

@@ -3,7 +3,7 @@
<parent>
<artifactId>abstracto-modules</artifactId>
<groupId>dev.sheldan.abstracto.modules</groupId>
<version>1.5.10</version>
<version>1.5.13-SNAPSHOT</version>
</parent>
<modelVersion>4.0.0</modelVersion>

View File

@@ -3,7 +3,7 @@
<parent>
<artifactId>suggestion</artifactId>
<groupId>dev.sheldan.abstracto.modules</groupId>
<version>1.5.10</version>
<version>1.5.13-SNAPSHOT</version>
</parent>
<modelVersion>4.0.0</modelVersion>

View File

@@ -48,7 +48,7 @@ public class UnSuggest extends AbstractConditionableCommand {
@Override
public CompletableFuture<CommandResult> executeSlash(SlashCommandInteractionEvent event) {
Long suggestionId = slashCommandParameterService.getCommandOption(SUGGESTION_ID_PARAMETER, event, Long.class, Integer.class).longValue();
return suggestionService.removeSuggestion(event.getMember().getIdLong(), suggestionId, event.getMember())
return suggestionService.removeSuggestion(event.getGuild().getIdLong(), suggestionId, event.getMember())
.thenCompose(unused -> interactionService.replyEmbed(UN_SUGGEST_RESPONSE, event))
.thenApply(aVoid -> CommandResult.fromSuccess());
}

View File

@@ -3,7 +3,7 @@
<parent>
<artifactId>suggestion</artifactId>
<groupId>dev.sheldan.abstracto.modules</groupId>
<version>1.5.10</version>
<version>1.5.13-SNAPSHOT</version>
</parent>
<modelVersion>4.0.0</modelVersion>

View File

@@ -3,7 +3,7 @@
<parent>
<artifactId>abstracto-modules</artifactId>
<groupId>dev.sheldan.abstracto.modules</groupId>
<version>1.5.10</version>
<version>1.5.13-SNAPSHOT</version>
</parent>
<modelVersion>4.0.0</modelVersion>

View File

@@ -3,7 +3,7 @@
<parent>
<artifactId>twitch</artifactId>
<groupId>dev.sheldan.abstracto.modules</groupId>
<version>1.5.10</version>
<version>1.5.13-SNAPSHOT</version>
</parent>
<modelVersion>4.0.0</modelVersion>

View File

@@ -3,7 +3,7 @@
<parent>
<groupId>dev.sheldan.abstracto.modules</groupId>
<artifactId>twitch</artifactId>
<version>1.5.10</version>
<version>1.5.13-SNAPSHOT</version>
</parent>
<modelVersion>4.0.0</modelVersion>

View File

@@ -3,7 +3,7 @@
<parent>
<groupId>dev.sheldan.abstracto.modules</groupId>
<artifactId>abstracto-modules</artifactId>
<version>1.5.10</version>
<version>1.5.13-SNAPSHOT</version>
</parent>
<modelVersion>4.0.0</modelVersion>

View File

@@ -3,7 +3,7 @@
<parent>
<groupId>dev.sheldan.abstracto.modules</groupId>
<artifactId>utility</artifactId>
<version>1.5.10</version>
<version>1.5.13-SNAPSHOT</version>
</parent>
<modelVersion>4.0.0</modelVersion>

View File

@@ -3,7 +3,7 @@
<parent>
<groupId>dev.sheldan.abstracto.modules</groupId>
<artifactId>utility</artifactId>
<version>1.5.10</version>
<version>1.5.13-SNAPSHOT</version>
</parent>
<modelVersion>4.0.0</modelVersion>

View File

@@ -3,7 +3,7 @@
<parent>
<artifactId>abstracto-modules</artifactId>
<groupId>dev.sheldan.abstracto.modules</groupId>
<version>1.5.10</version>
<version>1.5.13-SNAPSHOT</version>
</parent>
<modelVersion>4.0.0</modelVersion>

View File

@@ -3,7 +3,7 @@
<parent>
<groupId>dev.sheldan.abstracto.modules</groupId>
<artifactId>voice-channel-context</artifactId>
<version>1.5.10</version>
<version>1.5.13-SNAPSHOT</version>
</parent>
<modelVersion>4.0.0</modelVersion>

View File

@@ -3,7 +3,7 @@
<parent>
<groupId>dev.sheldan.abstracto.modules</groupId>
<artifactId>voice-channel-context</artifactId>
<version>1.5.10</version>
<version>1.5.13-SNAPSHOT</version>
</parent>
<modelVersion>4.0.0</modelVersion>

View File

@@ -3,7 +3,7 @@
<parent>
<groupId>dev.sheldan.abstracto.modules</groupId>
<artifactId>abstracto-modules</artifactId>
<version>1.5.10</version>
<version>1.5.13-SNAPSHOT</version>
</parent>
<modelVersion>4.0.0</modelVersion>

View File

@@ -3,7 +3,7 @@
<parent>
<groupId>dev.sheldan.abstracto.modules</groupId>
<artifactId>webservices</artifactId>
<version>1.5.10</version>
<version>1.5.13-SNAPSHOT</version>
</parent>
<modelVersion>4.0.0</modelVersion>

View File

@@ -3,7 +3,7 @@
<parent>
<groupId>dev.sheldan.abstracto.modules</groupId>
<artifactId>webservices</artifactId>
<version>1.5.10</version>
<version>1.5.13-SNAPSHOT</version>
</parent>
<modelVersion>4.0.0</modelVersion>

View File

@@ -3,7 +3,7 @@
<parent>
<groupId>dev.sheldan.abstracto</groupId>
<artifactId>abstracto-application</artifactId>
<version>1.5.10</version>
<version>1.5.13-SNAPSHOT</version>
</parent>
<modelVersion>4.0.0</modelVersion>

View File

@@ -3,7 +3,7 @@
<parent>
<groupId>dev.sheldan.abstracto.core</groupId>
<artifactId>core</artifactId>
<version>1.5.10</version>
<version>1.5.13-SNAPSHOT</version>
</parent>
<modelVersion>4.0.0</modelVersion>
<packaging>jar</packaging>

View File

@@ -88,6 +88,9 @@ public class CommandManager implements CommandRegistry {
if (commandConfiguration == null) {
return false;
}
if (commandConfiguration.isSlashCommandOnly()) {
return false;
}
if (!commandNameOrAliasMatches(name, commandConfiguration)) {
return false;
}

View File

@@ -15,6 +15,7 @@ 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.hooks.ListenerAdapter;
import net.dv8tion.jda.api.interactions.commands.build.OptionData;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.beans.factory.annotation.Qualifier;
import org.springframework.core.task.TaskExecutor;
@@ -129,7 +130,8 @@ public class SlashCommandListenerBean extends ListenerAdapter {
Optional<Command> potentialCommand = findCommand(event);
potentialCommand.ifPresent(command -> {
try {
List<String> replies = command.performAutoComplete(event);
List<String> fullRepliesList = command.performAutoComplete(event);
List<String> replies = fullRepliesList.subList(0, Math.min(fullRepliesList.size(), OptionData.MAX_CHOICES));
event.replyChoiceStrings(replies).queue(unused -> {},
throwable -> log.error("Failed to response to complete of command {} in guild {}.", command.getConfiguration().getName(), event.getGuild().getIdLong()));
} catch (Exception exception) {

View File

@@ -1,12 +1,33 @@
package dev.sheldan.abstracto.core.interaction.slash.parameter;
import net.dv8tion.jda.api.events.interaction.command.CommandAutoCompleteInteractionEvent;
import net.dv8tion.jda.api.interactions.AutoCompleteQuery;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Component;
@Component
public class SlashCommandAutoCompleteServiceBean implements SlashCommandAutoCompleteService{
public class SlashCommandAutoCompleteServiceBean implements SlashCommandAutoCompleteService {
@Autowired
private SlashCommandParameterService slashCommandParameterServiceBean;
@Override
public boolean matchesParameter(AutoCompleteQuery query, String parameterName) {
return query.getName().equalsIgnoreCase(parameterName);
}
@Override
public <T, Z> Z getCommandOption(String name, CommandAutoCompleteInteractionEvent event, Class<T> parameterType, Class<Z> slashParameterType) {
return slashCommandParameterServiceBean.getCommandOption(name, event, parameterType, slashParameterType);
}
@Override
public <T, Z> boolean hasCommandOption(String name, CommandAutoCompleteInteractionEvent event, Class<T> parameterType, Class<Z> slashParameterType) {
return slashCommandParameterServiceBean.hasCommandOption(name, event, parameterType, slashParameterType);
}
@Override
public <T> T getCommandOption(String name, CommandAutoCompleteInteractionEvent event, Class<T> parameterType) {
return getCommandOption(name, event, parameterType, parameterType);
}
}

View File

@@ -6,7 +6,7 @@ import dev.sheldan.abstracto.core.models.database.AEmote;
import dev.sheldan.abstracto.core.service.EmoteService;
import net.dv8tion.jda.api.entities.User;
import net.dv8tion.jda.api.entities.emoji.Emoji;
import net.dv8tion.jda.api.events.interaction.command.SlashCommandInteractionEvent;
import net.dv8tion.jda.api.interactions.commands.CommandInteractionPayload;
import net.dv8tion.jda.api.interactions.commands.OptionType;
import org.apache.commons.lang3.StringUtils;
import org.springframework.beans.factory.annotation.Autowired;
@@ -25,7 +25,7 @@ public class SlashCommandParameterServiceBean implements SlashCommandParameterSe
private List<SlashCommandParameterProvider> parameterProviders;
@Override
public <T, Z> Z getCommandOption(String name, SlashCommandInteractionEvent event, Class<T> parameterType, Class<Z> slashParameterType) {
public <T, Z> Z getCommandOption(String name, CommandInteractionPayload event, Class<T> parameterType, Class<Z> slashParameterType) {
name = name.toLowerCase(Locale.ROOT);
List<OptionType> potentialOptionTypes = getTypesFromParameter(parameterType);
OptionType actualOptionType = potentialOptionTypes.size() == 1 ? potentialOptionTypes.get(0) : null;
@@ -71,7 +71,7 @@ public class SlashCommandParameterServiceBean implements SlashCommandParameterSe
}
@Override
public <T, Z> boolean hasCommandOption(String name, SlashCommandInteractionEvent event, Class<T> parameterType, Class<Z> slashParameterType) {
public <T, Z> boolean hasCommandOption(String name, CommandInteractionPayload event, Class<T> parameterType, Class<Z> slashParameterType) {
name = name.toLowerCase(Locale.ROOT);
List<OptionType> potentialOptionTypes = getTypesFromParameter(parameterType);
OptionType actualOptionType = potentialOptionTypes.size() == 1 ? potentialOptionTypes.get(0) : null;
@@ -117,33 +117,33 @@ public class SlashCommandParameterServiceBean implements SlashCommandParameterSe
}
@Override
public <T> T getCommandOption(String name, SlashCommandInteractionEvent event, Class<T> parameterType) {
public <T> T getCommandOption(String name, CommandInteractionPayload event, Class<T> parameterType) {
return getCommandOption(name, event, parameterType, parameterType);
}
@Override
public Object getCommandOption(String name, SlashCommandInteractionEvent event) {
public Object getCommandOption(String name, CommandInteractionPayload event) {
return event.getOption(name.toLowerCase(Locale.ROOT));
}
@Override
public Boolean hasCommandOption(String name, SlashCommandInteractionEvent event) {
public Boolean hasCommandOption(String name, CommandInteractionPayload event) {
return event.getOption(name.toLowerCase(Locale.ROOT)) != null;
}
@Override
public Boolean hasCommandOptionWithFullType(String name, SlashCommandInteractionEvent event, OptionType optionType) {
public Boolean hasCommandOptionWithFullType(String name, CommandInteractionPayload event, OptionType optionType) {
return hasCommandOption(getFullQualifiedParameterName(name, optionType), event);
}
@Override
public AEmote loadAEmoteFromString(String input, SlashCommandInteractionEvent event) {
public AEmote loadAEmoteFromString(String input, CommandInteractionPayload event) {
Emoji emoji = loadEmoteFromString(input, event);
return emoteService.getFakeEmoteFromEmoji(emoji);
}
@Override
public Emoji loadEmoteFromString(String input, SlashCommandInteractionEvent event) {
public Emoji loadEmoteFromString(String input, CommandInteractionPayload event) {
if(StringUtils.isNumeric(input)) {
long emoteId = Long.parseLong(input);
return event.getGuild().getEmojiById(emoteId);

View File

@@ -3,7 +3,7 @@
<parent>
<groupId>dev.sheldan.abstracto.core</groupId>
<artifactId>core</artifactId>
<version>1.5.10</version>
<version>1.5.13-SNAPSHOT</version>
</parent>
<modelVersion>4.0.0</modelVersion>
<packaging>jar</packaging>

View File

@@ -5,12 +5,15 @@ import lombok.Getter;
import lombok.Setter;
import java.time.Duration;
import java.time.Instant;
import java.time.temporal.ChronoUnit;
@Getter
@Setter
@Builder
public class CoolDownCheckResult {
private Duration executeIn;
private Instant executeAt;
private Boolean canExecute;
private CoolDownReason reason;
@@ -20,6 +23,7 @@ public class CoolDownCheckResult {
.canExecute(false)
.reason(CoolDownReason.SERVER)
.executeIn(duration)
.executeAt(Instant.now().plus(duration.toSeconds(), ChronoUnit.SECONDS))
.build();
}
@@ -28,6 +32,7 @@ public class CoolDownCheckResult {
.builder()
.canExecute(false)
.reason(CoolDownReason.CHANNEL_GROUP)
.executeAt(Instant.now().plus(duration.toSeconds(), ChronoUnit.SECONDS))
.executeIn(duration)
.build();
}
@@ -37,6 +42,7 @@ public class CoolDownCheckResult {
.builder()
.canExecute(false)
.reason(CoolDownReason.MEMBER)
.executeAt(Instant.now().plus(duration.toSeconds(), ChronoUnit.SECONDS))
.executeIn(duration)
.build();
}

View File

@@ -1,7 +1,11 @@
package dev.sheldan.abstracto.core.interaction.slash.parameter;
import net.dv8tion.jda.api.events.interaction.command.CommandAutoCompleteInteractionEvent;
import net.dv8tion.jda.api.interactions.AutoCompleteQuery;
public interface SlashCommandAutoCompleteService {
boolean matchesParameter(AutoCompleteQuery query, String parameterName);
<T, Z> Z getCommandOption(String name, CommandAutoCompleteInteractionEvent event, Class<T> parameterType, Class<Z> slashParameterType);
<T, Z> boolean hasCommandOption(String name, CommandAutoCompleteInteractionEvent event, Class<T> parameterType, Class<Z> slashParameterType);
<T> T getCommandOption(String name, CommandAutoCompleteInteractionEvent event, Class<T> parameterType);
}

View File

@@ -3,20 +3,20 @@ package dev.sheldan.abstracto.core.interaction.slash.parameter;
import dev.sheldan.abstracto.core.models.database.AEmote;
import net.dv8tion.jda.api.entities.emoji.Emoji;
import net.dv8tion.jda.api.events.interaction.command.SlashCommandInteractionEvent;
import net.dv8tion.jda.api.interactions.commands.CommandInteractionPayload;
import net.dv8tion.jda.api.interactions.commands.OptionType;
import java.util.List;
public interface SlashCommandParameterService {
<T, Z> Z getCommandOption(String name, SlashCommandInteractionEvent event, Class<T> parameterType, Class<Z> slashParameterType);
<T, Z> boolean hasCommandOption(String name, SlashCommandInteractionEvent event, Class<T> parameterType, Class<Z> slashParameterType);
<T> T getCommandOption(String name, SlashCommandInteractionEvent event, Class<T> parameterType);
Object getCommandOption(String name, SlashCommandInteractionEvent event);
Boolean hasCommandOption(String name, SlashCommandInteractionEvent event);
Boolean hasCommandOptionWithFullType(String name, SlashCommandInteractionEvent event, OptionType optionType);
AEmote loadAEmoteFromString(String input, SlashCommandInteractionEvent event);
Emoji loadEmoteFromString(String input, SlashCommandInteractionEvent event);
<T, Z> Z getCommandOption(String name, CommandInteractionPayload event, Class<T> parameterType, Class<Z> slashParameterType);
<T, Z> boolean hasCommandOption(String name, CommandInteractionPayload event, Class<T> parameterType, Class<Z> slashParameterType);
<T> T getCommandOption(String name, CommandInteractionPayload event, Class<T> parameterType);
Object getCommandOption(String name, CommandInteractionPayload event);
Boolean hasCommandOption(String name, CommandInteractionPayload event);
Boolean hasCommandOptionWithFullType(String name, CommandInteractionPayload event, OptionType optionType);
AEmote loadAEmoteFromString(String input, CommandInteractionPayload event);
Emoji loadEmoteFromString(String input, CommandInteractionPayload event);
List<OptionType> getTypesFromParameter(Class clazz);
String getFullQualifiedParameterName(String name, OptionType type);
}

View File

@@ -3,7 +3,7 @@
<parent>
<artifactId>core</artifactId>
<groupId>dev.sheldan.abstracto.core</groupId>
<version>1.5.10</version>
<version>1.5.13-SNAPSHOT</version>
</parent>
<modelVersion>4.0.0</modelVersion>

View File

@@ -3,7 +3,7 @@
<parent>
<artifactId>core</artifactId>
<groupId>dev.sheldan.abstracto.core</groupId>
<version>1.5.10</version>
<version>1.5.13-SNAPSHOT</version>
</parent>
<modelVersion>4.0.0</modelVersion>

View File

@@ -3,7 +3,7 @@
<parent>
<groupId>dev.sheldan.abstracto</groupId>
<artifactId>abstracto-application</artifactId>
<version>1.5.10</version>
<version>1.5.13-SNAPSHOT</version>
</parent>
<modelVersion>4.0.0</modelVersion>

View File

@@ -3,7 +3,7 @@
<parent>
<artifactId>abstracto-application</artifactId>
<groupId>dev.sheldan.abstracto</groupId>
<version>1.5.10</version>
<version>1.5.13-SNAPSHOT</version>
</parent>
<modelVersion>4.0.0</modelVersion>

View File

@@ -10,7 +10,7 @@
<groupId>dev.sheldan.abstracto</groupId>
<artifactId>abstracto-application</artifactId>
<version>1.5.10</version>
<version>1.5.13-SNAPSHOT</version>
<packaging>pom</packaging>
<modules>
@@ -32,7 +32,7 @@
<scm>
<url>https://maven.pkg.github.com/Sheldan/abstracto</url>
<developerConnection>scm:git:git@github.com:Sheldan/abstracto.git</developerConnection>
<tag>v1.5.10</tag>
<tag>HEAD</tag>
</scm>
<repositories>

View File

@@ -3,7 +3,7 @@
<parent>
<groupId>dev.sheldan.abstracto</groupId>
<artifactId>abstracto-application</artifactId>
<version>1.5.10</version>
<version>1.5.13-SNAPSHOT</version>
</parent>
<modelVersion>4.0.0</modelVersion>

View File

@@ -3,7 +3,7 @@
<parent>
<groupId>dev.sheldan.abstracto.scheduling</groupId>
<artifactId>scheduling</artifactId>
<version>1.5.10</version>
<version>1.5.13-SNAPSHOT</version>
</parent>
<modelVersion>4.0.0</modelVersion>
<packaging>jar</packaging>

View File

@@ -3,7 +3,7 @@
<parent>
<groupId>dev.sheldan.abstracto.scheduling</groupId>
<artifactId>scheduling</artifactId>
<version>1.5.10</version>
<version>1.5.13-SNAPSHOT</version>
</parent>
<modelVersion>4.0.0</modelVersion>
<packaging>jar</packaging>

View File

@@ -1,2 +1,2 @@
REGISTRY_PREFIX=harbor.sheldan.dev/abstracto/
VERSION=1.5.10
VERSION=1.5.12