Compare commits

..

7 Commits

Author SHA1 Message Date
release-bot
a7bab8fa3e Commit from GitHub Actions (Publishes a new version of abstracto) 2026-04-24 17:44:48 +00:00
release-bot
d9ba8850af [maven-release-plugin] prepare for next development iteration 2026-04-24 17:29:47 +00:00
release-bot
d14a8c6d7c [maven-release-plugin] prepare release v1.6.22 2026-04-24 17:29:44 +00:00
Sheldan
7627ee72e6 [AB-xxx] adding modmail thread reminders and auto closing
fixing sending cv2 components to interactions
fixing error handling for message embeds
2026-04-24 18:23:07 +02:00
release-bot
d8bb4a365d Commit from GitHub Actions (Publishes a new version of abstracto) 2026-03-29 09:18:03 +00:00
release-bot
e614a97ea2 [maven-release-plugin] prepare for next development iteration 2026-03-29 09:07:22 +00:00
release-bot
194930f9db [maven-release-plugin] prepare release v1.6.21 2026-03-29 09:07:20 +00:00
113 changed files with 1071 additions and 147 deletions

2
.env
View File

@@ -1,2 +1,2 @@
REGISTRY_PREFIX=harbor.sheldan.dev/abstracto/ REGISTRY_PREFIX=harbor.sheldan.dev/abstracto/
VERSION=1.6.20 VERSION=1.6.22

View File

@@ -3,7 +3,7 @@
<parent> <parent>
<artifactId>anti-raid</artifactId> <artifactId>anti-raid</artifactId>
<groupId>dev.sheldan.abstracto.modules</groupId> <groupId>dev.sheldan.abstracto.modules</groupId>
<version>1.6.21-SNAPSHOT</version> <version>1.6.23-SNAPSHOT</version>
</parent> </parent>
<modelVersion>4.0.0</modelVersion> <modelVersion>4.0.0</modelVersion>

View File

@@ -3,7 +3,7 @@
<parent> <parent>
<artifactId>anti-raid</artifactId> <artifactId>anti-raid</artifactId>
<groupId>dev.sheldan.abstracto.modules</groupId> <groupId>dev.sheldan.abstracto.modules</groupId>
<version>1.6.21-SNAPSHOT</version> <version>1.6.23-SNAPSHOT</version>
</parent> </parent>
<modelVersion>4.0.0</modelVersion> <modelVersion>4.0.0</modelVersion>

View File

@@ -3,7 +3,7 @@
<parent> <parent>
<artifactId>abstracto-modules</artifactId> <artifactId>abstracto-modules</artifactId>
<groupId>dev.sheldan.abstracto.modules</groupId> <groupId>dev.sheldan.abstracto.modules</groupId>
<version>1.6.21-SNAPSHOT</version> <version>1.6.23-SNAPSHOT</version>
</parent> </parent>
<modelVersion>4.0.0</modelVersion> <modelVersion>4.0.0</modelVersion>

View File

@@ -3,7 +3,7 @@
<parent> <parent>
<groupId>dev.sheldan.abstracto.modules</groupId> <groupId>dev.sheldan.abstracto.modules</groupId>
<artifactId>assignable-roles</artifactId> <artifactId>assignable-roles</artifactId>
<version>1.6.21-SNAPSHOT</version> <version>1.6.23-SNAPSHOT</version>
</parent> </parent>
<modelVersion>4.0.0</modelVersion> <modelVersion>4.0.0</modelVersion>

View File

@@ -3,7 +3,7 @@
<parent> <parent>
<groupId>dev.sheldan.abstracto.modules</groupId> <groupId>dev.sheldan.abstracto.modules</groupId>
<artifactId>assignable-roles</artifactId> <artifactId>assignable-roles</artifactId>
<version>1.6.21-SNAPSHOT</version> <version>1.6.23-SNAPSHOT</version>
</parent> </parent>
<modelVersion>4.0.0</modelVersion> <modelVersion>4.0.0</modelVersion>
<artifactId>assignable-roles-int</artifactId> <artifactId>assignable-roles-int</artifactId>

View File

@@ -3,7 +3,7 @@
<parent> <parent>
<groupId>dev.sheldan.abstracto.modules</groupId> <groupId>dev.sheldan.abstracto.modules</groupId>
<artifactId>abstracto-modules</artifactId> <artifactId>abstracto-modules</artifactId>
<version>1.6.21-SNAPSHOT</version> <version>1.6.23-SNAPSHOT</version>
</parent> </parent>
<modelVersion>4.0.0</modelVersion> <modelVersion>4.0.0</modelVersion>

View File

@@ -3,7 +3,7 @@
<parent> <parent>
<groupId>dev.sheldan.abstracto.modules</groupId> <groupId>dev.sheldan.abstracto.modules</groupId>
<artifactId>custom-command</artifactId> <artifactId>custom-command</artifactId>
<version>1.6.21-SNAPSHOT</version> <version>1.6.23-SNAPSHOT</version>
</parent> </parent>
<modelVersion>4.0.0</modelVersion> <modelVersion>4.0.0</modelVersion>

View File

@@ -3,7 +3,7 @@
<parent> <parent>
<groupId>dev.sheldan.abstracto.modules</groupId> <groupId>dev.sheldan.abstracto.modules</groupId>
<artifactId>custom-command</artifactId> <artifactId>custom-command</artifactId>
<version>1.6.21-SNAPSHOT</version> <version>1.6.23-SNAPSHOT</version>
</parent> </parent>
<modelVersion>4.0.0</modelVersion> <modelVersion>4.0.0</modelVersion>

View File

@@ -3,7 +3,7 @@
<parent> <parent>
<artifactId>abstracto-modules</artifactId> <artifactId>abstracto-modules</artifactId>
<groupId>dev.sheldan.abstracto.modules</groupId> <groupId>dev.sheldan.abstracto.modules</groupId>
<version>1.6.21-SNAPSHOT</version> <version>1.6.23-SNAPSHOT</version>
</parent> </parent>
<modelVersion>4.0.0</modelVersion> <modelVersion>4.0.0</modelVersion>

View File

@@ -3,7 +3,7 @@
<parent> <parent>
<groupId>dev.sheldan.abstracto.modules</groupId> <groupId>dev.sheldan.abstracto.modules</groupId>
<artifactId>dynamic-activity</artifactId> <artifactId>dynamic-activity</artifactId>
<version>1.6.21-SNAPSHOT</version> <version>1.6.23-SNAPSHOT</version>
</parent> </parent>
<modelVersion>4.0.0</modelVersion> <modelVersion>4.0.0</modelVersion>

View File

@@ -3,7 +3,7 @@
<parent> <parent>
<artifactId>dynamic-activity</artifactId> <artifactId>dynamic-activity</artifactId>
<groupId>dev.sheldan.abstracto.modules</groupId> <groupId>dev.sheldan.abstracto.modules</groupId>
<version>1.6.21-SNAPSHOT</version> <version>1.6.23-SNAPSHOT</version>
</parent> </parent>
<modelVersion>4.0.0</modelVersion> <modelVersion>4.0.0</modelVersion>

View File

@@ -3,7 +3,7 @@
<parent> <parent>
<artifactId>abstracto-modules</artifactId> <artifactId>abstracto-modules</artifactId>
<groupId>dev.sheldan.abstracto.modules</groupId> <groupId>dev.sheldan.abstracto.modules</groupId>
<version>1.6.21-SNAPSHOT</version> <version>1.6.23-SNAPSHOT</version>
</parent> </parent>
<modelVersion>4.0.0</modelVersion> <modelVersion>4.0.0</modelVersion>

View File

@@ -3,7 +3,7 @@
<parent> <parent>
<artifactId>entertainment</artifactId> <artifactId>entertainment</artifactId>
<groupId>dev.sheldan.abstracto.modules</groupId> <groupId>dev.sheldan.abstracto.modules</groupId>
<version>1.6.21-SNAPSHOT</version> <version>1.6.23-SNAPSHOT</version>
</parent> </parent>
<modelVersion>4.0.0</modelVersion> <modelVersion>4.0.0</modelVersion>

View File

@@ -3,7 +3,7 @@
<parent> <parent>
<artifactId>entertainment</artifactId> <artifactId>entertainment</artifactId>
<groupId>dev.sheldan.abstracto.modules</groupId> <groupId>dev.sheldan.abstracto.modules</groupId>
<version>1.6.21-SNAPSHOT</version> <version>1.6.23-SNAPSHOT</version>
</parent> </parent>
<modelVersion>4.0.0</modelVersion> <modelVersion>4.0.0</modelVersion>

View File

@@ -3,7 +3,7 @@
<parent> <parent>
<artifactId>abstracto-modules</artifactId> <artifactId>abstracto-modules</artifactId>
<groupId>dev.sheldan.abstracto.modules</groupId> <groupId>dev.sheldan.abstracto.modules</groupId>
<version>1.6.21-SNAPSHOT</version> <version>1.6.23-SNAPSHOT</version>
</parent> </parent>
<modelVersion>4.0.0</modelVersion> <modelVersion>4.0.0</modelVersion>

View File

@@ -3,7 +3,7 @@
<parent> <parent>
<groupId>dev.sheldan.abstracto.modules</groupId> <groupId>dev.sheldan.abstracto.modules</groupId>
<artifactId>experience-tracking</artifactId> <artifactId>experience-tracking</artifactId>
<version>1.6.21-SNAPSHOT</version> <version>1.6.23-SNAPSHOT</version>
</parent> </parent>
<modelVersion>4.0.0</modelVersion> <modelVersion>4.0.0</modelVersion>

View File

@@ -3,7 +3,7 @@
<parent> <parent>
<groupId>dev.sheldan.abstracto.modules</groupId> <groupId>dev.sheldan.abstracto.modules</groupId>
<artifactId>experience-tracking</artifactId> <artifactId>experience-tracking</artifactId>
<version>1.6.21-SNAPSHOT</version> <version>1.6.23-SNAPSHOT</version>
</parent> </parent>
<modelVersion>4.0.0</modelVersion> <modelVersion>4.0.0</modelVersion>

View File

@@ -3,7 +3,7 @@
<parent> <parent>
<groupId>dev.sheldan.abstracto.modules</groupId> <groupId>dev.sheldan.abstracto.modules</groupId>
<artifactId>abstracto-modules</artifactId> <artifactId>abstracto-modules</artifactId>
<version>1.6.21-SNAPSHOT</version> <version>1.6.23-SNAPSHOT</version>
</parent> </parent>
<modelVersion>4.0.0</modelVersion> <modelVersion>4.0.0</modelVersion>

View File

@@ -4,7 +4,7 @@
<parent> <parent>
<groupId>dev.sheldan.abstracto.modules</groupId> <groupId>dev.sheldan.abstracto.modules</groupId>
<artifactId>giveaway</artifactId> <artifactId>giveaway</artifactId>
<version>1.6.21-SNAPSHOT</version> <version>1.6.23-SNAPSHOT</version>
</parent> </parent>
<artifactId>giveaway-impl</artifactId> <artifactId>giveaway-impl</artifactId>

View File

@@ -4,7 +4,7 @@
<parent> <parent>
<groupId>dev.sheldan.abstracto.modules</groupId> <groupId>dev.sheldan.abstracto.modules</groupId>
<artifactId>giveaway</artifactId> <artifactId>giveaway</artifactId>
<version>1.6.21-SNAPSHOT</version> <version>1.6.23-SNAPSHOT</version>
</parent> </parent>
<artifactId>giveaway-int</artifactId> <artifactId>giveaway-int</artifactId>

View File

