mirror of
https://github.com/Sheldan/abstracto.git
synced 2026-04-06 01:10:58 +00:00
added current values to post post target
added support for custom setup steps for each feature added mod mail category setup step
This commit is contained in:
@@ -1,5 +1,6 @@
|
||||
package dev.sheldan.abstracto.core.config;
|
||||
|
||||
import dev.sheldan.abstracto.core.interactive.SetupStep;
|
||||
import dev.sheldan.abstracto.core.service.FeatureValidator;
|
||||
|
||||
import java.util.Collections;
|
||||
@@ -18,4 +19,5 @@ public interface FeatureConfig {
|
||||
default List<FeatureValidator> getAdditionalFeatureValidators() { return Collections.emptyList(); }
|
||||
default List<String> getRequiredEmotes() { return Collections.emptyList(); }
|
||||
default List<FeatureMode> getAvailableModes() { return Collections.emptyList(); };
|
||||
default List<SetupStep> getCustomSetupSteps() { return Collections.emptyList(); }
|
||||
}
|
||||
|
||||
@@ -0,0 +1,42 @@
|
||||
package dev.sheldan.abstracto.core.interactive;
|
||||
|
||||
import dev.sheldan.abstracto.core.service.ChannelService;
|
||||
import dev.sheldan.abstracto.templating.service.TemplateService;
|
||||
import lombok.Getter;
|
||||
import lombok.Setter;
|
||||
import net.dv8tion.jda.api.entities.Message;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
|
||||
@Getter
|
||||
@Setter
|
||||
public abstract class AbstractConfigSetupStep implements SetupStep {
|
||||
|
||||
@Autowired
|
||||
private InteractiveService interactiveService;
|
||||
|
||||
@Autowired
|
||||
private TemplateService templateService;
|
||||
|
||||
@Autowired
|
||||
private ChannelService channelService;
|
||||
|
||||
protected SetupExecution nextStep;
|
||||
|
||||
@Autowired
|
||||
private InteractiveUtils interactiveUtils;
|
||||
|
||||
|
||||
protected Runnable getTimeoutRunnable(Long serverId, Long channelId) {
|
||||
return () -> {
|
||||
interactiveUtils.sendTimeoutMessage(serverId, channelId);
|
||||
};
|
||||
}
|
||||
|
||||
protected boolean checkForExit(Message message) {
|
||||
return message.getContentRaw().trim().equalsIgnoreCase("exit");
|
||||
}
|
||||
|
||||
protected boolean checkForKeep(Message message) {
|
||||
return message.getContentRaw().trim().equalsIgnoreCase("default");
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,12 @@
|
||||
package dev.sheldan.abstracto.core.interactive;
|
||||
|
||||
import lombok.Builder;
|
||||
import lombok.Getter;
|
||||
import lombok.Setter;
|
||||
|
||||
@Getter
|
||||
@Setter
|
||||
@Builder
|
||||
public class EmptySetupParameter implements SetupStepParameter {
|
||||
private Long previousMessageId;
|
||||
}
|
||||
@@ -0,0 +1,29 @@
|
||||
package dev.sheldan.abstracto.core.interactive;
|
||||
|
||||
import dev.sheldan.abstracto.core.service.ChannelService;
|
||||
import dev.sheldan.abstracto.templating.service.TemplateService;
|
||||
import net.dv8tion.jda.api.entities.TextChannel;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.stereotype.Component;
|
||||
import org.springframework.transaction.annotation.Transactional;
|
||||
|
||||
import java.util.Optional;
|
||||
|
||||
@Component
|
||||
public class InteractiveUtils {
|
||||
|
||||
@Autowired
|
||||
private TemplateService templateService;
|
||||
|
||||
@Autowired
|
||||
private ChannelService channelService;
|
||||
|
||||
@Transactional
|
||||
public void sendTimeoutMessage(Long serverId, Long channelId) {
|
||||
String s = templateService.renderSimpleTemplate("setup_configuration_timeout");
|
||||
Optional<TextChannel> channelOptional = channelService.getTextChannelInGuild(serverId, channelId);
|
||||
channelOptional.ifPresent(channel -> {
|
||||
channelService.sendTextToChannelNoFuture(s, channel);
|
||||
});
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,14 @@
|
||||
package dev.sheldan.abstracto.core.models.template.commands;
|
||||
|
||||
import lombok.Builder;
|
||||
import lombok.Getter;
|
||||
import lombok.Setter;
|
||||
import net.dv8tion.jda.api.entities.TextChannel;
|
||||
|
||||
@Getter
|
||||
@Setter
|
||||
@Builder
|
||||
public class SetupPostTargetMessageModel {
|
||||
private String postTargetKey;
|
||||
private TextChannel currentTextChannel;
|
||||
}
|
||||
Reference in New Issue
Block a user