mirror of
https://github.com/Sheldan/abstracto.git
synced 2026-04-13 19:41:38 +00:00
[AB-xxx] adding initial support for components v2
fixing issue with buttons which only provide an emoji adding logging in case updating a starboard post goes wrong
This commit is contained in:
@@ -31,7 +31,7 @@ import net.dv8tion.jda.api.entities.channel.middleman.GuildChannel;
|
||||
import net.dv8tion.jda.api.entities.channel.middleman.GuildMessageChannel;
|
||||
import net.dv8tion.jda.api.entities.emoji.CustomEmoji;
|
||||
import net.dv8tion.jda.api.entities.emoji.Emoji;
|
||||
import net.dv8tion.jda.api.interactions.components.buttons.ButtonStyle;
|
||||
import net.dv8tion.jda.api.components.buttons.ButtonStyle;
|
||||
import org.apache.commons.lang3.BooleanUtils;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.stereotype.Component;
|
||||
|
||||
@@ -357,7 +357,9 @@ public class MessageEmbedServiceBean implements MessageEmbedService {
|
||||
|
||||
private Boolean shouldMentionReferencedAuthor(Message message) {
|
||||
if(message.getReferencedMessage() != null) {
|
||||
return message.getMentions().getMentions(Message.MentionType.USER).contains(message.getReferencedMessage().getAuthor());
|
||||
return message.getMentions().getMentions(Message.MentionType.USER)
|
||||
.stream()
|
||||
.anyMatch(user -> message.getReferencedMessage().getAuthor().getIdLong() == user.getIdLong());
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
||||
@@ -138,8 +138,12 @@ public abstract class StarboardListener {
|
||||
|
||||
protected void updateStarboardPost(CachedMessage message, AUserInAServer userReacting, boolean adding, StarboardPost starboardPost, List<AUserInAServer> userExceptAuthor) {
|
||||
starboardPost.setIgnored(false);
|
||||
// TODO handle futures correctly
|
||||
starboardService.updateStarboardPost(starboardPost, message, userExceptAuthor);
|
||||
starboardService.updateStarboardPost(starboardPost, message, userExceptAuthor)
|
||||
.thenAccept(unused -> log.info("Updated starboard post."))
|
||||
.exceptionally(throwable -> {
|
||||
log.error("Failed to update starboard post.", throwable);
|
||||
return null;
|
||||
});
|
||||
if(adding) {
|
||||
log.debug("Adding reactor {} from message {}", userReacting.getUserReference().getId(), message.getMessageId());
|
||||
starboardPostReactorManagementService.addReactor(starboardPost, userReacting);
|
||||
|
||||
Reference in New Issue
Block a user