@@ -4,7 +4,7 @@
<parent> <parent>
<groupId>dev.sheldan.abstracto.modules</groupId> <groupId>dev.sheldan.abstracto.modules</groupId>
<artifactId>abstracto-modules</artifactId> <artifactId>abstracto-modules</artifactId>
<version>1.6.21-SNAPSHOT</version> <version>1.6.23-SNAPSHOT</version>
</parent> </parent>
<artifactId>giveaway</artifactId> <artifactId>giveaway</artifactId>

View File

@@ -4,7 +4,7 @@
<parent> <parent>
<artifactId>image-generation</artifactId> <artifactId>image-generation</artifactId>
<groupId>dev.sheldan.abstracto.modules</groupId> <groupId>dev.sheldan.abstracto.modules</groupId>
<version>1.6.21-SNAPSHOT</version> <version>1.6.23-SNAPSHOT</version>
</parent> </parent>
<artifactId>image-generation-impl</artifactId> <artifactId>image-generation-impl</artifactId>

View File

@@ -4,7 +4,7 @@
<parent> <parent>
<artifactId>image-generation</artifactId> <artifactId>image-generation</artifactId>
<groupId>dev.sheldan.abstracto.modules</groupId> <groupId>dev.sheldan.abstracto.modules</groupId>
<version>1.6.21-SNAPSHOT</version> <version>1.6.23-SNAPSHOT</version>
</parent> </parent>
<artifactId>image-generation-int</artifactId> <artifactId>image-generation-int</artifactId>

View File

@@ -4,7 +4,7 @@
<parent> <parent>
<groupId>dev.sheldan.abstracto.modules</groupId> <groupId>dev.sheldan.abstracto.modules</groupId>
<artifactId>abstracto-modules</artifactId> <artifactId>abstracto-modules</artifactId>
<version>1.6.21-SNAPSHOT</version> <version>1.6.23-SNAPSHOT</version>
</parent> </parent>
<artifactId>image-generation</artifactId> <artifactId>image-generation</artifactId>

View File

@@ -3,7 +3,7 @@
<parent> <parent>
<artifactId>invite-filter</artifactId> <artifactId>invite-filter</artifactId>
<groupId>dev.sheldan.abstracto.modules</groupId> <groupId>dev.sheldan.abstracto.modules</groupId>
<version>1.6.21-SNAPSHOT</version> <version>1.6.23-SNAPSHOT</version>
</parent> </parent>
<modelVersion>4.0.0</modelVersion> <modelVersion>4.0.0</modelVersion>

View File

@@ -3,7 +3,7 @@
<parent> <parent>
<artifactId>invite-filter</artifactId> <artifactId>invite-filter</artifactId>
<groupId>dev.sheldan.abstracto.modules</groupId> <groupId>dev.sheldan.abstracto.modules</groupId>
<version>1.6.21-SNAPSHOT</version> <version>1.6.23-SNAPSHOT</version>
</parent> </parent>
<modelVersion>4.0.0</modelVersion> <modelVersion>4.0.0</modelVersion>
@@ -18,7 +18,7 @@
<dependency> <dependency>
<groupId>dev.sheldan.abstracto.modules</groupId> <groupId>dev.sheldan.abstracto.modules</groupId>
<artifactId>moderation-int</artifactId> <artifactId>moderation-int</artifactId>
<version>1.6.21-SNAPSHOT</version> <version>1.6.23-SNAPSHOT</version>
<scope>compile</scope> <scope>compile</scope>
</dependency> </dependency>
</dependencies> </dependencies>

View File

@@ -3,7 +3,7 @@
<parent> <parent>
<artifactId>abstracto-modules</artifactId> <artifactId>abstracto-modules</artifactId>
<groupId>dev.sheldan.abstracto.modules</groupId> <groupId>dev.sheldan.abstracto.modules</groupId>
<version>1.6.21-SNAPSHOT</version> <version>1.6.23-SNAPSHOT</version>
</parent> </parent>
<modelVersion>4.0.0</modelVersion> <modelVersion>4.0.0</modelVersion>

View File

@@ -3,7 +3,7 @@
<parent> <parent>
<artifactId>link-embed</artifactId> <artifactId>link-embed</artifactId>
<groupId>dev.sheldan.abstracto.modules</groupId> <groupId>dev.sheldan.abstracto.modules</groupId>
<version>1.6.21-SNAPSHOT</version> <version>1.6.23-SNAPSHOT</version>
</parent> </parent>
<modelVersion>4.0.0</modelVersion> <modelVersion>4.0.0</modelVersion>

View File

@@ -12,6 +12,7 @@ import dev.sheldan.abstracto.core.service.MessageCache;
import dev.sheldan.abstracto.core.service.management.UserInServerManagementService; import dev.sheldan.abstracto.core.service.management.UserInServerManagementService;
import dev.sheldan.abstracto.linkembed.config.LinkEmbedFeatureDefinition; import dev.sheldan.abstracto.linkembed.config.LinkEmbedFeatureDefinition;
import dev.sheldan.abstracto.linkembed.service.MessageEmbedService; import dev.sheldan.abstracto.linkembed.service.MessageEmbedService;
import java.util.concurrent.CompletableFuture;
import lombok.extern.slf4j.Slf4j; import lombok.extern.slf4j.Slf4j;
import net.dv8tion.jda.api.entities.Member; import net.dv8tion.jda.api.entities.Member;
import net.dv8tion.jda.api.entities.Message; import net.dv8tion.jda.api.entities.Message;
@@ -46,13 +47,27 @@ public class MessageEmbedContextCommandListener implements MessageContextCommand
Message targetMessage = event.getInteraction().getTarget(); Message targetMessage = event.getInteraction().getTarget();
Member actor = model.getEvent().getMember(); Member actor = model.getEvent().getMember();
Long messageId = targetMessage.getIdLong();
messageCache.getMessageFromCache(targetMessage) messageCache.getMessageFromCache(targetMessage)
.thenAccept(cachedMessage -> self.embedMessage(model, actor, cachedMessage)); .thenCompose(cachedMessage -> {
try {
return self.embedMessage(model, actor, cachedMessage);
} catch (Exception ex) {
return CompletableFuture.failedFuture(ex);
}
})
.thenAccept(unused -> {
log.info("Finished embedding message {}.", messageId);
})
.exceptionally(throwable -> {
log.error("Failed to embed message {}.", messageId, throwable);
return null;
});
return DefaultListenerResult.PROCESSED; return DefaultListenerResult.PROCESSED;
} }
@Transactional @Transactional
public void embedMessage(MessageContextInteractionModel model, Member actor, CachedMessage cachedMessage) { public CompletableFuture<Void> embedMessage(MessageContextInteractionModel model, Member actor, CachedMessage cachedMessage) {
Long userEmbeddingUserInServerId = userInServerManagementService.loadOrCreateUser(actor).getUserInServerId(); Long userEmbeddingUserInServerId = userInServerManagementService.loadOrCreateUser(actor).getUserInServerId();
GuildMemberMessageChannel context = GuildMemberMessageChannel GuildMemberMessageChannel context = GuildMemberMessageChannel
.builder() .builder()
@@ -61,7 +76,7 @@ public class MessageEmbedContextCommandListener implements MessageContextCommand
.member(actor) .member(actor)
.guildChannel(model.getEvent().getGuildChannel()) .guildChannel(model.getEvent().getGuildChannel())
.build(); .build();
messageEmbedService.embedLink(cachedMessage, model.getEvent().getGuildChannel(), userEmbeddingUserInServerId, context, model.getEvent().getInteraction()); return messageEmbedService.embedLink(cachedMessage, model.getEvent().getGuildChannel(), userEmbeddingUserInServerId, context, model.getEvent().getInteraction());
} }
@Override @Override

View File

@@ -3,7 +3,7 @@
<parent> <parent>
<artifactId>link-embed</artifactId> <artifactId>link-embed</artifactId>
<groupId>dev.sheldan.abstracto.modules</groupId> <groupId>dev.sheldan.abstracto.modules</groupId>
<version>1.6.21-SNAPSHOT</version> <version>1.6.23-SNAPSHOT</version>
</parent> </parent>
<modelVersion>4.0.0</modelVersion> <modelVersion>4.0.0</modelVersion>

View File

@@ -3,7 +3,7 @@
<parent> <parent>
<artifactId>abstracto-modules</artifactId> <artifactId>abstracto-modules</artifactId>
<groupId>dev.sheldan.abstracto.modules</groupId> <groupId>dev.sheldan.abstracto.modules</groupId>
<version>1.6.21-SNAPSHOT</version> <version>1.6.23-SNAPSHOT</version>
</parent> </parent>
<modelVersion>4.0.0</modelVersion> <modelVersion>4.0.0</modelVersion>

View File

@@ -3,7 +3,7 @@
<parent> <parent>
<artifactId>logging</artifactId> <artifactId>logging</artifactId>
<groupId>dev.sheldan.abstracto.modules</groupId> <groupId>dev.sheldan.abstracto.modules</groupId>
<version>1.6.21-SNAPSHOT</version> <version>1.6.23-SNAPSHOT</version>
</parent> </parent>
<modelVersion>4.0.0</modelVersion> <modelVersion>4.0.0</modelVersion>

View File

@@ -3,7 +3,7 @@
<parent> <parent>
<artifactId>logging</artifactId> <artifactId>logging</artifactId>
<groupId>dev.sheldan.abstracto.modules</groupId> <groupId>dev.sheldan.abstracto.modules</groupId>
<version>1.6.21-SNAPSHOT</version> <version>1.6.23-SNAPSHOT</version>
</parent> </parent>
<modelVersion>4.0.0</modelVersion> <modelVersion>4.0.0</modelVersion>

View File

@@ -3,7 +3,7 @@
<parent> <parent>
<artifactId>abstracto-modules</artifactId> <artifactId>abstracto-modules</artifactId>
<groupId>dev.sheldan.abstracto.modules</groupId> <groupId>dev.sheldan.abstracto.modules</groupId>
<version>1.6.21-SNAPSHOT</version> <version>1.6.23-SNAPSHOT</version>
</parent> </parent>
<modelVersion>4.0.0</modelVersion> <modelVersion>4.0.0</modelVersion>

View File

@@ -3,7 +3,7 @@
<parent> <parent>
<groupId>dev.sheldan.abstracto.modules</groupId> <groupId>dev.sheldan.abstracto.modules</groupId>
<artifactId>moderation</artifactId> <artifactId>moderation</artifactId>
<version>1.6.21-SNAPSHOT</version> <version>1.6.23-SNAPSHOT</version>
</parent> </parent>
<modelVersion>4.0.0</modelVersion> <modelVersion>4.0.0</modelVersion>

View File

@@ -3,7 +3,7 @@
<parent> <parent>
<groupId>dev.sheldan.abstracto.modules</groupId> <groupId>dev.sheldan.abstracto.modules</groupId>
<artifactId>moderation</artifactId> <artifactId>moderation</artifactId>
<version>1.6.21-SNAPSHOT</version> <version>1.6.23-SNAPSHOT</version>
</parent> </parent>
<modelVersion>4.0.0</modelVersion> <modelVersion>4.0.0</modelVersion>

View File

@@ -3,7 +3,7 @@
<parent> <parent>
<groupId>dev.sheldan.abstracto.modules</groupId> <groupId>dev.sheldan.abstracto.modules</groupId>
<artifactId>abstracto-modules</artifactId> <artifactId>abstracto-modules</artifactId>
<version>1.6.21-SNAPSHOT</version> <version>1.6.23-SNAPSHOT</version>
</parent> </parent>
<modelVersion>4.0.0</modelVersion> <modelVersion>4.0.0</modelVersion>

View File

