added template support to echo

replaced HashMaps for templates with concrete models, so the interface is easier known
added rendering method for objects directly
added default parameters available for commands
split up service beans for server/channel into management and service bean
added server reference in AChannel
refactored join/leave listener
This commit is contained in:
Sheldan
2020-03-17 19:41:25 +01:00
parent 0521a1ab44
commit 167bbb0f8b
41 changed files with 399 additions and 205 deletions

View File

@@ -11,8 +11,6 @@ import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import java.util.Collections;
import java.util.HashMap;
import java.util.List;
@Service
@@ -23,10 +21,10 @@ public class Help implements Command {
private ModuleRegistry registry;
@Override
public Result execute(Context context) {
public Result execute(CommandContext commandContext) {
CommandHierarchy commandStructure = registry.getDetailedModules();
StringBuilder sb = new StringBuilder();
if(context.getParameters().getParameters().isEmpty()){
if(commandContext.getParameters().getParameters().isEmpty()){
sb.append("Help | Module overview \n");
sb.append("```");
commandStructure.getRootModules().forEach(packedModule -> {
@@ -35,7 +33,7 @@ public class Help implements Command {
});
sb.append("```");
} else {
String parameterValue = context.getParameters().getParameters().get(0).toString();
String parameterValue = commandContext.getParameters().getParameters().get(0).toString();
PackedModule module = commandStructure.getModuleWithName(parameterValue);
if(module != null){
sb.append("Help | Module overview \n");
@@ -53,7 +51,7 @@ public class Help implements Command {
}
}
context.getChannel().sendMessage(sb.toString()).queue();
commandContext.getChannel().sendMessage(sb.toString()).queue();
return Result.fromSuccess();
}