[AB-196] adding confirmation requirement to various commands

refactoring command received handler in order to re-use when confirmation has been given
removing reaction from showSuggestion and remind command
adding log message for message deleted message, in case the member left
all commands from now on must work without the member field from the message, as this is not available when retrieving the message
This commit is contained in:
Sheldan
2021-09-10 21:40:54 +02:00
parent da1a71ecdc
commit 16e6caa1f0
51 changed files with 615 additions and 109 deletions

View File

@@ -7,7 +7,6 @@ import dev.sheldan.abstracto.core.command.config.EffectConfig;
import dev.sheldan.abstracto.core.command.execution.CommandContext;
import dev.sheldan.abstracto.core.command.service.management.CommandInServerManagementService;
import dev.sheldan.abstracto.core.command.service.management.CommandManagementService;
import dev.sheldan.abstracto.core.exception.AbstractoRunTimeException;
import dev.sheldan.abstracto.core.models.database.RoleImmunity;
import dev.sheldan.abstracto.core.service.RoleImmunityService;
import dev.sheldan.abstracto.core.service.RoleService;
@@ -113,7 +112,6 @@ public class ImmuneUserCondition implements CommandCondition {
return;
}
} else {
resultFuture.completeExceptionally(new AbstractoRunTimeException("No member found for given member in condition."));
return;
}
} else {

View File

@@ -19,6 +19,9 @@ public class CommandConfiguration {
@Builder.Default
private boolean supportsEmbedException = false;
@Builder.Default
private boolean requiresConfirmation = false;
@Builder.Default
private List<Parameter> parameters = new ArrayList<>();

View File

@@ -14,6 +14,7 @@ public class CoreFeatureConfig implements FeatureConfig {
public static final String SUCCESS_REACTION_KEY = "successReaction";
public static final String WARN_REACTION_KEY = "warnReaction";
public static final String MAX_MESSAGES_KEY = "maxMessages";
public static final String CONFIRMATION_TIMEOUT = "confirmationTimeout";
@Override
public FeatureDefinition getFeature() {
@@ -27,6 +28,6 @@ public class CoreFeatureConfig implements FeatureConfig {
@Override
public List<String> getRequiredSystemConfigKeys() {
return Arrays.asList(NO_COMMAND_REPORTING_CONFIG_KEY, MAX_MESSAGES_KEY);
return Arrays.asList(NO_COMMAND_REPORTING_CONFIG_KEY, MAX_MESSAGES_KEY, CONFIRMATION_TIMEOUT);
}
}

View File

@@ -0,0 +1,26 @@
package dev.sheldan.abstracto.core.command.execution;
import lombok.Builder;
import lombok.Getter;
import lombok.Setter;
@Getter
@Setter
@Builder
public class DriedCommandContext {
private String commandName;
private Long serverId;
private Long channelId;
private Long messageId;
private Long userId;
public static DriedCommandContext buildFromCommandContext(CommandContext commandContext) {
return DriedCommandContext
.builder()
.channelId(commandContext.getChannel().getIdLong())
.messageId(commandContext.getMessage().getIdLong())
.serverId(commandContext.getGuild().getIdLong())
.userId(commandContext.getMessage().getAuthor().getIdLong())
.build();
}
}