@@ -3,7 +3,7 @@
<parent> <parent>
<groupId>dev.sheldan.abstracto.modules</groupId> <groupId>dev.sheldan.abstracto.modules</groupId>
<artifactId>modmail</artifactId> <artifactId>modmail</artifactId>
<version>1.6.21-SNAPSHOT</version> <version>1.6.23-SNAPSHOT</version>
</parent> </parent>
<modelVersion>4.0.0</modelVersion> <modelVersion>4.0.0</modelVersion>
@@ -44,6 +44,12 @@
<version>${project.version}</version> <version>${project.version}</version>
</dependency> </dependency>
<dependency>
<groupId>dev.sheldan.abstracto.scheduling</groupId>
<artifactId>scheduling-int</artifactId>
<version>${project.version}</version>
</dependency>
<dependency> <dependency>
<groupId>dev.sheldan.abstracto.core</groupId> <groupId>dev.sheldan.abstracto.core</groupId>
<artifactId>metrics-int</artifactId> <artifactId>metrics-int</artifactId>

View File

@@ -0,0 +1,112 @@
package dev.sheldan.abstracto.modmail.command;
import dev.sheldan.abstracto.core.command.condition.AbstractConditionableCommand;
import dev.sheldan.abstracto.core.command.condition.CommandCondition;
import dev.sheldan.abstracto.core.command.config.CommandConfiguration;
import dev.sheldan.abstracto.core.command.config.HelpInfo;
import dev.sheldan.abstracto.core.command.config.Parameter;
import dev.sheldan.abstracto.core.command.execution.CommandResult;
import dev.sheldan.abstracto.core.config.FeatureDefinition;
import dev.sheldan.abstracto.core.interaction.InteractionService;
import dev.sheldan.abstracto.core.interaction.slash.SlashCommandConfig;
import dev.sheldan.abstracto.core.interaction.slash.SlashCommandPrivilegeLevels;
import dev.sheldan.abstracto.core.interaction.slash.parameter.SlashCommandParameterService;
import dev.sheldan.abstracto.modmail.condition.ModMailContextCondition;
import dev.sheldan.abstracto.modmail.config.ModMailFeatureDefinition;
import dev.sheldan.abstracto.modmail.config.ModMailSlashCommandNames;
import dev.sheldan.abstracto.modmail.exception.ModMailThreadClosedException;
import dev.sheldan.abstracto.modmail.model.database.ModMailThread;
import dev.sheldan.abstracto.modmail.model.database.ModMailThreadState;
import dev.sheldan.abstracto.modmail.service.ModMailThreadService;
import dev.sheldan.abstracto.modmail.service.management.ModMailThreadManagementService;
import java.util.Arrays;
import java.util.List;
import java.util.concurrent.CompletableFuture;
import net.dv8tion.jda.api.events.interaction.command.SlashCommandInteractionEvent;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Component;
@Component
public class SetThreadPause extends AbstractConditionableCommand {
private static final String SET_THREAD_PAUSE_COMMAND = "setThreadPause";
private static final String SET_THREAD_PAUSE_RESPONSE = "setThreadPause_response";
private static final String PAUSED_PARAMETER = "paused";
@Autowired
private ModMailContextCondition requiresModMailCondition;
@Autowired
private ModMailThreadManagementService modMailThreadManagementService;
@Autowired
private ModMailThreadService modMailThreadService;
@Autowired
private InteractionService interactionService;
@Autowired
private SlashCommandParameterService slashCommandParameterService;
@Override
public CompletableFuture<CommandResult> executeSlash(SlashCommandInteractionEvent event) {
ModMailThread modMailThread = modMailThreadManagementService.getByChannelId(event.getChannel().getIdLong());
if(ModMailThreadState.CLOSED.equals(modMailThread.getState()) || ModMailThreadState.CLOSING.equals(modMailThread.getState())) {
throw new ModMailThreadClosedException();
}
Boolean paused = slashCommandParameterService.getCommandOption(PAUSED_PARAMETER, event, Boolean.class);
modMailThreadService.setPauseOfThreadTo(modMailThread, paused);
return interactionService.replyEmbed(SET_THREAD_PAUSE_RESPONSE, event)
.thenApply(interactionHook -> CommandResult.fromSuccess());
}
@Override
public CommandConfiguration getConfiguration() {
HelpInfo helpInfo = HelpInfo
.builder()
.templated(true)
.build();
Parameter newStateParameter = Parameter
.builder()
.name(PAUSED_PARAMETER)
.type(Boolean.class)
.templated(true)
.build();
List<Parameter> parameters = Arrays.asList(newStateParameter);
SlashCommandConfig slashCommandConfig = SlashCommandConfig
.builder()
.enabled(true)
.rootCommandName(ModMailSlashCommandNames.MODMAIL)
.defaultPrivilege(SlashCommandPrivilegeLevels.INVITER)
.commandName(SET_THREAD_PAUSE_COMMAND)
.build();
return CommandConfiguration.builder()
.name(SET_THREAD_PAUSE_COMMAND)
.slashCommandConfig(slashCommandConfig)
.module(ModMailModuleDefinition.MODMAIL)
.help(helpInfo)
.slashCommandOnly(true)
.supportsEmbedException(true)
.templated(true)
.parameters(parameters)
.causesReaction(true)
.build();
}
@Override
public FeatureDefinition getFeature() {
return ModMailFeatureDefinition.MOD_MAIL;
}
@Override
public List<CommandCondition> getConditions() {
List<CommandCondition> conditions = super.getConditions();
conditions.add(requiresModMailCondition);
return conditions;
}
}

View File

@@ -0,0 +1,115 @@
package dev.sheldan.abstracto.modmail.command;
import dev.sheldan.abstracto.core.command.condition.AbstractConditionableCommand;
import dev.sheldan.abstracto.core.command.condition.CommandCondition;
import dev.sheldan.abstracto.core.command.config.CommandConfiguration;
import dev.sheldan.abstracto.core.command.config.HelpInfo;
import dev.sheldan.abstracto.core.command.config.Parameter;
import dev.sheldan.abstracto.core.command.execution.CommandResult;
import dev.sheldan.abstracto.core.config.FeatureDefinition;
import dev.sheldan.abstracto.core.interaction.InteractionService;
import dev.sheldan.abstracto.core.interaction.slash.SlashCommandConfig;
import dev.sheldan.abstracto.core.interaction.slash.SlashCommandPrivilegeLevels;
import dev.sheldan.abstracto.core.interaction.slash.parameter.SlashCommandParameterService;
import dev.sheldan.abstracto.core.utils.ParseUtils;
import dev.sheldan.abstracto.modmail.condition.ModMailContextCondition;
import dev.sheldan.abstracto.modmail.config.ModMailFeatureDefinition;
import dev.sheldan.abstracto.modmail.config.ModMailSlashCommandNames;
import dev.sheldan.abstracto.modmail.exception.ModMailThreadClosedException;
import dev.sheldan.abstracto.modmail.model.database.ModMailThread;
import dev.sheldan.abstracto.modmail.model.database.ModMailThreadState;
import dev.sheldan.abstracto.modmail.service.ModMailThreadService;
import dev.sheldan.abstracto.modmail.service.management.ModMailThreadManagementService;
import java.time.Duration;
import java.util.Arrays;
import java.util.List;
import java.util.concurrent.CompletableFuture;
import net.dv8tion.jda.api.events.interaction.command.SlashCommandInteractionEvent;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Component;
@Component
public class SnoozeThreadReminder extends AbstractConditionableCommand {
private static final String SNOOZE_THREAD_REMINDER_COMMAND = "snoozeThreadReminder";
private static final String SNOOZE_THREAD_REMINDER_RESPONSE = "snoozeThreadReminder_response";
private static final String DURATION_PARAMETER = "duration";
@Autowired
private ModMailContextCondition requiresModMailCondition;
@Autowired
private ModMailThreadManagementService modMailThreadManagementService;
@Autowired
private ModMailThreadService modMailThreadService;
@Autowired
private InteractionService interactionService;
@Autowired
private SlashCommandParameterService slashCommandParameterService;
@Override
public CompletableFuture<CommandResult> executeSlash(SlashCommandInteractionEvent event) {
ModMailThread modMailThread = modMailThreadManagementService.getByChannelId(event.getChannel().getIdLong());
if(ModMailThreadState.CLOSED.equals(modMailThread.getState()) || ModMailThreadState.CLOSING.equals(modMailThread.getState())) {
throw new ModMailThreadClosedException();
}
String durationString = slashCommandParameterService.getCommandOption(DURATION_PARAMETER, event, Duration.class, String.class);
Duration duration = ParseUtils.parseDuration(durationString);
modMailThreadService.snoozeThreadReminder(modMailThread, duration);
return interactionService.replyEmbed(SNOOZE_THREAD_REMINDER_RESPONSE, event)
.thenApply(interactionHook -> CommandResult.fromSuccess());
}
@Override
public CommandConfiguration getConfiguration() {
HelpInfo helpInfo = HelpInfo
.builder()
.templated(true)
.build();
Parameter durationParameter = Parameter
.builder()
.name(DURATION_PARAMETER)
.type(Duration.class)
.templated(true)
.build();
List<Parameter> parameters = Arrays.asList(durationParameter);
SlashCommandConfig slashCommandConfig = SlashCommandConfig
.builder()
.enabled(true)
.rootCommandName(ModMailSlashCommandNames.MODMAIL)
.defaultPrivilege(SlashCommandPrivilegeLevels.INVITER)
.commandName(SNOOZE_THREAD_REMINDER_COMMAND)
.build();
return CommandConfiguration.builder()
.name(SNOOZE_THREAD_REMINDER_COMMAND)
.slashCommandConfig(slashCommandConfig)
.module(ModMailModuleDefinition.MODMAIL)
.help(helpInfo)
.slashCommandOnly(true)
.supportsEmbedException(true)
.templated(true)
.parameters(parameters)
.causesReaction(true)
.build();
}
@Override
public FeatureDefinition getFeature() {
return ModMailFeatureDefinition.MOD_MAIL;
}
@Override
public List<CommandCondition> getConditions() {
List<CommandCondition> conditions = super.getConditions();
conditions.add(requiresModMailCondition);
return conditions;
}
}

View File

@@ -0,0 +1,32 @@
package dev.sheldan.abstracto.modmail.job;
import dev.sheldan.abstracto.modmail.service.ModMailThreadServiceBean;
import lombok.extern.slf4j.Slf4j;
import org.quartz.DisallowConcurrentExecution;
import org.quartz.JobExecutionContext;
import org.quartz.JobExecutionException;
import org.quartz.PersistJobDataAfterExecution;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.scheduling.quartz.QuartzJobBean;
import org.springframework.stereotype.Component;
@Slf4j
@DisallowConcurrentExecution
@Component
@PersistJobDataAfterExecution
public class ModmailThreadActionJob extends QuartzJobBean {
@Autowired
private ModMailThreadServiceBean modMailThreadServiceBean;
@Override
protected void executeInternal(JobExecutionContext context) throws JobExecutionException {
try {
log.info("Check modmail threads to perform action for.");
modMailThreadServiceBean.checkModmailActionsForNeededActions();
} catch (Exception exception) {
log.error("Modmail thread action job failed.", exception);
}
}
}

View File

