mirror of
https://github.com/Sheldan/abstracto.git
synced 2026-04-26 15:10:33 +00:00
[AB-136] replacing some rare occurrences where fake objects where used for actual database operations
replacing a few sync commands with async commands refactoring parameters in assignable role place service bean fixing emote parameter handler to also consider default emojis removing unused description in command replacing some ARole parameters with Role parameters, so we can be sure they exists added a few TODOs marking exception changes required
This commit is contained in:
@@ -37,6 +37,7 @@ public class DeleteNote extends AbstractConditionableCommand {
|
||||
if(userNoteManagementService.noteExists(id)) {
|
||||
userNoteManagementService.deleteNote(id);
|
||||
} else {
|
||||
// TODO replace with exception
|
||||
return CommandResult.fromError(templateService.renderSimpleTemplate(NOTE_NOT_FOUND_EXCEPTION_TEMPLATE));
|
||||
}
|
||||
return CommandResult.fromSuccess();
|
||||
|
||||
@@ -8,9 +8,11 @@ import dev.sheldan.abstracto.core.command.execution.CommandContext;
|
||||
import dev.sheldan.abstracto.core.command.execution.CommandResult;
|
||||
import dev.sheldan.abstracto.core.config.FeatureEnum;
|
||||
import dev.sheldan.abstracto.core.models.database.ARole;
|
||||
import dev.sheldan.abstracto.core.service.management.RoleManagementService;
|
||||
import dev.sheldan.abstracto.moderation.config.ModerationModule;
|
||||
import dev.sheldan.abstracto.moderation.config.features.ModerationFeatures;
|
||||
import dev.sheldan.abstracto.moderation.service.management.MuteRoleManagementService;
|
||||
import net.dv8tion.jda.api.entities.Role;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.stereotype.Component;
|
||||
|
||||
@@ -23,10 +25,14 @@ public class SetMuteRole extends AbstractConditionableCommand {
|
||||
@Autowired
|
||||
private MuteRoleManagementService muteRoleManagementService;
|
||||
|
||||
@Autowired
|
||||
private RoleManagementService roleManagementService;
|
||||
|
||||
@Override
|
||||
public CommandResult execute(CommandContext commandContext) {
|
||||
checkParameters(commandContext);
|
||||
ARole role = (ARole) commandContext.getParameters().getParameters().get(0);
|
||||
Role jdaRole = (Role) commandContext.getParameters().getParameters().get(0);
|
||||
ARole role = roleManagementService.findRole(jdaRole.getIdLong());
|
||||
muteRoleManagementService.setMuteRoleForServer(commandContext.getUserInitiatedContext().getServer(), role);
|
||||
return CommandResult.fromSuccess();
|
||||
}
|
||||
@@ -34,7 +40,7 @@ public class SetMuteRole extends AbstractConditionableCommand {
|
||||
@Override
|
||||
public CommandConfiguration getConfiguration() {
|
||||
List<Parameter> parameters = new ArrayList<>();
|
||||
parameters.add(Parameter.builder().name("role").templated(true).type(ARole.class).build());
|
||||
parameters.add(Parameter.builder().name("role").templated(true).type(Role.class).build());
|
||||
HelpInfo helpInfo = HelpInfo.builder().templated(true).build();
|
||||
return CommandConfiguration.builder()
|
||||
.name("setMuteRole")
|
||||
|
||||
Reference in New Issue
Block a user