added ability to delete embedded posts (only the author and the person embedding can delete them) (this requires the embeds to be stored, they are deleted if the embed is deleted)

added filter to only handle reactions not done by the bot
introduced completable future to the delete message wrapper
fixed multi embed handling always resulting in two embeds
added logging of template exceptions
refactored link embed handling to be in a service instead of the listener
This commit is contained in:
Sheldan
2020-04-07 22:32:56 +02:00
parent 02a7c3633b
commit 523aaaae2a
17 changed files with 442 additions and 95 deletions

View File

@@ -11,6 +11,7 @@ import org.springframework.stereotype.Service;
import javax.security.auth.login.LoginException;
import java.util.Optional;
import java.util.concurrent.CompletableFuture;
@Service
public interface Bot {
@@ -18,7 +19,7 @@ public interface Bot {
JDA getInstance();
ServerChannelUser getServerChannelUser(Long serverId, Long channelId, Long userId);
Member getMemberInServer(Long serverId, Long memberId);
void deleteMessage(Long serverId, Long channelId, Long messageId);
CompletableFuture<Void> deleteMessage(Long serverId, Long channelId, Long messageId);
Optional<Emote> getEmote(Long serverId, AEmote emote);
Optional<TextChannel> getTextChannelFromServer(Guild serverId, Long textChannelId);
Optional<TextChannel> getTextChannelFromServer(Long serverId, Long textChannelId);

View File

@@ -2,6 +2,9 @@ package dev.sheldan.abstracto.core.service;
import net.dv8tion.jda.api.entities.Message;
import java.util.concurrent.CompletableFuture;
public interface MessageService {
void addReactionToMessage(String emoteKey, Long serverId, Message message);
CompletableFuture<Void> deleteMessageInChannelInServer(Long serverId, Long channelId, Long messageId);
}