@@ -0,0 +1,117 @@
package dev.sheldan.abstracto.modmail.listener;
import dev.sheldan.abstracto.core.config.ListenerPriority;
import dev.sheldan.abstracto.core.service.ConfigService;
import dev.sheldan.abstracto.core.service.FeatureModeService;
import dev.sheldan.abstracto.core.service.GuildService;
import dev.sheldan.abstracto.core.templating.service.TemplateService;
import dev.sheldan.abstracto.core.utils.ParseUtils;
import dev.sheldan.abstracto.modmail.config.ModMailFeatureConfig;
import dev.sheldan.abstracto.modmail.config.ModMailFeatureDefinition;
import dev.sheldan.abstracto.modmail.config.ModMailMode;
import dev.sheldan.abstracto.modmail.model.ClosingContext;
import dev.sheldan.abstracto.modmail.model.database.ModMailThread;
import dev.sheldan.abstracto.modmail.model.database.ModMailThreadState;
import dev.sheldan.abstracto.modmail.model.listener.ModmailThreadActionListenerModel;
import dev.sheldan.abstracto.modmail.service.ModMailThreadService;
import dev.sheldan.abstracto.modmail.service.management.ModMailThreadManagementService;
import java.time.Duration;
import java.time.Instant;
import java.util.ArrayList;
import java.util.concurrent.CompletableFuture;
import lombok.extern.slf4j.Slf4j;
import net.dv8tion.jda.api.entities.Guild;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Component;
@Component
@Slf4j
public class ModmailAutoCloseListener implements ModmailThreadActionListener {
@Autowired
private ModMailThreadManagementService modMailThreadManagementService;
@Autowired
private ConfigService configService;
@Autowired
private FeatureModeService featureModeService;
@Autowired
private ModMailThreadService modMailThreadService;
@Autowired
private ModmailReminderListener self;
@Autowired
private GuildService guildService;
@Autowired
private TemplateService templateService;
private static final String AUTO_CLOSE_NOTE_TEMPLATE_KEY = "modmail_auto_closing_note_text";
@Override
public Integer getPriority() {
return ListenerPriority.HIGH;
}
@Override
public ModmailThreadActionListenerResult execute(ModmailThreadActionListenerModel model) {
ModmailThreadActionListenerResult result;
if(!featureModeService.featureModeActive(ModMailFeatureDefinition.MOD_MAIL, model.getServerId(), ModMailMode.THREAD_AUTO_CLOSE)) {
result = ModmailThreadActionListenerResult.IGNORED;
} else {
String closeDuration = configService.getStringValueOrConfigDefault(ModMailFeatureConfig.MOD_MAIL_AUTO_CLOSE_DURATION, model.getServerId());
Duration duration = ParseUtils.parseDuration(closeDuration);
Instant timeInPastDuration = Instant.now().minus(duration);
ModMailThread thread = modMailThreadManagementService.getById(model.getThreadId());
if(thread.getState() == ModMailThreadState.PAUSED) {
log.info("Thread {} is paused - not closing.", thread.getId());
return ModmailThreadActionListenerResult.IGNORED;
}
Instant timeStampToConsider = getTimeStampToConsider(thread);
boolean mustBeClosed = timeInPastDuration.isAfter(timeStampToConsider);
if (mustBeClosed) {
closeThread(thread)
.thenAccept(unused -> {
self.updateSnoozeTimer(model.getThreadId(), duration);
log.info("Automatically closed thread {}", model.getThreadId());
})
.exceptionally(throwable -> {
log.warn("Failed to automatically close thread {}.", model.getThreadId(), throwable);
return null;
});
result = ModmailThreadActionListenerResult.FINAL;
} else {
result = ModmailThreadActionListenerResult.IGNORED;
}
}
return result;
}
private static Instant getTimeStampToConsider(ModMailThread thread) {
if(thread.getUpdated() != null) {
return thread.getUpdated();
}
return thread.getCreated();
}
private CompletableFuture<Void> closeThread(ModMailThread modMailThread) {
Guild guild = guildService.getGuildById(modMailThread.getServer().getId());
if(guild != null) {
String closingNote = templateService.renderTemplate(AUTO_CLOSE_NOTE_TEMPLATE_KEY, new Object(), modMailThread.getServer().getId());
ClosingContext closingContext = ClosingContext
.builder()
.notifyUser(true)
.log(true)
.closingMember(guild.getSelfMember())
.note(closingNote)
.build();
return modMailThreadService.closeModMailThreadEvaluateLogging(modMailThread, closingContext, new ArrayList<>());
} else {
return CompletableFuture.completedFuture(null);
}
}
}

View File

@@ -0,0 +1,144 @@
package dev.sheldan.abstracto.modmail.listener;
import dev.sheldan.abstracto.core.config.ListenerPriority;
import dev.sheldan.abstracto.core.models.template.display.MemberDisplay;
import dev.sheldan.abstracto.core.models.template.display.RoleDisplay;
import dev.sheldan.abstracto.core.service.ChannelService;
import dev.sheldan.abstracto.core.service.ConfigService;
import dev.sheldan.abstracto.core.service.FeatureModeService;
import dev.sheldan.abstracto.core.templating.model.MessageToSend;
import dev.sheldan.abstracto.core.templating.service.TemplateService;
import dev.sheldan.abstracto.core.utils.FutureUtils;
import dev.sheldan.abstracto.core.utils.ParseUtils;
import dev.sheldan.abstracto.modmail.config.ModMailFeatureConfig;
import dev.sheldan.abstracto.modmail.config.ModMailFeatureDefinition;
import dev.sheldan.abstracto.modmail.config.ModMailMode;
import dev.sheldan.abstracto.modmail.model.database.ModMailRole;
import dev.sheldan.abstracto.modmail.model.database.ModMailThread;
import dev.sheldan.abstracto.modmail.model.database.ModMailThreadState;
import dev.sheldan.abstracto.modmail.model.listener.ModmailThreadActionListenerModel;
import dev.sheldan.abstracto.modmail.model.template.ModmailThreadReminderModel;
import dev.sheldan.abstracto.modmail.service.management.ModMailRoleManagementService;
import dev.sheldan.abstracto.modmail.service.management.ModMailThreadManagementService;
import java.time.Duration;
import java.time.Instant;
import java.util.List;
import java.util.concurrent.CompletableFuture;
import lombok.extern.slf4j.Slf4j;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Component;
import org.springframework.transaction.annotation.Transactional;
@Component
@Slf4j
public class ModmailReminderListener implements ModmailThreadActionListener {
@Autowired
private ChannelService channelService;
@Autowired
private TemplateService templateService;
@Autowired
private ModMailThreadManagementService modMailThreadManagementService;
@Autowired
private ConfigService configService;
@Autowired
private FeatureModeService featureModeService;
@Autowired
private ModMailRoleManagementService modMailRoleManagementService;
@Autowired
private ModmailReminderListener self;
private static final String MODMAIL_THREAD_REMINDER_TEMPLATE_KEY = "modmail_thread_reminder_notification";
@Override
public Integer getPriority() {
return ListenerPriority.MEDIUM;
}
@Override
public ModmailThreadActionListenerResult execute(ModmailThreadActionListenerModel model) {
ModmailThreadActionListenerResult result;
if(!featureModeService.featureModeActive(ModMailFeatureDefinition.MOD_MAIL, model.getServerId(), ModMailMode.THREAD_REMINDER)) {
result = ModmailThreadActionListenerResult.IGNORED;
} else {
String reminderDurationString = configService.getStringValueOrConfigDefault(ModMailFeatureConfig.MOD_MAIL_REMINDER_DURATION, model.getServerId());
Duration duration = ParseUtils.parseDuration(reminderDurationString);
Instant timeInPastDuration = Instant.now().minus(duration);
ModMailThread thread = modMailThreadManagementService.getById(model.getThreadId());
if(List.of(ModMailThreadState.CLOSED, ModMailThreadState.CLOSING).contains(thread.getState())) {
log.debug("Thread {} is closed - ignoring.", model.getThreadId());
return ModmailThreadActionListenerResult.IGNORED;
}
Instant timeStampToConsider = getTimestampToUse(thread);
boolean mustBeReminded = timeInPastDuration.isAfter(timeStampToConsider);
if (mustBeReminded) {
sendReminder(thread)
.thenAccept(unused -> {
self.updateSnoozeTimer(model.getThreadId(), duration);
log.info("Sent reminder about thread {}", model.getThreadId());
})
.exceptionally(throwable -> {
log.warn("Failed to send reminder about thread {}.", model.getThreadId(), throwable);
return null;
});
result = ModmailThreadActionListenerResult.PROCESSED;
} else {
result = ModmailThreadActionListenerResult.IGNORED;
}
}
return result;
}
private static Instant getTimestampToUse(ModMailThread thread) {
if (thread.getRemindersSnoozedUntil() != null) {
return thread.getRemindersSnoozedUntil();
}
return getUpdatedOrCrated(thread);
}
private static Instant getUpdatedOrCrated(ModMailThread thread) {
if(thread.getUpdated() != null) {
return thread.getUpdated();
}
return thread.getCreated();
}
private CompletableFuture<Void> sendReminder(ModMailThread modMailThread) {
List<ModMailRole> modmailRolesToPing = modMailRoleManagementService.getRolesForServer(modMailThread.getServer());
List<RoleDisplay> rolesToDisplay = modmailRolesToPing.stream().map(role -> RoleDisplay.fromARole(role.getRole())).toList();
Instant autoCloseInstant;
if(featureModeService.featureModeActive(ModMailFeatureDefinition.MOD_MAIL, modMailThread.getServer().getId(), ModMailMode.THREAD_AUTO_CLOSE)
&& !modMailThread.getState().equals(ModMailThreadState.PAUSED)) {
String closeDurationString = configService.getStringValueOrConfigDefault(ModMailFeatureConfig.MOD_MAIL_AUTO_CLOSE_DURATION, modMailThread.getServer().getId());
Duration autoCloseDuration = ParseUtils.parseDuration(closeDurationString);
autoCloseInstant = getUpdatedOrCrated(modMailThread).plus(autoCloseDuration);
} else {
autoCloseInstant = null;
}
ModmailThreadReminderModel model = ModmailThreadReminderModel
.builder()
.updated(getUpdatedOrCrated(modMailThread))
.created(modMailThread.getCreated())
.paused(modMailThread.getState().equals(ModMailThreadState.PAUSED))
.autoCloseInstant(autoCloseInstant)
.pingRoles(rolesToDisplay)
.memberDisplay(MemberDisplay.fromAUserInAServer(modMailThread.getUser()))
.build();
MessageToSend messageToSend = templateService.renderEmbedTemplate(MODMAIL_THREAD_REMINDER_TEMPLATE_KEY, model, modMailThread.getServer().getId());
return FutureUtils.toSingleFutureGeneric(channelService.sendMessageEmbedToSendToAChannel(messageToSend, modMailThread.getChannel()));
}
@Transactional
public void updateSnoozeTimer(long modmailThreadId, Duration duration) {
ModMailThread thread = modMailThreadManagementService.getById(modmailThreadId);
thread.setRemindersSnoozedUntil(Instant.now().plus(duration));
}
}

View File

@@ -36,6 +36,7 @@ public interface ModMailThreadRepository extends JpaRepository<ModMailThread, Lo
boolean existsByUserAndStateNot(AUserInAServer userInAServer, ModMailThreadState state); boolean existsByUserAndStateNot(AUserInAServer userInAServer, ModMailThreadState state);
List<ModMailThread> findByUserAndState(AUserInAServer userInAServer, ModMailThreadState state); List<ModMailThread> findByUserAndState(AUserInAServer userInAServer, ModMailThreadState state);
List<ModMailThread> findByStateNot(ModMailThreadState state);
@Override @Override
Optional<ModMailThread> findById(@NonNull Long aLong); Optional<ModMailThread> findById(@NonNull Long aLong);

View File

