mirror of
https://github.com/Sheldan/abstracto.git
synced 2026-01-26 05:44:42 +00:00
[AB-104] adding server wide member individual command cooldown and commands to set/reset this cooldown configuration on a command level
removing custom cooldown handling from payday and slots commands
This commit is contained in:
@@ -6,6 +6,7 @@ import lombok.*;
|
||||
|
||||
import jakarta.persistence.*;
|
||||
import java.io.Serializable;
|
||||
import java.time.Duration;
|
||||
import java.time.Instant;
|
||||
import java.util.List;
|
||||
|
||||
@@ -51,6 +52,9 @@ public class ACommandInAServer implements Serializable {
|
||||
@Column(name = "slash_command_id")
|
||||
private Long slashCommandId;
|
||||
|
||||
@Column(name = "member_cooldown")
|
||||
private Duration memberCooldown;
|
||||
|
||||
@Column(name = "created", nullable = false, insertable = false, updatable = false)
|
||||
private Instant created;
|
||||
|
||||
|
||||
@@ -10,9 +10,11 @@ import dev.sheldan.abstracto.core.command.model.database.ACommand;
|
||||
import dev.sheldan.abstracto.core.config.FeatureDefinition;
|
||||
import dev.sheldan.abstracto.core.models.database.ARole;
|
||||
import dev.sheldan.abstracto.core.models.database.AServer;
|
||||
import net.dv8tion.jda.api.entities.Guild;
|
||||
import net.dv8tion.jda.api.entities.Message;
|
||||
import net.dv8tion.jda.api.events.interaction.command.SlashCommandInteractionEvent;
|
||||
|
||||
import java.time.Duration;
|
||||
import java.util.concurrent.CompletableFuture;
|
||||
|
||||
public interface CommandService {
|
||||
@@ -30,4 +32,5 @@ public interface CommandService {
|
||||
UnParsedCommandParameter getUnParsedCommandParameter(String messageContent, Message message);
|
||||
CompletableFuture<Parameters> getParametersForCommand(String commandName, Message messageContainingContent);
|
||||
Parameter cloneParameter(Parameter parameter);
|
||||
void setServerCooldownTo(String commandName, Guild guild, Duration duration);
|
||||
}
|
||||
|
||||
@@ -4,6 +4,7 @@ import dev.sheldan.abstracto.core.command.model.database.ACommand;
|
||||
import dev.sheldan.abstracto.core.command.model.database.ACommandInAServer;
|
||||
import dev.sheldan.abstracto.core.models.database.AServer;
|
||||
|
||||
import java.time.Duration;
|
||||
import java.util.List;
|
||||
|
||||
public interface CommandInServerManagementService {
|
||||
@@ -11,6 +12,7 @@ public interface CommandInServerManagementService {
|
||||
ACommandInAServer createCommandInServer(ACommand command, AServer server, Long commandId);
|
||||
boolean doesCommandExistInServer(ACommand command, AServer server);
|
||||
ACommandInAServer getCommandForServer(ACommand command, AServer server);
|
||||
void setCooldownForCommandInServer(ACommand command, AServer server, Duration duration);
|
||||
ACommandInAServer getCommandForServer(ACommand command, Long serverId);
|
||||
ACommandInAServer getCommandForServer(Long commandInServerId);
|
||||
List<ACommandInAServer> getCommandsForServer(List<Long> commandInServerId);
|
||||
|
||||
@@ -3,6 +3,7 @@ package dev.sheldan.abstracto.core.interaction.slash;
|
||||
public class CoreSlashCommandNames {
|
||||
public static final String UTILITY = "utility";
|
||||
public static final String CONFIG = "config";
|
||||
public static final String COOLDOWN = "cooldown";
|
||||
public static final String FEATURE = "feature";
|
||||
public static final String CHANNELS = "channels";
|
||||
public static final String POST_TARGET = "posttarget";
|
||||
|
||||
Reference in New Issue
Block a user