[AB-8] upgrading to new JDA alpha version 19

cleaning up imports
This commit is contained in:
Sheldan
2022-09-18 15:51:49 +02:00
parent 102209aaca
commit 4e1f9e0018
216 changed files with 682 additions and 704 deletions

View File

@@ -43,7 +43,7 @@ public class MessageEmbedRemovalReactionListener implements AsyncReactionAddedLi
public DefaultListenerResult execute(ReactionAddedModel model) {
Long serverId = model.getServerId();
AEmote aEmote = emoteService.getEmoteOrDefaultEmote(REMOVAL_EMOTE, serverId);
if(emoteService.isReactionEmoteAEmote(model.getReaction().getReactionEmote(), aEmote)) {
if(emoteService.isReactionEmoteAEmote(model.getReaction().getEmoji(), aEmote)) {
Long messageId = model.getMessage().getMessageId();
Optional<EmbeddedMessage> embeddedMessageOptional = messageEmbedPostManagementService.findEmbeddedPostByMessageId(messageId);
if(embeddedMessageOptional.isPresent()) {

View File

@@ -24,9 +24,9 @@ import dev.sheldan.abstracto.linkembed.model.MessageEmbedLink;
import dev.sheldan.abstracto.linkembed.model.database.EmbeddedMessage;
import dev.sheldan.abstracto.linkembed.service.management.MessageEmbedPostManagementService;
import lombok.extern.slf4j.Slf4j;
import net.dv8tion.jda.api.entities.GuildMessageChannel;
import net.dv8tion.jda.api.entities.Message;
import net.dv8tion.jda.api.entities.User;
import net.dv8tion.jda.api.entities.channel.middleman.GuildMessageChannel;
import net.dv8tion.jda.api.interactions.commands.CommandInteraction;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.beans.factory.annotation.Value;

View File

@@ -11,6 +11,8 @@ import dev.sheldan.abstracto.core.service.management.UserInServerManagementServi
import dev.sheldan.abstracto.linkembed.model.MessageEmbedLink;
import dev.sheldan.abstracto.linkembed.service.MessageEmbedService;
import net.dv8tion.jda.api.entities.*;
import net.dv8tion.jda.api.entities.channel.unions.GuildMessageChannelUnion;
import net.dv8tion.jda.api.entities.channel.unions.MessageChannelUnion;
import org.junit.Before;
import org.junit.Test;
import org.junit.runner.RunWith;
@@ -54,7 +56,10 @@ public class MessageEmbedListenerTest {
private Message message;
@Mock
private GuildMessageChannel textChannel;
private GuildMessageChannelUnion textChannel;
@Mock
private MessageChannelUnion messageChannelUnion;
@Mock
private MessageReceivedModel model;
@@ -77,7 +82,7 @@ public class MessageEmbedListenerTest {
when(guild.getIdLong()).thenReturn(FIRST_SERVER_ID);
when(model.getMessage()).thenReturn(message);
when(message.getGuild()).thenReturn(guild);
when(message.getChannel()).thenReturn(textChannel);
when(message.getChannel()).thenReturn(messageChannelUnion);
when(message.getMember()).thenReturn(member);
}

View File

@@ -12,6 +12,7 @@ import dev.sheldan.abstracto.core.service.MessageService;
import dev.sheldan.abstracto.linkembed.model.database.EmbeddedMessage;
import dev.sheldan.abstracto.linkembed.service.management.MessageEmbedPostManagementService;
import net.dv8tion.jda.api.entities.MessageReaction;
import net.dv8tion.jda.api.entities.emoji.EmojiUnion;
import org.junit.Test;
import org.junit.runner.RunWith;
import org.mockito.InjectMocks;
@@ -46,7 +47,7 @@ public class MessageEmbedRemovalReactionListenerTest {
private MessageReaction messageReaction;
@Mock
private MessageReaction.ReactionEmote reactionEmote;
private EmojiUnion reactionEmote;
@Mock
private AUserInAServer embeddingUser;
@@ -119,7 +120,7 @@ public class MessageEmbedRemovalReactionListenerTest {
when(cachedMessage.getMessageId()).thenReturn(MESSAGE_ID);
AEmote reactedEmote = Mockito.mock(AEmote.class);
when(emoteService.getEmoteOrDefaultEmote(MessageEmbedRemovalReactionListener.REMOVAL_EMOTE, SERVER_ID)).thenReturn(reactedEmote);
when(messageReaction.getReactionEmote()).thenReturn(reactionEmote);
when(messageReaction.getEmoji()).thenReturn(reactionEmote);
when(emoteService.isReactionEmoteAEmote(reactionEmote, reactedEmote)).thenReturn(true);
EmbeddedMessage message = Mockito.mock(EmbeddedMessage.class);
when(message.getEmbeddingUser()).thenReturn(embeddingUser);
@@ -143,7 +144,7 @@ public class MessageEmbedRemovalReactionListenerTest {
when(cachedMessage.getMessageId()).thenReturn(MESSAGE_ID);
AEmote reactedEmote = Mockito.mock(AEmote.class);
when(emoteService.getEmoteOrDefaultEmote(MessageEmbedRemovalReactionListener.REMOVAL_EMOTE, SERVER_ID)).thenReturn(reactedEmote);
when(messageReaction.getReactionEmote()).thenReturn(reactionEmote);
when(messageReaction.getEmoji()).thenReturn(reactionEmote);
when(emoteService.isReactionEmoteAEmote(reactionEmote, reactedEmote)).thenReturn(wasCorrectEmote);
when(model.getMessage()).thenReturn(cachedMessage);
when(model.getReaction()).thenReturn(messageReaction);

View File

@@ -18,6 +18,7 @@ import dev.sheldan.abstracto.core.templating.service.TemplateService;
import dev.sheldan.abstracto.linkembed.model.MessageEmbedLink;
import dev.sheldan.abstracto.linkembed.service.management.MessageEmbedPostManagementService;
import net.dv8tion.jda.api.entities.*;
import net.dv8tion.jda.api.entities.channel.middleman.GuildMessageChannel;
import org.junit.Assert;
import org.junit.Test;
import org.junit.runner.RunWith;

View File

@@ -13,8 +13,8 @@ import dev.sheldan.abstracto.linkembed.model.database.EmbeddedMessage;
import dev.sheldan.abstracto.linkembed.repository.EmbeddedMessageRepository;
import net.dv8tion.jda.api.entities.Guild;
import net.dv8tion.jda.api.entities.Message;
import net.dv8tion.jda.api.entities.MessageChannel;
import net.dv8tion.jda.api.entities.User;
import net.dv8tion.jda.api.entities.channel.unions.MessageChannelUnion;
import org.junit.Assert;
import org.junit.Test;
import org.junit.runner.RunWith;
@@ -69,7 +69,7 @@ public class MessageEmbedPostManagementServiceBeanTest {
when(cachedAuthor.getAuthorId()).thenReturn(EMBEDDED_USER_ID);
when(cachedMessage.getAuthor()).thenReturn(cachedAuthor);
Message embeddingMessage = Mockito.mock(Message.class);
MessageChannel embeddingChannel = Mockito.mock(MessageChannel.class);
MessageChannelUnion embeddingChannel = Mockito.mock(MessageChannelUnion.class);
when(embeddingChannel.getIdLong()).thenReturn(EMBEDDING_CHANNEL_ID);
when(embeddingMessage.getChannel()).thenReturn(embeddingChannel);
User embeddingJdaUser = Mockito.mock(User.class);