@@ -15,6 +15,7 @@ import dev.sheldan.abstracto.core.service.*;
import dev.sheldan.abstracto.core.service.management.ChannelManagementService; import dev.sheldan.abstracto.core.service.management.ChannelManagementService;
import dev.sheldan.abstracto.core.service.management.ServerManagementService; import dev.sheldan.abstracto.core.service.management.ServerManagementService;
import dev.sheldan.abstracto.core.service.management.UserInServerManagementService; import dev.sheldan.abstracto.core.service.management.UserInServerManagementService;
import dev.sheldan.abstracto.core.utils.BeanUtils;
import dev.sheldan.abstracto.core.utils.CompletableFutureList; import dev.sheldan.abstracto.core.utils.CompletableFutureList;
import dev.sheldan.abstracto.core.utils.FutureUtils; import dev.sheldan.abstracto.core.utils.FutureUtils;
import dev.sheldan.abstracto.core.utils.SnowflakeUtils; import dev.sheldan.abstracto.core.utils.SnowflakeUtils;
@@ -26,9 +27,11 @@ import dev.sheldan.abstracto.modmail.config.ModMailPostTargets;
import dev.sheldan.abstracto.modmail.exception.ModMailCategoryIdException; import dev.sheldan.abstracto.modmail.exception.ModMailCategoryIdException;
import dev.sheldan.abstracto.modmail.exception.ModMailThreadChannelNotFound; import dev.sheldan.abstracto.modmail.exception.ModMailThreadChannelNotFound;
import dev.sheldan.abstracto.modmail.exception.ModMailThreadNotFoundException; import dev.sheldan.abstracto.modmail.exception.ModMailThreadNotFoundException;
import dev.sheldan.abstracto.modmail.listener.ModmailThreadActionListener;
import dev.sheldan.abstracto.modmail.model.ClosingContext; import dev.sheldan.abstracto.modmail.model.ClosingContext;
import dev.sheldan.abstracto.modmail.model.dto.ServiceChoicesPayload; import dev.sheldan.abstracto.modmail.model.dto.ServiceChoicesPayload;
import dev.sheldan.abstracto.modmail.model.database.*; import dev.sheldan.abstracto.modmail.model.database.*;
import dev.sheldan.abstracto.modmail.model.listener.ModmailThreadActionListenerModel;
import dev.sheldan.abstracto.modmail.model.listener.ModmailThreadCreatedSendMessageModel; import dev.sheldan.abstracto.modmail.model.listener.ModmailThreadCreatedSendMessageModel;
import dev.sheldan.abstracto.modmail.model.template.*; import dev.sheldan.abstracto.modmail.model.template.*;
import dev.sheldan.abstracto.modmail.service.management.ModMailMessageManagementService; import dev.sheldan.abstracto.modmail.service.management.ModMailMessageManagementService;
@@ -166,6 +169,9 @@ public class ModMailThreadServiceBean implements ModMailThreadService {
@Autowired @Autowired
private ApplicationEventPublisher eventPublisher; private ApplicationEventPublisher eventPublisher;
@Autowired
private List<ModmailThreadActionListener> threadActionListeners;
public static final String MODMAIL_THREAD_METRIC = "modmail.threads"; public static final String MODMAIL_THREAD_METRIC = "modmail.threads";
public static final String MODMAIL_MESSAGE_METRIC = "modmail.messges"; public static final String MODMAIL_MESSAGE_METRIC = "modmail.messges";
public static final String ACTION = "action"; public static final String ACTION = "action";
@@ -269,6 +275,38 @@ public class ModMailThreadServiceBean implements ModMailThreadService {
return FutureUtils.toSingleFutureGeneric(interactionService.sendMessageToInteraction(MODMAIL_THREAD_CREATED_TEMPLATE_KEY, model, interactionHook)); return FutureUtils.toSingleFutureGeneric(interactionService.sendMessageToInteraction(MODMAIL_THREAD_CREATED_TEMPLATE_KEY, model, interactionHook));
} }
@Transactional
public void checkModmailActionsForNeededActions() {
List<ModMailThread> allOpenThreads = modMailThreadManagementService.getAllOpenThreads();
allOpenThreads.forEach(thread -> {
ModmailThreadActionListenerModel model = ModmailThreadActionListenerModel
.builder()
.threadId(thread.getId())
.state(thread.getState())
.appeal(thread.getAppeal())
.serverId(thread.getServer().getId())
.serverUser(ServerUser.fromAUserInAServer(thread.getUser()))
.messageCount(thread.getMessages() != null ? thread.getMessages().size() : 0)
.updated(thread.getUpdated())
.created(thread.getCreated())
.subscriberCount(thread.getSubscribers() != null ? thread.getSubscribers().size() : 0)
.build();
for (ModmailThreadActionListener modmailThreadActionListener : threadActionListeners) {
try {
log.info("Executing action {} for thread {}.", modmailThreadActionListener.getClass().getSimpleName(), model.getThreadId());
ModmailThreadActionListener.ModmailThreadActionListenerResult result = modmailThreadActionListener.execute(model);
if(ModmailThreadActionListener.ModmailThreadActionListenerResult.FINAL == result) {
log.info("Listener {} terminated for thread {}.", modmailThreadActionListener.getClass().getSimpleName(), model.getThreadId());
break;
}
} catch (Exception exception) {
log.error("Action failed to execute.", exception);
}
}
});
}
/** /**
* This method is responsible for creating the instance in the database, sending the header in the newly created text channel and forwarding the initial message * This method is responsible for creating the instance in the database, sending the header in the newly created text channel and forwarding the initial message
* by the user (if any), after this is complete, this method executes the method to perform the mod mail notification. * by the user (if any), after this is complete, this method executes the method to perform the mod mail notification.
@@ -808,6 +846,27 @@ public class ModMailThreadServiceBean implements ModMailThreadService {
return isModMailThread(channel); return isModMailThread(channel);
} }
@Override
public void snoozeThreadReminder(ModMailThread thread, Duration snoozeDuration) {
Instant snoozeTargetDate = Instant.now().plus(snoozeDuration);
log.info("Snoozing Thread {} until {}.", thread.getId(), snoozeTargetDate);
thread.setRemindersSnoozedUntil(snoozeTargetDate);
}
@Override
public void setPauseOfThreadTo(ModMailThread thread, boolean paused) {
if(thread.getState().equals(ModMailThreadState.PAUSED) && !paused) {
thread.setState(thread.getPreviousState());
thread.setPreviousState(null);
}
if(!thread.getState().equals(ModMailThreadState.PAUSED) && paused) {
thread.setPreviousState(thread.getState());
thread.setState(ModMailThreadState.PAUSED);
}
log.info("Thread {} has state {} and previous state {}.", thread.getId(), thread.getState(), thread.getPreviousState());
}
/** /**
* This method takes the actively loaded futures, calls the method responsible for logging the messages, and calls the method * This method takes the actively loaded futures, calls the method responsible for logging the messages, and calls the method
* after the logging has been done. * after the logging has been done.
@@ -1127,5 +1186,6 @@ public class ModMailThreadServiceBean implements ModMailThreadService {
metricService.registerCounter(MODMAIL_THREAD_CLOSED_COUNTER, "Mod mail threads closed"); metricService.registerCounter(MODMAIL_THREAD_CLOSED_COUNTER, "Mod mail threads closed");
metricService.registerCounter(MDOMAIL_THREAD_MESSAGE_RECEIVED, "Mod mail messages received"); metricService.registerCounter(MDOMAIL_THREAD_MESSAGE_RECEIVED, "Mod mail messages received");
metricService.registerCounter(MDOMAIL_THREAD_MESSAGE_SENT, "Mod mail messages sent"); metricService.registerCounter(MDOMAIL_THREAD_MESSAGE_SENT, "Mod mail messages sent");
BeanUtils.sortPrioritizedListeners(threadActionListeners);
} }
} }

View File

@@ -89,6 +89,11 @@ public class ModMailThreadManagementServiceBean implements ModMailThreadManageme
return modMailThreadRepository.findByUser(aUserInAServer); return modMailThreadRepository.findByUser(aUserInAServer);
} }
@Override
public List<ModMailThread> getAllOpenThreads() {
return modMailThreadRepository.findByStateNot(ModMailThreadState.CLOSED);
}
@Override @Override
public ModMailThread getLatestModMailThread(AUserInAServer aUserInAServer) { public ModMailThread getLatestModMailThread(AUserInAServer aUserInAServer) {
return modMailThreadRepository.findTopByUserOrderByClosedDesc(aUserInAServer); return modMailThreadRepository.findTopByUserOrderByClosedDesc(aUserInAServer);
@@ -123,7 +128,11 @@ public class ModMailThreadManagementServiceBean implements ModMailThreadManageme
@Override @Override
public void setModMailThreadState(ModMailThread modMailThread, ModMailThreadState newState) { public void setModMailThreadState(ModMailThread modMailThread, ModMailThreadState newState) {
if(modMailThread.getState().equals(ModMailThreadState.PAUSED)) {
modMailThread.setPreviousState(newState);
} else {
modMailThread.setState(newState); modMailThread.setState(newState);
}
modMailThread.setUpdated(Instant.now()); modMailThread.setUpdated(Instant.now());
modMailThreadRepository.save(modMailThread); modMailThreadRepository.save(modMailThread);
} }

View File

@@ -0,0 +1,7 @@
<?xml version="1.1" encoding="UTF-8" standalone="no"?>
<databaseChangeLog xmlns="http://www.liquibase.org/xml/ns/dbchangelog"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://www.liquibase.org/xml/ns/dbchangelog https://www.liquibase.org/xml/ns/dbchangelog/dbchangelog-4.26.xsd" >
<include file="tables/tables.xml" relativeToChangelogFile="true"/>
<include file="seedData/data.xml" relativeToChangelogFile="true"/>
</databaseChangeLog>

View File

@@ -0,0 +1,21 @@
<?xml version="1.1" encoding="UTF-8" standalone="no"?>
<databaseChangeLog xmlns="http://www.liquibase.org/xml/ns/dbchangelog"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://www.liquibase.org/xml/ns/dbchangelog https://www.liquibase.org/xml/ns/dbchangelog/dbchangelog-4.26.xsd" >
<property name="modmailModule" value="(SELECT id FROM module WHERE name = 'modmail')"/>
<property name="modmailFeature" value="(SELECT id FROM feature WHERE key = 'modmail')"/>
<changeSet author="Sheldan" id="modmail_thread_action_commands">
<insert tableName="command">
<column name="name" value="snoozeThreadReminder"/>
<column name="module_id" valueComputed="${modmailModule}"/>
<column name="feature_id" valueComputed="${modmailFeature}"/>
</insert>
<insert tableName="command">
<column name="name" value="setThreadPause"/>
<column name="module_id" valueComputed="${modmailModule}"/>
<column name="feature_id" valueComputed="${modmailFeature}"/>
</insert>
</changeSet>
</databaseChangeLog>

View File

@@ -0,0 +1,7 @@
<?xml version="1.1" encoding="UTF-8" standalone="no"?>
<databaseChangeLog xmlns="http://www.liquibase.org/xml/ns/dbchangelog"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://www.liquibase.org/xml/ns/dbchangelog https://www.liquibase.org/xml/ns/dbchangelog/dbchangelog-4.26.xsd" >
<include file="modmail_action_job.xml" relativeToChangelogFile="true"/>
<include file="command.xml" relativeToChangelogFile="true"/>
</databaseChangeLog>

View File

@@ -0,0 +1,15 @@
<?xml version="1.1" encoding="UTF-8" standalone="no"?>
<databaseChangeLog xmlns="http://www.liquibase.org/xml/ns/dbchangelog"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://www.liquibase.org/xml/ns/dbchangelog https://www.liquibase.org/xml/ns/dbchangelog/dbchangelog-4.26.xsd" >
<changeSet author="Sheldan" id="modmail_action_job-insert">
<insert tableName="scheduler_job">
<column name="name" value="modmailActionJob"/>
<column name="group_name" value="modmail"/>
<column name="clazz" value="dev.sheldan.abstracto.modmail.job.ModmailThreadActionJob"/>
<column name="active" value="true"/>
<column name="cron_expression" value="0 0 0 * * ?"/>
<column name="recovery" value="false"/>
</insert>
</changeSet>
</databaseChangeLog>

View File

@@ -0,0 +1,15 @@
<?xml version="1.1" encoding="UTF-8" standalone="no"?>
<databaseChangeLog xmlns="http://www.liquibase.org/xml/ns/dbchangelog"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://www.liquibase.org/xml/ns/dbchangelog https://www.liquibase.org/xml/ns/dbchangelog/dbchangelog-4.26.xsd" >
<changeSet author="Sheldan" id="mod_mail_thread-add_columns_for_modmail_thread_actions">
<addColumn tableName="mod_mail_thread">
<column name="reminders_snoozed_until" type="TIMESTAMP WITHOUT TIME ZONE" defaultValueComputed="CURRENT_TIMESTAMP">
<constraints nullable="true" />
</column>
<column name="previous_state" type="VARCHAR(255)">
<constraints nullable="true"/>
</column>
</addColumn>
</changeSet>
</databaseChangeLog>

View File

@@ -0,0 +1,6 @@
<?xml version="1.1" encoding="UTF-8" standalone="no"?>
<databaseChangeLog xmlns="http://www.liquibase.org/xml/ns/dbchangelog"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://www.liquibase.org/xml/ns/dbchangelog https://www.liquibase.org/xml/ns/dbchangelog/dbchangelog-4.26.xsd" >
<include file="modmail_thread.xml" relativeToChangelogFile="true"/>
</databaseChangeLog>

View File

@@ -5,4 +5,5 @@
<include file="1.0-modmail/collection.xml" relativeToChangelogFile="true"/> <include file="1.0-modmail/collection.xml" relativeToChangelogFile="true"/>
<include file="1.5.37/collection.xml" relativeToChangelogFile="true"/> <include file="1.5.37/collection.xml" relativeToChangelogFile="true"/>
<include file="1.5.51/collection.xml" relativeToChangelogFile="true"/> <include file="1.5.51/collection.xml" relativeToChangelogFile="true"/>
<include file="1.6.22/collection.xml" relativeToChangelogFile="true"/>
</databaseChangeLog> </databaseChangeLog>

View File

@@ -4,6 +4,12 @@ abstracto.systemConfigs.modMailClosingText.stringValue=Thread has been closed.
abstracto.systemConfigs.modmailCategory.name=modmailCategory abstracto.systemConfigs.modmailCategory.name=modmailCategory
abstracto.systemConfigs.modmailCategory.longValue=0 abstracto.systemConfigs.modmailCategory.longValue=0
abstracto.systemConfigs.modMailReminderDuration.name=modMailReminderDuration
abstracto.systemConfigs.modMailReminderDuration.stringValue=3d
abstracto.systemConfigs.modMailAutoCloseDuration.name=modMailAutoCloseDuration
abstracto.systemConfigs.modMailAutoCloseDuration.stringValue=14d
abstracto.featureFlags.modmail.featureName=modmail abstracto.featureFlags.modmail.featureName=modmail
abstracto.featureFlags.modmail.enabled=false abstracto.featureFlags.modmail.enabled=false
@@ -29,3 +35,11 @@ abstracto.featureModes.modMailAppeals.enabled=false
abstracto.systemConfigs.modMailAppealServer.name=modMailAppealServer abstracto.systemConfigs.modMailAppealServer.name=modMailAppealServer
abstracto.systemConfigs.modMailAppealServer.longValue=0 abstracto.systemConfigs.modMailAppealServer.longValue=0
abstracto.featureModes.threadReminder.featureName=modmail
abstracto.featureModes.threadReminder.mode=threadReminder
abstracto.featureModes.threadReminder.enabled=false
abstracto.featureModes.threadAutoClose.featureName=modmail
abstracto.featureModes.threadAutoClose.mode=threadAutoClose
abstracto.featureModes.threadAutoClose.enabled=false

View File

@@ -0,0 +1,134 @@
package dev.sheldan.abstracto.modmail.listener;
import static org.mockito.ArgumentMatchers.any;
import static org.mockito.ArgumentMatchers.anyString;
import static org.mockito.ArgumentMatchers.eq;
import static org.mockito.Mockito.times;
import static org.mockito.Mockito.verify;
import static org.mockito.Mockito.when;
import dev.sheldan.abstracto.core.models.database.AServer;
import dev.sheldan.abstracto.core.models.database.AUser;
import dev.sheldan.abstracto.core.models.database.AUserInAServer;
import dev.sheldan.abstracto.core.service.ChannelService;
import dev.sheldan.abstracto.core.service.ConfigService;
import dev.sheldan.abstracto.core.service.FeatureModeService;
import dev.sheldan.abstracto.core.templating.model.MessageToSend;
import dev.sheldan.abstracto.core.templating.service.TemplateService;
import dev.sheldan.abstracto.modmail.config.ModMailFeatureConfig;
import dev.sheldan.abstracto.modmail.config.ModMailFeatureDefinition;
import dev.sheldan.abstracto.modmail.config.ModMailMode;
import dev.sheldan.abstracto.modmail.model.database.ModMailThread;
import dev.sheldan.abstracto.modmail.model.listener.ModmailThreadActionListenerModel;
import dev.sheldan.abstracto.modmail.service.management.ModMailRoleManagementService;
import dev.sheldan.abstracto.modmail.service.management.ModMailThreadManagementService;
import java.time.Instant;
import java.time.temporal.ChronoUnit;
import java.util.List;
import org.junit.Before;
import org.junit.Test;
import org.junit.runner.RunWith;
import org.mockito.InjectMocks;
import org.mockito.Mock;
import org.mockito.Mockito;
import org.mockito.junit.MockitoJUnitRunner;
@RunWith(MockitoJUnitRunner.class)
public class ModmailReminderListenerTest {
@InjectMocks
private ModmailReminderListener unitUnderTest;
@Mock
private ChannelService channelService;
@Mock
private TemplateService templateService;
@Mock
private ModMailThreadManagementService modMailThreadManagementService;
@Mock
private ConfigService configService;
@Mock
private FeatureModeService featureModeService;
@Mock
private ModMailRoleManagementService modMailRoleManagementService;
private static final long SERVER_ID = 1L;
private static final long THREAD_ID = 2L;
private static final long USER_ID = 3L;
@Before
public void setup() {
when(featureModeService.featureModeActive(ModMailFeatureDefinition.MOD_MAIL, SERVER_ID, ModMailMode.THREAD_REMINDER)).thenReturn(true);
when(configService.getStringValueOrConfigDefault(ModMailFeatureConfig.MOD_MAIL_REMINDER_DURATION, SERVER_ID)).thenReturn("5m");
MessageToSend messageToSend = MessageToSend
.builder()
.build();
when(templateService.renderEmbedTemplate(anyString(), any(), any())).thenReturn(messageToSend);
when(modMailRoleManagementService.getRolesForServer(any())).thenReturn(List.of());
}
@Test
public void executeInitialReminder() {
Instant updatedTimeStamp = Instant.now().minus(10, ChronoUnit.MINUTES);
Instant snoozedUntil = Instant.now().minus(1, ChronoUnit.SECONDS);
executeTest(updatedTimeStamp, snoozedUntil, true);
}
@Test
public void shouldNotExecuteAfterSnoozing() {
Instant updatedTimeStamp = Instant.now().minus(10, ChronoUnit.MINUTES);
Instant snoozedUntil = Instant.now().plus(5, ChronoUnit.MINUTES);
executeTest(updatedTimeStamp, snoozedUntil, false);
}
@Test
public void shouldExecuteAfterSnoozingButSnoozingHasPassed() {
Instant updatedTimeStamp = Instant.now().minus(25, ChronoUnit.MINUTES);
Instant snoozedUntil = Instant.now().minus(2, ChronoUnit.MINUTES);
executeTest(updatedTimeStamp, snoozedUntil, true);
}
private void executeTest(Instant updatedTimeStamp, Instant snoozedUntil, boolean shouldExecute) {
ModMailThread thread = Mockito.mock(ModMailThread.class);
when(thread.getUpdated()).thenReturn(updatedTimeStamp);
when(thread.getRemindersSnoozedUntil()).thenReturn(snoozedUntil);
AUser user = AUser
.builder()
.id(USER_ID)
.build();
AServer server = AServer
.builder()
.id(SERVER_ID)
.build();
AUserInAServer aUserInAServer = AUserInAServer
.builder()
.serverReference(server)
.userReference(user)
.userInServerId(USER_ID)
.build();
when(thread.getServer()).thenReturn(server);
when(thread.getUser()).thenReturn(aUserInAServer);
when(modMailThreadManagementService.getById(THREAD_ID)).thenReturn(thread);
ModmailThreadActionListenerModel model = getModel();
unitUnderTest.execute(model);
if(shouldExecute) {
verify(channelService).sendMessageEmbedToSendToAChannel(any(), any());
} else {
verify(channelService, times(0)).sendMessageEmbedToSendToAChannel(any(), any());
}
}
private static ModmailThreadActionListenerModel getModel() {
return ModmailThreadActionListenerModel
.builder()
.serverId(SERVER_ID)
.threadId(THREAD_ID)
.build();
}
}

View File

@@ -3,7 +3,7 @@
<parent> <parent>
<groupId>dev.sheldan.abstracto.modules</groupId> <groupId>dev.sheldan.abstracto.modules</groupId>
<artifactId>modmail</artifactId> <artifactId>modmail</artifactId>
<version>1.6.21-SNAPSHOT</version> <version>1.6.23-SNAPSHOT</version>
</parent> </parent>
<modelVersion>4.0.0</modelVersion> <modelVersion>4.0.0</modelVersion>

View File

@@ -22,6 +22,8 @@ public class ModMailFeatureConfig implements FeatureConfig {
public static final String MOD_MAIL_CLOSING_TEXT_SYSTEM_CONFIG_KEY = "modMailClosingText"; public static final String MOD_MAIL_CLOSING_TEXT_SYSTEM_CONFIG_KEY = "modMailClosingText";
public static final String MOD_MAIL_APPEAL_SERVER = "modMailAppealServer"; public static final String MOD_MAIL_APPEAL_SERVER = "modMailAppealServer";
public static final String MOD_MAIL_REMINDER_DURATION = "modMailReminderDuration";
public static final String MOD_MAIL_AUTO_CLOSE_DURATION = "modMailAutoCloseDuration";
@Autowired @Autowired
private ModMailFeatureValidator modMailFeatureValidator; private ModMailFeatureValidator modMailFeatureValidator;
@@ -55,13 +57,18 @@ public class ModMailFeatureConfig implements FeatureConfig {
return List.of(ModMailMode.LOGGING, return List.of(ModMailMode.LOGGING,
ModMailMode.SEPARATE_MESSAGE, ModMailMode.SEPARATE_MESSAGE,
ModMailMode.THREAD_CONTAINER, ModMailMode.THREAD_CONTAINER,
ModMailMode.MOD_MAIL_APPEALS ModMailMode.MOD_MAIL_APPEALS,
ModMailMode.THREAD_AUTO_CLOSE,
ModMailMode.THREAD_REMINDER
); );
} }
@Override @Override
public List<String> getRequiredSystemConfigKeys() { public List<String> getRequiredSystemConfigKeys() {
return List.of(MOD_MAIL_CLOSING_TEXT_SYSTEM_CONFIG_KEY, MOD_MAIL_APPEAL_SERVER); return List.of(MOD_MAIL_CLOSING_TEXT_SYSTEM_CONFIG_KEY,
MOD_MAIL_APPEAL_SERVER,
MOD_MAIL_REMINDER_DURATION,
MOD_MAIL_AUTO_CLOSE_DURATION);
} }
@Override @Override

View File

@@ -12,6 +12,8 @@ public enum ModMailMode implements FeatureMode {
LOGGING("log"), LOGGING("log"),
SEPARATE_MESSAGE("threadMessage"), SEPARATE_MESSAGE("threadMessage"),
THREAD_CONTAINER("threadContainer"), THREAD_CONTAINER("threadContainer"),
THREAD_REMINDER("threadReminder"),
THREAD_AUTO_CLOSE("threadAutoClose"),
MOD_MAIL_APPEALS("modMailAppeals"); MOD_MAIL_APPEALS("modMailAppeals");
private final String key; private final String key;

View File

@@ -0,0 +1,14 @@
package dev.sheldan.abstracto.modmail.listener;
import dev.sheldan.abstracto.core.Prioritized;
import dev.sheldan.abstracto.core.listener.AbstractoListener;
import dev.sheldan.abstracto.core.listener.ListenerExecutionResult;
import dev.sheldan.abstracto.modmail.model.listener.ModmailThreadActionListenerModel;
public interface ModmailThreadActionListener extends
AbstractoListener<ModmailThreadActionListenerModel, ModmailThreadActionListener.ModmailThreadActionListenerResult>, Prioritized {
enum ModmailThreadActionListenerResult implements ListenerExecutionResult {
FINAL, IGNORED, PROCESSED
}
}

View File

@@ -59,6 +59,9 @@ public class ModMailThread implements Serializable {
@Column(name = "closed") @Column(name = "closed")
private Instant closed; private Instant closed;
@Column(name = "reminders_snoozed_until")
private Instant remindersSnoozedUntil;
@Column(name = "appeal", nullable = false) @Column(name = "appeal", nullable = false)
private Boolean appeal; private Boolean appeal;
@@ -92,4 +95,8 @@ public class ModMailThread implements Serializable {
@Column(name = "state") @Column(name = "state")
private ModMailThreadState state; private ModMailThreadState state;
@Enumerated(EnumType.STRING)
@Column(name = "previous_state")
private ModMailThreadState previousState;
} }

View File

@@ -13,6 +13,10 @@ public enum ModMailThreadState {
* Staff member responded to the mod mail thread * Staff member responded to the mod mail thread
*/ */
MOD_REPLIED, MOD_REPLIED,
/**
* Staff member paused the thread to not be closed
*/
PAUSED,
/** /**
* The thread was closed by a staff member and the channel was removed * The thread was closed by a staff member and the channel was removed
*/ */

