mirror of
https://github.com/Sheldan/abstracto.git
synced 2026-03-27 14:23:56 +00:00
[AB-8] upgrading to new JDA alpha version 19
cleaning up imports
This commit is contained in:
@@ -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()) {
|
||||
|
||||
@@ -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;
|
||||
|
||||
@@ -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);
|
||||
}
|
||||
|
||||
|
||||
@@ -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);
|
||||
|
||||
@@ -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;
|
||||
|
||||
@@ -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);
|
||||
|
||||
Reference in New Issue
Block a user