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

@@ -35,6 +35,12 @@
<version>${project.version}</version>
</dependency>
<dependency>
<groupId>dev.sheldan.abstracto.core</groupId>
<artifactId>core-interface</artifactId>
<version>${project.version}</version>
</dependency>
</dependencies>

View File

@@ -1,11 +1,11 @@
package dev.sheldan.abstracto.command;
import dev.sheldan.abstracto.command.execution.Configuration;
import dev.sheldan.abstracto.command.execution.Context;
import dev.sheldan.abstracto.command.execution.CommandContext;
import dev.sheldan.abstracto.command.execution.Result;
public interface Command<T> {
Result execute(Context context);
Result execute(CommandContext commandContext);
Configuration getConfiguration();
}

View File

@@ -1,8 +1,8 @@
package dev.sheldan.abstracto.command;
import dev.sheldan.abstracto.command.execution.Context;
import dev.sheldan.abstracto.command.execution.CommandContext;
import dev.sheldan.abstracto.command.execution.Result;
public interface PostCommandExecution {
void execute(Context context, Result result, Command command);
void execute(CommandContext commandContext, Result result, Command command);
}

View File

@@ -10,11 +10,12 @@ import net.dv8tion.jda.api.entities.User;
@Builder
@Getter
public class Context {
public class CommandContext {
private TextChannel channel;
private Guild guild;
private User author;
private Message message;
private CommandTemplateContext commandTemplateContext;
private Parameters parameters;
private JDA jda;
}

View File

@@ -0,0 +1,18 @@
package dev.sheldan.abstracto.command.execution;
import dev.sheldan.abstracto.core.models.AChannel;
import dev.sheldan.abstracto.core.models.AServer;
import lombok.AllArgsConstructor;
import lombok.Builder;
import lombok.Getter;
@Getter @Builder @AllArgsConstructor
public class CommandTemplateContext {
private AChannel channel;
private AServer server;
public CommandTemplateContext(CommandTemplateContext commandTemplateContext) {
this.channel = commandTemplateContext.channel;
this.server = commandTemplateContext.server;
}
}