View File

@@ -0,0 +1,27 @@
package dev.sheldan.abstracto.modmail.model.listener;
import dev.sheldan.abstracto.core.listener.ListenerModel;
import dev.sheldan.abstracto.core.models.ServerUser;
import dev.sheldan.abstracto.modmail.model.database.ModMailThreadState;
import java.time.Instant;
import lombok.Builder;
import lombok.Getter;
import lombok.Setter;
@Getter
@Setter
@Builder
public class ModmailThreadActionListenerModel implements ListenerModel {
private long threadId;
private ServerUser serverUser;
private long serverId;
private ModMailThreadState state;
private Boolean appeal;
private Instant created;
private Instant updated;
private long messageCount;
private long subscriberCount;
private long channelId;
}

View File

@@ -0,0 +1,21 @@
package dev.sheldan.abstracto.modmail.model.template;
import dev.sheldan.abstracto.core.models.template.display.MemberDisplay;
import dev.sheldan.abstracto.core.models.template.display.RoleDisplay;
import java.time.Instant;
import java.util.List;
import lombok.Builder;
import lombok.Getter;
import lombok.Setter;
@Getter
@Setter
@Builder
public class ModmailThreadReminderModel {
private List<RoleDisplay> pingRoles;
private MemberDisplay memberDisplay;
private Instant autoCloseInstant;
private boolean paused;
private Instant created;
private Instant updated;
}

