mirror of
https://github.com/Sheldan/abstracto.git
synced 2026-04-14 11:48:16 +00:00
[AB-150] creating repost detection feature including configuration and documentation
adding http and hash service adding ability to add default emotes to a message to message service adding message embedded listener to wrap the embedded event adding custom channel groups which can be defined by modules, in case a change on a channel group (only created and updated) happens a listener is available in order to sync the state in dependant areas changing command receiver re-throwing abstracto runtime exceptions in order to display them better changing channel group parameter handler to throw an exception in case the channel group was not found adding User in a server parameter handler split channel not found exception to be able to differentiate between not found in database and not found in guild changing exception handling in command received handler to handle the case for only one parameter handler future which failed (the whole single future failed, which was not reported) changing parameter type of `removeFromChannelGroup` to AChannel in order to be able to delete channels in the database via ID moving method to mock utils for mocking consumer removing parameter validation from commands, as it should be done in the command received handler and parameter handlers anyway
This commit is contained in:
@@ -23,7 +23,6 @@ public class ActivateAssignableRolePlace extends AbstractConditionableCommand {
|
||||
|
||||
@Override
|
||||
public CommandResult execute(CommandContext commandContext) {
|
||||
checkParameters(commandContext);
|
||||
List<Object> parameters = commandContext.getParameters().getParameters();
|
||||
String name = (String) parameters.get(0);
|
||||
service.activateAssignableRolePlace(commandContext.getUserInitiatedContext().getServer(), name);
|
||||
|
||||
@@ -32,7 +32,6 @@ public class AddRoleToAssignableRolePost extends AbstractConditionableCommand {
|
||||
|
||||
@Override
|
||||
public CompletableFuture<CommandResult> executeAsync(CommandContext commandContext) {
|
||||
checkParameters(commandContext);
|
||||
List<Object> parameters = commandContext.getParameters().getParameters();
|
||||
String name = (String) parameters.get(0);
|
||||
FullEmote emote = (FullEmote) parameters.get(1);
|
||||
|
||||
@@ -33,7 +33,6 @@ public class CreateAssignableRolePost extends AbstractConditionableCommand {
|
||||
|
||||
@Override
|
||||
public CommandResult execute(CommandContext commandContext) {
|
||||
checkParameters(commandContext);
|
||||
List<Object> parameters = commandContext.getParameters().getParameters();
|
||||
String name = (String) parameters.get(0);
|
||||
MessageChannel channel = (TextChannel) parameters.get(1);
|
||||
|
||||
@@ -23,7 +23,6 @@ public class DeactivateAssignableRolePlace extends AbstractConditionableCommand
|
||||
|
||||
@Override
|
||||
public CommandResult execute(CommandContext commandContext) {
|
||||
checkParameters(commandContext);
|
||||
List<Object> parameters = commandContext.getParameters().getParameters();
|
||||
String name = (String) parameters.get(0);
|
||||
service.deactivateAssignableRolePlace(commandContext.getUserInitiatedContext().getServer(), name);
|
||||
|
||||
@@ -24,7 +24,6 @@ public class DeleteAssignableRolePlace extends AbstractConditionableCommand {
|
||||
|
||||
@Override
|
||||
public CompletableFuture<CommandResult> executeAsync(CommandContext commandContext) {
|
||||
checkParameters(commandContext);
|
||||
List<Object> parameters = commandContext.getParameters().getParameters();
|
||||
String name = (String) parameters.get(0);
|
||||
return service.deleteAssignableRolePlace(commandContext.getUserInitiatedContext().getServer(), name)
|
||||
|
||||
@@ -29,7 +29,6 @@ public class EditAssignableRolePlaceText extends AbstractConditionableCommand {
|
||||
|
||||
@Override
|
||||
public CompletableFuture<CommandResult> executeAsync(CommandContext commandContext) {
|
||||
checkParameters(commandContext);
|
||||
List<Object> parameters = commandContext.getParameters().getParameters();
|
||||
String name = (String) parameters.get(0);
|
||||
String newText = (String) parameters.get(1);
|
||||
|
||||
@@ -24,7 +24,6 @@ public class MoveAssignableRolePlace extends AbstractConditionableCommand {
|
||||
|
||||
@Override
|
||||
public CommandResult execute(CommandContext commandContext) {
|
||||
checkParameters(commandContext);
|
||||
List<Object> parameters = commandContext.getParameters().getParameters();
|
||||
String name = (String) parameters.get(0);
|
||||
TextChannel newChannel = (TextChannel) parameters.get(1);
|
||||
|
||||
@@ -25,7 +25,6 @@ public class RemoveRoleFromAssignableRolePlace extends AbstractConditionableComm
|
||||
|
||||
@Override
|
||||
public CompletableFuture<CommandResult> executeAsync(CommandContext commandContext) {
|
||||
checkParameters(commandContext);
|
||||
List<Object> parameters = commandContext.getParameters().getParameters();
|
||||
String name = (String) parameters.get(0);
|
||||
FullEmote emote = (FullEmote) parameters.get(1);
|
||||
|
||||
@@ -24,7 +24,6 @@ public class SetAssignableRolePosition extends AbstractConditionableCommand {
|
||||
|
||||
@Override
|
||||
public CommandResult execute(CommandContext commandContext) {
|
||||
checkParameters(commandContext);
|
||||
List<Object> parameters = commandContext.getParameters().getParameters();
|
||||
String name = (String) parameters.get(0);
|
||||
FullEmote emote = (FullEmote) parameters.get(1);
|
||||
|
||||
@@ -30,7 +30,6 @@ public class SetupAssignableRolePlace extends AbstractConditionableCommand {
|
||||
|
||||
@Override
|
||||
public CompletableFuture<CommandResult> executeAsync(CommandContext commandContext) {
|
||||
checkParameters(commandContext);
|
||||
List<Object> parameters = commandContext.getParameters().getParameters();
|
||||
String name = (String) parameters.get(0);
|
||||
return service.setupAssignableRolePlace(commandContext.getUserInitiatedContext().getServer(), name)
|
||||
|
||||
@@ -24,7 +24,6 @@ public class ShowAssignableRolePlaceConfig extends AbstractConditionableCommand
|
||||
|
||||
@Override
|
||||
public CommandResult execute(CommandContext commandContext) {
|
||||
checkParameters(commandContext);
|
||||
List<Object> parameters = commandContext.getParameters().getParameters();
|
||||
String name = (String) parameters.get(0);
|
||||
// TODO refactor to return something to be posted in this command here instead of relying it to be posted somewhere else
|
||||
|
||||
@@ -30,7 +30,6 @@ public class SwapAssignableRolePosition extends AbstractConditionableCommand {
|
||||
|
||||
@Override
|
||||
public CommandResult execute(CommandContext commandContext) {
|
||||
checkParameters(commandContext);
|
||||
List<Object> parameters = commandContext.getParameters().getParameters();
|
||||
String name = (String) parameters.get(0);
|
||||
FullEmote firstEmote = (FullEmote) parameters.get(1);
|
||||
|
||||
@@ -24,7 +24,6 @@ public class TestAssignableRolePlace extends AbstractConditionableCommand {
|
||||
|
||||
@Override
|
||||
public CompletableFuture<CommandResult> executeAsync(CommandContext commandContext) {
|
||||
checkParameters(commandContext);
|
||||
List<Object> parameters = commandContext.getParameters().getParameters();
|
||||
String name = (String) parameters.get(0);
|
||||
return service.testAssignableRolePlace(commandContext.getUserInitiatedContext().getServer(), name, commandContext.getChannel())
|
||||
|
||||
@@ -14,7 +14,7 @@ import dev.sheldan.abstracto.assignableroles.service.management.AssignableRolePl
|
||||
import dev.sheldan.abstracto.assignableroles.service.management.AssignableRolePlacePostManagementService;
|
||||
import dev.sheldan.abstracto.core.command.exception.AbstractoTemplatedException;
|
||||
import dev.sheldan.abstracto.core.command.exception.CommandParameterKeyValueWrongTypeException;
|
||||
import dev.sheldan.abstracto.core.exception.ChannelNotFoundException;
|
||||
import dev.sheldan.abstracto.core.exception.ChannelNotInGuildException;
|
||||
import dev.sheldan.abstracto.core.exception.EmoteNotUsableException;
|
||||
import dev.sheldan.abstracto.core.models.FullEmote;
|
||||
import dev.sheldan.abstracto.core.models.database.*;
|
||||
@@ -185,7 +185,7 @@ public class AssignableRolePlaceServiceBean implements AssignableRolePlaceServic
|
||||
return addNewMessageToAssignableRolePlace(placeId, fakeEmote, description, roleId, serverId, messageToSend, textChannel);
|
||||
}
|
||||
} else {
|
||||
throw new ChannelNotFoundException(latestPost.getUsedChannel().getId());
|
||||
throw new ChannelNotInGuildException(latestPost.getUsedChannel().getId());
|
||||
}
|
||||
} else {
|
||||
log.trace("Added emote to assignable place {} in server {}, but no message post yet.", placeId, serverId);
|
||||
@@ -374,7 +374,7 @@ public class AssignableRolePlaceServiceBean implements AssignableRolePlaceServic
|
||||
log.info("Refreshing text for assignable role place {} in channel {} in post {}.", place.getId(), channelId, firstPost.getId());
|
||||
return channelService.editEmbedMessageInAChannel(renderedMessage.getEmbeds().get(0), channelOptional.get(), firstPost.getId()).thenCompose(message -> CompletableFuture.completedFuture(null));
|
||||
}
|
||||
throw new ChannelNotFoundException(channelId);
|
||||
throw new ChannelNotInGuildException(channelId);
|
||||
}
|
||||
return CompletableFuture.completedFuture(null);
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user