[AB-xxx] refactoring modmail to offer a feature mode to use threads instead of channels

adding various utilities for thread channels in core
fixing enable feature not showing validation messages
restructuring feature mode collection to be a startup listener, because postconstruct might not have the appropriate values available, and therefore not initialize the map correctly
This commit is contained in:
Sheldan
2023-12-24 23:25:03 +01:00
parent 1f0bc493d9
commit befef1f61d
16 changed files with 283 additions and 101 deletions

View File

@@ -16,7 +16,8 @@ import java.util.List;
public class FeatureValidationResult implements Templatable {
private FeatureConfig feature;
private Boolean validationResult;
@Builder.Default
private Boolean validationResult = false;
@Builder.Default
private List<ValidationErrorModel> validationErrorModels = new ArrayList<>();
private String validationText;

View File

@@ -5,6 +5,7 @@ import dev.sheldan.abstracto.core.models.database.AServer;
import dev.sheldan.abstracto.core.templating.model.MessageToSend;
import net.dv8tion.jda.api.entities.*;
import net.dv8tion.jda.api.entities.channel.concrete.TextChannel;
import net.dv8tion.jda.api.entities.channel.concrete.ThreadChannel;
import net.dv8tion.jda.api.entities.channel.middleman.GuildChannel;
import net.dv8tion.jda.api.entities.channel.middleman.GuildMessageChannel;
import net.dv8tion.jda.api.entities.channel.middleman.MessageChannel;
@@ -43,6 +44,8 @@ public interface ChannelService {
CompletableFuture<Message> editFieldValueInMessage(MessageChannel channel, Long messageId, Integer index, String newValue);
CompletableFuture<Message> removeFieldFromMessage(MessageChannel channel, Long messageId, Integer index, Integer embedIndex);
CompletableFuture<Message> removeComponents(MessageChannel channel, Long messageId);
ThreadChannel getThreadChannel(Long threadChannelId);
CompletableFuture<Void> archiveThreadChannel(ThreadChannel threadChannel);
CompletableFuture<Void> deleteTextChannel(AChannel channel);
CompletableFuture<Void> deleteTextChannel(Long serverId, Long channelId);
List<CompletableFuture<Message>> sendEmbedTemplateInTextChannelList(String templateKey, Object model, MessageChannel channel);
@@ -52,6 +55,9 @@ public interface ChannelService {
CompletableFuture<Void> deleteMessagesInChannel(MessageChannel messageChannel, List<Message> messages);
CompletableFuture<TextChannel> createTextChannel(String name, AServer server, Long categoryId);
CompletableFuture<ThreadChannel> createThread(TextChannel textChannel, String name);
CompletableFuture<ThreadChannel> createThreadWithStarterMessage(TextChannel textChannel, String name, Long messageId);
CompletableFuture<ThreadChannel> createPrivateThread(TextChannel textChannel, String name);
Optional<GuildChannel> getChannelFromAChannel(AChannel channel);
Optional<GuildMessageChannel> getGuildMessageChannelFromAChannelOptional(AChannel channel);
GuildMessageChannel getGuildMessageChannelFromAChannel(AChannel channel);