mirror of
https://github.com/Sheldan/abstracto.git
synced 2026-01-29 17:02:40 +00:00
pulled some more user facing strings into templates
This commit is contained in:
@@ -14,6 +14,7 @@ import dev.sheldan.abstracto.core.service.RoleService;
|
||||
import dev.sheldan.abstracto.core.service.management.RoleManagementService;
|
||||
import dev.sheldan.abstracto.experience.config.features.ExperienceFeature;
|
||||
import dev.sheldan.abstracto.experience.service.ExperienceRoleService;
|
||||
import dev.sheldan.abstracto.templating.service.TemplateService;
|
||||
import lombok.extern.slf4j.Slf4j;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.stereotype.Component;
|
||||
@@ -35,6 +36,8 @@ public class SetExpRole extends AbstractConditionableCommand {
|
||||
@Autowired
|
||||
private RoleService roleService;
|
||||
|
||||
@Autowired
|
||||
private TemplateService templateService;
|
||||
|
||||
@Override
|
||||
public CommandResult execute(CommandContext commandContext) {
|
||||
@@ -51,7 +54,7 @@ public class SetExpRole extends AbstractConditionableCommand {
|
||||
experienceRoleService.setRoleToLevel(role, level, server, commandContext.getUserInitiatedContext().getChannel());
|
||||
return CommandResult.fromSuccess();
|
||||
}
|
||||
return CommandResult.fromError("Could not find role");
|
||||
return CommandResult.fromError(templateService.renderTemplate("could_not_find_role", new Object()));
|
||||
}
|
||||
|
||||
@Override
|
||||
|
||||
@@ -30,7 +30,7 @@ public class ShowEmote extends AbstractConditionableCommand {
|
||||
List<Object> parameters = commandContext.getParameters().getParameters();
|
||||
Object emoteParameter = parameters.get(0);
|
||||
if(!(emoteParameter instanceof Emote)) {
|
||||
return CommandResult.fromError("No custom emote found.");
|
||||
return CommandResult.fromError(templateService.renderTemplate("no_custom_emote_found", new Object()));
|
||||
}
|
||||
Emote emote = (Emote) emoteParameter;
|
||||
ShowEmoteLog emoteLog = (ShowEmoteLog) ContextConverter.fromCommandContext(commandContext, ShowEmoteLog.class);
|
||||
|
||||
@@ -12,6 +12,7 @@ import dev.sheldan.abstracto.core.command.execution.*;
|
||||
import dev.sheldan.abstracto.core.command.execution.UnParsedCommandParameter;
|
||||
import dev.sheldan.abstracto.core.Constants;
|
||||
import dev.sheldan.abstracto.core.exception.ChannelNotFoundException;
|
||||
import dev.sheldan.abstracto.core.exception.RoleNotFoundInDBException;
|
||||
import dev.sheldan.abstracto.core.models.database.ARole;
|
||||
import dev.sheldan.abstracto.core.service.management.ChannelManagementService;
|
||||
import dev.sheldan.abstracto.core.service.management.RoleManagementService;
|
||||
@@ -175,9 +176,11 @@ public class CommandReceivedHandler extends ListenerAdapter {
|
||||
}
|
||||
} else if(param.getType().equals(ARole.class)) {
|
||||
if(StringUtils.isNumeric(value)) {
|
||||
parsedParameters.add(roleManagementService.findRole(Long.parseLong(value), userInitiatedServerContext.getServer()));
|
||||
long roleId = Long.parseLong(value);
|
||||
parsedParameters.add(roleManagementService.findRole(roleId, userInitiatedServerContext.getServer()).orElseThrow(() -> new RoleNotFoundInDBException(roleId, message.getGuild().getIdLong())));
|
||||
} else {
|
||||
parsedParameters.add(roleManagementService.findRole(roleIterator.next().getIdLong(), userInitiatedServerContext.getServer()));
|
||||
long roleId = roleIterator.next().getIdLong();
|
||||
parsedParameters.add(roleManagementService.findRole(roleId, userInitiatedServerContext.getServer()).orElseThrow(() -> new RoleNotFoundInDBException(roleId, message.getGuild().getIdLong())));
|
||||
}
|
||||
} else if(param.getType().equals(Boolean.class)) {
|
||||
parsedParameters.add(Boolean.valueOf(value));
|
||||
|
||||
@@ -15,6 +15,7 @@ import dev.sheldan.abstracto.core.config.FeatureEnum;
|
||||
import dev.sheldan.abstracto.core.config.features.CoreFeatures;
|
||||
import dev.sheldan.abstracto.core.models.database.AFeature;
|
||||
import dev.sheldan.abstracto.core.service.management.RoleManagementService;
|
||||
import dev.sheldan.abstracto.templating.service.TemplateService;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.stereotype.Component;
|
||||
|
||||
@@ -36,6 +37,9 @@ public class Allow extends AbstractConditionableCommand {
|
||||
@Autowired
|
||||
private RoleManagementService roleManagementService;
|
||||
|
||||
@Autowired
|
||||
private TemplateService templateService;
|
||||
|
||||
@Override
|
||||
public CommandResult execute(CommandContext commandContext) {
|
||||
String name = (String) commandContext.getParameters().getParameters().get(0);
|
||||
@@ -48,7 +52,7 @@ public class Allow extends AbstractConditionableCommand {
|
||||
ACommand command = commandManagementService.findCommandByName(name);
|
||||
commandService.unRestrictCommand(command, commandContext.getUserInitiatedContext().getServer());
|
||||
} else {
|
||||
return CommandResult.fromError("No Feature/Command with that name");
|
||||
return CommandResult.fromError(templateService.renderTemplate("no_feature_command_found", new Object()));
|
||||
}
|
||||
return CommandResult.fromSuccess();
|
||||
}
|
||||
|
||||
@@ -17,6 +17,7 @@ import dev.sheldan.abstracto.core.models.database.AFeature;
|
||||
import dev.sheldan.abstracto.core.models.database.ARole;
|
||||
import dev.sheldan.abstracto.core.service.FeatureFlagService;
|
||||
import dev.sheldan.abstracto.core.service.management.RoleManagementService;
|
||||
import dev.sheldan.abstracto.templating.service.TemplateService;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.stereotype.Component;
|
||||
|
||||
@@ -41,6 +42,9 @@ public class AllowRole extends AbstractConditionableCommand {
|
||||
@Autowired
|
||||
private FeatureFlagService featureFlagService;
|
||||
|
||||
@Autowired
|
||||
private TemplateService templateService;
|
||||
|
||||
@Override
|
||||
public CommandResult execute(CommandContext commandContext) {
|
||||
String name = (String) commandContext.getParameters().getParameters().get(0);
|
||||
@@ -52,7 +56,7 @@ public class AllowRole extends AbstractConditionableCommand {
|
||||
ACommand command = commandManagementService.findCommandByName(name);
|
||||
commandService.allowCommandForRole(command, role);
|
||||
} else {
|
||||
return CommandResult.fromError("No Feature/Command with that name");
|
||||
return CommandResult.fromError(templateService.renderTemplate("no_feature_command_found", new Object()));
|
||||
}
|
||||
return CommandResult.fromSuccess();
|
||||
}
|
||||
|
||||
@@ -16,6 +16,7 @@ import dev.sheldan.abstracto.core.config.features.CoreFeatures;
|
||||
import dev.sheldan.abstracto.core.models.database.AFeature;
|
||||
import dev.sheldan.abstracto.core.models.database.ARole;
|
||||
import dev.sheldan.abstracto.core.service.management.RoleManagementService;
|
||||
import dev.sheldan.abstracto.templating.service.TemplateService;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.stereotype.Component;
|
||||
|
||||
@@ -37,6 +38,9 @@ public class DisAllowRole extends AbstractConditionableCommand {
|
||||
@Autowired
|
||||
private RoleManagementService roleManagementService;
|
||||
|
||||
@Autowired
|
||||
private TemplateService templateService;
|
||||
|
||||
@Override
|
||||
public CommandResult execute(CommandContext commandContext) {
|
||||
String name = (String) commandContext.getParameters().getParameters().get(0);
|
||||
@@ -50,7 +54,7 @@ public class DisAllowRole extends AbstractConditionableCommand {
|
||||
ACommand command = commandManagementService.findCommandByName(name);
|
||||
commandService.disAllowCommandForRole(command, role);
|
||||
} else {
|
||||
return CommandResult.fromError("No Feature/Command with that name");
|
||||
return CommandResult.fromError(templateService.renderTemplate("no_feature_command_found", new Object()));
|
||||
}
|
||||
return CommandResult.fromSuccess();
|
||||
}
|
||||
|
||||
@@ -16,6 +16,7 @@ import dev.sheldan.abstracto.core.config.features.CoreFeatures;
|
||||
import dev.sheldan.abstracto.core.models.database.AFeature;
|
||||
import dev.sheldan.abstracto.core.models.database.ARole;
|
||||
import dev.sheldan.abstracto.core.service.management.RoleManagementService;
|
||||
import dev.sheldan.abstracto.templating.service.TemplateService;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.stereotype.Component;
|
||||
|
||||
@@ -37,6 +38,9 @@ public class MakeAffected extends AbstractConditionableCommand {
|
||||
@Autowired
|
||||
private RoleManagementService roleManagementService;
|
||||
|
||||
@Autowired
|
||||
private TemplateService templateService;
|
||||
|
||||
@Override
|
||||
public CommandResult execute(CommandContext commandContext) {
|
||||
String name = (String) commandContext.getParameters().getParameters().get(0);
|
||||
@@ -50,7 +54,7 @@ public class MakeAffected extends AbstractConditionableCommand {
|
||||
ACommand command = commandManagementService.findCommandByName(name);
|
||||
commandService.makeRoleAffectedByCommand(command, role);
|
||||
} else {
|
||||
return CommandResult.fromError("No Feature/Command with that name");
|
||||
return CommandResult.fromError(templateService.renderTemplate("no_feature_command_found", new Object()));
|
||||
}
|
||||
return CommandResult.fromSuccess();
|
||||
}
|
||||
|
||||
@@ -16,6 +16,7 @@ import dev.sheldan.abstracto.core.config.features.CoreFeatures;
|
||||
import dev.sheldan.abstracto.core.models.database.AFeature;
|
||||
import dev.sheldan.abstracto.core.models.database.ARole;
|
||||
import dev.sheldan.abstracto.core.service.management.RoleManagementService;
|
||||
import dev.sheldan.abstracto.templating.service.TemplateService;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.stereotype.Component;
|
||||
|
||||
@@ -37,6 +38,9 @@ public class MakeImmune extends AbstractConditionableCommand {
|
||||
@Autowired
|
||||
private RoleManagementService roleManagementService;
|
||||
|
||||
@Autowired
|
||||
private TemplateService templateService;
|
||||
|
||||
@Override
|
||||
public CommandResult execute(CommandContext commandContext) {
|
||||
String name = (String) commandContext.getParameters().getParameters().get(0);
|
||||
@@ -50,7 +54,7 @@ public class MakeImmune extends AbstractConditionableCommand {
|
||||
ACommand command = commandManagementService.findCommandByName(name);
|
||||
commandService.makeRoleImmuneForCommand(command, role);
|
||||
} else {
|
||||
return CommandResult.fromError("No Feature/Command with that name");
|
||||
return CommandResult.fromError(templateService.renderTemplate("no_feature_command_found", new Object()));
|
||||
}
|
||||
return CommandResult.fromSuccess();
|
||||
}
|
||||
|
||||
@@ -15,6 +15,7 @@ import dev.sheldan.abstracto.core.config.FeatureEnum;
|
||||
import dev.sheldan.abstracto.core.config.features.CoreFeatures;
|
||||
import dev.sheldan.abstracto.core.models.database.AFeature;
|
||||
import dev.sheldan.abstracto.core.service.management.RoleManagementService;
|
||||
import dev.sheldan.abstracto.templating.service.TemplateService;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.stereotype.Component;
|
||||
|
||||
@@ -36,6 +37,9 @@ public class Restrict extends AbstractConditionableCommand {
|
||||
@Autowired
|
||||
private RoleManagementService roleManagementService;
|
||||
|
||||
@Autowired
|
||||
private TemplateService templateService;
|
||||
|
||||
@Override
|
||||
public CommandResult execute(CommandContext commandContext) {
|
||||
String name = (String) commandContext.getParameters().getParameters().get(0);
|
||||
@@ -48,7 +52,7 @@ public class Restrict extends AbstractConditionableCommand {
|
||||
ACommand command = commandManagementService.findCommandByName(name);
|
||||
commandService.restrictCommand(command, commandContext.getUserInitiatedContext().getServer());
|
||||
} else {
|
||||
return CommandResult.fromError("No Feature/Command with that name");
|
||||
return CommandResult.fromError(templateService.renderTemplate("no_feature_command_found", new Object()));
|
||||
}
|
||||
return CommandResult.fromSuccess();
|
||||
}
|
||||
|
||||
@@ -0,0 +1 @@
|
||||
<#include "could_not_find_role_text">
|
||||
@@ -0,0 +1 @@
|
||||
<#include "no_custom_emote_found_text">
|
||||
@@ -0,0 +1 @@
|
||||
<#include "no_feature_command_found_text">
|
||||
@@ -0,0 +1 @@
|
||||
Could not find role.
|
||||
@@ -0,0 +1 @@
|
||||
No custom emote found.
|
||||
@@ -0,0 +1 @@
|
||||
No Feature/Command with that name.
|
||||
Reference in New Issue
Block a user