View File

@@ -8,6 +8,7 @@ import dev.sheldan.abstracto.core.models.database.AUserInAServer;
import dev.sheldan.abstracto.core.templating.model.MessageToSend; import dev.sheldan.abstracto.core.templating.model.MessageToSend;
import dev.sheldan.abstracto.modmail.model.ClosingContext; import dev.sheldan.abstracto.modmail.model.ClosingContext;
import dev.sheldan.abstracto.modmail.model.database.ModMailThread; import dev.sheldan.abstracto.modmail.model.database.ModMailThread;
import java.time.Duration;
import net.dv8tion.jda.api.entities.*; import net.dv8tion.jda.api.entities.*;
import net.dv8tion.jda.api.entities.channel.middleman.MessageChannel; import net.dv8tion.jda.api.entities.channel.middleman.MessageChannel;
import net.dv8tion.jda.api.interactions.InteractionHook; import net.dv8tion.jda.api.interactions.InteractionHook;
@@ -103,6 +104,8 @@ public interface ModMailThreadService {
boolean isModMailThread(AChannel channel); boolean isModMailThread(AChannel channel);
boolean isModMailThread(Long channelId); boolean isModMailThread(Long channelId);
void snoozeThreadReminder(ModMailThread thread, Duration snoozeDuration);
void setPauseOfThreadTo(ModMailThread thread, boolean paused);
CompletableFuture<Void> rejectAppeal(ModMailThread modMailThread, String reason, Member memberPerforming); CompletableFuture<Void> rejectAppeal(ModMailThread modMailThread, String reason, Member memberPerforming);
} }

View File

