[AB-154] split up private and guild message received handler, split handlers into async and sync handlers

adapting the tests and improving tests to reduce usage of MockUtils
adding some util methods to message bean
extending cache for cached messages
enabling to build cached messages from messages in DM channels (they are not part of the message cache)
splitting multiple listeners to different beans, for better overview (emote updated)
adding convenience service for reactions specifically
split cached reaction and cached reactions, singular only contains one user, while the later contains all users
fixing liquibase configuration for assigned role user
fixing assignable role not having a transaction
moved caching update a bit earlier in various methods
fixing bug that a manual unmute caused duplicate unmute notification
fixing short scheduled unmute not checking the new mute state
limiting parameters for roll
This commit is contained in:
Sheldan
2020-12-20 19:21:24 +01:00
parent 69aa82e26e
commit fb3ed69650
200 changed files with 4253 additions and 1813 deletions

View File

@@ -1,5 +1,8 @@
package dev.sheldan.abstracto.utility.service;
import dev.sheldan.abstracto.core.models.cache.CachedAttachment;
import dev.sheldan.abstracto.core.models.cache.CachedEmbed;
import dev.sheldan.abstracto.core.models.cache.CachedMessage;
import dev.sheldan.abstracto.core.models.database.AUserInAServer;
import dev.sheldan.abstracto.utility.models.RepostLeaderboardEntryModel;
import dev.sheldan.abstracto.utility.models.database.PostedImage;
@@ -10,12 +13,14 @@ import java.util.Optional;
import java.util.concurrent.CompletableFuture;
public interface RepostService {
boolean isRepost(Message message, MessageEmbed messageEmbed, Integer embedIndex);
boolean isRepost(CachedMessage message, CachedEmbed messageEmbed, Integer embedIndex);
Optional<PostedImage> getRepostFor(CachedMessage message, CachedEmbed messageEmbed, Integer embedIndex);
Optional<PostedImage> getRepostFor(Message message, MessageEmbed messageEmbed, Integer embedIndex);
boolean isRepost(Message message, Message.Attachment attachment, Integer index);
Optional<PostedImage> getRepostFor(Message message, Message.Attachment attachment, Integer index);
boolean isRepost(CachedMessage message, CachedAttachment attachment, Integer index);
Optional<PostedImage> getRepostFor(CachedMessage message, CachedAttachment attachment, Integer index);
String calculateHashForPost(String url, Long serverId);
void processMessageAttachmentRepostCheck(Message message);
void processMessageAttachmentRepostCheck(CachedMessage message);
void processMessageEmbedsRepostCheck(List<CachedEmbed> embeds, CachedMessage message);
void processMessageEmbedsRepostCheck(List<MessageEmbed> embeds, Message message);
CompletableFuture<List<RepostLeaderboardEntryModel>> retrieveRepostLeaderboard(Guild guild, Integer page);
void purgeReposts(AUserInAServer userInAServer);

View File

@@ -4,13 +4,12 @@ import dev.sheldan.abstracto.core.models.AServerAChannelAUser;
import dev.sheldan.abstracto.core.models.database.AServer;
import dev.sheldan.abstracto.core.models.database.AUserInAServer;
import dev.sheldan.abstracto.utility.models.database.PostedImage;
import net.dv8tion.jda.api.entities.Message;
import java.util.List;
import java.util.Optional;
public interface PostedImageManagement {
PostedImage createPost(AServerAChannelAUser creation, Message source, String hash, Integer index);
PostedImage createPost(AServerAChannelAUser creation, Long messageId, String hash, Integer index);
boolean postWitHashExists(String hash, AServer server);
Optional<PostedImage> getPostWithHash(String hash, AServer server);
boolean messageHasBeenCovered(Long messageId);