mirror of
https://github.com/Sheldan/abstracto.git
synced 2026-05-04 01:01:46 +00:00
Compare commits
13 Commits
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
0cec5284b4 | ||
|
|
51e0da06ae | ||
|
|
f4b048d18b | ||
|
|
6addd5939b | ||
|
|
dafde2d8f6 | ||
|
|
96cbe2db87 | ||
|
|
2ae2542c71 | ||
|
|
a69d4c25ff | ||
|
|
fba5adf573 | ||
|
|
dd21390a60 | ||
|
|
790cca7278 | ||
|
|
52f6fd148e | ||
|
|
708703fc1f |
2
.env
2
.env
@@ -1,2 +1,2 @@
|
|||||||
REGISTRY_PREFIX=harbor.sheldan.dev/abstracto/
|
REGISTRY_PREFIX=harbor.sheldan.dev/abstracto/
|
||||||
VERSION=1.6.22
|
VERSION=1.6.25
|
||||||
@@ -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.23</version>
|
<version>1.6.26-SNAPSHOT</version>
|
||||||
</parent>
|
</parent>
|
||||||
<modelVersion>4.0.0</modelVersion>
|
<modelVersion>4.0.0</modelVersion>
|
||||||
|
|
||||||
|
|||||||
@@ -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.23</version>
|
<version>1.6.26-SNAPSHOT</version>
|
||||||
</parent>
|
</parent>
|
||||||
<modelVersion>4.0.0</modelVersion>
|
<modelVersion>4.0.0</modelVersion>
|
||||||
|
|
||||||
|
|||||||
@@ -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.23</version>
|
<version>1.6.26-SNAPSHOT</version>
|
||||||
</parent>
|
</parent>
|
||||||
<modelVersion>4.0.0</modelVersion>
|
<modelVersion>4.0.0</modelVersion>
|
||||||
|
|
||||||
|
|||||||
@@ -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.23</version>
|
<version>1.6.26-SNAPSHOT</version>
|
||||||
</parent>
|
</parent>
|
||||||
<modelVersion>4.0.0</modelVersion>
|
<modelVersion>4.0.0</modelVersion>
|
||||||
|
|
||||||
|
|||||||
@@ -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.23</version>
|
<version>1.6.26-SNAPSHOT</version>
|
||||||
</parent>
|
</parent>
|
||||||
<modelVersion>4.0.0</modelVersion>
|
<modelVersion>4.0.0</modelVersion>
|
||||||
<artifactId>assignable-roles-int</artifactId>
|
<artifactId>assignable-roles-int</artifactId>
|
||||||
|
|||||||
@@ -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.23</version>
|
<version>1.6.26-SNAPSHOT</version>
|
||||||
</parent>
|
</parent>
|
||||||
<modelVersion>4.0.0</modelVersion>
|
<modelVersion>4.0.0</modelVersion>
|
||||||
|
|
||||||
|
|||||||
@@ -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.23</version>
|
<version>1.6.26-SNAPSHOT</version>
|
||||||
</parent>
|
</parent>
|
||||||
<modelVersion>4.0.0</modelVersion>
|
<modelVersion>4.0.0</modelVersion>
|
||||||
|
|
||||||
|
|||||||
@@ -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.23</version>
|
<version>1.6.26-SNAPSHOT</version>
|
||||||
</parent>
|
</parent>
|
||||||
<modelVersion>4.0.0</modelVersion>
|
<modelVersion>4.0.0</modelVersion>
|
||||||
|
|
||||||
|
|||||||
@@ -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.23</version>
|
<version>1.6.26-SNAPSHOT</version>
|
||||||
</parent>
|
</parent>
|
||||||
<modelVersion>4.0.0</modelVersion>
|
<modelVersion>4.0.0</modelVersion>
|
||||||
|
|
||||||
|
|||||||
@@ -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.23</version>
|
<version>1.6.26-SNAPSHOT</version>
|
||||||
</parent>
|
</parent>
|
||||||
<modelVersion>4.0.0</modelVersion>
|
<modelVersion>4.0.0</modelVersion>
|
||||||
|
|
||||||
|
|||||||
@@ -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.23</version>
|
<version>1.6.26-SNAPSHOT</version>
|
||||||
</parent>
|
</parent>
|
||||||
<modelVersion>4.0.0</modelVersion>
|
<modelVersion>4.0.0</modelVersion>
|
||||||
|
|
||||||
|
|||||||
@@ -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.23</version>
|
<version>1.6.26-SNAPSHOT</version>
|
||||||
</parent>
|
</parent>
|
||||||
<modelVersion>4.0.0</modelVersion>
|
<modelVersion>4.0.0</modelVersion>
|
||||||
|
|
||||||
|
|||||||
@@ -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.23</version>
|
<version>1.6.26-SNAPSHOT</version>
|
||||||
</parent>
|
</parent>
|
||||||
<modelVersion>4.0.0</modelVersion>
|
<modelVersion>4.0.0</modelVersion>
|
||||||
|
|
||||||
|
|||||||
@@ -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.23</version>
|
<version>1.6.26-SNAPSHOT</version>
|
||||||
</parent>
|
</parent>
|
||||||
<modelVersion>4.0.0</modelVersion>
|
<modelVersion>4.0.0</modelVersion>
|
||||||
|
|
||||||
|
|||||||
@@ -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.23</version>
|
<version>1.6.26-SNAPSHOT</version>
|
||||||
</parent>
|
</parent>
|
||||||
<modelVersion>4.0.0</modelVersion>
|
<modelVersion>4.0.0</modelVersion>
|
||||||
|
|
||||||
|
|||||||
@@ -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.23</version>
|
<version>1.6.26-SNAPSHOT</version>
|
||||||
</parent>
|
</parent>
|
||||||
<modelVersion>4.0.0</modelVersion>
|
<modelVersion>4.0.0</modelVersion>
|
||||||
|
|
||||||
|
|||||||
@@ -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.23</version>
|
<version>1.6.26-SNAPSHOT</version>
|
||||||
</parent>
|
</parent>
|
||||||
<modelVersion>4.0.0</modelVersion>
|
<modelVersion>4.0.0</modelVersion>
|
||||||
|
|
||||||
|
|||||||
@@ -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.23</version>
|
<version>1.6.26-SNAPSHOT</version>
|
||||||
</parent>
|
</parent>
|
||||||
<modelVersion>4.0.0</modelVersion>
|
<modelVersion>4.0.0</modelVersion>
|
||||||
|
|
||||||
|
|||||||
@@ -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.23</version>
|
<version>1.6.26-SNAPSHOT</version>
|
||||||
</parent>
|
</parent>
|
||||||
|
|
||||||
<artifactId>giveaway-impl</artifactId>
|
<artifactId>giveaway-impl</artifactId>
|
||||||
|
|||||||
@@ -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.23</version>
|
<version>1.6.26-SNAPSHOT</version>
|
||||||
</parent>
|
</parent>
|
||||||
|
|
||||||
<artifactId>giveaway-int</artifactId>
|
<artifactId>giveaway-int</artifactId>
|
||||||
|
|||||||
@@ -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.23</version>
|
<version>1.6.26-SNAPSHOT</version>
|
||||||
</parent>
|
</parent>
|
||||||
|
|
||||||
<artifactId>giveaway</artifactId>
|
<artifactId>giveaway</artifactId>
|
||||||
|
|||||||
@@ -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.23</version>
|
<version>1.6.26-SNAPSHOT</version>
|
||||||
</parent>
|
</parent>
|
||||||
|
|
||||||
<artifactId>image-generation-impl</artifactId>
|
<artifactId>image-generation-impl</artifactId>
|
||||||
|
|||||||
@@ -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.23</version>
|
<version>1.6.26-SNAPSHOT</version>
|
||||||
</parent>
|
</parent>
|
||||||
|
|
||||||
<artifactId>image-generation-int</artifactId>
|
<artifactId>image-generation-int</artifactId>
|
||||||
|
|||||||
@@ -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.23</version>
|
<version>1.6.26-SNAPSHOT</version>
|
||||||
</parent>
|
</parent>
|
||||||
|
|
||||||
<artifactId>image-generation</artifactId>
|
<artifactId>image-generation</artifactId>
|
||||||
|
|||||||
@@ -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.23</version>
|
<version>1.6.26-SNAPSHOT</version>
|
||||||
</parent>
|
</parent>
|
||||||
<modelVersion>4.0.0</modelVersion>
|
<modelVersion>4.0.0</modelVersion>
|
||||||
|
|
||||||
|
|||||||
@@ -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.23</version>
|
<version>1.6.26-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.23</version>
|
<version>1.6.26-SNAPSHOT</version>
|
||||||
<scope>compile</scope>
|
<scope>compile</scope>
|
||||||
</dependency>
|
</dependency>
|
||||||
</dependencies>
|
</dependencies>
|
||||||
|
|||||||
@@ -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.23</version>
|
<version>1.6.26-SNAPSHOT</version>
|
||||||
</parent>
|
</parent>
|
||||||
<modelVersion>4.0.0</modelVersion>
|
<modelVersion>4.0.0</modelVersion>
|
||||||
|
|
||||||
|
|||||||
@@ -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.23</version>
|
<version>1.6.26-SNAPSHOT</version>
|
||||||
</parent>
|
</parent>
|
||||||
<modelVersion>4.0.0</modelVersion>
|
<modelVersion>4.0.0</modelVersion>
|
||||||
|
|
||||||
|
|||||||
@@ -26,9 +26,11 @@ import dev.sheldan.abstracto.linkembed.service.management.MessageEmbedPostManage
|
|||||||
import lombok.extern.slf4j.Slf4j;
|
import lombok.extern.slf4j.Slf4j;
|
||||||
import net.dv8tion.jda.api.entities.Message;
|
import net.dv8tion.jda.api.entities.Message;
|
||||||
import net.dv8tion.jda.api.entities.User;
|
import net.dv8tion.jda.api.entities.User;
|
||||||
|
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.GuildMessageChannel;
|
||||||
import net.dv8tion.jda.api.interactions.commands.CommandInteraction;
|
import net.dv8tion.jda.api.interactions.commands.CommandInteraction;
|
||||||
import org.apache.commons.lang3.tuple.Pair;
|
import org.apache.commons.lang3.tuple.Pair;
|
||||||
|
import org.checkerframework.checker.units.qual.A;
|
||||||
import org.springframework.beans.factory.annotation.Autowired;
|
import org.springframework.beans.factory.annotation.Autowired;
|
||||||
import org.springframework.beans.factory.annotation.Value;
|
import org.springframework.beans.factory.annotation.Value;
|
||||||
import org.springframework.stereotype.Component;
|
import org.springframework.stereotype.Component;
|
||||||
@@ -191,11 +193,20 @@ public class MessageEmbedServiceBean implements MessageEmbedService {
|
|||||||
.builder()
|
.builder()
|
||||||
.message(embeddedMessage)
|
.message(embeddedMessage)
|
||||||
.build();
|
.build();
|
||||||
|
Optional<GuildChannel> existingChannel =
|
||||||
|
channelService.getGuildChannelFromServerOptional(embeddingMessage.getServerId(), embeddingMessage.getChannelId());
|
||||||
|
// if the channel doesnt exist, we dont need to cleanup
|
||||||
|
if(existingChannel.isPresent()) {
|
||||||
MessageToSend messageToSend =
|
MessageToSend messageToSend =
|
||||||
templateService.renderEmbedTemplate(MESSAGE_EMBED_CLEANUP_REPLACEMENT_TEMPLATE, model, embeddingMessage.getServerId());
|
templateService.renderEmbedTemplate(MESSAGE_EMBED_CLEANUP_REPLACEMENT_TEMPLATE, model, embeddingMessage.getServerId());
|
||||||
return channelService.editMessageInAChannelFuture(messageToSend, embeddingMessage.getServerId(), embeddingMessage.getChannelId(),
|
return channelService.editMessageInAChannelFuture(messageToSend, embeddingMessage.getServerId(), embeddingMessage.getChannelId(),
|
||||||
embeddingMessage.getMessageId());
|
embeddingMessage.getMessageId());
|
||||||
}).toList();
|
} else {
|
||||||
|
return null;
|
||||||
|
}
|
||||||
|
})
|
||||||
|
.filter(Objects::nonNull)
|
||||||
|
.toList();
|
||||||
return FutureUtils.toSingleFutureGeneric(editList).whenComplete((unused, throwable) -> {
|
return FutureUtils.toSingleFutureGeneric(editList).whenComplete((unused, throwable) -> {
|
||||||
if(throwable != null) {
|
if(throwable != null) {
|
||||||
log.warn("Failed to cleanup embedded messages..", throwable);
|
log.warn("Failed to cleanup embedded messages..", throwable);
|
||||||
|
|||||||
@@ -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.23</version>
|
<version>1.6.26-SNAPSHOT</version>
|
||||||
</parent>
|
</parent>
|
||||||
<modelVersion>4.0.0</modelVersion>
|
<modelVersion>4.0.0</modelVersion>
|
||||||
|
|
||||||
|
|||||||
@@ -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.23</version>
|
<version>1.6.26-SNAPSHOT</version>
|
||||||
</parent>
|
</parent>
|
||||||
<modelVersion>4.0.0</modelVersion>
|
<modelVersion>4.0.0</modelVersion>
|
||||||
|
|
||||||
|
|||||||
@@ -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.23</version>
|
<version>1.6.26-SNAPSHOT</version>
|
||||||
</parent>
|
</parent>
|
||||||
<modelVersion>4.0.0</modelVersion>
|
<modelVersion>4.0.0</modelVersion>
|
||||||
|
|
||||||
|
|||||||
@@ -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.23</version>
|
<version>1.6.26-SNAPSHOT</version>
|
||||||
</parent>
|
</parent>
|
||||||
<modelVersion>4.0.0</modelVersion>
|
<modelVersion>4.0.0</modelVersion>
|
||||||
|
|
||||||
|
|||||||
@@ -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.23</version>
|
<version>1.6.26-SNAPSHOT</version>
|
||||||
</parent>
|
</parent>
|
||||||
<modelVersion>4.0.0</modelVersion>
|
<modelVersion>4.0.0</modelVersion>
|
||||||
|
|
||||||
|
|||||||
@@ -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.23</version>
|
<version>1.6.26-SNAPSHOT</version>
|
||||||
</parent>
|
</parent>
|
||||||
<modelVersion>4.0.0</modelVersion>
|
<modelVersion>4.0.0</modelVersion>
|
||||||
|
|
||||||
|
|||||||
@@ -18,7 +18,7 @@ import dev.sheldan.abstracto.moderation.config.ModerationModuleDefinition;
|
|||||||
import dev.sheldan.abstracto.moderation.config.ModerationSlashCommandNames;
|
import dev.sheldan.abstracto.moderation.config.ModerationSlashCommandNames;
|
||||||
import dev.sheldan.abstracto.moderation.config.feature.HoneyPotFeatureConfig;
|
import dev.sheldan.abstracto.moderation.config.feature.HoneyPotFeatureConfig;
|
||||||
import dev.sheldan.abstracto.moderation.config.feature.ModerationFeatureDefinition;
|
import dev.sheldan.abstracto.moderation.config.feature.ModerationFeatureDefinition;
|
||||||
import dev.sheldan.abstracto.moderation.listener.HoneyPotServiceBean;
|
import dev.sheldan.abstracto.moderation.service.HoneyPotServiceBean;
|
||||||
import dev.sheldan.abstracto.moderation.model.template.command.HoneyPotBanResponseModel;
|
import dev.sheldan.abstracto.moderation.model.template.command.HoneyPotBanResponseModel;
|
||||||
import java.time.Duration;
|
import java.time.Duration;
|
||||||
import java.time.Instant;
|
import java.time.Instant;
|
||||||
@@ -98,7 +98,7 @@ public class HoneyPotBan extends AbstractConditionableCommand {
|
|||||||
.toList();
|
.toList();
|
||||||
Role honeyPotRole = guild.getRoleById(honeyPotServiceBean.getHoneyPotRoleId(guild.getIdLong()));
|
Role honeyPotRole = guild.getRoleById(honeyPotServiceBean.getHoneyPotRoleId(guild.getIdLong()));
|
||||||
List<CompletableFuture<Void>> futures = currentMembersWithHoneypotRole.stream().map(member ->
|
List<CompletableFuture<Void>> futures = currentMembersWithHoneypotRole.stream().map(member ->
|
||||||
honeyPotServiceBean.banForHoneyPot(member, honeyPotRole)
|
honeyPotServiceBean.banForHoneyPotRole(member, honeyPotRole)
|
||||||
).toList();
|
).toList();
|
||||||
Integer memberCount = currentMembersWithHoneypotRole.size();
|
Integer memberCount = currentMembersWithHoneypotRole.size();
|
||||||
CompletableFutureList<Void> futureList = new CompletableFutureList<>(futures);
|
CompletableFutureList<Void> futureList = new CompletableFutureList<>(futures);
|
||||||
|
|||||||
@@ -0,0 +1,61 @@
|
|||||||
|
package dev.sheldan.abstracto.moderation.listener;
|
||||||
|
|
||||||
|
import dev.sheldan.abstracto.core.config.FeatureDefinition;
|
||||||
|
import dev.sheldan.abstracto.core.config.FeatureMode;
|
||||||
|
import dev.sheldan.abstracto.core.listener.DefaultListenerResult;
|
||||||
|
import dev.sheldan.abstracto.core.listener.async.jda.AsyncMessageReceivedListener;
|
||||||
|
import dev.sheldan.abstracto.core.models.listener.MessageReceivedModel;
|
||||||
|
import dev.sheldan.abstracto.core.service.ConfigService;
|
||||||
|
import dev.sheldan.abstracto.core.service.MessageService;
|
||||||
|
import dev.sheldan.abstracto.moderation.config.feature.HoneyPotFeatureConfig;
|
||||||
|
import dev.sheldan.abstracto.moderation.config.feature.ModerationFeatureDefinition;
|
||||||
|
import dev.sheldan.abstracto.moderation.config.feature.mode.HoneypotMode;
|
||||||
|
import dev.sheldan.abstracto.moderation.service.HoneyPotServiceBean;
|
||||||
|
import java.util.List;
|
||||||
|
import lombok.extern.slf4j.Slf4j;
|
||||||
|
import org.springframework.beans.factory.annotation.Autowired;
|
||||||
|
import org.springframework.stereotype.Component;
|
||||||
|
|
||||||
|
@Component
|
||||||
|
@Slf4j
|
||||||
|
public class HoneyPotMessageListener implements AsyncMessageReceivedListener {
|
||||||
|
|
||||||
|
@Autowired
|
||||||
|
private ConfigService configService;
|
||||||
|
|
||||||
|
@Autowired
|
||||||
|
private HoneyPotServiceBean honeyPotServiceBean;
|
||||||
|
|
||||||
|
@Autowired
|
||||||
|
private MessageService messageService;
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public DefaultListenerResult execute(MessageReceivedModel model) {
|
||||||
|
Long honeyPotChannel = configService.getLongValueOrConfigDefault(HoneyPotFeatureConfig.HONEYPOT_CHANNEL, model.getServerId());
|
||||||
|
if(honeyPotChannel == 0) {
|
||||||
|
return DefaultListenerResult.IGNORED;
|
||||||
|
}
|
||||||
|
if(model.getMessage().getChannelId().equals(honeyPotChannel.toString())) {
|
||||||
|
boolean honeyPotActivated = honeyPotServiceBean.fellIntoHoneyPotIgnoringJoinDate(model.getServerId(), model.getMessage().getMember());
|
||||||
|
if(honeyPotActivated) {
|
||||||
|
log.info("Banning user {} in guild {} due to a message in channel {}.", model.getMessage().getAuthor().getIdLong(), model.getServerId(), honeyPotChannel);
|
||||||
|
honeyPotServiceBean.banForHoneyPotMessage(model.getMessage().getMember(), honeyPotChannel);
|
||||||
|
} else {
|
||||||
|
log.info("NOT banning user {} in guild {} due to a message in honeypot channel {}.", model.getMessage().getAuthor().getIdLong(), model.getServerId(), honeyPotChannel);
|
||||||
|
messageService.deleteMessage(model.getMessage());
|
||||||
|
}
|
||||||
|
return DefaultListenerResult.PROCESSED;
|
||||||
|
}
|
||||||
|
return DefaultListenerResult.IGNORED;
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public FeatureDefinition getFeature() {
|
||||||
|
return ModerationFeatureDefinition.HONEYPOT;
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public List<FeatureMode> getFeatureModeLimitations() {
|
||||||
|
return List.of(HoneypotMode.MESSAGE);
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -1,12 +1,15 @@
|
|||||||
package dev.sheldan.abstracto.moderation.listener;
|
package dev.sheldan.abstracto.moderation.listener;
|
||||||
|
|
||||||
import dev.sheldan.abstracto.core.config.FeatureDefinition;
|
import dev.sheldan.abstracto.core.config.FeatureDefinition;
|
||||||
|
import dev.sheldan.abstracto.core.config.FeatureMode;
|
||||||
import dev.sheldan.abstracto.core.config.ListenerPriority;
|
import dev.sheldan.abstracto.core.config.ListenerPriority;
|
||||||
import dev.sheldan.abstracto.core.listener.DefaultListenerResult;
|
import dev.sheldan.abstracto.core.listener.DefaultListenerResult;
|
||||||
import dev.sheldan.abstracto.core.listener.sync.jda.RoleAddedListener;
|
import dev.sheldan.abstracto.core.listener.sync.jda.RoleAddedListener;
|
||||||
import dev.sheldan.abstracto.core.models.listener.RoleAddedModel;
|
import dev.sheldan.abstracto.core.models.listener.RoleAddedModel;
|
||||||
import dev.sheldan.abstracto.core.service.RoleService;
|
import dev.sheldan.abstracto.core.service.RoleService;
|
||||||
import dev.sheldan.abstracto.moderation.config.feature.ModerationFeatureDefinition;
|
import dev.sheldan.abstracto.moderation.config.feature.ModerationFeatureDefinition;
|
||||||
|
import dev.sheldan.abstracto.moderation.config.feature.mode.HoneypotMode;
|
||||||
|
import dev.sheldan.abstracto.moderation.service.HoneyPotServiceBean;
|
||||||
import java.util.ArrayList;
|
import java.util.ArrayList;
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
import java.util.stream.Collectors;
|
import java.util.stream.Collectors;
|
||||||
@@ -37,7 +40,7 @@ public class HoneyPotRoleAddedListener implements RoleAddedListener {
|
|||||||
boolean fellIntoHoneyPot = honeyPotServiceBean.fellIntoHoneyPot(model.getServerId(), model.getTargetMember());
|
boolean fellIntoHoneyPot = honeyPotServiceBean.fellIntoHoneyPot(model.getServerId(), model.getTargetMember());
|
||||||
if (fellIntoHoneyPot) {
|
if (fellIntoHoneyPot) {
|
||||||
log.info("Banning user {} in guild {} due to role {}.", model.getTargetUser().getUserId(), model.getTargetUser().getServerId(), model.getRoleId());
|
log.info("Banning user {} in guild {} due to role {}.", model.getTargetUser().getUserId(), model.getTargetUser().getServerId(), model.getRoleId());
|
||||||
honeyPotServiceBean.banForHoneyPot(model.getTargetMember(), model.getRole());
|
honeyPotServiceBean.banForHoneyPotRole(model.getTargetMember(), model.getRole());
|
||||||
} else {
|
} else {
|
||||||
log.info("User {} in server {} will not get banned by honeypot. All existing roles besides {} will be removed.",
|
log.info("User {} in server {} will not get banned by honeypot. All existing roles besides {} will be removed.",
|
||||||
model.getTargetUser().getUserId(), model.getTargetUser().getServerId(), honeyPotRoleId);
|
model.getTargetUser().getUserId(), model.getTargetUser().getServerId(), honeyPotRoleId);
|
||||||
@@ -83,4 +86,8 @@ public class HoneyPotRoleAddedListener implements RoleAddedListener {
|
|||||||
return ListenerPriority.MEDIUM;
|
return ListenerPriority.MEDIUM;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public List<FeatureMode> getFeatureModeLimitations() {
|
||||||
|
return List.of(HoneypotMode.ROLE);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -1,4 +1,4 @@
|
|||||||
package dev.sheldan.abstracto.moderation.listener;
|
package dev.sheldan.abstracto.moderation.service;
|
||||||
|
|
||||||
import dev.sheldan.abstracto.core.models.ConditionContextInstance;
|
import dev.sheldan.abstracto.core.models.ConditionContextInstance;
|
||||||
import dev.sheldan.abstracto.core.models.ServerUser;
|
import dev.sheldan.abstracto.core.models.ServerUser;
|
||||||
@@ -13,7 +13,6 @@ import dev.sheldan.abstracto.core.service.management.UserInServerManagementServi
|
|||||||
import dev.sheldan.abstracto.core.templating.service.TemplateService;
|
import dev.sheldan.abstracto.core.templating.service.TemplateService;
|
||||||
import dev.sheldan.abstracto.moderation.config.feature.HoneyPotFeatureConfig;
|
import dev.sheldan.abstracto.moderation.config.feature.HoneyPotFeatureConfig;
|
||||||
import dev.sheldan.abstracto.moderation.model.listener.HoneyPotReasonModel;
|
import dev.sheldan.abstracto.moderation.model.listener.HoneyPotReasonModel;
|
||||||
import dev.sheldan.abstracto.moderation.service.BanService;
|
|
||||||
import java.time.Duration;
|
import java.time.Duration;
|
||||||
import java.time.Instant;
|
import java.time.Instant;
|
||||||
import java.time.temporal.ChronoUnit;
|
import java.time.temporal.ChronoUnit;
|
||||||
@@ -68,11 +67,33 @@ public class HoneyPotServiceBean {
|
|||||||
return !allowed;
|
return !allowed;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public boolean fellIntoHoneyPotIgnoringJoinDate(Long serverId, Member member) {
|
||||||
|
Integer levelToSkipBan = configService.getLongValueOrConfigDefault(HoneyPotFeatureConfig.HONEYPOT_IGNORED_LEVEL, serverId).intValue();
|
||||||
|
boolean allowed = userHasLevel(member, levelToSkipBan);
|
||||||
|
return !allowed;
|
||||||
|
}
|
||||||
|
|
||||||
public List<Member> getCurrentMembersWithHoneypotRole(Guild guild) {
|
public List<Member> getCurrentMembersWithHoneypotRole(Guild guild) {
|
||||||
return memberService.getMembersWithRole(guild.getIdLong(), getHoneyPotRoleId(guild.getIdLong()));
|
return memberService.getMembersWithRole(guild.getIdLong(), getHoneyPotRoleId(guild.getIdLong()));
|
||||||
}
|
}
|
||||||
|
|
||||||
public CompletableFuture<Void> banForHoneyPot(Member targetMember, Role role) {
|
public CompletableFuture<Void> banForHoneyPotMessage(Member targetMember, Long channelId) {
|
||||||
|
HoneyPotReasonModel reasonModel = HoneyPotReasonModel
|
||||||
|
.builder()
|
||||||
|
.memberDisplay(MemberDisplay.fromMember(targetMember))
|
||||||
|
.build();
|
||||||
|
ServerUser bannedUser = ServerUser.fromMember(targetMember);
|
||||||
|
String banReason = templateService.renderTemplate(HONEYPOT_BAN_REASON_TEMPLATE, reasonModel, bannedUser.getServerId());
|
||||||
|
return banService.banUserWithNotification(bannedUser, banReason, ServerUser.fromMember(targetMember.getGuild().getSelfMember()),
|
||||||
|
targetMember.getGuild(), Duration.ofDays(7)).thenAccept(banResult -> {
|
||||||
|
log.info("Banned user {} in guild {} due to a message in channel {}.", bannedUser.getUserId(), bannedUser.getServerId(), channelId);
|
||||||
|
}).exceptionally(throwable -> {
|
||||||
|
log.error("Failed to ban user {} in guild {} due to a message in channel {}.", bannedUser.getUserId(), bannedUser.getServerId(), channelId, throwable);
|
||||||
|
return null;
|
||||||
|
});
|
||||||
|
}
|
||||||
|
|
||||||
|
public CompletableFuture<Void> banForHoneyPotRole(Member targetMember, Role role) {
|
||||||
HoneyPotReasonModel reasonModel = HoneyPotReasonModel
|
HoneyPotReasonModel reasonModel = HoneyPotReasonModel
|
||||||
.builder()
|
.builder()
|
||||||
.memberDisplay(MemberDisplay.fromMember(targetMember))
|
.memberDisplay(MemberDisplay.fromMember(targetMember))
|
||||||
@@ -91,7 +112,7 @@ public class HoneyPotServiceBean {
|
|||||||
}
|
}
|
||||||
|
|
||||||
private boolean userHasLevel(Member member, Integer level) {
|
private boolean userHasLevel(Member member, Integer level) {
|
||||||
log.info("Checking if member {} is ignored to click on the honeypot in server {}.", member.getIdLong(),member.getGuild().getIdLong());
|
log.info("Checking if member {} is ignored by the honeypot in server {}.", member.getIdLong(),member.getGuild().getIdLong());
|
||||||
Map<String, Object> parameters = new HashMap<>();
|
Map<String, Object> parameters = new HashMap<>();
|
||||||
AUserInAServer userInAServer = userInServerManagementService.loadOrCreateUser(member);
|
AUserInAServer userInAServer = userInServerManagementService.loadOrCreateUser(member);
|
||||||
parameters.put(LEVEL_CONDITION_USER_ID_PARAMETER, userInAServer.getUserInServerId());
|
parameters.put(LEVEL_CONDITION_USER_ID_PARAMETER, userInAServer.getUserInServerId());
|
||||||
@@ -99,3 +99,14 @@ abstracto.systemConfigs.honeypotIgnoredJoinDurationSeconds.longValue=86400
|
|||||||
|
|
||||||
abstracto.featureFlags.honeypot.featureName=honeypot
|
abstracto.featureFlags.honeypot.featureName=honeypot
|
||||||
abstracto.featureFlags.honeypot.enabled=false
|
abstracto.featureFlags.honeypot.enabled=false
|
||||||
|
|
||||||
|
abstracto.featureModes.honeypotRole.featureName=honeypot
|
||||||
|
abstracto.featureModes.honeypotRole.mode=honeypotRole
|
||||||
|
abstracto.featureModes.honeypotRole.enabled=false
|
||||||
|
|
||||||
|
abstracto.featureModes.honeypotMessage.featureName=honeypot
|
||||||
|
abstracto.featureModes.honeypotMessage.mode=honeypotMessage
|
||||||
|
abstracto.featureModes.honeypotMessage.enabled=false
|
||||||
|
|
||||||
|
abstracto.systemConfigs.honeypotChannel.name=honeypotChannel
|
||||||
|
abstracto.systemConfigs.honeypotChannel.longValue=0
|
||||||
@@ -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.23</version>
|
<version>1.6.26-SNAPSHOT</version>
|
||||||
</parent>
|
</parent>
|
||||||
<modelVersion>4.0.0</modelVersion>
|
<modelVersion>4.0.0</modelVersion>
|
||||||
|
|
||||||
|
|||||||
@@ -2,6 +2,8 @@ package dev.sheldan.abstracto.moderation.config.feature;
|
|||||||
|
|
||||||
import dev.sheldan.abstracto.core.config.FeatureConfig;
|
import dev.sheldan.abstracto.core.config.FeatureConfig;
|
||||||
import dev.sheldan.abstracto.core.config.FeatureDefinition;
|
import dev.sheldan.abstracto.core.config.FeatureDefinition;
|
||||||
|
import dev.sheldan.abstracto.core.config.FeatureMode;
|
||||||
|
import dev.sheldan.abstracto.moderation.config.feature.mode.HoneypotMode;
|
||||||
import org.springframework.stereotype.Component;
|
import org.springframework.stereotype.Component;
|
||||||
|
|
||||||
import java.util.Arrays;
|
import java.util.Arrays;
|
||||||
@@ -12,6 +14,7 @@ public class HoneyPotFeatureConfig implements FeatureConfig {
|
|||||||
|
|
||||||
public static final String HONEYPOT_ROLE_ID = "honeypotRoleId";
|
public static final String HONEYPOT_ROLE_ID = "honeypotRoleId";
|
||||||
public static final String HONEYPOT_IGNORED_LEVEL = "honeypotIgnoredLevel";
|
public static final String HONEYPOT_IGNORED_LEVEL = "honeypotIgnoredLevel";
|
||||||
|
public static final String HONEYPOT_CHANNEL = "honeypotChannel";
|
||||||
public static final String HONEYPOT_IGNORED_JOIN_DURATION_SECONDS = "honeypotIgnoredJoinDurationSeconds";
|
public static final String HONEYPOT_IGNORED_JOIN_DURATION_SECONDS = "honeypotIgnoredJoinDurationSeconds";
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
@@ -21,6 +24,11 @@ public class HoneyPotFeatureConfig implements FeatureConfig {
|
|||||||
|
|
||||||
@Override
|
@Override
|
||||||
public List<String> getRequiredSystemConfigKeys() {
|
public List<String> getRequiredSystemConfigKeys() {
|
||||||
return Arrays.asList(HONEYPOT_ROLE_ID, HONEYPOT_IGNORED_LEVEL, HONEYPOT_IGNORED_JOIN_DURATION_SECONDS);
|
return Arrays.asList(HONEYPOT_ROLE_ID, HONEYPOT_IGNORED_LEVEL, HONEYPOT_IGNORED_JOIN_DURATION_SECONDS, HONEYPOT_CHANNEL);
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public List<FeatureMode> getAvailableModes() {
|
||||||
|
return Arrays.asList(HoneypotMode.values());
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -0,0 +1,16 @@
|
|||||||
|
package dev.sheldan.abstracto.moderation.config.feature.mode;
|
||||||
|
|
||||||
|
import dev.sheldan.abstracto.core.config.FeatureMode;
|
||||||
|
import lombok.Getter;
|
||||||
|
|
||||||
|
@Getter
|
||||||
|
public enum HoneypotMode implements FeatureMode {
|
||||||
|
ROLE("honeypotRole"),
|
||||||
|
MESSAGE("honeypotMessage");
|
||||||
|
|
||||||
|
private final String key;
|
||||||
|
|
||||||
|
HoneypotMode(String key) {
|
||||||
|
this.key = key;
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -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.23</version>
|
<version>1.6.26-SNAPSHOT</version>
|
||||||
</parent>
|
</parent>
|
||||||
<modelVersion>4.0.0</modelVersion>
|
<modelVersion>4.0.0</modelVersion>
|
||||||
|
|
||||||
|
|||||||
@@ -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.23</version>
|
<version>1.6.26-SNAPSHOT</version>
|
||||||
</parent>
|
</parent>
|
||||||
<modelVersion>4.0.0</modelVersion>
|
<modelVersion>4.0.0</modelVersion>
|
||||||
|
|
||||||
|
|||||||
@@ -75,7 +75,7 @@ public class ModmailReminderListener implements ModmailThreadActionListener {
|
|||||||
log.debug("Thread {} is closed - ignoring.", model.getThreadId());
|
log.debug("Thread {} is closed - ignoring.", model.getThreadId());
|
||||||
return ModmailThreadActionListenerResult.IGNORED;
|
return ModmailThreadActionListenerResult.IGNORED;
|
||||||
}
|
}
|
||||||
Instant timeStampToConsider = getTimestampToUse(thread);
|
Instant timeStampToConsider = getTimestampToUse(thread, duration);
|
||||||
boolean mustBeReminded = timeInPastDuration.isAfter(timeStampToConsider);
|
boolean mustBeReminded = timeInPastDuration.isAfter(timeStampToConsider);
|
||||||
if (mustBeReminded) {
|
if (mustBeReminded) {
|
||||||
sendReminder(thread)
|
sendReminder(thread)
|
||||||
@@ -97,14 +97,17 @@ public class ModmailReminderListener implements ModmailThreadActionListener {
|
|||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
private static Instant getTimestampToUse(ModMailThread thread) {
|
private static Instant getTimestampToUse(ModMailThread thread, Duration configuredDuration) {
|
||||||
if (thread.getRemindersSnoozedUntil() != null) {
|
if (thread.getRemindersSnoozedUntil() != null) {
|
||||||
return thread.getRemindersSnoozedUntil();
|
return thread.getRemindersSnoozedUntil().minus(configuredDuration);
|
||||||
}
|
}
|
||||||
return getUpdatedOrCrated(thread);
|
return getUpdatedOrCrated(thread);
|
||||||
}
|
}
|
||||||
|
|
||||||
private static Instant getUpdatedOrCrated(ModMailThread thread) {
|
private static Instant getUpdatedOrCrated(ModMailThread thread) {
|
||||||
|
if(thread.getLastUpdated() != null) {
|
||||||
|
return thread.getLastUpdated();
|
||||||
|
}
|
||||||
if(thread.getUpdated() != null) {
|
if(thread.getUpdated() != null) {
|
||||||
return thread.getUpdated();
|
return thread.getUpdated();
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -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.23</version>
|
<version>1.6.26-SNAPSHOT</version>
|
||||||
</parent>
|
</parent>
|
||||||
<modelVersion>4.0.0</modelVersion>
|
<modelVersion>4.0.0</modelVersion>
|
||||||
|
|
||||||
|
|||||||
@@ -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.23</version>
|
<version>1.6.26-SNAPSHOT</version>
|
||||||
</parent>
|
</parent>
|
||||||
<modelVersion>4.0.0</modelVersion>
|
<modelVersion>4.0.0</modelVersion>
|
||||||
|
|
||||||
|
|||||||
@@ -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.23</version>
|
<version>1.6.26-SNAPSHOT</version>
|
||||||
</parent>
|
</parent>
|
||||||
<modelVersion>4.0.0</modelVersion>
|
<modelVersion>4.0.0</modelVersion>
|
||||||
|
|
||||||
|
|||||||
@@ -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.23</version>
|
<version>1.6.26-SNAPSHOT</version>
|
||||||
</parent>
|
</parent>
|
||||||
<modelVersion>4.0.0</modelVersion>
|
<modelVersion>4.0.0</modelVersion>
|
||||||
|
|
||||||
|
|||||||
@@ -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.23</version>
|
<version>1.6.26-SNAPSHOT</version>
|
||||||
</parent>
|
</parent>
|
||||||
<modelVersion>4.0.0</modelVersion>
|
<modelVersion>4.0.0</modelVersion>
|
||||||
|
|
||||||
|
|||||||
@@ -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.23</version>
|
<version>1.6.26-SNAPSHOT</version>
|
||||||
</parent>
|
</parent>
|
||||||
<modelVersion>4.0.0</modelVersion>
|
<modelVersion>4.0.0</modelVersion>
|
||||||
|
|
||||||
|
|||||||
@@ -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.23</version>
|
<version>1.6.26-SNAPSHOT</version>
|
||||||
</parent>
|
</parent>
|
||||||
<modelVersion>4.0.0</modelVersion>
|
<modelVersion>4.0.0</modelVersion>
|
||||||
|
|
||||||
|
|||||||
@@ -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.23</version>
|
<version>1.6.26-SNAPSHOT</version>
|
||||||
</parent>
|
</parent>
|
||||||
<modelVersion>4.0.0</modelVersion>
|
<modelVersion>4.0.0</modelVersion>
|
||||||
|
|
||||||
|
|||||||
@@ -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.23</version>
|
<version>1.6.26-SNAPSHOT</version>
|
||||||
</parent>
|
</parent>
|
||||||
<modelVersion>4.0.0</modelVersion>
|
<modelVersion>4.0.0</modelVersion>
|
||||||
|
|
||||||
|
|||||||
@@ -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.23</version>
|
<version>1.6.26-SNAPSHOT</version>
|
||||||
</parent>
|
</parent>
|
||||||
<modelVersion>4.0.0</modelVersion>
|
<modelVersion>4.0.0</modelVersion>
|
||||||
|
|
||||||
|
|||||||
@@ -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.23</version>
|
<version>1.6.26-SNAPSHOT</version>
|
||||||
</parent>
|
</parent>
|
||||||
<modelVersion>4.0.0</modelVersion>
|
<modelVersion>4.0.0</modelVersion>
|
||||||
|
|
||||||
|
|||||||
@@ -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.23</version>
|
<version>1.6.26-SNAPSHOT</version>
|
||||||
</parent>
|
</parent>
|
||||||
<modelVersion>4.0.0</modelVersion>
|
<modelVersion>4.0.0</modelVersion>
|
||||||
|
|
||||||
|
|||||||
@@ -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.23</version>
|
<version>1.6.26-SNAPSHOT</version>
|
||||||
</parent>
|
</parent>
|
||||||
<modelVersion>4.0.0</modelVersion>
|
<modelVersion>4.0.0</modelVersion>
|
||||||
|
|
||||||
|
|||||||
@@ -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.23</version>
|
<version>1.6.26-SNAPSHOT</version>
|
||||||
</parent>
|
</parent>
|
||||||
<modelVersion>4.0.0</modelVersion>
|
<modelVersion>4.0.0</modelVersion>
|
||||||
|
|
||||||
|
|||||||
@@ -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.23</version>
|
<version>1.6.26-SNAPSHOT</version>
|
||||||
</parent>
|
</parent>
|
||||||
<modelVersion>4.0.0</modelVersion>
|
<modelVersion>4.0.0</modelVersion>
|
||||||
|
|
||||||
|
|||||||
@@ -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.23</version>
|
<version>1.6.26-SNAPSHOT</version>
|
||||||
</parent>
|
</parent>
|
||||||
<modelVersion>4.0.0</modelVersion>
|
<modelVersion>4.0.0</modelVersion>
|
||||||
|
|
||||||
|
|||||||
@@ -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.23</version>
|
<version>1.6.26-SNAPSHOT</version>
|
||||||
</parent>
|
</parent>
|
||||||
<modelVersion>4.0.0</modelVersion>
|
<modelVersion>4.0.0</modelVersion>
|
||||||
|
|
||||||
|
|||||||
@@ -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.23</version>
|
<version>1.6.26-SNAPSHOT</version>
|
||||||
</parent>
|
</parent>
|
||||||
<modelVersion>4.0.0</modelVersion>
|
<modelVersion>4.0.0</modelVersion>
|
||||||
|
|
||||||
|
|||||||
@@ -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.23</version>
|
<version>1.6.26-SNAPSHOT</version>
|
||||||
</parent>
|
</parent>
|
||||||
<modelVersion>4.0.0</modelVersion>
|
<modelVersion>4.0.0</modelVersion>
|
||||||
|
|
||||||
|
|||||||
@@ -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.23</version>
|
<version>1.6.26-SNAPSHOT</version>
|
||||||
</parent>
|
</parent>
|
||||||
|
|
||||||
<artifactId>sticky-roles-impl</artifactId>
|
<artifactId>sticky-roles-impl</artifactId>
|
||||||
|
|||||||
@@ -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.23</version>
|
<version>1.6.26-SNAPSHOT</version>
|
||||||
</parent>
|
</parent>
|
||||||
|
|
||||||
<artifactId>sticky-roles-int</artifactId>
|
<artifactId>sticky-roles-int</artifactId>
|
||||||
|
|||||||
@@ -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.23</version>
|
<version>1.6.26-SNAPSHOT</version>
|
||||||
</parent>
|
</parent>
|
||||||
<modelVersion>4.0.0</modelVersion>
|
<modelVersion>4.0.0</modelVersion>
|
||||||
|
|
||||||
|
|||||||
@@ -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.23</version>
|
<version>1.6.26-SNAPSHOT</version>
|
||||||
</parent>
|
</parent>
|
||||||
<modelVersion>4.0.0</modelVersion>
|
<modelVersion>4.0.0</modelVersion>
|
||||||
|
|
||||||
|
|||||||
@@ -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.23</version>
|
<version>1.6.26-SNAPSHOT</version>
|
||||||
</parent>
|
</parent>
|
||||||
<modelVersion>4.0.0</modelVersion>
|
<modelVersion>4.0.0</modelVersion>
|
||||||
|
|
||||||
|
|||||||
@@ -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.23</version>
|
<version>1.6.26-SNAPSHOT</version>
|
||||||
</parent>
|
</parent>
|
||||||
<modelVersion>4.0.0</modelVersion>
|
<modelVersion>4.0.0</modelVersion>
|
||||||
|
|
||||||
|
|||||||
@@ -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.23</version>
|
<version>1.6.26-SNAPSHOT</version>
|
||||||
</parent>
|
</parent>
|
||||||
<modelVersion>4.0.0</modelVersion>
|
<modelVersion>4.0.0</modelVersion>
|
||||||
|
|
||||||
|
|||||||
@@ -13,6 +13,7 @@ import dev.sheldan.abstracto.core.service.management.UserInServerManagementServi
|
|||||||
import dev.sheldan.abstracto.core.templating.model.MessageToSend;
|
import dev.sheldan.abstracto.core.templating.model.MessageToSend;
|
||||||
import dev.sheldan.abstracto.core.templating.service.TemplateService;
|
import dev.sheldan.abstracto.core.templating.service.TemplateService;
|
||||||
import dev.sheldan.abstracto.core.utils.CompletableFutureList;
|
import dev.sheldan.abstracto.core.utils.CompletableFutureList;
|
||||||
|
import dev.sheldan.abstracto.core.utils.ParseUtils;
|
||||||
import dev.sheldan.abstracto.twitch.config.TwitchFeatureConfig;
|
import dev.sheldan.abstracto.twitch.config.TwitchFeatureConfig;
|
||||||
import dev.sheldan.abstracto.twitch.config.TwitchFeatureDefinition;
|
import dev.sheldan.abstracto.twitch.config.TwitchFeatureDefinition;
|
||||||
import dev.sheldan.abstracto.twitch.config.TwitchFeatureMode;
|
import dev.sheldan.abstracto.twitch.config.TwitchFeatureMode;
|
||||||
@@ -26,6 +27,8 @@ import dev.sheldan.abstracto.twitch.model.template.*;
|
|||||||
import dev.sheldan.abstracto.twitch.service.management.StreamSessionManagementService;
|
import dev.sheldan.abstracto.twitch.service.management.StreamSessionManagementService;
|
||||||
import dev.sheldan.abstracto.twitch.service.management.StreamSessionSectionManagementService;
|
import dev.sheldan.abstracto.twitch.service.management.StreamSessionSectionManagementService;
|
||||||
import dev.sheldan.abstracto.twitch.service.management.StreamerManagementService;
|
import dev.sheldan.abstracto.twitch.service.management.StreamerManagementService;
|
||||||
|
import java.time.Duration;
|
||||||
|
import java.time.Instant;
|
||||||
import lombok.extern.slf4j.Slf4j;
|
import lombok.extern.slf4j.Slf4j;
|
||||||
import net.dv8tion.jda.api.entities.Guild;
|
import net.dv8tion.jda.api.entities.Guild;
|
||||||
import net.dv8tion.jda.api.entities.Member;
|
import net.dv8tion.jda.api.entities.Member;
|
||||||
@@ -92,6 +95,9 @@ public class StreamerServiceBean implements StreamerService {
|
|||||||
@Autowired
|
@Autowired
|
||||||
private MessageService messageService;
|
private MessageService messageService;
|
||||||
|
|
||||||
|
@Autowired
|
||||||
|
private ConfigService configService;
|
||||||
|
|
||||||
@Autowired
|
@Autowired
|
||||||
private StreamerServiceBean self;
|
private StreamerServiceBean self;
|
||||||
|
|
||||||
@@ -277,6 +283,8 @@ public class StreamerServiceBean implements StreamerService {
|
|||||||
log.debug("Searching through {} servers for twitch notifications and {} have twitch feature enabled.", servers.size(), serversWithEnabledFeature.size());
|
log.debug("Searching through {} servers for twitch notifications and {} have twitch feature enabled.", servers.size(), serversWithEnabledFeature.size());
|
||||||
serversWithEnabledFeature.forEach(server -> {
|
serversWithEnabledFeature.forEach(server -> {
|
||||||
List<Streamer> streamersInServer = streamerManagementService.getStreamersForServer(server);
|
List<Streamer> streamersInServer = streamerManagementService.getStreamersForServer(server);
|
||||||
|
String refreshDurationString = configService.getStringValueOrConfigDefault(TwitchFeatureConfig.TWITCH_REFRESH_INTERVAL, server.getId());
|
||||||
|
Duration refreshDuration = ParseUtils.parseDuration(refreshDurationString);
|
||||||
Map<Long, Streamer> streamerIdMap = streamersInServer
|
Map<Long, Streamer> streamerIdMap = streamersInServer
|
||||||
.stream()
|
.stream()
|
||||||
.collect(Collectors.toMap(Streamer::getId, Function.identity()));
|
.collect(Collectors.toMap(Streamer::getId, Function.identity()));
|
||||||
@@ -295,7 +303,7 @@ public class StreamerServiceBean implements StreamerService {
|
|||||||
List<Stream> streamsOfUsers = twitchService.getStreamsByUserIds(userIds);
|
List<Stream> streamsOfUsers = twitchService.getStreamsByUserIds(userIds);
|
||||||
Set<Long> onlineStreamers = new HashSet<>();
|
Set<Long> onlineStreamers = new HashSet<>();
|
||||||
Map<Long, Boolean> updateNotificationFlagValues = new HashMap<>();
|
Map<Long, Boolean> updateNotificationFlagValues = new HashMap<>();
|
||||||
streamsOfUsers.forEach(stream -> self.processOnlineStreamer(server, streamerMap, onlineStreamers, updateNotificationFlagValues, stream));
|
streamsOfUsers.forEach(stream -> self.processOnlineStreamer(server, streamerMap, onlineStreamers, updateNotificationFlagValues, stream, refreshDuration));
|
||||||
Set<Long> allStreamersInServer = streamerIdMap.keySet();
|
Set<Long> allStreamersInServer = streamerIdMap.keySet();
|
||||||
allStreamersInServer.removeAll(onlineStreamers); // then we have those that went offline
|
allStreamersInServer.removeAll(onlineStreamers); // then we have those that went offline
|
||||||
Map<Long, Boolean> deleteFlagValues = new HashMap<>();
|
Map<Long, Boolean> deleteFlagValues = new HashMap<>();
|
||||||
@@ -370,7 +378,8 @@ public class StreamerServiceBean implements StreamerService {
|
|||||||
}
|
}
|
||||||
|
|
||||||
@Transactional(propagation = Propagation.REQUIRES_NEW)
|
@Transactional(propagation = Propagation.REQUIRES_NEW)
|
||||||
public void processOnlineStreamer(AServer server, Map<String, Streamer> streamerMap, Set<Long> onlineStreamers, Map<Long, Boolean> updateNotificationFlagValues, Stream stream) {
|
public void processOnlineStreamer(AServer server, Map<String, Streamer> streamerMap, Set<Long> onlineStreamers, Map<Long, Boolean> updateNotificationFlagValues,
|
||||||
|
Stream stream, Duration refreshDuration) {
|
||||||
Streamer streamer = streamerMap.get(stream.getUserId());
|
Streamer streamer = streamerMap.get(stream.getUserId());
|
||||||
Long streamerId = streamer.getId();
|
Long streamerId = streamer.getId();
|
||||||
onlineStreamers.add(streamerId);
|
onlineStreamers.add(streamerId);
|
||||||
@@ -378,18 +387,19 @@ public class StreamerServiceBean implements StreamerService {
|
|||||||
// that is the case if you add an online streamer
|
// that is the case if you add an online streamer
|
||||||
User streamerUser = twitchService.getStreamerById(stream.getUserId());
|
User streamerUser = twitchService.getStreamerById(stream.getUserId());
|
||||||
StreamSession currentSession = streamer.getCurrentSession();
|
StreamSession currentSession = streamer.getCurrentSession();
|
||||||
|
Long serverId = streamer.getServer().getId();
|
||||||
if (Boolean.TRUE.equals(streamer.getOnline()) && currentSession != null) {
|
if (Boolean.TRUE.equals(streamer.getOnline()) && currentSession != null) {
|
||||||
// we already know that this streamer is online
|
// we already know that this streamer is online
|
||||||
log.debug("Not notifying for streamer {} in server {} - streamer is already online.", streamerId, server.getId());
|
log.debug("Not notifying for streamer {} in server {} - streamer is already online.", streamerId, server.getId());
|
||||||
if(!stream.getGameId().equals(streamer.getCurrentGameId())) {
|
if(!stream.getGameId().equals(streamer.getCurrentGameId())) {
|
||||||
log.info("Streamer {} changed game from {} to {} - storing new section.", streamerId, streamer.getCurrentGameId(), stream.getGameId());
|
log.info("Streamer {} changed game from {} to {} - storing new section.", streamerId, streamer.getCurrentGameId(), stream.getGameId());
|
||||||
streamSessionSectionService.createSectionFromStream(currentSession, stream);
|
streamSessionSectionService.createSectionFromStream(currentSession, stream);
|
||||||
|
currentSession.setLastUpdated(Instant.now());
|
||||||
if (updateNotificationFlagValues.computeIfAbsent(streamer.getServer().getId(),
|
if (updateNotificationFlagValues.computeIfAbsent(streamer.getServer().getId(),
|
||||||
aLong -> featureModeService.featureModeActive(TwitchFeatureDefinition.TWITCH, aLong, TwitchFeatureMode.UPDATE_NOTIFICATION))) {
|
aLong -> featureModeService.featureModeActive(TwitchFeatureDefinition.TWITCH, aLong, TwitchFeatureMode.UPDATE_NOTIFICATION))) {
|
||||||
log.info("Updating notification is enabled - updating notification for streamer {}.", streamer.getId());
|
log.info("Updating notification is enabled - updating notification for streamer {}.", streamer.getId());
|
||||||
Long notificationMessageId = currentSession.getId();
|
Long notificationMessageId = currentSession.getId();
|
||||||
Long notificationChannelId = currentSession.getChannel().getId();
|
Long notificationChannelId = currentSession.getChannel().getId();
|
||||||
Long serverId = streamer.getServer().getId();
|
|
||||||
updateExistingNotification(stream, streamer, streamerUser).thenAccept(unused -> {
|
updateExistingNotification(stream, streamer, streamerUser).thenAccept(unused -> {
|
||||||
log.info("Updating existing notification {} for server {} in channel {} about streamer {}.",
|
log.info("Updating existing notification {} for server {} in channel {} about streamer {}.",
|
||||||
notificationMessageId, serverId, notificationChannelId, streamerId);
|
notificationMessageId, serverId, notificationChannelId, streamerId);
|
||||||
@@ -400,6 +410,20 @@ public class StreamerServiceBean implements StreamerService {
|
|||||||
});
|
});
|
||||||
}
|
}
|
||||||
streamer.setCurrentGameId(stream.getGameId());
|
streamer.setCurrentGameId(stream.getGameId());
|
||||||
|
} else if(currentSession.getLastUpdated().isBefore(Instant.now().minus(refreshDuration)) &&
|
||||||
|
updateNotificationFlagValues.computeIfAbsent(streamer.getServer().getId(),
|
||||||
|
serverIdKey -> featureModeService.featureModeActive(TwitchFeatureDefinition.TWITCH, serverIdKey, TwitchFeatureMode.UPDATE_NOTIFICATION))) {
|
||||||
|
Long notificationMessageId = currentSession.getId();
|
||||||
|
currentSession.setLastUpdated(Instant.now());
|
||||||
|
Long notificationChannelId = currentSession.getChannel().getId();
|
||||||
|
updateExistingNotification(stream, streamer, streamerUser).thenAccept(unused -> {
|
||||||
|
log.info("Updating existing notification {} for server {} in channel {} about streamer {}.",
|
||||||
|
notificationMessageId, serverId, notificationChannelId, streamerId);
|
||||||
|
}).exceptionally(throwable -> {
|
||||||
|
log.error("Failed to update existing notification {} for server {} in channel {} about streamer {}.",
|
||||||
|
notificationMessageId, serverId, notificationChannelId, streamerId, throwable);
|
||||||
|
return null;
|
||||||
|
});
|
||||||
}
|
}
|
||||||
} else if(currentSession == null &&
|
} else if(currentSession == null &&
|
||||||
!postTargetService.postTargetUsableInServer(TwitchPostTarget.TWITCH_LIVE_NOTIFICATION, server.getId())) {
|
!postTargetService.postTargetUsableInServer(TwitchPostTarget.TWITCH_LIVE_NOTIFICATION, server.getId())) {
|
||||||
|
|||||||
@@ -6,6 +6,7 @@ import dev.sheldan.abstracto.core.service.management.ChannelManagementService;
|
|||||||
import dev.sheldan.abstracto.twitch.model.database.Streamer;
|
import dev.sheldan.abstracto.twitch.model.database.Streamer;
|
||||||
import dev.sheldan.abstracto.twitch.model.database.StreamSession;
|
import dev.sheldan.abstracto.twitch.model.database.StreamSession;
|
||||||
import dev.sheldan.abstracto.twitch.repository.StreamSessionRepository;
|
import dev.sheldan.abstracto.twitch.repository.StreamSessionRepository;
|
||||||
|
import java.time.Instant;
|
||||||
import org.springframework.beans.factory.annotation.Autowired;
|
import org.springframework.beans.factory.annotation.Autowired;
|
||||||
import org.springframework.stereotype.Component;
|
import org.springframework.stereotype.Component;
|
||||||
|
|
||||||
@@ -26,6 +27,7 @@ public class StreamSessionManagementServiceBean implements StreamSessionManageme
|
|||||||
.id(messageId)
|
.id(messageId)
|
||||||
.startTime(stream.getStartedAtInstant())
|
.startTime(stream.getStartedAtInstant())
|
||||||
.channel(channel)
|
.channel(channel)
|
||||||
|
.lastUpdated(Instant.now())
|
||||||
.streamer(streamer)
|
.streamer(streamer)
|
||||||
.streamId(stream.getId())
|
.streamId(stream.getId())
|
||||||
.build();
|
.build();
|
||||||
|
|||||||
@@ -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="tables/tables.xml" relativeToChangelogFile="true"/>
|
||||||
|
</databaseChangeLog>
|
||||||
@@ -0,0 +1,12 @@
|
|||||||
|
<?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="stream_session-add_last_updated">
|
||||||
|
<addColumn tableName="stream_session">
|
||||||
|
<column name="last_updated" type="TIMESTAMP WITHOUT TIME ZONE" defaultValueComputed="CURRENT_TIMESTAMP">
|
||||||
|
<constraints nullable="false" />
|
||||||
|
</column>
|
||||||
|
</addColumn>
|
||||||
|
</changeSet>
|
||||||
|
</databaseChangeLog>
|
||||||
@@ -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="stream_session.xml" relativeToChangelogFile="true"/>
|
||||||
|
</databaseChangeLog>
|
||||||
@@ -3,4 +3,5 @@
|
|||||||
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
|
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" >
|
xsi:schemaLocation="http://www.liquibase.org/xml/ns/dbchangelog https://www.liquibase.org/xml/ns/dbchangelog/dbchangelog-4.26.xsd" >
|
||||||
<include file="1.4.27/collection.xml" relativeToChangelogFile="true"/>
|
<include file="1.4.27/collection.xml" relativeToChangelogFile="true"/>
|
||||||
|
<include file="1.6.25/collection.xml" relativeToChangelogFile="true"/>
|
||||||
</databaseChangeLog>
|
</databaseChangeLog>
|
||||||
@@ -13,3 +13,6 @@ abstracto.featureModes.deleteNotification.enabled=true
|
|||||||
abstracto.featureModes.updateNotification.featureName=twitch
|
abstracto.featureModes.updateNotification.featureName=twitch
|
||||||
abstracto.featureModes.updateNotification.mode=updateNotification
|
abstracto.featureModes.updateNotification.mode=updateNotification
|
||||||
abstracto.featureModes.updateNotification.enabled=true
|
abstracto.featureModes.updateNotification.enabled=true
|
||||||
|
|
||||||
|
abstracto.systemConfigs.twitchRefreshInterval.name=twitchRefreshInterval
|
||||||
|
abstracto.systemConfigs.twitchRefreshInterval.stringValue=30m
|
||||||
@@ -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.23</version>
|
<version>1.6.26-SNAPSHOT</version>
|
||||||
</parent>
|
</parent>
|
||||||
|
|
||||||
<modelVersion>4.0.0</modelVersion>
|
<modelVersion>4.0.0</modelVersion>
|
||||||
|
|||||||
@@ -11,6 +11,9 @@ import java.util.List;
|
|||||||
|
|
||||||
@Component
|
@Component
|
||||||
public class TwitchFeatureConfig implements FeatureConfig {
|
public class TwitchFeatureConfig implements FeatureConfig {
|
||||||
|
|
||||||
|
public static final String TWITCH_REFRESH_INTERVAL = "twitchRefreshInterval";
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public FeatureDefinition getFeature() {
|
public FeatureDefinition getFeature() {
|
||||||
return TwitchFeatureDefinition.TWITCH;
|
return TwitchFeatureDefinition.TWITCH;
|
||||||
@@ -25,4 +28,9 @@ public class TwitchFeatureConfig implements FeatureConfig {
|
|||||||
public List<FeatureMode> getAvailableModes() {
|
public List<FeatureMode> getAvailableModes() {
|
||||||
return Arrays.asList(TwitchFeatureMode.DELETE_NOTIFICATION, TwitchFeatureMode.UPDATE_NOTIFICATION);
|
return Arrays.asList(TwitchFeatureMode.DELETE_NOTIFICATION, TwitchFeatureMode.UPDATE_NOTIFICATION);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public List<String> getRequiredSystemConfigKeys() {
|
||||||
|
return List.of(TWITCH_REFRESH_INTERVAL);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -39,6 +39,9 @@ public class StreamSession {
|
|||||||
@Column(name = "updated", insertable = false, updatable = false)
|
@Column(name = "updated", insertable = false, updatable = false)
|
||||||
private Instant updated;
|
private Instant updated;
|
||||||
|
|
||||||
|
@Column(name = "lastUpdated")
|
||||||
|
private Instant lastUpdated;
|
||||||
|
|
||||||
@Column(name = "startTime", nullable = false)
|
@Column(name = "startTime", nullable = false)
|
||||||
private Instant startTime;
|
private Instant startTime;
|
||||||
|
|
||||||
|
|||||||
@@ -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.23</version>
|
<version>1.6.26-SNAPSHOT</version>
|
||||||
</parent>
|
</parent>
|
||||||
<modelVersion>4.0.0</modelVersion>
|
<modelVersion>4.0.0</modelVersion>
|
||||||
|
|
||||||
|
|||||||
@@ -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.23</version>
|
<version>1.6.26-SNAPSHOT</version>
|
||||||
</parent>
|
</parent>
|
||||||
<modelVersion>4.0.0</modelVersion>
|
<modelVersion>4.0.0</modelVersion>
|
||||||
|
|
||||||
|
|||||||
@@ -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.23</version>
|
<version>1.6.26-SNAPSHOT</version>
|
||||||
</parent>
|
</parent>
|
||||||
<modelVersion>4.0.0</modelVersion>
|
<modelVersion>4.0.0</modelVersion>
|
||||||
|
|
||||||
|
|||||||
@@ -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.23</version>
|
<version>1.6.26-SNAPSHOT</version>
|
||||||
</parent>
|
</parent>
|
||||||
<modelVersion>4.0.0</modelVersion>
|
<modelVersion>4.0.0</modelVersion>
|
||||||
|
|
||||||
|
|||||||
@@ -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.23</version>
|
<version>1.6.26-SNAPSHOT</version>
|
||||||
</parent>
|
</parent>
|
||||||
<modelVersion>4.0.0</modelVersion>
|
<modelVersion>4.0.0</modelVersion>
|
||||||
|
|
||||||
|
|||||||
@@ -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.23</version>
|
<version>1.6.26-SNAPSHOT</version>
|
||||||
</parent>
|
</parent>
|
||||||
<modelVersion>4.0.0</modelVersion>
|
<modelVersion>4.0.0</modelVersion>
|
||||||
|
|
||||||
|
|||||||
@@ -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.23</version>
|
<version>1.6.26-SNAPSHOT</version>
|
||||||
</parent>
|
</parent>
|
||||||
<modelVersion>4.0.0</modelVersion>
|
<modelVersion>4.0.0</modelVersion>
|
||||||
|
|
||||||
|
|||||||
@@ -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.23</version>
|
<version>1.6.26-SNAPSHOT</version>
|
||||||
</parent>
|
</parent>
|
||||||
<modelVersion>4.0.0</modelVersion>
|
<modelVersion>4.0.0</modelVersion>
|
||||||
|
|
||||||
|
|||||||
@@ -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.23</version>
|
<version>1.6.26-SNAPSHOT</version>
|
||||||
</parent>
|
</parent>
|
||||||
<modelVersion>4.0.0</modelVersion>
|
<modelVersion>4.0.0</modelVersion>
|
||||||
|
|
||||||
|
|||||||
@@ -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.23</version>
|
<version>1.6.26-SNAPSHOT</version>
|
||||||
</parent>
|
</parent>
|
||||||
<modelVersion>4.0.0</modelVersion>
|
<modelVersion>4.0.0</modelVersion>
|
||||||
|
|
||||||
|
|||||||
@@ -3,7 +3,7 @@
|
|||||||
<parent>
|
<parent>
|
||||||
<groupId>dev.sheldan.abstracto.core</groupId>
|
<groupId>dev.sheldan.abstracto.core</groupId>
|
||||||
<artifactId>core</artifactId>
|
<artifactId>core</artifactId>
|
||||||
<version>1.6.23</version>
|
<version>1.6.26-SNAPSHOT</version>
|
||||||
</parent>
|
</parent>
|
||||||
<modelVersion>4.0.0</modelVersion>
|
<modelVersion>4.0.0</modelVersion>
|
||||||
<packaging>jar</packaging>
|
<packaging>jar</packaging>
|
||||||
|
|||||||
@@ -1,6 +1,7 @@
|
|||||||
package dev.sheldan.abstracto.core.commands.config.features;
|
package dev.sheldan.abstracto.core.commands.config.features;
|
||||||
|
|
||||||
import dev.sheldan.abstracto.core.command.service.management.FeatureManagementService;
|
import dev.sheldan.abstracto.core.command.service.management.FeatureManagementService;
|
||||||
|
import dev.sheldan.abstracto.core.config.FeatureConfig;
|
||||||
import dev.sheldan.abstracto.core.interaction.slash.CoreSlashCommandNames;
|
import dev.sheldan.abstracto.core.interaction.slash.CoreSlashCommandNames;
|
||||||
import dev.sheldan.abstracto.core.command.condition.AbstractConditionableCommand;
|
import dev.sheldan.abstracto.core.command.condition.AbstractConditionableCommand;
|
||||||
import dev.sheldan.abstracto.core.command.config.CommandConfiguration;
|
import dev.sheldan.abstracto.core.command.config.CommandConfiguration;
|
||||||
@@ -15,9 +16,7 @@ import dev.sheldan.abstracto.core.config.FeatureMode;
|
|||||||
import dev.sheldan.abstracto.core.interaction.InteractionService;
|
import dev.sheldan.abstracto.core.interaction.InteractionService;
|
||||||
import dev.sheldan.abstracto.core.interaction.slash.SlashCommandPrivilegeLevels;
|
import dev.sheldan.abstracto.core.interaction.slash.SlashCommandPrivilegeLevels;
|
||||||
import dev.sheldan.abstracto.core.interaction.slash.parameter.SlashCommandAutoCompleteService;
|
import dev.sheldan.abstracto.core.interaction.slash.parameter.SlashCommandAutoCompleteService;
|
||||||
import dev.sheldan.abstracto.core.models.database.AFeature;
|
|
||||||
import dev.sheldan.abstracto.core.models.database.AFeatureFlag;
|
import dev.sheldan.abstracto.core.models.database.AFeatureFlag;
|
||||||
import dev.sheldan.abstracto.core.models.database.AFeatureMode;
|
|
||||||
import dev.sheldan.abstracto.core.models.database.AServer;
|
import dev.sheldan.abstracto.core.models.database.AServer;
|
||||||
import dev.sheldan.abstracto.core.service.FeatureConfigService;
|
import dev.sheldan.abstracto.core.service.FeatureConfigService;
|
||||||
import dev.sheldan.abstracto.core.service.FeatureModeService;
|
import dev.sheldan.abstracto.core.service.FeatureModeService;
|
||||||
@@ -59,12 +58,6 @@ public class DisableMode extends AbstractConditionableCommand {
|
|||||||
@Autowired
|
@Autowired
|
||||||
private FeatureFlagManagementService featureFlagManagementService;
|
private FeatureFlagManagementService featureFlagManagementService;
|
||||||
|
|
||||||
@Autowired
|
|
||||||
private FeatureModeManagementService featureModeManagementService;
|
|
||||||
|
|
||||||
@Autowired
|
|
||||||
private FeatureManagementService featureManagementService;
|
|
||||||
|
|
||||||
private static final String DISABLE_MODE_RESPONSE_KEY = "disableMode_response";
|
private static final String DISABLE_MODE_RESPONSE_KEY = "disableMode_response";
|
||||||
private static final String FEATURE_PARAMETER = "feature";
|
private static final String FEATURE_PARAMETER = "feature";
|
||||||
private static final String MODE_PARAMETER = "mode";
|
private static final String MODE_PARAMETER = "mode";
|
||||||
@@ -99,11 +92,11 @@ public class DisableMode extends AbstractConditionableCommand {
|
|||||||
return new ArrayList<>();
|
return new ArrayList<>();
|
||||||
}
|
}
|
||||||
FeatureDefinition featureDefinition = featureConfigService.getFeatureEnum(featureName);
|
FeatureDefinition featureDefinition = featureConfigService.getFeatureEnum(featureName);
|
||||||
AFeature feature = featureManagementService.getFeature(featureDefinition.getKey());
|
FeatureConfig feature = featureConfigService.getFeatureDisplayForFeature(featureDefinition);
|
||||||
List<AFeatureMode> modes = featureModeManagementService.getFeatureModesOfFeatureInServer(server, feature);
|
List<FeatureMode> modes = feature.getAvailableModes();
|
||||||
return modes
|
return modes
|
||||||
.stream()
|
.stream()
|
||||||
.map(mode -> mode.getFeatureMode().toLowerCase())
|
.map(mode -> mode.getKey().toLowerCase())
|
||||||
.filter(string -> string.startsWith(input))
|
.filter(string -> string.startsWith(input))
|
||||||
.toList();
|
.toList();
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -1,6 +1,7 @@
|
|||||||
package dev.sheldan.abstracto.core.commands.config.features;
|
package dev.sheldan.abstracto.core.commands.config.features;
|
||||||
|
|
||||||
import dev.sheldan.abstracto.core.command.service.management.FeatureManagementService;
|
import dev.sheldan.abstracto.core.command.service.management.FeatureManagementService;
|
||||||
|
import dev.sheldan.abstracto.core.config.FeatureConfig;
|
||||||
import dev.sheldan.abstracto.core.interaction.slash.CoreSlashCommandNames;
|
import dev.sheldan.abstracto.core.interaction.slash.CoreSlashCommandNames;
|
||||||
import dev.sheldan.abstracto.core.command.condition.AbstractConditionableCommand;
|
import dev.sheldan.abstracto.core.command.condition.AbstractConditionableCommand;
|
||||||
import dev.sheldan.abstracto.core.command.config.CommandConfiguration;
|
import dev.sheldan.abstracto.core.command.config.CommandConfiguration;
|
||||||
@@ -15,9 +16,7 @@ import dev.sheldan.abstracto.core.config.FeatureMode;
|
|||||||
import dev.sheldan.abstracto.core.interaction.InteractionService;
|
import dev.sheldan.abstracto.core.interaction.InteractionService;
|
||||||
import dev.sheldan.abstracto.core.interaction.slash.SlashCommandPrivilegeLevels;
|
import dev.sheldan.abstracto.core.interaction.slash.SlashCommandPrivilegeLevels;
|
||||||
import dev.sheldan.abstracto.core.interaction.slash.parameter.SlashCommandAutoCompleteService;
|
import dev.sheldan.abstracto.core.interaction.slash.parameter.SlashCommandAutoCompleteService;
|
||||||
import dev.sheldan.abstracto.core.models.database.AFeature;
|
|
||||||
import dev.sheldan.abstracto.core.models.database.AFeatureFlag;
|
import dev.sheldan.abstracto.core.models.database.AFeatureFlag;
|
||||||
import dev.sheldan.abstracto.core.models.database.AFeatureMode;
|
|
||||||
import dev.sheldan.abstracto.core.models.database.AServer;
|
import dev.sheldan.abstracto.core.models.database.AServer;
|
||||||
import dev.sheldan.abstracto.core.service.FeatureConfigService;
|
import dev.sheldan.abstracto.core.service.FeatureConfigService;
|
||||||
import dev.sheldan.abstracto.core.service.FeatureModeService;
|
import dev.sheldan.abstracto.core.service.FeatureModeService;
|
||||||
@@ -59,12 +58,6 @@ public class EnableMode extends AbstractConditionableCommand {
|
|||||||
@Autowired
|
@Autowired
|
||||||
private FeatureFlagManagementService featureFlagManagementService;
|
private FeatureFlagManagementService featureFlagManagementService;
|
||||||
|
|
||||||
@Autowired
|
|
||||||
private FeatureModeManagementService featureModeManagementService;
|
|
||||||
|
|
||||||
@Autowired
|
|
||||||
private FeatureManagementService featureManagementService;
|
|
||||||
|
|
||||||
private static final String ENABLE_MODE_RESPONSE_KEY = "enableMode_response";
|
private static final String ENABLE_MODE_RESPONSE_KEY = "enableMode_response";
|
||||||
private static final String FEATURE_PARAMETER = "feature";
|
private static final String FEATURE_PARAMETER = "feature";
|
||||||
private static final String MODE_PARAMETER = "mode";
|
private static final String MODE_PARAMETER = "mode";
|
||||||
@@ -99,11 +92,11 @@ public class EnableMode extends AbstractConditionableCommand {
|
|||||||
return new ArrayList<>();
|
return new ArrayList<>();
|
||||||
}
|
}
|
||||||
FeatureDefinition featureDefinition = featureConfigService.getFeatureEnum(featureName);
|
FeatureDefinition featureDefinition = featureConfigService.getFeatureEnum(featureName);
|
||||||
AFeature feature = featureManagementService.getFeature(featureDefinition.getKey());
|
FeatureConfig feature = featureConfigService.getFeatureDisplayForFeature(featureDefinition);
|
||||||
List<AFeatureMode> modes = featureModeManagementService.getFeatureModesOfFeatureInServer(server, feature);
|
List<FeatureMode> modes = feature.getAvailableModes();
|
||||||
return modes
|
return modes
|
||||||
.stream()
|
.stream()
|
||||||
.map(mode -> mode.getFeatureMode().toLowerCase())
|
.map(mode -> mode.getKey().toLowerCase())
|
||||||
.filter(string -> string.startsWith(input))
|
.filter(string -> string.startsWith(input))
|
||||||
.toList();
|
.toList();
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -3,7 +3,7 @@
|
|||||||
<parent>
|
<parent>
|
||||||
<groupId>dev.sheldan.abstracto.core</groupId>
|
<groupId>dev.sheldan.abstracto.core</groupId>
|
||||||
<artifactId>core</artifactId>
|
<artifactId>core</artifactId>
|
||||||
<version>1.6.23</version>
|
<version>1.6.26-SNAPSHOT</version>
|
||||||
</parent>
|
</parent>
|
||||||
<modelVersion>4.0.0</modelVersion>
|
<modelVersion>4.0.0</modelVersion>
|
||||||
<packaging>jar</packaging>
|
<packaging>jar</packaging>
|
||||||
|
|||||||
@@ -3,7 +3,7 @@
|
|||||||
<parent>
|
<parent>
|
||||||
<artifactId>core</artifactId>
|
<artifactId>core</artifactId>
|
||||||
<groupId>dev.sheldan.abstracto.core</groupId>
|
<groupId>dev.sheldan.abstracto.core</groupId>
|
||||||
<version>1.6.23</version>
|
<version>1.6.26-SNAPSHOT</version>
|
||||||
</parent>
|
</parent>
|
||||||
<modelVersion>4.0.0</modelVersion>
|
<modelVersion>4.0.0</modelVersion>
|
||||||
|
|
||||||
|
|||||||
@@ -3,7 +3,7 @@
|
|||||||
<parent>
|
<parent>
|
||||||
<artifactId>core</artifactId>
|
<artifactId>core</artifactId>
|
||||||
<groupId>dev.sheldan.abstracto.core</groupId>
|
<groupId>dev.sheldan.abstracto.core</groupId>
|
||||||
<version>1.6.23</version>
|
<version>1.6.26-SNAPSHOT</version>
|
||||||
</parent>
|
</parent>
|
||||||
<modelVersion>4.0.0</modelVersion>
|
<modelVersion>4.0.0</modelVersion>
|
||||||
|
|
||||||
|
|||||||
@@ -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.23</version>
|
<version>1.6.26-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
Reference in New Issue
Block a user