@@ -91,6 +91,7 @@ public interface ModMailThreadManagementService {
* @return A list of {@link ModMailThread} which contains all the current mod mail threads for the member, should be at most one * @return A list of {@link ModMailThread} which contains all the current mod mail threads for the member, should be at most one
*/ */
List<ModMailThread> getModMailThreadForUser(AUserInAServer aUserInAServer); List<ModMailThread> getModMailThreadForUser(AUserInAServer aUserInAServer);
List<ModMailThread> getAllOpenThreads();
/** /**
* Retrieves the *latest* {@link ModMailThread} of the {@link AUserInAServer}, which means, the latest thread which is in the state * Retrieves the *latest* {@link ModMailThread} of the {@link AUserInAServer}, which means, the latest thread which is in the state

View File

@@ -3,7 +3,7 @@
<parent> <parent>
<groupId>dev.sheldan.abstracto.modules</groupId> <groupId>dev.sheldan.abstracto.modules</groupId>
<artifactId>abstracto-modules</artifactId> <artifactId>abstracto-modules</artifactId>
<version>1.6.21-SNAPSHOT</version> <version>1.6.23-SNAPSHOT</version>
</parent> </parent>
<modelVersion>4.0.0</modelVersion> <modelVersion>4.0.0</modelVersion>

View File

@@ -3,7 +3,7 @@
<parent> <parent>
<groupId>dev.sheldan.abstracto</groupId> <groupId>dev.sheldan.abstracto</groupId>
<artifactId>abstracto-application</artifactId> <artifactId>abstracto-application</artifactId>
<version>1.6.21-SNAPSHOT</version> <version>1.6.23-SNAPSHOT</version>
</parent> </parent>
<modelVersion>4.0.0</modelVersion> <modelVersion>4.0.0</modelVersion>

View File

@@ -3,7 +3,7 @@
<parent> <parent>
<artifactId>abstracto-modules</artifactId> <artifactId>abstracto-modules</artifactId>
<groupId>dev.sheldan.abstracto.modules</groupId> <groupId>dev.sheldan.abstracto.modules</groupId>
<version>1.6.21-SNAPSHOT</version> <version>1.6.23-SNAPSHOT</version>
</parent> </parent>
<modelVersion>4.0.0</modelVersion> <modelVersion>4.0.0</modelVersion>

View File

@@ -3,7 +3,7 @@
<parent> <parent>
<artifactId>profanity-filter</artifactId> <artifactId>profanity-filter</artifactId>
<groupId>dev.sheldan.abstracto.modules</groupId> <groupId>dev.sheldan.abstracto.modules</groupId>
<version>1.6.21-SNAPSHOT</version> <version>1.6.23-SNAPSHOT</version>
</parent> </parent>
<modelVersion>4.0.0</modelVersion> <modelVersion>4.0.0</modelVersion>

View File

@@ -3,7 +3,7 @@
<parent> <parent>
<groupId>dev.sheldan.abstracto.modules</groupId> <groupId>dev.sheldan.abstracto.modules</groupId>
<artifactId>profanity-filter</artifactId> <artifactId>profanity-filter</artifactId>
<version>1.6.21-SNAPSHOT</version> <version>1.6.23-SNAPSHOT</version>
</parent> </parent>
<modelVersion>4.0.0</modelVersion> <modelVersion>4.0.0</modelVersion>

View File

@@ -3,7 +3,7 @@
<parent> <parent>
<artifactId>abstracto-modules</artifactId> <artifactId>abstracto-modules</artifactId>
<groupId>dev.sheldan.abstracto.modules</groupId> <groupId>dev.sheldan.abstracto.modules</groupId>
<version>1.6.21-SNAPSHOT</version> <version>1.6.23-SNAPSHOT</version>
</parent> </parent>
<modelVersion>4.0.0</modelVersion> <modelVersion>4.0.0</modelVersion>

View File

@@ -3,7 +3,7 @@
<parent> <parent>
<artifactId>remind</artifactId> <artifactId>remind</artifactId>
<groupId>dev.sheldan.abstracto.modules</groupId> <groupId>dev.sheldan.abstracto.modules</groupId>
<version>1.6.21-SNAPSHOT</version> <version>1.6.23-SNAPSHOT</version>
</parent> </parent>
<modelVersion>4.0.0</modelVersion> <modelVersion>4.0.0</modelVersion>

View File

@@ -3,7 +3,7 @@
<parent> <parent>
<artifactId>remind</artifactId> <artifactId>remind</artifactId>
<groupId>dev.sheldan.abstracto.modules</groupId> <groupId>dev.sheldan.abstracto.modules</groupId>
<version>1.6.21-SNAPSHOT</version> <version>1.6.23-SNAPSHOT</version>
</parent> </parent>
<modelVersion>4.0.0</modelVersion> <modelVersion>4.0.0</modelVersion>

View File

@@ -3,7 +3,7 @@
<parent> <parent>
<artifactId>abstracto-modules</artifactId> <artifactId>abstracto-modules</artifactId>
<groupId>dev.sheldan.abstracto.modules</groupId> <groupId>dev.sheldan.abstracto.modules</groupId>
<version>1.6.21-SNAPSHOT</version> <version>1.6.23-SNAPSHOT</version>
</parent> </parent>
<modelVersion>4.0.0</modelVersion> <modelVersion>4.0.0</modelVersion>

View File

@@ -3,7 +3,7 @@
<parent> <parent>
<artifactId>repost-detection</artifactId> <artifactId>repost-detection</artifactId>
<groupId>dev.sheldan.abstracto.modules</groupId> <groupId>dev.sheldan.abstracto.modules</groupId>
<version>1.6.21-SNAPSHOT</version> <version>1.6.23-SNAPSHOT</version>
</parent> </parent>
<modelVersion>4.0.0</modelVersion> <modelVersion>4.0.0</modelVersion>

View File

@@ -3,7 +3,7 @@
<parent> <parent>
<artifactId>repost-detection</artifactId> <artifactId>repost-detection</artifactId>
<groupId>dev.sheldan.abstracto.modules</groupId> <groupId>dev.sheldan.abstracto.modules</groupId>
<version>1.6.21-SNAPSHOT</version> <version>1.6.23-SNAPSHOT</version>
</parent> </parent>
<modelVersion>4.0.0</modelVersion> <modelVersion>4.0.0</modelVersion>

View File

@@ -3,7 +3,7 @@
<parent> <parent>
<artifactId>abstracto-modules</artifactId> <artifactId>abstracto-modules</artifactId>
<groupId>dev.sheldan.abstracto.modules</groupId> <groupId>dev.sheldan.abstracto.modules</groupId>
<version>1.6.21-SNAPSHOT</version> <version>1.6.23-SNAPSHOT</version>
</parent> </parent>
<modelVersion>4.0.0</modelVersion> <modelVersion>4.0.0</modelVersion>

View File

@@ -3,7 +3,7 @@
<parent> <parent>
<artifactId>starboard</artifactId> <artifactId>starboard</artifactId>
<groupId>dev.sheldan.abstracto.modules</groupId> <groupId>dev.sheldan.abstracto.modules</groupId>
<version>1.6.21-SNAPSHOT</version> <version>1.6.23-SNAPSHOT</version>
</parent> </parent>
<modelVersion>4.0.0</modelVersion> <modelVersion>4.0.0</modelVersion>

View File

@@ -3,7 +3,7 @@
<parent> <parent>
<artifactId>starboard</artifactId> <artifactId>starboard</artifactId>
<groupId>dev.sheldan.abstracto.modules</groupId> <groupId>dev.sheldan.abstracto.modules</groupId>
<version>1.6.21-SNAPSHOT</version> <version>1.6.23-SNAPSHOT</version>
</parent> </parent>
<modelVersion>4.0.0</modelVersion> <modelVersion>4.0.0</modelVersion>

View File

@@ -3,7 +3,7 @@
<parent> <parent>
<groupId>dev.sheldan.abstracto.modules</groupId> <groupId>dev.sheldan.abstracto.modules</groupId>
<artifactId>abstracto-modules</artifactId> <artifactId>abstracto-modules</artifactId>
<version>1.6.21-SNAPSHOT</version> <version>1.6.23-SNAPSHOT</version>
</parent> </parent>
<modelVersion>4.0.0</modelVersion> <modelVersion>4.0.0</modelVersion>

View File

@@ -3,7 +3,7 @@
<parent> <parent>
<groupId>dev.sheldan.abstracto.modules</groupId> <groupId>dev.sheldan.abstracto.modules</groupId>
<artifactId>statistic</artifactId> <artifactId>statistic</artifactId>
<version>1.6.21-SNAPSHOT</version> <version>1.6.23-SNAPSHOT</version>
</parent> </parent>
<modelVersion>4.0.0</modelVersion> <modelVersion>4.0.0</modelVersion>

View File

@@ -3,7 +3,7 @@
<parent> <parent>
<groupId>dev.sheldan.abstracto.modules</groupId> <groupId>dev.sheldan.abstracto.modules</groupId>
<artifactId>statistic</artifactId> <artifactId>statistic</artifactId>
<version>1.6.21-SNAPSHOT</version> <version>1.6.23-SNAPSHOT</version>
</parent> </parent>
<modelVersion>4.0.0</modelVersion> <modelVersion>4.0.0</modelVersion>

View File

@@ -3,7 +3,7 @@
<parent> <parent>
<artifactId>abstracto-modules</artifactId> <artifactId>abstracto-modules</artifactId>
<groupId>dev.sheldan.abstracto.modules</groupId> <groupId>dev.sheldan.abstracto.modules</groupId>
<version>1.6.21-SNAPSHOT</version> <version>1.6.23-SNAPSHOT</version>
</parent> </parent>
<modelVersion>4.0.0</modelVersion> <modelVersion>4.0.0</modelVersion>

View File

@@ -4,7 +4,7 @@
<parent> <parent>
<groupId>dev.sheldan.abstracto.modules</groupId> <groupId>dev.sheldan.abstracto.modules</groupId>
<artifactId>sticky-roles</artifactId> <artifactId>sticky-roles</artifactId>
<version>1.6.21-SNAPSHOT</version> <version>1.6.23-SNAPSHOT</version>
</parent> </parent>
<artifactId>sticky-roles-impl</artifactId> <artifactId>sticky-roles-impl</artifactId>

View File

@@ -4,7 +4,7 @@
<parent> <parent>
<groupId>dev.sheldan.abstracto.modules</groupId> <groupId>dev.sheldan.abstracto.modules</groupId>
<artifactId>sticky-roles</artifactId> <artifactId>sticky-roles</artifactId>
<version>1.6.21-SNAPSHOT</version> <version>1.6.23-SNAPSHOT</version>
</parent> </parent>
<artifactId>sticky-roles-int</artifactId> <artifactId>sticky-roles-int</artifactId>

View File

@@ -3,7 +3,7 @@
<parent> <parent>
<artifactId>abstracto-modules</artifactId> <artifactId>abstracto-modules</artifactId>
<groupId>dev.sheldan.abstracto.modules</groupId> <groupId>dev.sheldan.abstracto.modules</groupId>
<version>1.6.21-SNAPSHOT</version> <version>1.6.23-SNAPSHOT</version>
</parent> </parent>
<modelVersion>4.0.0</modelVersion> <modelVersion>4.0.0</modelVersion>

View File

@@ -3,7 +3,7 @@
<parent> <parent>
<artifactId>suggestion</artifactId> <artifactId>suggestion</artifactId>
<groupId>dev.sheldan.abstracto.modules</groupId> <groupId>dev.sheldan.abstracto.modules</groupId>
<version>1.6.21-SNAPSHOT</version> <version>1.6.23-SNAPSHOT</version>
</parent> </parent>
<modelVersion>4.0.0</modelVersion> <modelVersion>4.0.0</modelVersion>

View File

@@ -3,7 +3,7 @@
<parent> <parent>
<artifactId>suggestion</artifactId> <artifactId>suggestion</artifactId>
<groupId>dev.sheldan.abstracto.modules</groupId> <groupId>dev.sheldan.abstracto.modules</groupId>
<version>1.6.21-SNAPSHOT</version> <version>1.6.23-SNAPSHOT</version>
</parent> </parent>
<modelVersion>4.0.0</modelVersion> <modelVersion>4.0.0</modelVersion>

View File

@@ -3,7 +3,7 @@
<parent> <parent>
<artifactId>abstracto-modules</artifactId> <artifactId>abstracto-modules</artifactId>
<groupId>dev.sheldan.abstracto.modules</groupId> <groupId>dev.sheldan.abstracto.modules</groupId>
<version>1.6.21-SNAPSHOT</version> <version>1.6.23-SNAPSHOT</version>
</parent> </parent>
<modelVersion>4.0.0</modelVersion> <modelVersion>4.0.0</modelVersion>

View File

@@ -3,7 +3,7 @@
<parent> <parent>
<artifactId>twitch</artifactId> <artifactId>twitch</artifactId>
<groupId>dev.sheldan.abstracto.modules</groupId> <groupId>dev.sheldan.abstracto.modules</groupId>
<version>1.6.21-SNAPSHOT</version> <version>1.6.23-SNAPSHOT</version>
</parent> </parent>
<modelVersion>4.0.0</modelVersion> <modelVersion>4.0.0</modelVersion>

View File

@@ -3,7 +3,7 @@
<parent> <parent>
<groupId>dev.sheldan.abstracto.modules</groupId> <groupId>dev.sheldan.abstracto.modules</groupId>
<artifactId>twitch</artifactId> <artifactId>twitch</artifactId>
<version>1.6.21-SNAPSHOT</version> <version>1.6.23-SNAPSHOT</version>
</parent> </parent>
<modelVersion>4.0.0</modelVersion> <modelVersion>4.0.0</modelVersion>

View File

@@ -3,7 +3,7 @@
<parent> <parent>
<groupId>dev.sheldan.abstracto.modules</groupId> <groupId>dev.sheldan.abstracto.modules</groupId>
<artifactId>abstracto-modules</artifactId> <artifactId>abstracto-modules</artifactId>
<version>1.6.21-SNAPSHOT</version> <version>1.6.23-SNAPSHOT</version>
</parent> </parent>
<modelVersion>4.0.0</modelVersion> <modelVersion>4.0.0</modelVersion>

View File

@@ -3,7 +3,7 @@
<parent> <parent>
<groupId>dev.sheldan.abstracto.modules</groupId> <groupId>dev.sheldan.abstracto.modules</groupId>
<artifactId>utility</artifactId> <artifactId>utility</artifactId>
<version>1.6.21-SNAPSHOT</version> <version>1.6.23-SNAPSHOT</version>
</parent> </parent>
<modelVersion>4.0.0</modelVersion> <modelVersion>4.0.0</modelVersion>

View File

@@ -3,7 +3,7 @@
<parent> <parent>
<groupId>dev.sheldan.abstracto.modules</groupId> <groupId>dev.sheldan.abstracto.modules</groupId>
<artifactId>utility</artifactId> <artifactId>utility</artifactId>
<version>1.6.21-SNAPSHOT</version> <version>1.6.23-SNAPSHOT</version>
</parent> </parent>
<modelVersion>4.0.0</modelVersion> <modelVersion>4.0.0</modelVersion>

View File

@@ -3,7 +3,7 @@
<parent> <parent>
<artifactId>abstracto-modules</artifactId> <artifactId>abstracto-modules</artifactId>
<groupId>dev.sheldan.abstracto.modules</groupId> <groupId>dev.sheldan.abstracto.modules</groupId>
<version>1.6.21-SNAPSHOT</version> <version>1.6.23-SNAPSHOT</version>
</parent> </parent>
<modelVersion>4.0.0</modelVersion> <modelVersion>4.0.0</modelVersion>

View File

@@ -3,7 +3,7 @@
<parent> <parent>
<groupId>dev.sheldan.abstracto.modules</groupId> <groupId>dev.sheldan.abstracto.modules</groupId>
<artifactId>voice-channel-context</artifactId> <artifactId>voice-channel-context</artifactId>
<version>1.6.21-SNAPSHOT</version> <version>1.6.23-SNAPSHOT</version>
</parent> </parent>
<modelVersion>4.0.0</modelVersion> <modelVersion>4.0.0</modelVersion>

View File

@@ -3,7 +3,7 @@
<parent> <parent>
<groupId>dev.sheldan.abstracto.modules</groupId> <groupId>dev.sheldan.abstracto.modules</groupId>
<artifactId>voice-channel-context</artifactId> <artifactId>voice-channel-context</artifactId>
<version>1.6.21-SNAPSHOT</version> <version>1.6.23-SNAPSHOT</version>
</parent> </parent>
<modelVersion>4.0.0</modelVersion> <modelVersion>4.0.0</modelVersion>

View File

@@ -3,7 +3,7 @@
<parent> <parent>
<groupId>dev.sheldan.abstracto.modules</groupId> <groupId>dev.sheldan.abstracto.modules</groupId>
<artifactId>abstracto-modules</artifactId> <artifactId>abstracto-modules</artifactId>
<version>1.6.21-SNAPSHOT</version> <version>1.6.23-SNAPSHOT</version>
</parent> </parent>
<modelVersion>4.0.0</modelVersion> <modelVersion>4.0.0</modelVersion>

View File

@@ -3,7 +3,7 @@
<parent> <parent>
<groupId>dev.sheldan.abstracto.modules</groupId> <groupId>dev.sheldan.abstracto.modules</groupId>
<artifactId>webservices</artifactId> <artifactId>webservices</artifactId>
<version>1.6.21-SNAPSHOT</version> <version>1.6.23-SNAPSHOT</version>
</parent> </parent>
<modelVersion>4.0.0</modelVersion> <modelVersion>4.0.0</modelVersion>

Some files were not shown because too many files have changed in this diff Show More