mirror of
https://github.com/Sheldan/abstracto.git
synced 2026-06-16 23:33:48 +00:00
[AB-8] upgrading to new JDA alpha version 19
cleaning up imports
This commit is contained in:
@@ -7,8 +7,8 @@ import dev.sheldan.abstracto.core.listener.DefaultListenerResult;
|
|||||||
import dev.sheldan.abstracto.core.listener.async.jda.AsyncMessageReceivedListener;
|
import dev.sheldan.abstracto.core.listener.async.jda.AsyncMessageReceivedListener;
|
||||||
import dev.sheldan.abstracto.core.models.listener.MessageReceivedModel;
|
import dev.sheldan.abstracto.core.models.listener.MessageReceivedModel;
|
||||||
import lombok.extern.slf4j.Slf4j;
|
import lombok.extern.slf4j.Slf4j;
|
||||||
import net.dv8tion.jda.api.entities.ChannelType;
|
|
||||||
import net.dv8tion.jda.api.entities.Message;
|
import net.dv8tion.jda.api.entities.Message;
|
||||||
|
import net.dv8tion.jda.api.entities.channel.ChannelType;
|
||||||
import org.springframework.beans.factory.annotation.Autowired;
|
import org.springframework.beans.factory.annotation.Autowired;
|
||||||
import org.springframework.stereotype.Component;
|
import org.springframework.stereotype.Component;
|
||||||
|
|
||||||
|
|||||||
@@ -17,7 +17,7 @@ import dev.sheldan.abstracto.core.exception.EntityGuildMismatchException;
|
|||||||
import dev.sheldan.abstracto.core.models.database.AChannel;
|
import dev.sheldan.abstracto.core.models.database.AChannel;
|
||||||
import dev.sheldan.abstracto.core.service.management.ChannelManagementService;
|
import dev.sheldan.abstracto.core.service.management.ChannelManagementService;
|
||||||
import dev.sheldan.abstracto.core.service.management.ServerManagementService;
|
import dev.sheldan.abstracto.core.service.management.ServerManagementService;
|
||||||
import net.dv8tion.jda.api.entities.TextChannel;
|
import net.dv8tion.jda.api.entities.channel.concrete.TextChannel;
|
||||||
import org.springframework.beans.factory.annotation.Autowired;
|
import org.springframework.beans.factory.annotation.Autowired;
|
||||||
import org.springframework.stereotype.Component;
|
import org.springframework.stereotype.Component;
|
||||||
|
|
||||||
|
|||||||
@@ -12,7 +12,7 @@ import dev.sheldan.abstracto.core.config.FeatureDefinition;
|
|||||||
import dev.sheldan.abstracto.core.exception.EntityGuildMismatchException;
|
import dev.sheldan.abstracto.core.exception.EntityGuildMismatchException;
|
||||||
import dev.sheldan.abstracto.core.models.database.AServer;
|
import dev.sheldan.abstracto.core.models.database.AServer;
|
||||||
import dev.sheldan.abstracto.core.service.management.ServerManagementService;
|
import dev.sheldan.abstracto.core.service.management.ServerManagementService;
|
||||||
import net.dv8tion.jda.api.entities.TextChannel;
|
import net.dv8tion.jda.api.entities.channel.concrete.TextChannel;
|
||||||
import org.springframework.beans.factory.annotation.Autowired;
|
import org.springframework.beans.factory.annotation.Autowired;
|
||||||
import org.springframework.stereotype.Component;
|
import org.springframework.stereotype.Component;
|
||||||
|
|
||||||
@@ -48,8 +48,18 @@ public class MoveAssignableRolePlace extends AbstractConditionableCommand {
|
|||||||
|
|
||||||
@Override
|
@Override
|
||||||
public CommandConfiguration getConfiguration() {
|
public CommandConfiguration getConfiguration() {
|
||||||
Parameter rolePostName = Parameter.builder().name("name").type(String.class).templated(true).build();
|
Parameter rolePostName = Parameter
|
||||||
Parameter channel = Parameter.builder().name("channel").type(TextChannel.class).templated(true).build();
|
.builder()
|
||||||
|
.name("name")
|
||||||
|
.type(String.class)
|
||||||
|
.templated(true)
|
||||||
|
.build();
|
||||||
|
Parameter channel = Parameter
|
||||||
|
.builder()
|
||||||
|
.name("channel")
|
||||||
|
.type(TextChannel.class)
|
||||||
|
.templated(true)
|
||||||
|
.build();
|
||||||
List<Parameter> parameters = Arrays.asList(rolePostName, channel);
|
List<Parameter> parameters = Arrays.asList(rolePostName, channel);
|
||||||
HelpInfo helpInfo = HelpInfo.builder().templated(true).build();
|
HelpInfo helpInfo = HelpInfo.builder().templated(true).build();
|
||||||
return CommandConfiguration.builder()
|
return CommandConfiguration.builder()
|
||||||
|
|||||||
@@ -27,6 +27,8 @@ import dev.sheldan.abstracto.core.templating.model.MessageToSend;
|
|||||||
import dev.sheldan.abstracto.core.templating.service.TemplateService;
|
import dev.sheldan.abstracto.core.templating.service.TemplateService;
|
||||||
import lombok.extern.slf4j.Slf4j;
|
import lombok.extern.slf4j.Slf4j;
|
||||||
import net.dv8tion.jda.api.entities.*;
|
import net.dv8tion.jda.api.entities.*;
|
||||||
|
import net.dv8tion.jda.api.entities.channel.concrete.TextChannel;
|
||||||
|
import net.dv8tion.jda.api.entities.channel.middleman.GuildMessageChannel;
|
||||||
import net.dv8tion.jda.api.interactions.components.buttons.ButtonStyle;
|
import net.dv8tion.jda.api.interactions.components.buttons.ButtonStyle;
|
||||||
import org.apache.commons.lang3.BooleanUtils;
|
import org.apache.commons.lang3.BooleanUtils;
|
||||||
import org.springframework.beans.factory.annotation.Autowired;
|
import org.springframework.beans.factory.annotation.Autowired;
|
||||||
@@ -117,7 +119,7 @@ public class AssignableRolePlaceServiceBean implements AssignableRolePlaceServic
|
|||||||
// it only may be unusable if its a custom emote
|
// it only may be unusable if its a custom emote
|
||||||
log.debug("Using custom emote {} to create assignable role {} for assignable role place {} in server {}.",
|
log.debug("Using custom emote {} to create assignable role {} for assignable role place {} in server {}.",
|
||||||
fakeEmote.getEmote().getId(), role.getId(), placeId, serverId);
|
fakeEmote.getEmote().getId(), role.getId(), placeId, serverId);
|
||||||
if (!emoteService.isEmoteUsableByBot(fakeEmote.getEmote()) && fakeEmote.getEmote().isAvailable()) {
|
if (!emoteService.isEmoteUsableByBot(fakeEmote.getEmote())) {
|
||||||
throw new EmoteNotUsableException(fakeEmote.getEmote());
|
throw new EmoteNotUsableException(fakeEmote.getEmote());
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -11,7 +11,7 @@ import dev.sheldan.abstracto.core.models.database.ARole;
|
|||||||
import dev.sheldan.abstracto.core.models.database.AServer;
|
import dev.sheldan.abstracto.core.models.database.AServer;
|
||||||
import net.dv8tion.jda.api.entities.Guild;
|
import net.dv8tion.jda.api.entities.Guild;
|
||||||
import net.dv8tion.jda.api.entities.Role;
|
import net.dv8tion.jda.api.entities.Role;
|
||||||
import net.dv8tion.jda.api.entities.TextChannel;
|
import net.dv8tion.jda.api.entities.channel.concrete.TextChannel;
|
||||||
|
|
||||||
import java.util.concurrent.CompletableFuture;
|
import java.util.concurrent.CompletableFuture;
|
||||||
|
|
||||||
|
|||||||
@@ -23,7 +23,6 @@ import java.time.Duration;
|
|||||||
import java.time.Instant;
|
import java.time.Instant;
|
||||||
import java.time.temporal.ChronoUnit;
|
import java.time.temporal.ChronoUnit;
|
||||||
import java.util.*;
|
import java.util.*;
|
||||||
import java.util.stream.Collectors;
|
|
||||||
|
|
||||||
import static dev.sheldan.abstracto.entertainment.config.EconomyFeatureConfig.PAYDAY_COOLDOWN_CONFIG_KEY;
|
import static dev.sheldan.abstracto.entertainment.config.EconomyFeatureConfig.PAYDAY_COOLDOWN_CONFIG_KEY;
|
||||||
import static dev.sheldan.abstracto.entertainment.config.EconomyFeatureConfig.SLOTS_COOLDOWN_CONFIG_KEY;
|
import static dev.sheldan.abstracto.entertainment.config.EconomyFeatureConfig.SLOTS_COOLDOWN_CONFIG_KEY;
|
||||||
|
|||||||
@@ -11,7 +11,6 @@ import net.dv8tion.jda.api.entities.Member;
|
|||||||
import org.junit.Assert;
|
import org.junit.Assert;
|
||||||
import org.junit.Test;
|
import org.junit.Test;
|
||||||
import org.junit.runner.RunWith;
|
import org.junit.runner.RunWith;
|
||||||
import org.mockito.ArgumentMatchers;
|
|
||||||
import org.mockito.InjectMocks;
|
import org.mockito.InjectMocks;
|
||||||
import org.mockito.Mock;
|
import org.mockito.Mock;
|
||||||
import org.mockito.Mockito;
|
import org.mockito.Mockito;
|
||||||
@@ -20,7 +19,6 @@ import org.springframework.core.io.Resource;
|
|||||||
|
|
||||||
import java.io.ByteArrayInputStream;
|
import java.io.ByteArrayInputStream;
|
||||||
import java.io.IOException;
|
import java.io.IOException;
|
||||||
import java.io.Reader;
|
|
||||||
import java.security.SecureRandom;
|
import java.security.SecureRandom;
|
||||||
import java.util.Arrays;
|
import java.util.Arrays;
|
||||||
import java.util.HashMap;
|
import java.util.HashMap;
|
||||||
|
|||||||
@@ -1,7 +1,6 @@
|
|||||||
package dev.sheldan.abstracto.entertainment.exception;
|
package dev.sheldan.abstracto.entertainment.exception;
|
||||||
|
|
||||||
import dev.sheldan.abstracto.core.exception.AbstractoTemplatableException;
|
import dev.sheldan.abstracto.core.exception.AbstractoTemplatableException;
|
||||||
import dev.sheldan.abstracto.entertainment.model.exception.PayDayCooldownExceptionModel;
|
|
||||||
import dev.sheldan.abstracto.entertainment.model.exception.SlotsCooldownExceptionModel;
|
import dev.sheldan.abstracto.entertainment.model.exception.SlotsCooldownExceptionModel;
|
||||||
|
|
||||||
import java.time.Duration;
|
import java.time.Duration;
|
||||||
|
|||||||
@@ -20,7 +20,7 @@ import dev.sheldan.abstracto.core.templating.service.TemplateService;
|
|||||||
import lombok.extern.slf4j.Slf4j;
|
import lombok.extern.slf4j.Slf4j;
|
||||||
import net.dv8tion.jda.api.entities.Member;
|
import net.dv8tion.jda.api.entities.Member;
|
||||||
import net.dv8tion.jda.api.entities.Message;
|
import net.dv8tion.jda.api.entities.Message;
|
||||||
import net.dv8tion.jda.api.entities.MessageChannel;
|
import net.dv8tion.jda.api.entities.channel.middleman.MessageChannel;
|
||||||
import org.springframework.beans.factory.annotation.Autowired;
|
import org.springframework.beans.factory.annotation.Autowired;
|
||||||
import org.springframework.stereotype.Component;
|
import org.springframework.stereotype.Component;
|
||||||
import org.springframework.transaction.annotation.Transactional;
|
import org.springframework.transaction.annotation.Transactional;
|
||||||
@@ -289,7 +289,7 @@ public class AUserExperienceServiceBean implements AUserExperienceService {
|
|||||||
* Persists the list of {@link ExperienceGainResult results} in the database. If the creation of {@link AUserExperience userExperience} object was requested,
|
* Persists the list of {@link ExperienceGainResult results} in the database. If the creation of {@link AUserExperience userExperience} object was requested,
|
||||||
* this will happen here, also the correct level is selected
|
* this will happen here, also the correct level is selected
|
||||||
* @param resultFutures A list of {@link ExperienceGainResult results} which define what should be changed for the given {@link AUserExperience userExperience} object:
|
* @param resultFutures A list of {@link ExperienceGainResult results} which define what should be changed for the given {@link AUserExperience userExperience} object:
|
||||||
* The level, experience, experienceRole, message account could change, or the object could not even exist ({@link ExperienceGainResult#createUserExperience})
|
* The level, experience, experienceRole, message account could change, or the object could not even exist
|
||||||
*/
|
*/
|
||||||
@Transactional
|
@Transactional
|
||||||
public void persistExperienceChanges(List<ExperienceGainResult> resultFutures) {
|
public void persistExperienceChanges(List<ExperienceGainResult> resultFutures) {
|
||||||
|
|||||||
@@ -6,11 +6,9 @@ import dev.sheldan.abstracto.core.models.database.AUserInAServer;
|
|||||||
import dev.sheldan.abstracto.core.service.MemberService;
|
import dev.sheldan.abstracto.core.service.MemberService;
|
||||||
import dev.sheldan.abstracto.experience.model.LeaderBoard;
|
import dev.sheldan.abstracto.experience.model.LeaderBoard;
|
||||||
import dev.sheldan.abstracto.experience.model.LeaderBoardEntry;
|
import dev.sheldan.abstracto.experience.model.LeaderBoardEntry;
|
||||||
import dev.sheldan.abstracto.experience.model.database.AExperienceLevel;
|
|
||||||
import dev.sheldan.abstracto.experience.model.database.AUserExperience;
|
import dev.sheldan.abstracto.experience.model.database.AUserExperience;
|
||||||
import dev.sheldan.abstracto.experience.model.template.LeaderBoardEntryModel;
|
import dev.sheldan.abstracto.experience.model.template.LeaderBoardEntryModel;
|
||||||
import net.dv8tion.jda.api.entities.Member;
|
import net.dv8tion.jda.api.entities.Member;
|
||||||
import org.hibernate.event.spi.ClearEventListener;
|
|
||||||
import org.junit.Assert;
|
import org.junit.Assert;
|
||||||
import org.junit.Test;
|
import org.junit.Test;
|
||||||
import org.junit.runner.RunWith;
|
import org.junit.runner.RunWith;
|
||||||
|
|||||||
@@ -5,9 +5,9 @@ import dev.sheldan.abstracto.core.models.listener.MessageReceivedModel;
|
|||||||
import dev.sheldan.abstracto.core.service.management.UserInServerManagementService;
|
import dev.sheldan.abstracto.core.service.management.UserInServerManagementService;
|
||||||
import dev.sheldan.abstracto.experience.service.AUserExperienceService;
|
import dev.sheldan.abstracto.experience.service.AUserExperienceService;
|
||||||
import net.dv8tion.jda.api.entities.Message;
|
import net.dv8tion.jda.api.entities.Message;
|
||||||
import net.dv8tion.jda.api.entities.MessageChannel;
|
|
||||||
import net.dv8tion.jda.api.entities.MessageType;
|
import net.dv8tion.jda.api.entities.MessageType;
|
||||||
import net.dv8tion.jda.api.entities.User;
|
import net.dv8tion.jda.api.entities.User;
|
||||||
|
import net.dv8tion.jda.api.entities.channel.unions.MessageChannelUnion;
|
||||||
import org.junit.Test;
|
import org.junit.Test;
|
||||||
import org.junit.runner.RunWith;
|
import org.junit.runner.RunWith;
|
||||||
import org.mockito.InjectMocks;
|
import org.mockito.InjectMocks;
|
||||||
@@ -44,7 +44,7 @@ public class ExperienceTrackerListenerTest {
|
|||||||
Message mockedMessage = Mockito.mock(Message.class);
|
Message mockedMessage = Mockito.mock(Message.class);
|
||||||
when(mockedMessage.isFromGuild()).thenReturn(true);
|
when(mockedMessage.isFromGuild()).thenReturn(true);
|
||||||
when(mockedMessage.isWebhookMessage()).thenReturn(false);
|
when(mockedMessage.isWebhookMessage()).thenReturn(false);
|
||||||
MessageChannel channel = Mockito.mock(MessageChannel.class);
|
MessageChannelUnion channel = Mockito.mock(MessageChannelUnion.class);
|
||||||
MessageType type = MessageType.DEFAULT;
|
MessageType type = MessageType.DEFAULT;
|
||||||
when(mockedMessage.getType()).thenReturn(type);
|
when(mockedMessage.getType()).thenReturn(type);
|
||||||
when(userInServerManagementService.loadOrCreateUser(SERVER_ID, USER_ID)).thenReturn(userInAServer);
|
when(userInServerManagementService.loadOrCreateUser(SERVER_ID, USER_ID)).thenReturn(userInAServer);
|
||||||
|
|||||||
@@ -1,7 +1,6 @@
|
|||||||
package dev.sheldan.abstracto.experience.listener;
|
package dev.sheldan.abstracto.experience.listener;
|
||||||
|
|
||||||
import dev.sheldan.abstracto.core.listener.DefaultListenerResult;
|
import dev.sheldan.abstracto.core.listener.DefaultListenerResult;
|
||||||
import dev.sheldan.abstracto.core.listener.ListenerExecutionResult;
|
|
||||||
import dev.sheldan.abstracto.core.models.ServerUser;
|
import dev.sheldan.abstracto.core.models.ServerUser;
|
||||||
import dev.sheldan.abstracto.core.models.database.AUserInAServer;
|
import dev.sheldan.abstracto.core.models.database.AUserInAServer;
|
||||||
import dev.sheldan.abstracto.core.models.listener.MemberJoinModel;
|
import dev.sheldan.abstracto.core.models.listener.MemberJoinModel;
|
||||||
|
|||||||
@@ -1,18 +1,13 @@
|
|||||||
package dev.sheldan.abstracto.experience.service;
|
package dev.sheldan.abstracto.experience.service;
|
||||||
|
|
||||||
import dev.sheldan.abstracto.core.models.database.AChannel;
|
|
||||||
import dev.sheldan.abstracto.core.models.database.ARole;
|
import dev.sheldan.abstracto.core.models.database.ARole;
|
||||||
import dev.sheldan.abstracto.core.models.database.AServer;
|
import dev.sheldan.abstracto.core.models.database.AServer;
|
||||||
import dev.sheldan.abstracto.core.service.management.ChannelManagementService;
|
import dev.sheldan.abstracto.core.service.management.ChannelManagementService;
|
||||||
import dev.sheldan.abstracto.core.service.management.RoleManagementService;
|
import dev.sheldan.abstracto.core.service.management.RoleManagementService;
|
||||||
import dev.sheldan.abstracto.core.utils.CompletableFutureList;
|
|
||||||
import dev.sheldan.abstracto.experience.model.RoleCalculationResult;
|
|
||||||
import dev.sheldan.abstracto.experience.model.database.AExperienceLevel;
|
import dev.sheldan.abstracto.experience.model.database.AExperienceLevel;
|
||||||
import dev.sheldan.abstracto.experience.model.database.AExperienceRole;
|
import dev.sheldan.abstracto.experience.model.database.AExperienceRole;
|
||||||
import dev.sheldan.abstracto.experience.model.database.AUserExperience;
|
|
||||||
import dev.sheldan.abstracto.experience.service.management.ExperienceLevelManagementService;
|
import dev.sheldan.abstracto.experience.service.management.ExperienceLevelManagementService;
|
||||||
import dev.sheldan.abstracto.experience.service.management.ExperienceRoleManagementService;
|
import dev.sheldan.abstracto.experience.service.management.ExperienceRoleManagementService;
|
||||||
import net.dv8tion.jda.api.entities.Role;
|
|
||||||
import org.junit.Assert;
|
import org.junit.Assert;
|
||||||
import org.junit.Test;
|
import org.junit.Test;
|
||||||
import org.junit.runner.RunWith;
|
import org.junit.runner.RunWith;
|
||||||
@@ -25,7 +20,6 @@ import java.util.ArrayList;
|
|||||||
import java.util.Arrays;
|
import java.util.Arrays;
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
import java.util.Optional;
|
import java.util.Optional;
|
||||||
import java.util.concurrent.CompletableFuture;
|
|
||||||
|
|
||||||
import static org.mockito.Mockito.*;
|
import static org.mockito.Mockito.*;
|
||||||
|
|
||||||
|
|||||||
@@ -16,7 +16,6 @@ import java.util.Arrays;
|
|||||||
import java.util.List;
|
import java.util.List;
|
||||||
import java.util.Optional;
|
import java.util.Optional;
|
||||||
|
|
||||||
import static org.mockito.ArgumentMatchers.any;
|
|
||||||
import static org.mockito.Mockito.*;
|
import static org.mockito.Mockito.*;
|
||||||
|
|
||||||
@RunWith(MockitoJUnitRunner.class)
|
@RunWith(MockitoJUnitRunner.class)
|
||||||
|
|||||||
@@ -11,7 +11,7 @@ import dev.sheldan.abstracto.experience.model.ServerExperience;
|
|||||||
import dev.sheldan.abstracto.experience.model.database.AExperienceLevel;
|
import dev.sheldan.abstracto.experience.model.database.AExperienceLevel;
|
||||||
import dev.sheldan.abstracto.experience.model.database.AExperienceRole;
|
import dev.sheldan.abstracto.experience.model.database.AExperienceRole;
|
||||||
import dev.sheldan.abstracto.experience.model.database.AUserExperience;
|
import dev.sheldan.abstracto.experience.model.database.AUserExperience;
|
||||||
import net.dv8tion.jda.api.entities.MessageChannel;
|
import net.dv8tion.jda.api.entities.channel.middleman.MessageChannel;
|
||||||
|
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
import java.util.concurrent.CompletableFuture;
|
import java.util.concurrent.CompletableFuture;
|
||||||
|
|||||||
@@ -29,7 +29,7 @@ import net.dv8tion.jda.api.JDA;
|
|||||||
import net.dv8tion.jda.api.entities.Invite;
|
import net.dv8tion.jda.api.entities.Invite;
|
||||||
import net.dv8tion.jda.api.entities.Member;
|
import net.dv8tion.jda.api.entities.Member;
|
||||||
import net.dv8tion.jda.api.entities.Message;
|
import net.dv8tion.jda.api.entities.Message;
|
||||||
import net.dv8tion.jda.api.entities.MessageChannel;
|
import net.dv8tion.jda.api.entities.channel.middleman.MessageChannel;
|
||||||
import org.springframework.beans.factory.annotation.Autowired;
|
import org.springframework.beans.factory.annotation.Autowired;
|
||||||
import org.springframework.stereotype.Component;
|
import org.springframework.stereotype.Component;
|
||||||
import org.springframework.transaction.annotation.Transactional;
|
import org.springframework.transaction.annotation.Transactional;
|
||||||
|
|||||||
@@ -5,12 +5,10 @@ import dev.sheldan.abstracto.core.command.execution.CommandResult;
|
|||||||
import dev.sheldan.abstracto.core.test.command.CommandConfigValidator;
|
import dev.sheldan.abstracto.core.test.command.CommandConfigValidator;
|
||||||
import dev.sheldan.abstracto.core.test.command.CommandTestUtilities;
|
import dev.sheldan.abstracto.core.test.command.CommandTestUtilities;
|
||||||
import dev.sheldan.abstracto.invitefilter.service.InviteLinkFilterService;
|
import dev.sheldan.abstracto.invitefilter.service.InviteLinkFilterService;
|
||||||
import net.dv8tion.jda.api.entities.Guild;
|
|
||||||
import org.junit.Test;
|
import org.junit.Test;
|
||||||
import org.junit.runner.RunWith;
|
import org.junit.runner.RunWith;
|
||||||
import org.mockito.InjectMocks;
|
import org.mockito.InjectMocks;
|
||||||
import org.mockito.Mock;
|
import org.mockito.Mock;
|
||||||
import org.mockito.Mockito;
|
|
||||||
import org.mockito.junit.MockitoJUnitRunner;
|
import org.mockito.junit.MockitoJUnitRunner;
|
||||||
|
|
||||||
import java.util.Arrays;
|
import java.util.Arrays;
|
||||||
|
|||||||
@@ -6,14 +6,13 @@ import dev.sheldan.abstracto.invitefilter.service.InviteLinkFilterService;
|
|||||||
import dev.sheldan.abstracto.invitefilter.service.InviteLinkFilterServiceBean;
|
import dev.sheldan.abstracto.invitefilter.service.InviteLinkFilterServiceBean;
|
||||||
import net.dv8tion.jda.api.entities.Member;
|
import net.dv8tion.jda.api.entities.Member;
|
||||||
import net.dv8tion.jda.api.entities.Message;
|
import net.dv8tion.jda.api.entities.Message;
|
||||||
import net.dv8tion.jda.api.entities.MessageChannel;
|
|
||||||
import net.dv8tion.jda.api.entities.MessageType;
|
import net.dv8tion.jda.api.entities.MessageType;
|
||||||
|
import net.dv8tion.jda.api.entities.channel.unions.MessageChannelUnion;
|
||||||
import org.junit.Assert;
|
import org.junit.Assert;
|
||||||
import org.junit.Test;
|
import org.junit.Test;
|
||||||
import org.junit.runner.RunWith;
|
import org.junit.runner.RunWith;
|
||||||
import org.mockito.InjectMocks;
|
import org.mockito.InjectMocks;
|
||||||
import org.mockito.Mock;
|
import org.mockito.Mock;
|
||||||
import org.mockito.Mockito;
|
|
||||||
import org.mockito.junit.MockitoJUnitRunner;
|
import org.mockito.junit.MockitoJUnitRunner;
|
||||||
|
|
||||||
import java.util.ArrayList;
|
import java.util.ArrayList;
|
||||||
@@ -37,7 +36,7 @@ public class InviteLinkFilterListenerTest {
|
|||||||
private Member member;
|
private Member member;
|
||||||
|
|
||||||
@Mock
|
@Mock
|
||||||
private MessageChannel messageChannel;
|
private MessageChannelUnion messageChannel;
|
||||||
|
|
||||||
@Mock
|
@Mock
|
||||||
private InviteLinkFilterServiceBean filterServiceBean;
|
private InviteLinkFilterServiceBean filterServiceBean;
|
||||||
|
|||||||
@@ -4,6 +4,7 @@ import lombok.Builder;
|
|||||||
import lombok.Getter;
|
import lombok.Getter;
|
||||||
import lombok.Setter;
|
import lombok.Setter;
|
||||||
import net.dv8tion.jda.api.entities.*;
|
import net.dv8tion.jda.api.entities.*;
|
||||||
|
import net.dv8tion.jda.api.entities.channel.middleman.MessageChannel;
|
||||||
|
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
|
|
||||||
|
|||||||
@@ -6,7 +6,7 @@ import net.dv8tion.jda.api.JDA;
|
|||||||
import net.dv8tion.jda.api.entities.Invite;
|
import net.dv8tion.jda.api.entities.Invite;
|
||||||
import net.dv8tion.jda.api.entities.Member;
|
import net.dv8tion.jda.api.entities.Member;
|
||||||
import net.dv8tion.jda.api.entities.Message;
|
import net.dv8tion.jda.api.entities.Message;
|
||||||
import net.dv8tion.jda.api.entities.MessageChannel;
|
import net.dv8tion.jda.api.entities.channel.middleman.MessageChannel;
|
||||||
|
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
import java.util.concurrent.CompletableFuture;
|
import java.util.concurrent.CompletableFuture;
|
||||||
|
|||||||
@@ -43,7 +43,7 @@ public class MessageEmbedRemovalReactionListener implements AsyncReactionAddedLi
|
|||||||
public DefaultListenerResult execute(ReactionAddedModel model) {
|
public DefaultListenerResult execute(ReactionAddedModel model) {
|
||||||
Long serverId = model.getServerId();
|
Long serverId = model.getServerId();
|
||||||
AEmote aEmote = emoteService.getEmoteOrDefaultEmote(REMOVAL_EMOTE, serverId);
|
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();
|
Long messageId = model.getMessage().getMessageId();
|
||||||
Optional<EmbeddedMessage> embeddedMessageOptional = messageEmbedPostManagementService.findEmbeddedPostByMessageId(messageId);
|
Optional<EmbeddedMessage> embeddedMessageOptional = messageEmbedPostManagementService.findEmbeddedPostByMessageId(messageId);
|
||||||
if(embeddedMessageOptional.isPresent()) {
|
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.model.database.EmbeddedMessage;
|
||||||
import dev.sheldan.abstracto.linkembed.service.management.MessageEmbedPostManagementService;
|
import dev.sheldan.abstracto.linkembed.service.management.MessageEmbedPostManagementService;
|
||||||
import lombok.extern.slf4j.Slf4j;
|
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.Message;
|
||||||
import net.dv8tion.jda.api.entities.User;
|
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 net.dv8tion.jda.api.interactions.commands.CommandInteraction;
|
||||||
import org.springframework.beans.factory.annotation.Autowired;
|
import org.springframework.beans.factory.annotation.Autowired;
|
||||||
import org.springframework.beans.factory.annotation.Value;
|
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.model.MessageEmbedLink;
|
||||||
import dev.sheldan.abstracto.linkembed.service.MessageEmbedService;
|
import dev.sheldan.abstracto.linkembed.service.MessageEmbedService;
|
||||||
import net.dv8tion.jda.api.entities.*;
|
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.Before;
|
||||||
import org.junit.Test;
|
import org.junit.Test;
|
||||||
import org.junit.runner.RunWith;
|
import org.junit.runner.RunWith;
|
||||||
@@ -54,7 +56,10 @@ public class MessageEmbedListenerTest {
|
|||||||
private Message message;
|
private Message message;
|
||||||
|
|
||||||
@Mock
|
@Mock
|
||||||
private GuildMessageChannel textChannel;
|
private GuildMessageChannelUnion textChannel;
|
||||||
|
|
||||||
|
@Mock
|
||||||
|
private MessageChannelUnion messageChannelUnion;
|
||||||
|
|
||||||
@Mock
|
@Mock
|
||||||
private MessageReceivedModel model;
|
private MessageReceivedModel model;
|
||||||
@@ -77,7 +82,7 @@ public class MessageEmbedListenerTest {
|
|||||||
when(guild.getIdLong()).thenReturn(FIRST_SERVER_ID);
|
when(guild.getIdLong()).thenReturn(FIRST_SERVER_ID);
|
||||||
when(model.getMessage()).thenReturn(message);
|
when(model.getMessage()).thenReturn(message);
|
||||||
when(message.getGuild()).thenReturn(guild);
|
when(message.getGuild()).thenReturn(guild);
|
||||||
when(message.getChannel()).thenReturn(textChannel);
|
when(message.getChannel()).thenReturn(messageChannelUnion);
|
||||||
when(message.getMember()).thenReturn(member);
|
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.model.database.EmbeddedMessage;
|
||||||
import dev.sheldan.abstracto.linkembed.service.management.MessageEmbedPostManagementService;
|
import dev.sheldan.abstracto.linkembed.service.management.MessageEmbedPostManagementService;
|
||||||
import net.dv8tion.jda.api.entities.MessageReaction;
|
import net.dv8tion.jda.api.entities.MessageReaction;
|
||||||
|
import net.dv8tion.jda.api.entities.emoji.EmojiUnion;
|
||||||
import org.junit.Test;
|
import org.junit.Test;
|
||||||
import org.junit.runner.RunWith;
|
import org.junit.runner.RunWith;
|
||||||
import org.mockito.InjectMocks;
|
import org.mockito.InjectMocks;
|
||||||
@@ -46,7 +47,7 @@ public class MessageEmbedRemovalReactionListenerTest {
|
|||||||
private MessageReaction messageReaction;
|
private MessageReaction messageReaction;
|
||||||
|
|
||||||
@Mock
|
@Mock
|
||||||
private MessageReaction.ReactionEmote reactionEmote;
|
private EmojiUnion reactionEmote;
|
||||||
|
|
||||||
@Mock
|
@Mock
|
||||||
private AUserInAServer embeddingUser;
|
private AUserInAServer embeddingUser;
|
||||||
@@ -119,7 +120,7 @@ public class MessageEmbedRemovalReactionListenerTest {
|
|||||||
when(cachedMessage.getMessageId()).thenReturn(MESSAGE_ID);
|
when(cachedMessage.getMessageId()).thenReturn(MESSAGE_ID);
|
||||||
AEmote reactedEmote = Mockito.mock(AEmote.class);
|
AEmote reactedEmote = Mockito.mock(AEmote.class);
|
||||||
when(emoteService.getEmoteOrDefaultEmote(MessageEmbedRemovalReactionListener.REMOVAL_EMOTE, SERVER_ID)).thenReturn(reactedEmote);
|
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);
|
when(emoteService.isReactionEmoteAEmote(reactionEmote, reactedEmote)).thenReturn(true);
|
||||||
EmbeddedMessage message = Mockito.mock(EmbeddedMessage.class);
|
EmbeddedMessage message = Mockito.mock(EmbeddedMessage.class);
|
||||||
when(message.getEmbeddingUser()).thenReturn(embeddingUser);
|
when(message.getEmbeddingUser()).thenReturn(embeddingUser);
|
||||||
@@ -143,7 +144,7 @@ public class MessageEmbedRemovalReactionListenerTest {
|
|||||||
when(cachedMessage.getMessageId()).thenReturn(MESSAGE_ID);
|
when(cachedMessage.getMessageId()).thenReturn(MESSAGE_ID);
|
||||||
AEmote reactedEmote = Mockito.mock(AEmote.class);
|
AEmote reactedEmote = Mockito.mock(AEmote.class);
|
||||||
when(emoteService.getEmoteOrDefaultEmote(MessageEmbedRemovalReactionListener.REMOVAL_EMOTE, SERVER_ID)).thenReturn(reactedEmote);
|
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(emoteService.isReactionEmoteAEmote(reactionEmote, reactedEmote)).thenReturn(wasCorrectEmote);
|
||||||
when(model.getMessage()).thenReturn(cachedMessage);
|
when(model.getMessage()).thenReturn(cachedMessage);
|
||||||
when(model.getReaction()).thenReturn(messageReaction);
|
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.model.MessageEmbedLink;
|
||||||
import dev.sheldan.abstracto.linkembed.service.management.MessageEmbedPostManagementService;
|
import dev.sheldan.abstracto.linkembed.service.management.MessageEmbedPostManagementService;
|
||||||
import net.dv8tion.jda.api.entities.*;
|
import net.dv8tion.jda.api.entities.*;
|
||||||
|
import net.dv8tion.jda.api.entities.channel.middleman.GuildMessageChannel;
|
||||||
import org.junit.Assert;
|
import org.junit.Assert;
|
||||||
import org.junit.Test;
|
import org.junit.Test;
|
||||||
import org.junit.runner.RunWith;
|
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 dev.sheldan.abstracto.linkembed.repository.EmbeddedMessageRepository;
|
||||||
import net.dv8tion.jda.api.entities.Guild;
|
import net.dv8tion.jda.api.entities.Guild;
|
||||||
import net.dv8tion.jda.api.entities.Message;
|
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.User;
|
||||||
|
import net.dv8tion.jda.api.entities.channel.unions.MessageChannelUnion;
|
||||||
import org.junit.Assert;
|
import org.junit.Assert;
|
||||||
import org.junit.Test;
|
import org.junit.Test;
|
||||||
import org.junit.runner.RunWith;
|
import org.junit.runner.RunWith;
|
||||||
@@ -69,7 +69,7 @@ public class MessageEmbedPostManagementServiceBeanTest {
|
|||||||
when(cachedAuthor.getAuthorId()).thenReturn(EMBEDDED_USER_ID);
|
when(cachedAuthor.getAuthorId()).thenReturn(EMBEDDED_USER_ID);
|
||||||
when(cachedMessage.getAuthor()).thenReturn(cachedAuthor);
|
when(cachedMessage.getAuthor()).thenReturn(cachedAuthor);
|
||||||
Message embeddingMessage = Mockito.mock(Message.class);
|
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(embeddingChannel.getIdLong()).thenReturn(EMBEDDING_CHANNEL_ID);
|
||||||
when(embeddingMessage.getChannel()).thenReturn(embeddingChannel);
|
when(embeddingMessage.getChannel()).thenReturn(embeddingChannel);
|
||||||
User embeddingJdaUser = Mockito.mock(User.class);
|
User embeddingJdaUser = Mockito.mock(User.class);
|
||||||
|
|||||||
@@ -6,9 +6,9 @@ import dev.sheldan.abstracto.core.interaction.button.ButtonConfigModel;
|
|||||||
import lombok.Getter;
|
import lombok.Getter;
|
||||||
import lombok.Setter;
|
import lombok.Setter;
|
||||||
import lombok.experimental.SuperBuilder;
|
import lombok.experimental.SuperBuilder;
|
||||||
import net.dv8tion.jda.api.entities.GuildMessageChannel;
|
|
||||||
import net.dv8tion.jda.api.entities.Member;
|
import net.dv8tion.jda.api.entities.Member;
|
||||||
import net.dv8tion.jda.api.entities.User;
|
import net.dv8tion.jda.api.entities.User;
|
||||||
|
import net.dv8tion.jda.api.entities.channel.middleman.GuildMessageChannel;
|
||||||
|
|
||||||
@Getter
|
@Getter
|
||||||
@Setter
|
@Setter
|
||||||
|
|||||||
@@ -3,7 +3,7 @@ package dev.sheldan.abstracto.linkembed.service;
|
|||||||
import dev.sheldan.abstracto.core.models.GuildMemberMessageChannel;
|
import dev.sheldan.abstracto.core.models.GuildMemberMessageChannel;
|
||||||
import dev.sheldan.abstracto.core.models.cache.CachedMessage;
|
import dev.sheldan.abstracto.core.models.cache.CachedMessage;
|
||||||
import dev.sheldan.abstracto.linkembed.model.MessageEmbedLink;
|
import dev.sheldan.abstracto.linkembed.model.MessageEmbedLink;
|
||||||
import net.dv8tion.jda.api.entities.GuildMessageChannel;
|
import net.dv8tion.jda.api.entities.channel.middleman.GuildMessageChannel;
|
||||||
import net.dv8tion.jda.api.interactions.commands.CommandInteraction;
|
import net.dv8tion.jda.api.interactions.commands.CommandInteraction;
|
||||||
|
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
|
|||||||
@@ -16,8 +16,8 @@ import dev.sheldan.abstracto.logging.config.LoggingPostTarget;
|
|||||||
import dev.sheldan.abstracto.logging.model.template.MessageDeletedAttachmentLog;
|
import dev.sheldan.abstracto.logging.model.template.MessageDeletedAttachmentLog;
|
||||||
import dev.sheldan.abstracto.logging.model.template.MessageDeletedLog;
|
import dev.sheldan.abstracto.logging.model.template.MessageDeletedLog;
|
||||||
import lombok.extern.slf4j.Slf4j;
|
import lombok.extern.slf4j.Slf4j;
|
||||||
import net.dv8tion.jda.api.entities.GuildMessageChannel;
|
|
||||||
import net.dv8tion.jda.api.entities.Member;
|
import net.dv8tion.jda.api.entities.Member;
|
||||||
|
import net.dv8tion.jda.api.entities.channel.middleman.GuildMessageChannel;
|
||||||
import org.springframework.beans.factory.annotation.Autowired;
|
import org.springframework.beans.factory.annotation.Autowired;
|
||||||
import org.springframework.stereotype.Component;
|
import org.springframework.stereotype.Component;
|
||||||
import org.springframework.transaction.annotation.Transactional;
|
import org.springframework.transaction.annotation.Transactional;
|
||||||
|
|||||||
@@ -17,9 +17,8 @@ import dev.sheldan.abstracto.logging.config.LoggingPostTarget;
|
|||||||
import dev.sheldan.abstracto.logging.model.template.MessageDeletedAttachmentLog;
|
import dev.sheldan.abstracto.logging.model.template.MessageDeletedAttachmentLog;
|
||||||
import dev.sheldan.abstracto.logging.model.template.MessageEditedLog;
|
import dev.sheldan.abstracto.logging.model.template.MessageEditedLog;
|
||||||
import lombok.extern.slf4j.Slf4j;
|
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.Message;
|
||||||
import net.dv8tion.jda.api.entities.TextChannel;
|
import net.dv8tion.jda.api.entities.channel.middleman.GuildMessageChannel;
|
||||||
import org.springframework.beans.factory.annotation.Autowired;
|
import org.springframework.beans.factory.annotation.Autowired;
|
||||||
import org.springframework.stereotype.Service;
|
import org.springframework.stereotype.Service;
|
||||||
|
|
||||||
|
|||||||
@@ -17,7 +17,7 @@ import dev.sheldan.abstracto.logging.model.template.MessageDeletedAttachmentLog;
|
|||||||
import dev.sheldan.abstracto.logging.model.template.MessageDeletedLog;
|
import dev.sheldan.abstracto.logging.model.template.MessageDeletedLog;
|
||||||
import net.dv8tion.jda.api.entities.Guild;
|
import net.dv8tion.jda.api.entities.Guild;
|
||||||
import net.dv8tion.jda.api.entities.Member;
|
import net.dv8tion.jda.api.entities.Member;
|
||||||
import net.dv8tion.jda.api.entities.TextChannel;
|
import net.dv8tion.jda.api.entities.channel.concrete.TextChannel;
|
||||||
import org.junit.Assert;
|
import org.junit.Assert;
|
||||||
import org.junit.Test;
|
import org.junit.Test;
|
||||||
import org.junit.runner.RunWith;
|
import org.junit.runner.RunWith;
|
||||||
|
|||||||
@@ -12,7 +12,7 @@ import dev.sheldan.abstracto.logging.model.template.MessageEditedLog;
|
|||||||
import net.dv8tion.jda.api.entities.Guild;
|
import net.dv8tion.jda.api.entities.Guild;
|
||||||
import net.dv8tion.jda.api.entities.Member;
|
import net.dv8tion.jda.api.entities.Member;
|
||||||
import net.dv8tion.jda.api.entities.Message;
|
import net.dv8tion.jda.api.entities.Message;
|
||||||
import net.dv8tion.jda.api.entities.TextChannel;
|
import net.dv8tion.jda.api.entities.channel.concrete.TextChannel;
|
||||||
import org.junit.Assert;
|
import org.junit.Assert;
|
||||||
import org.junit.Test;
|
import org.junit.Test;
|
||||||
import org.junit.runner.RunWith;
|
import org.junit.runner.RunWith;
|
||||||
|
|||||||
@@ -16,7 +16,7 @@ import dev.sheldan.abstracto.moderation.config.ModerationModuleDefinition;
|
|||||||
import dev.sheldan.abstracto.moderation.config.ModerationSlashCommandNames;
|
import dev.sheldan.abstracto.moderation.config.ModerationSlashCommandNames;
|
||||||
import dev.sheldan.abstracto.moderation.config.feature.ModerationFeatureDefinition;
|
import dev.sheldan.abstracto.moderation.config.feature.ModerationFeatureDefinition;
|
||||||
import dev.sheldan.abstracto.moderation.service.SlowModeService;
|
import dev.sheldan.abstracto.moderation.service.SlowModeService;
|
||||||
import net.dv8tion.jda.api.entities.TextChannel;
|
import net.dv8tion.jda.api.entities.channel.concrete.TextChannel;
|
||||||
import net.dv8tion.jda.api.events.interaction.command.SlashCommandInteractionEvent;
|
import net.dv8tion.jda.api.events.interaction.command.SlashCommandInteractionEvent;
|
||||||
import org.springframework.beans.factory.annotation.Autowired;
|
import org.springframework.beans.factory.annotation.Autowired;
|
||||||
import org.springframework.stereotype.Component;
|
import org.springframework.stereotype.Component;
|
||||||
|
|||||||
@@ -63,6 +63,7 @@ public class Warn extends AbstractConditionableCommand {
|
|||||||
.builder()
|
.builder()
|
||||||
.reason(reason)
|
.reason(reason)
|
||||||
.warnedMember(member)
|
.warnedMember(member)
|
||||||
|
.channel(commandContext.getChannel())
|
||||||
.member(commandContext.getAuthor())
|
.member(commandContext.getAuthor())
|
||||||
.guild(commandContext.getGuild())
|
.guild(commandContext.getGuild())
|
||||||
.message(commandContext.getMessage())
|
.message(commandContext.getMessage())
|
||||||
|
|||||||
@@ -3,13 +3,10 @@ package dev.sheldan.abstracto.moderation.listener;
|
|||||||
import dev.sheldan.abstracto.core.config.FeatureDefinition;
|
import dev.sheldan.abstracto.core.config.FeatureDefinition;
|
||||||
import dev.sheldan.abstracto.core.listener.DefaultListenerResult;
|
import dev.sheldan.abstracto.core.listener.DefaultListenerResult;
|
||||||
import dev.sheldan.abstracto.core.listener.async.jda.AsyncJoinListener;
|
import dev.sheldan.abstracto.core.listener.async.jda.AsyncJoinListener;
|
||||||
import dev.sheldan.abstracto.core.models.database.AUserInAServer;
|
|
||||||
import dev.sheldan.abstracto.core.models.listener.MemberJoinModel;
|
import dev.sheldan.abstracto.core.models.listener.MemberJoinModel;
|
||||||
import dev.sheldan.abstracto.core.service.MemberService;
|
import dev.sheldan.abstracto.core.service.MemberService;
|
||||||
import dev.sheldan.abstracto.core.service.management.UserInServerManagementService;
|
|
||||||
import dev.sheldan.abstracto.moderation.config.feature.ModerationFeatureDefinition;
|
import dev.sheldan.abstracto.moderation.config.feature.ModerationFeatureDefinition;
|
||||||
import dev.sheldan.abstracto.moderation.model.database.Mute;
|
import dev.sheldan.abstracto.moderation.model.database.Mute;
|
||||||
import dev.sheldan.abstracto.moderation.service.MuteService;
|
|
||||||
import dev.sheldan.abstracto.moderation.service.management.MuteManagementService;
|
import dev.sheldan.abstracto.moderation.service.management.MuteManagementService;
|
||||||
import lombok.extern.slf4j.Slf4j;
|
import lombok.extern.slf4j.Slf4j;
|
||||||
import org.springframework.beans.factory.annotation.Autowired;
|
import org.springframework.beans.factory.annotation.Autowired;
|
||||||
|
|||||||
@@ -44,7 +44,7 @@ public class ReactionReportListener implements AsyncReactionAddedListener {
|
|||||||
|
|
||||||
Long serverId = model.getServerId();
|
Long serverId = model.getServerId();
|
||||||
AEmote aEmote = emoteService.getEmoteOrDefaultEmote(ReactionReportService.REACTION_REPORT_EMOTE_KEY, serverId);
|
AEmote aEmote = emoteService.getEmoteOrDefaultEmote(ReactionReportService.REACTION_REPORT_EMOTE_KEY, serverId);
|
||||||
if(emoteService.isReactionEmoteAEmote(model.getReaction().getReactionEmote(), aEmote)) {
|
if(emoteService.isReactionEmoteAEmote(model.getReaction().getEmoji(), aEmote)) {
|
||||||
memberService.retrieveMemberInServer(model.getUserReacting())
|
memberService.retrieveMemberInServer(model.getUserReacting())
|
||||||
.thenCompose(member -> reactionService.removeReactionFromMessage(model.getReaction(), cachedMessage, member.getUser()))
|
.thenCompose(member -> reactionService.removeReactionFromMessage(model.getReaction(), cachedMessage, member.getUser()))
|
||||||
.thenAccept(unused -> log.info("Removed report reaction on message {} in server {} in channel {}.", cachedMessage.getMessageId(), serverId, cachedMessage.getChannelId()));
|
.thenAccept(unused -> log.info("Removed report reaction on message {} in server {} in channel {}.", cachedMessage.getMessageId(), serverId, cachedMessage.getChannelId()));
|
||||||
|
|||||||
@@ -19,9 +19,9 @@ import dev.sheldan.abstracto.moderation.service.BanService;
|
|||||||
import dev.sheldan.abstracto.moderation.service.BanServiceBean;
|
import dev.sheldan.abstracto.moderation.service.BanServiceBean;
|
||||||
import dev.sheldan.abstracto.moderation.service.management.InfractionManagementService;
|
import dev.sheldan.abstracto.moderation.service.management.InfractionManagementService;
|
||||||
import lombok.extern.slf4j.Slf4j;
|
import lombok.extern.slf4j.Slf4j;
|
||||||
import net.dv8tion.jda.api.entities.GuildMessageChannel;
|
|
||||||
import net.dv8tion.jda.api.entities.Member;
|
import net.dv8tion.jda.api.entities.Member;
|
||||||
import net.dv8tion.jda.api.entities.User;
|
import net.dv8tion.jda.api.entities.User;
|
||||||
|
import net.dv8tion.jda.api.entities.channel.middleman.GuildMessageChannel;
|
||||||
import org.springframework.beans.factory.annotation.Autowired;
|
import org.springframework.beans.factory.annotation.Autowired;
|
||||||
import org.springframework.stereotype.Component;
|
import org.springframework.stereotype.Component;
|
||||||
import org.springframework.transaction.annotation.Transactional;
|
import org.springframework.transaction.annotation.Transactional;
|
||||||
|
|||||||
@@ -20,8 +20,8 @@ import dev.sheldan.abstracto.moderation.service.management.InfractionManagementS
|
|||||||
import dev.sheldan.abstracto.moderation.service.management.WarnManagementService;
|
import dev.sheldan.abstracto.moderation.service.management.WarnManagementService;
|
||||||
import lombok.extern.slf4j.Slf4j;
|
import lombok.extern.slf4j.Slf4j;
|
||||||
import net.dv8tion.jda.api.entities.Guild;
|
import net.dv8tion.jda.api.entities.Guild;
|
||||||
import net.dv8tion.jda.api.entities.GuildMessageChannel;
|
|
||||||
import net.dv8tion.jda.api.entities.Member;
|
import net.dv8tion.jda.api.entities.Member;
|
||||||
|
import net.dv8tion.jda.api.entities.channel.middleman.GuildMessageChannel;
|
||||||
import org.springframework.beans.factory.annotation.Autowired;
|
import org.springframework.beans.factory.annotation.Autowired;
|
||||||
import org.springframework.stereotype.Component;
|
import org.springframework.stereotype.Component;
|
||||||
|
|
||||||
|
|||||||
@@ -25,6 +25,7 @@ import java.util.HashMap;
|
|||||||
import java.util.List;
|
import java.util.List;
|
||||||
import java.util.Map;
|
import java.util.Map;
|
||||||
import java.util.concurrent.CompletableFuture;
|
import java.util.concurrent.CompletableFuture;
|
||||||
|
import java.util.concurrent.TimeUnit;
|
||||||
|
|
||||||
@Component
|
@Component
|
||||||
@Slf4j
|
@Slf4j
|
||||||
@@ -120,7 +121,7 @@ public class BanServiceBean implements BanService {
|
|||||||
@Override
|
@Override
|
||||||
public CompletableFuture<Void> banUser(Guild guild, User user, Integer deletionDays, String reason) {
|
public CompletableFuture<Void> banUser(Guild guild, User user, Integer deletionDays, String reason) {
|
||||||
log.info("Banning user {} in guild {}.", user.getIdLong(), guild.getId());
|
log.info("Banning user {} in guild {}.", user.getIdLong(), guild.getId());
|
||||||
return guild.ban(user, deletionDays, reason).submit();
|
return guild.ban(user, deletionDays, TimeUnit.DAYS).reason(reason).submit();
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
|
|||||||
@@ -8,7 +8,6 @@ import dev.sheldan.abstracto.core.models.database.AUserInAServer;
|
|||||||
import dev.sheldan.abstracto.core.models.template.display.MemberDisplay;
|
import dev.sheldan.abstracto.core.models.template.display.MemberDisplay;
|
||||||
import dev.sheldan.abstracto.core.service.ConfigService;
|
import dev.sheldan.abstracto.core.service.ConfigService;
|
||||||
import dev.sheldan.abstracto.core.service.PostTargetService;
|
import dev.sheldan.abstracto.core.service.PostTargetService;
|
||||||
import dev.sheldan.abstracto.core.service.management.ChannelManagementService;
|
|
||||||
import dev.sheldan.abstracto.core.service.management.ConfigManagementService;
|
import dev.sheldan.abstracto.core.service.management.ConfigManagementService;
|
||||||
import dev.sheldan.abstracto.core.templating.model.MessageToSend;
|
import dev.sheldan.abstracto.core.templating.model.MessageToSend;
|
||||||
import dev.sheldan.abstracto.core.templating.service.TemplateService;
|
import dev.sheldan.abstracto.core.templating.service.TemplateService;
|
||||||
|
|||||||
@@ -28,9 +28,9 @@ import dev.sheldan.abstracto.scheduling.model.JobParameters;
|
|||||||
import dev.sheldan.abstracto.scheduling.service.SchedulerService;
|
import dev.sheldan.abstracto.scheduling.service.SchedulerService;
|
||||||
import lombok.extern.slf4j.Slf4j;
|
import lombok.extern.slf4j.Slf4j;
|
||||||
import net.dv8tion.jda.api.entities.Guild;
|
import net.dv8tion.jda.api.entities.Guild;
|
||||||
import net.dv8tion.jda.api.entities.GuildMessageChannel;
|
|
||||||
import net.dv8tion.jda.api.entities.Member;
|
import net.dv8tion.jda.api.entities.Member;
|
||||||
import net.dv8tion.jda.api.entities.Message;
|
import net.dv8tion.jda.api.entities.Message;
|
||||||
|
import net.dv8tion.jda.api.entities.channel.middleman.GuildMessageChannel;
|
||||||
import org.springframework.beans.factory.annotation.Autowired;
|
import org.springframework.beans.factory.annotation.Autowired;
|
||||||
import org.springframework.beans.factory.annotation.Qualifier;
|
import org.springframework.beans.factory.annotation.Qualifier;
|
||||||
import org.springframework.stereotype.Component;
|
import org.springframework.stereotype.Component;
|
||||||
|
|||||||
@@ -11,7 +11,7 @@ import dev.sheldan.abstracto.core.templating.model.MessageToSend;
|
|||||||
import dev.sheldan.abstracto.core.templating.service.TemplateService;
|
import dev.sheldan.abstracto.core.templating.service.TemplateService;
|
||||||
import lombok.extern.slf4j.Slf4j;
|
import lombok.extern.slf4j.Slf4j;
|
||||||
import net.dv8tion.jda.api.entities.*;
|
import net.dv8tion.jda.api.entities.*;
|
||||||
import net.dv8tion.jda.api.events.interaction.command.SlashCommandInteractionEvent;
|
import net.dv8tion.jda.api.entities.channel.middleman.GuildMessageChannel;
|
||||||
import net.dv8tion.jda.api.interactions.InteractionHook;
|
import net.dv8tion.jda.api.interactions.InteractionHook;
|
||||||
import net.dv8tion.jda.api.utils.MiscUtil;
|
import net.dv8tion.jda.api.utils.MiscUtil;
|
||||||
import net.dv8tion.jda.api.utils.TimeUtil;
|
import net.dv8tion.jda.api.utils.TimeUtil;
|
||||||
|
|||||||
@@ -18,8 +18,8 @@ import dev.sheldan.abstracto.moderation.model.template.listener.ReportReactionNo
|
|||||||
import dev.sheldan.abstracto.moderation.service.management.ModerationUserManagementService;
|
import dev.sheldan.abstracto.moderation.service.management.ModerationUserManagementService;
|
||||||
import dev.sheldan.abstracto.moderation.service.management.ReactionReportManagementService;
|
import dev.sheldan.abstracto.moderation.service.management.ReactionReportManagementService;
|
||||||
import lombok.extern.slf4j.Slf4j;
|
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.Message;
|
||||||
|
import net.dv8tion.jda.api.entities.channel.middleman.GuildMessageChannel;
|
||||||
import org.springframework.beans.factory.annotation.Autowired;
|
import org.springframework.beans.factory.annotation.Autowired;
|
||||||
import org.springframework.stereotype.Component;
|
import org.springframework.stereotype.Component;
|
||||||
import org.springframework.transaction.annotation.Transactional;
|
import org.springframework.transaction.annotation.Transactional;
|
||||||
|
|||||||
@@ -4,8 +4,7 @@ import dev.sheldan.abstracto.core.exception.ChannelNotInGuildException;
|
|||||||
import dev.sheldan.abstracto.core.models.database.AChannel;
|
import dev.sheldan.abstracto.core.models.database.AChannel;
|
||||||
import dev.sheldan.abstracto.core.service.ChannelService;
|
import dev.sheldan.abstracto.core.service.ChannelService;
|
||||||
import lombok.extern.slf4j.Slf4j;
|
import lombok.extern.slf4j.Slf4j;
|
||||||
import net.dv8tion.jda.api.entities.GuildMessageChannel;
|
import net.dv8tion.jda.api.entities.channel.concrete.TextChannel;
|
||||||
import net.dv8tion.jda.api.entities.TextChannel;
|
|
||||||
import org.springframework.beans.factory.annotation.Autowired;
|
import org.springframework.beans.factory.annotation.Autowired;
|
||||||
import org.springframework.stereotype.Component;
|
import org.springframework.stereotype.Component;
|
||||||
|
|
||||||
|
|||||||
@@ -5,7 +5,7 @@ import dev.sheldan.abstracto.core.command.execution.CommandResult;
|
|||||||
import dev.sheldan.abstracto.core.test.command.CommandConfigValidator;
|
import dev.sheldan.abstracto.core.test.command.CommandConfigValidator;
|
||||||
import dev.sheldan.abstracto.core.test.command.CommandTestUtilities;
|
import dev.sheldan.abstracto.core.test.command.CommandTestUtilities;
|
||||||
import dev.sheldan.abstracto.moderation.service.SlowModeService;
|
import dev.sheldan.abstracto.moderation.service.SlowModeService;
|
||||||
import net.dv8tion.jda.api.entities.TextChannel;
|
import net.dv8tion.jda.api.entities.channel.concrete.TextChannel;
|
||||||
import org.junit.Test;
|
import org.junit.Test;
|
||||||
import org.junit.runner.RunWith;
|
import org.junit.runner.RunWith;
|
||||||
import org.mockito.InjectMocks;
|
import org.mockito.InjectMocks;
|
||||||
|
|||||||
@@ -5,7 +5,6 @@ import dev.sheldan.abstracto.core.command.execution.CommandResult;
|
|||||||
import dev.sheldan.abstracto.core.templating.service.TemplateService;
|
import dev.sheldan.abstracto.core.templating.service.TemplateService;
|
||||||
import dev.sheldan.abstracto.core.test.command.CommandConfigValidator;
|
import dev.sheldan.abstracto.core.test.command.CommandConfigValidator;
|
||||||
import dev.sheldan.abstracto.core.test.command.CommandTestUtilities;
|
import dev.sheldan.abstracto.core.test.command.CommandTestUtilities;
|
||||||
import dev.sheldan.abstracto.moderation.command.Ban;
|
|
||||||
import dev.sheldan.abstracto.moderation.command.Mute;
|
import dev.sheldan.abstracto.moderation.command.Mute;
|
||||||
import dev.sheldan.abstracto.moderation.model.template.command.MuteContext;
|
import dev.sheldan.abstracto.moderation.model.template.command.MuteContext;
|
||||||
import dev.sheldan.abstracto.moderation.service.MuteService;
|
import dev.sheldan.abstracto.moderation.service.MuteService;
|
||||||
|
|||||||
@@ -5,7 +5,7 @@ import dev.sheldan.abstracto.core.models.database.AChannel;
|
|||||||
import dev.sheldan.abstracto.core.models.database.AServer;
|
import dev.sheldan.abstracto.core.models.database.AServer;
|
||||||
import dev.sheldan.abstracto.core.service.ChannelService;
|
import dev.sheldan.abstracto.core.service.ChannelService;
|
||||||
import net.dv8tion.jda.api.entities.Guild;
|
import net.dv8tion.jda.api.entities.Guild;
|
||||||
import net.dv8tion.jda.api.entities.TextChannel;
|
import net.dv8tion.jda.api.entities.channel.concrete.TextChannel;
|
||||||
import net.dv8tion.jda.api.managers.channel.ChannelManager;
|
import net.dv8tion.jda.api.managers.channel.ChannelManager;
|
||||||
import org.junit.Test;
|
import org.junit.Test;
|
||||||
import org.junit.runner.RunWith;
|
import org.junit.runner.RunWith;
|
||||||
|
|||||||
@@ -4,8 +4,8 @@ import lombok.Builder;
|
|||||||
import lombok.Getter;
|
import lombok.Getter;
|
||||||
import lombok.Setter;
|
import lombok.Setter;
|
||||||
import net.dv8tion.jda.api.entities.Guild;
|
import net.dv8tion.jda.api.entities.Guild;
|
||||||
import net.dv8tion.jda.api.entities.GuildMessageChannel;
|
|
||||||
import net.dv8tion.jda.api.entities.Member;
|
import net.dv8tion.jda.api.entities.Member;
|
||||||
|
import net.dv8tion.jda.api.entities.channel.middleman.GuildMessageChannel;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Used when rendering the notification when a member was kicked. The template is: "kick_log_embed"
|
* Used when rendering the notification when a member was kicked. The template is: "kick_log_embed"
|
||||||
|
|||||||
@@ -5,9 +5,9 @@ import lombok.Builder;
|
|||||||
import lombok.Getter;
|
import lombok.Getter;
|
||||||
import lombok.Setter;
|
import lombok.Setter;
|
||||||
import net.dv8tion.jda.api.entities.Guild;
|
import net.dv8tion.jda.api.entities.Guild;
|
||||||
import net.dv8tion.jda.api.entities.GuildMessageChannel;
|
|
||||||
import net.dv8tion.jda.api.entities.Member;
|
import net.dv8tion.jda.api.entities.Member;
|
||||||
import net.dv8tion.jda.api.entities.Message;
|
import net.dv8tion.jda.api.entities.Message;
|
||||||
|
import net.dv8tion.jda.api.entities.channel.middleman.GuildMessageChannel;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Used when rendering the notification when a member was warned. The template is: "warn_log_embed"
|
* Used when rendering the notification when a member was warned. The template is: "warn_log_embed"
|
||||||
|
|||||||
@@ -1,6 +1,7 @@
|
|||||||
package dev.sheldan.abstracto.moderation.service;
|
package dev.sheldan.abstracto.moderation.service;
|
||||||
|
|
||||||
import net.dv8tion.jda.api.entities.*;
|
import net.dv8tion.jda.api.entities.*;
|
||||||
|
import net.dv8tion.jda.api.entities.channel.middleman.GuildMessageChannel;
|
||||||
import net.dv8tion.jda.api.interactions.InteractionHook;
|
import net.dv8tion.jda.api.interactions.InteractionHook;
|
||||||
|
|
||||||
import java.util.concurrent.CompletableFuture;
|
import java.util.concurrent.CompletableFuture;
|
||||||
|
|||||||
@@ -1,7 +1,7 @@
|
|||||||
package dev.sheldan.abstracto.moderation.service;
|
package dev.sheldan.abstracto.moderation.service;
|
||||||
|
|
||||||
import dev.sheldan.abstracto.core.models.database.AChannel;
|
import dev.sheldan.abstracto.core.models.database.AChannel;
|
||||||
import net.dv8tion.jda.api.entities.TextChannel;
|
import net.dv8tion.jda.api.entities.channel.concrete.TextChannel;
|
||||||
|
|
||||||
import java.time.Duration;
|
import java.time.Duration;
|
||||||
import java.util.concurrent.CompletableFuture;
|
import java.util.concurrent.CompletableFuture;
|
||||||
|
|||||||
@@ -24,7 +24,7 @@ import dev.sheldan.abstracto.modmail.service.management.ModMailThreadManagementS
|
|||||||
import lombok.extern.slf4j.Slf4j;
|
import lombok.extern.slf4j.Slf4j;
|
||||||
import net.dv8tion.jda.api.entities.Member;
|
import net.dv8tion.jda.api.entities.Member;
|
||||||
import net.dv8tion.jda.api.entities.Message;
|
import net.dv8tion.jda.api.entities.Message;
|
||||||
import net.dv8tion.jda.api.entities.MessageChannel;
|
import net.dv8tion.jda.api.entities.channel.middleman.MessageChannel;
|
||||||
import net.dv8tion.jda.api.events.interaction.command.SlashCommandInteractionEvent;
|
import net.dv8tion.jda.api.events.interaction.command.SlashCommandInteractionEvent;
|
||||||
import net.dv8tion.jda.api.interactions.InteractionHook;
|
import net.dv8tion.jda.api.interactions.InteractionHook;
|
||||||
import org.springframework.beans.factory.annotation.Autowired;
|
import org.springframework.beans.factory.annotation.Autowired;
|
||||||
@@ -37,7 +37,7 @@ import java.util.concurrent.CompletableFuture;
|
|||||||
|
|
||||||
/**
|
/**
|
||||||
* This command is used to create a thread with a member directly. If a thread already exists, this will post a link to
|
* This command is used to create a thread with a member directly. If a thread already exists, this will post a link to
|
||||||
* the {@link net.dv8tion.jda.api.entities.MessageChannel}
|
* the {@link net.dv8tion.jda.api.entities.channel.middleman.GuildMessageChannel}
|
||||||
*/
|
*/
|
||||||
@Component
|
@Component
|
||||||
@Slf4j
|
@Slf4j
|
||||||
|
|||||||
@@ -12,6 +12,8 @@ import dev.sheldan.abstracto.modmail.model.database.ModMailThread;
|
|||||||
import dev.sheldan.abstracto.modmail.model.template.ModmailLoggingThreadMessages;
|
import dev.sheldan.abstracto.modmail.model.template.ModmailLoggingThreadMessages;
|
||||||
import lombok.extern.slf4j.Slf4j;
|
import lombok.extern.slf4j.Slf4j;
|
||||||
import net.dv8tion.jda.api.entities.*;
|
import net.dv8tion.jda.api.entities.*;
|
||||||
|
import net.dv8tion.jda.api.entities.channel.concrete.PrivateChannel;
|
||||||
|
import net.dv8tion.jda.api.entities.channel.middleman.GuildMessageChannel;
|
||||||
import org.springframework.beans.factory.annotation.Autowired;
|
import org.springframework.beans.factory.annotation.Autowired;
|
||||||
import org.springframework.stereotype.Component;
|
import org.springframework.stereotype.Component;
|
||||||
|
|
||||||
|
|||||||
@@ -28,9 +28,7 @@ import dev.sheldan.abstracto.modmail.exception.ModMailThreadChannelNotFound;
|
|||||||
import dev.sheldan.abstracto.modmail.exception.ModMailThreadNotFoundException;
|
import dev.sheldan.abstracto.modmail.exception.ModMailThreadNotFoundException;
|
||||||
import dev.sheldan.abstracto.modmail.model.ClosingContext;
|
import dev.sheldan.abstracto.modmail.model.ClosingContext;
|
||||||
import dev.sheldan.abstracto.modmail.model.dto.ServiceChoicesPayload;
|
import dev.sheldan.abstracto.modmail.model.dto.ServiceChoicesPayload;
|
||||||
import dev.sheldan.abstracto.modmail.model.template.ServerChoices;
|
|
||||||
import dev.sheldan.abstracto.modmail.model.database.*;
|
import dev.sheldan.abstracto.modmail.model.database.*;
|
||||||
import dev.sheldan.abstracto.modmail.model.template.ServerChoice;
|
|
||||||
import dev.sheldan.abstracto.modmail.model.template.*;
|
import dev.sheldan.abstracto.modmail.model.template.*;
|
||||||
import dev.sheldan.abstracto.modmail.service.management.ModMailMessageManagementService;
|
import dev.sheldan.abstracto.modmail.service.management.ModMailMessageManagementService;
|
||||||
import dev.sheldan.abstracto.modmail.service.management.ModMailRoleManagementService;
|
import dev.sheldan.abstracto.modmail.service.management.ModMailRoleManagementService;
|
||||||
@@ -41,6 +39,9 @@ import dev.sheldan.abstracto.core.templating.model.MessageToSend;
|
|||||||
import dev.sheldan.abstracto.core.templating.service.TemplateService;
|
import dev.sheldan.abstracto.core.templating.service.TemplateService;
|
||||||
import lombok.extern.slf4j.Slf4j;
|
import lombok.extern.slf4j.Slf4j;
|
||||||
import net.dv8tion.jda.api.entities.*;
|
import net.dv8tion.jda.api.entities.*;
|
||||||
|
import net.dv8tion.jda.api.entities.channel.concrete.TextChannel;
|
||||||
|
import net.dv8tion.jda.api.entities.channel.middleman.GuildMessageChannel;
|
||||||
|
import net.dv8tion.jda.api.entities.channel.middleman.MessageChannel;
|
||||||
import net.dv8tion.jda.api.exceptions.InsufficientPermissionException;
|
import net.dv8tion.jda.api.exceptions.InsufficientPermissionException;
|
||||||
import net.dv8tion.jda.api.interactions.InteractionHook;
|
import net.dv8tion.jda.api.interactions.InteractionHook;
|
||||||
import org.apache.commons.lang3.RandomStringUtils;
|
import org.apache.commons.lang3.RandomStringUtils;
|
||||||
@@ -64,7 +65,7 @@ public class ModMailThreadServiceBean implements ModMailThreadService {
|
|||||||
*/
|
*/
|
||||||
public static final String MODMAIL_CLOSING_MESSAGE_TEXT = "modMailClosingText";
|
public static final String MODMAIL_CLOSING_MESSAGE_TEXT = "modMailClosingText";
|
||||||
/**
|
/**
|
||||||
* The config key to use for the ID of the category to create {@link MessageChannel} in
|
* The config key to use for the ID of the category to create {@link GuildMessageChannel} in
|
||||||
*/
|
*/
|
||||||
public static final String MODMAIL_CATEGORY = "modmailCategory";
|
public static final String MODMAIL_CATEGORY = "modmailCategory";
|
||||||
public static final String TEXT_CHANNEL_NAME_TEMPLATE_KEY = "modMail_channel_name";
|
public static final String TEXT_CHANNEL_NAME_TEMPLATE_KEY = "modMail_channel_name";
|
||||||
@@ -467,14 +468,14 @@ public class ModMailThreadServiceBean implements ModMailThreadService {
|
|||||||
* This message takes a received {@link Message} from a user, renders it to a new message to send and sends it to
|
* This message takes a received {@link Message} from a user, renders it to a new message to send and sends it to
|
||||||
* the appropriate {@link ModMailThread} channel, the returned promise only returns if the message was dealt with on the user
|
* the appropriate {@link ModMailThread} channel, the returned promise only returns if the message was dealt with on the user
|
||||||
* side.
|
* side.
|
||||||
* @param textChannel The {@link GuildMessageChannel} in which the {@link ModMailThread} is being handled
|
* @param messageChannel The {@link GuildMessageChannel} in which the {@link ModMailThread} is being handled
|
||||||
* @param modMailThreadId The id of the modmail thread to which the received {@link Message} is a reply to, can be null, if it is null, its the initial message
|
* @param modMailThreadId The id of the modmail thread to which the received {@link Message} is a reply to, can be null, if it is null, its the initial message
|
||||||
* @param messageFromUser The received message from the user
|
* @param messageFromUser The received message from the user
|
||||||
* @param member The {@link Member} instance from the user the thread is about. It is used as author
|
* @param member The {@link Member} instance from the user the thread is about. It is used as author
|
||||||
* @param modMailThreadExists Whether or not the modmail thread already exists and is persisted.
|
* @param modMailThreadExists Whether or not the modmail thread already exists and is persisted.
|
||||||
* @return A {@link CompletableFuture} which resolves when the post processing of the message is completed (adding read notification, and storing messageIDs)
|
* @return A {@link CompletableFuture} which resolves when the post processing of the message is completed (adding read notification, and storing messageIDs)
|
||||||
*/
|
*/
|
||||||
public CompletableFuture<Message> sendUserReply(GuildMessageChannel textChannel, Long modMailThreadId, Message messageFromUser, Member member, boolean modMailThreadExists) {
|
public CompletableFuture<Message> sendUserReply(GuildMessageChannel messageChannel, Long modMailThreadId, Message messageFromUser, Member member, boolean modMailThreadExists) {
|
||||||
List<CompletableFuture<Member>> subscriberMemberFutures = new ArrayList<>();
|
List<CompletableFuture<Member>> subscriberMemberFutures = new ArrayList<>();
|
||||||
if(modMailThreadExists) {
|
if(modMailThreadExists) {
|
||||||
ModMailThread modMailThread = modMailThreadManagementService.getById(modMailThreadId);
|
ModMailThread modMailThread = modMailThreadManagementService.getById(modMailThreadId);
|
||||||
@@ -520,17 +521,17 @@ public class ModMailThreadServiceBean implements ModMailThreadService {
|
|||||||
.remainingAttachments(otherAttachments)
|
.remainingAttachments(otherAttachments)
|
||||||
.subscribers(subscribers)
|
.subscribers(subscribers)
|
||||||
.build();
|
.build();
|
||||||
MessageToSend messageToSend = templateService.renderEmbedTemplate("modmail_user_message", modMailUserReplyModel, textChannel.getGuild().getIdLong());
|
MessageToSend messageToSend = templateService.renderEmbedTemplate("modmail_user_message", modMailUserReplyModel, messageChannel.getGuild().getIdLong());
|
||||||
List<CompletableFuture<Message>> completableFutures = channelService.sendMessageToSendToChannel(messageToSend, textChannel);
|
List<CompletableFuture<Message>> completableFutures = channelService.sendMessageToSendToChannel(messageToSend, messageChannel);
|
||||||
CompletableFuture.allOf(completableFutures.toArray(new CompletableFuture[0]))
|
CompletableFuture.allOf(completableFutures.toArray(new CompletableFuture[0]))
|
||||||
.thenCompose(aVoid -> {
|
.thenCompose(aVoid -> {
|
||||||
log.debug("Adding read reaction to initial message for mod mail thread in channel {}.", textChannel.getGuild().getId());
|
log.debug("Adding read reaction to initial message for mod mail thread in channel {}.", messageChannel.getGuild().getId());
|
||||||
return reactionService.addReactionToMessageAsync("readReaction", textChannel.getGuild().getIdLong(), messageFromUser);
|
return reactionService.addReactionToMessageAsync("readReaction", messageChannel.getGuild().getIdLong(), messageFromUser);
|
||||||
})
|
})
|
||||||
.thenApply(aVoid -> {
|
.thenApply(aVoid -> {
|
||||||
Message createdMessage = completableFutures.get(0).join();
|
Message createdMessage = completableFutures.get(0).join();
|
||||||
if(modMailThreadExists) {
|
if(modMailThreadExists) {
|
||||||
self.postProcessSendMessages(textChannel, createdMessage, messageFromUser);
|
self.postProcessSendMessages(messageChannel, createdMessage, messageFromUser);
|
||||||
}
|
}
|
||||||
return messageFuture.complete(createdMessage);
|
return messageFuture.complete(createdMessage);
|
||||||
}).exceptionally(throwable1 -> {
|
}).exceptionally(throwable1 -> {
|
||||||
|
|||||||
@@ -16,10 +16,9 @@ import dev.sheldan.abstracto.modmail.service.ModMailThreadServiceBean;
|
|||||||
import dev.sheldan.abstracto.modmail.validator.ModMailFeatureValidator;
|
import dev.sheldan.abstracto.modmail.validator.ModMailFeatureValidator;
|
||||||
import dev.sheldan.abstracto.core.templating.service.TemplateService;
|
import dev.sheldan.abstracto.core.templating.service.TemplateService;
|
||||||
import lombok.extern.slf4j.Slf4j;
|
import lombok.extern.slf4j.Slf4j;
|
||||||
import net.dv8tion.jda.api.entities.Category;
|
|
||||||
import net.dv8tion.jda.api.entities.Guild;
|
import net.dv8tion.jda.api.entities.Guild;
|
||||||
import net.dv8tion.jda.api.entities.Message;
|
import net.dv8tion.jda.api.entities.Message;
|
||||||
import net.dv8tion.jda.api.events.message.MessageReceivedEvent;
|
import net.dv8tion.jda.api.entities.channel.concrete.Category;
|
||||||
import org.springframework.beans.factory.annotation.Autowired;
|
import org.springframework.beans.factory.annotation.Autowired;
|
||||||
import org.springframework.stereotype.Component;
|
import org.springframework.stereotype.Component;
|
||||||
|
|
||||||
|
|||||||
@@ -9,8 +9,8 @@ import dev.sheldan.abstracto.core.service.GuildService;
|
|||||||
import dev.sheldan.abstracto.modmail.model.template.ModMailCategoryValidationErrorModel;
|
import dev.sheldan.abstracto.modmail.model.template.ModMailCategoryValidationErrorModel;
|
||||||
import dev.sheldan.abstracto.modmail.service.ModMailThreadServiceBean;
|
import dev.sheldan.abstracto.modmail.service.ModMailThreadServiceBean;
|
||||||
import lombok.extern.slf4j.Slf4j;
|
import lombok.extern.slf4j.Slf4j;
|
||||||
import net.dv8tion.jda.api.entities.Category;
|
|
||||||
import net.dv8tion.jda.api.entities.Guild;
|
import net.dv8tion.jda.api.entities.Guild;
|
||||||
|
import net.dv8tion.jda.api.entities.channel.concrete.Category;
|
||||||
import org.springframework.beans.factory.annotation.Autowired;
|
import org.springframework.beans.factory.annotation.Autowired;
|
||||||
import org.springframework.stereotype.Component;
|
import org.springframework.stereotype.Component;
|
||||||
|
|
||||||
|
|||||||
@@ -3,8 +3,8 @@ package dev.sheldan.abstracto.modmail.model;
|
|||||||
import lombok.Builder;
|
import lombok.Builder;
|
||||||
import lombok.Getter;
|
import lombok.Getter;
|
||||||
import lombok.Setter;
|
import lombok.Setter;
|
||||||
import net.dv8tion.jda.api.entities.Channel;
|
|
||||||
import net.dv8tion.jda.api.entities.Member;
|
import net.dv8tion.jda.api.entities.Member;
|
||||||
|
import net.dv8tion.jda.api.entities.channel.Channel;
|
||||||
|
|
||||||
@Getter
|
@Getter
|
||||||
@Setter
|
@Setter
|
||||||
|
|||||||
@@ -4,7 +4,7 @@ import lombok.Builder;
|
|||||||
import lombok.Getter;
|
import lombok.Getter;
|
||||||
import lombok.Setter;
|
import lombok.Setter;
|
||||||
import net.dv8tion.jda.api.entities.Member;
|
import net.dv8tion.jda.api.entities.Member;
|
||||||
import net.dv8tion.jda.api.entities.MessageChannel;
|
import net.dv8tion.jda.api.entities.channel.middleman.MessageChannel;
|
||||||
|
|
||||||
@Getter
|
@Getter
|
||||||
@Setter
|
@Setter
|
||||||
|
|||||||
@@ -4,8 +4,6 @@ import dev.sheldan.abstracto.core.utils.ChannelUtils;
|
|||||||
import lombok.Builder;
|
import lombok.Builder;
|
||||||
import lombok.Getter;
|
import lombok.Getter;
|
||||||
import lombok.Setter;
|
import lombok.Setter;
|
||||||
import net.dv8tion.jda.api.entities.Category;
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* This model is used when confirming the setup up the mod mail configuration for the category in which the channels should be created
|
* This model is used when confirming the setup up the mod mail configuration for the category in which the channels should be created
|
||||||
* This model contains the actual JDA category object where the channels will be created in, and the id of said
|
* This model contains the actual JDA category object where the channels will be created in, and the id of said
|
||||||
|
|||||||
@@ -8,7 +8,7 @@ import lombok.Getter;
|
|||||||
import lombok.Setter;
|
import lombok.Setter;
|
||||||
import lombok.experimental.SuperBuilder;
|
import lombok.experimental.SuperBuilder;
|
||||||
import net.dv8tion.jda.api.entities.Member;
|
import net.dv8tion.jda.api.entities.Member;
|
||||||
import net.dv8tion.jda.api.entities.TextChannel;
|
import net.dv8tion.jda.api.entities.channel.concrete.TextChannel;
|
||||||
|
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
|
|
||||||
|
|||||||
@@ -8,6 +8,7 @@ import dev.sheldan.abstracto.core.models.database.AUserInAServer;
|
|||||||
import dev.sheldan.abstracto.modmail.model.ClosingContext;
|
import dev.sheldan.abstracto.modmail.model.ClosingContext;
|
||||||
import dev.sheldan.abstracto.modmail.model.database.ModMailThread;
|
import dev.sheldan.abstracto.modmail.model.database.ModMailThread;
|
||||||
import net.dv8tion.jda.api.entities.*;
|
import net.dv8tion.jda.api.entities.*;
|
||||||
|
import net.dv8tion.jda.api.entities.channel.middleman.MessageChannel;
|
||||||
import net.dv8tion.jda.api.interactions.InteractionHook;
|
import net.dv8tion.jda.api.interactions.InteractionHook;
|
||||||
|
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
@@ -18,8 +19,8 @@ import java.util.concurrent.CompletableFuture;
|
|||||||
*/
|
*/
|
||||||
public interface ModMailThreadService {
|
public interface ModMailThreadService {
|
||||||
/**
|
/**
|
||||||
* Creates a new mod mail thread for the given user. including: the {@link net.dv8tion.jda.api.entities.TextChannel}
|
* Creates a new mod mail thread for the given user. including: the {@link net.dv8tion.jda.api.entities.channel.middleman.GuildMessageChannel}
|
||||||
* in the appropriate {@link net.dv8tion.jda.api.entities.Category} and calls the methods responsible for storing
|
* in the appropriate {@link net.dv8tion.jda.api.entities.channel.concrete.Category} and calls the methods responsible for storing
|
||||||
* the necessary data in the database, notifying the users and sending messages related to the creation of the {@link ModMailThread}
|
* the necessary data in the database, notifying the users and sending messages related to the creation of the {@link ModMailThread}
|
||||||
* @param member The {@link AUserInAServer} to create the mod mail thread for
|
* @param member The {@link AUserInAServer} to create the mod mail thread for
|
||||||
* @param initialMessage The initial message sparking this mod mail thread, null in case it was created by a command
|
* @param initialMessage The initial message sparking this mod mail thread, null in case it was created by a command
|
||||||
@@ -73,7 +74,7 @@ public interface ModMailThreadService {
|
|||||||
CompletableFuture<Void> loadExecutingMemberAndRelay(Long threadId, String text, Message message, boolean anonymous, Member targetMember);
|
CompletableFuture<Void> loadExecutingMemberAndRelay(Long threadId, String text, Message message, boolean anonymous, Member targetMember);
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Closes the mod mail thread which means: deletes the {@link net.dv8tion.jda.api.entities.TextChannel} associated with the mod mail thread,
|
* Closes the mod mail thread which means: deletes the {@link net.dv8tion.jda.api.entities.channel.middleman.GuildMessageChannel} associated with the mod mail thread,
|
||||||
* and depending on the {@link dev.sheldan.abstracto.core.config.FeatureMode} of mod mail logs the content of the thread into the appropriate
|
* and depending on the {@link dev.sheldan.abstracto.core.config.FeatureMode} of mod mail logs the content of the thread into the appropriate
|
||||||
* post target. This also takes an optional note, which will be displayed in the first message of the logging. This method changes the state of the
|
* post target. This also takes an optional note, which will be displayed in the first message of the logging. This method changes the state of the
|
||||||
* {@link ModMailThread} to CLOSED and notifies the user about closing.
|
* {@link ModMailThread} to CLOSED and notifies the user about closing.
|
||||||
@@ -84,7 +85,7 @@ public interface ModMailThreadService {
|
|||||||
CompletableFuture<Void> closeModMailThreadEvaluateLogging(ModMailThread modMailThread, ClosingContext closingConfig, List<UndoActionInstance> undoActions);
|
CompletableFuture<Void> closeModMailThreadEvaluateLogging(ModMailThread modMailThread, ClosingContext closingConfig, List<UndoActionInstance> undoActions);
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Closes the mod mail thread which means: deletes the {@link net.dv8tion.jda.api.entities.TextChannel} associated with the mod mail thread,
|
* Closes the mod mail thread which means: deletes the {@link net.dv8tion.jda.api.entities.channel.middleman.GuildMessageChannel} associated with the mod mail thread,
|
||||||
* and logs the content of the thread into the appropriate post target. This also takes an optional note, which will
|
* and logs the content of the thread into the appropriate post target. This also takes an optional note, which will
|
||||||
* be displayed in the first message of the logging. This method changes the state of the {@link ModMailThread} to
|
* be displayed in the first message of the logging. This method changes the state of the {@link ModMailThread} to
|
||||||
* CLOSED and notifies the user about closing.
|
* CLOSED and notifies the user about closing.
|
||||||
|
|||||||
@@ -43,7 +43,7 @@ public class ProfanityReportVoteListener implements AsyncReactionAddedListener {
|
|||||||
if(use.getVerified()) {
|
if(use.getVerified()) {
|
||||||
return DefaultListenerResult.PROCESSED;
|
return DefaultListenerResult.PROCESSED;
|
||||||
}
|
}
|
||||||
AEmote addedEmote = emoteService.buildAEmoteFromReaction(model.getReaction().getReactionEmote());
|
AEmote addedEmote = emoteService.buildAEmoteFromReaction(model.getReaction().getEmoji());
|
||||||
AEmote agreeEmote = emoteService.getEmoteOrDefaultEmote(ProfanityFilterService.REPORT_AGREE_EMOTE, model.getServerId());
|
AEmote agreeEmote = emoteService.getEmoteOrDefaultEmote(ProfanityFilterService.REPORT_AGREE_EMOTE, model.getServerId());
|
||||||
boolean isAgreement = emoteService.compareAEmote(addedEmote, agreeEmote);
|
boolean isAgreement = emoteService.compareAEmote(addedEmote, agreeEmote);
|
||||||
boolean reactionWasVote;
|
boolean reactionWasVote;
|
||||||
|
|||||||
@@ -1,6 +1,5 @@
|
|||||||
package dev.sheldan.abstracto.remind.listener;
|
package dev.sheldan.abstracto.remind.listener;
|
||||||
|
|
||||||
import dev.sheldan.abstracto.core.command.execution.DriedCommandContext;
|
|
||||||
import dev.sheldan.abstracto.core.config.FeatureDefinition;
|
import dev.sheldan.abstracto.core.config.FeatureDefinition;
|
||||||
import dev.sheldan.abstracto.core.config.ListenerPriority;
|
import dev.sheldan.abstracto.core.config.ListenerPriority;
|
||||||
import dev.sheldan.abstracto.core.interaction.InteractionService;
|
import dev.sheldan.abstracto.core.interaction.InteractionService;
|
||||||
|
|||||||
@@ -24,6 +24,7 @@ import dev.sheldan.abstracto.scheduling.model.JobParameters;
|
|||||||
import dev.sheldan.abstracto.scheduling.service.SchedulerService;
|
import dev.sheldan.abstracto.scheduling.service.SchedulerService;
|
||||||
import lombok.extern.slf4j.Slf4j;
|
import lombok.extern.slf4j.Slf4j;
|
||||||
import net.dv8tion.jda.api.entities.*;
|
import net.dv8tion.jda.api.entities.*;
|
||||||
|
import net.dv8tion.jda.api.entities.channel.middleman.GuildMessageChannel;
|
||||||
import org.springframework.beans.factory.annotation.Autowired;
|
import org.springframework.beans.factory.annotation.Autowired;
|
||||||
import org.springframework.beans.factory.annotation.Qualifier;
|
import org.springframework.beans.factory.annotation.Qualifier;
|
||||||
import org.springframework.stereotype.Component;
|
import org.springframework.stereotype.Component;
|
||||||
|
|||||||
@@ -18,6 +18,8 @@ import dev.sheldan.abstracto.scheduling.service.SchedulerService;
|
|||||||
import dev.sheldan.abstracto.core.templating.model.MessageToSend;
|
import dev.sheldan.abstracto.core.templating.model.MessageToSend;
|
||||||
import dev.sheldan.abstracto.core.templating.service.TemplateService;
|
import dev.sheldan.abstracto.core.templating.service.TemplateService;
|
||||||
import net.dv8tion.jda.api.entities.*;
|
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 net.dv8tion.jda.api.utils.ImageProxy;
|
import net.dv8tion.jda.api.utils.ImageProxy;
|
||||||
import org.junit.Assert;
|
import org.junit.Assert;
|
||||||
import org.junit.Before;
|
import org.junit.Before;
|
||||||
@@ -72,7 +74,10 @@ public class RemindServiceBeanTest {
|
|||||||
private Message message;
|
private Message message;
|
||||||
|
|
||||||
@Mock
|
@Mock
|
||||||
private GuildMessageChannel channel;
|
private GuildMessageChannelUnion guildMessageChannelUnion;
|
||||||
|
|
||||||
|
@Mock
|
||||||
|
private MessageChannelUnion messageChannelUnion;
|
||||||
|
|
||||||
@Mock
|
@Mock
|
||||||
private ScheduledExecutorService instantReminderScheduler;
|
private ScheduledExecutorService instantReminderScheduler;
|
||||||
@@ -103,8 +108,8 @@ public class RemindServiceBeanTest {
|
|||||||
@Before
|
@Before
|
||||||
public void setup() {
|
public void setup() {
|
||||||
when(message.getIdLong()).thenReturn(5L);
|
when(message.getIdLong()).thenReturn(5L);
|
||||||
when(channel.getIdLong()).thenReturn(5L);
|
when(guildMessageChannelUnion.getIdLong()).thenReturn(5L);
|
||||||
when(message.getChannel()).thenReturn(channel);
|
when(message.getChannel()).thenReturn(messageChannelUnion);
|
||||||
}
|
}
|
||||||
|
|
||||||
@Test
|
@Test
|
||||||
@@ -112,8 +117,8 @@ public class RemindServiceBeanTest {
|
|||||||
String remindText = "text";
|
String remindText = "text";
|
||||||
String triggerKey = "trigger";
|
String triggerKey = "trigger";
|
||||||
Duration duration = Duration.ofSeconds(62);
|
Duration duration = Duration.ofSeconds(62);
|
||||||
when(message.getChannel()).thenReturn(channel);
|
when(message.getChannel()).thenReturn(messageChannelUnion);
|
||||||
when(channel.getIdLong()).thenReturn(CHANNEL_ID);
|
when(guildMessageChannelUnion.getIdLong()).thenReturn(CHANNEL_ID);
|
||||||
when(aUserInAServer.getServerReference()).thenReturn(server);
|
when(aUserInAServer.getServerReference()).thenReturn(server);
|
||||||
when(aUserInAServer.getUserReference()).thenReturn(user);
|
when(aUserInAServer.getUserReference()).thenReturn(user);
|
||||||
when(channelManagementService.loadChannel(CHANNEL_ID)).thenReturn(aChannel);
|
when(channelManagementService.loadChannel(CHANNEL_ID)).thenReturn(aChannel);
|
||||||
@@ -132,8 +137,8 @@ public class RemindServiceBeanTest {
|
|||||||
public void createReminderWithoutScheduler() {
|
public void createReminderWithoutScheduler() {
|
||||||
String remindText = "text";
|
String remindText = "text";
|
||||||
Duration duration = Duration.ofSeconds(50);
|
Duration duration = Duration.ofSeconds(50);
|
||||||
when(message.getChannel()).thenReturn(channel);
|
when(message.getChannel()).thenReturn(messageChannelUnion);
|
||||||
when(channel.getIdLong()).thenReturn(CHANNEL_ID);
|
when(messageChannelUnion.getIdLong()).thenReturn(CHANNEL_ID);
|
||||||
when(channelManagementService.loadChannel(CHANNEL_ID)).thenReturn(aChannel);
|
when(channelManagementService.loadChannel(CHANNEL_ID)).thenReturn(aChannel);
|
||||||
Reminder createdReminder = Mockito.mock(Reminder.class);
|
Reminder createdReminder = Mockito.mock(Reminder.class);
|
||||||
when(createdReminder.getText()).thenReturn(remindText);
|
when(createdReminder.getText()).thenReturn(remindText);
|
||||||
@@ -160,7 +165,7 @@ public class RemindServiceBeanTest {
|
|||||||
when(reminderManagementService.loadReminder(REMINDER_ID)).thenReturn(remindedReminder);
|
when(reminderManagementService.loadReminder(REMINDER_ID)).thenReturn(remindedReminder);
|
||||||
Guild guildMock = Mockito.mock(Guild.class);
|
Guild guildMock = Mockito.mock(Guild.class);
|
||||||
when(guildService.getGuildByIdOptional(SERVER_ID)).thenReturn(Optional.of(guildMock));
|
when(guildService.getGuildByIdOptional(SERVER_ID)).thenReturn(Optional.of(guildMock));
|
||||||
when(channelService.getMessageChannelFromServerOptional(SERVER_ID, CHANNEL_ID)).thenReturn(Optional.of(channel));
|
when(channelService.getMessageChannelFromServerOptional(SERVER_ID, CHANNEL_ID)).thenReturn(Optional.of(guildMessageChannelUnion));
|
||||||
Member mockedMember = Mockito.mock(Member.class);
|
Member mockedMember = Mockito.mock(Member.class);
|
||||||
when(memberService.getMemberInServerAsync(SERVER_ID, USER_ID)).thenReturn(CompletableFuture.completedFuture(mockedMember));
|
when(memberService.getMemberInServerAsync(SERVER_ID, USER_ID)).thenReturn(CompletableFuture.completedFuture(mockedMember));
|
||||||
testUnit.executeReminder(REMINDER_ID);
|
testUnit.executeReminder(REMINDER_ID);
|
||||||
@@ -253,10 +258,10 @@ public class RemindServiceBeanTest {
|
|||||||
when(remindedReminder.getReminderDate()).thenReturn(Instant.now());
|
when(remindedReminder.getReminderDate()).thenReturn(Instant.now());
|
||||||
when(reminderManagementService.loadReminder(REMINDER_ID)).thenReturn(remindedReminder);
|
when(reminderManagementService.loadReminder(REMINDER_ID)).thenReturn(remindedReminder);
|
||||||
MessageToSend messageToSend = Mockito.mock(MessageToSend.class);
|
MessageToSend messageToSend = Mockito.mock(MessageToSend.class);
|
||||||
when(channel.getGuild()).thenReturn(guild);
|
when(guildMessageChannelUnion.getGuild()).thenReturn(guild);
|
||||||
when(templateService.renderEmbedTemplate(eq(RemindServiceBean.REMINDER_TEMPLATE_TEXT), any(), eq(SERVER_ID))).thenReturn(messageToSend);
|
when(templateService.renderEmbedTemplate(eq(RemindServiceBean.REMINDER_TEMPLATE_TEXT), any(), eq(SERVER_ID))).thenReturn(messageToSend);
|
||||||
when(channelService.sendMessageToSendToChannel(messageToSend, channel)).thenReturn(Arrays.asList(CompletableFuture.completedFuture(null)));
|
when(channelService.sendMessageToSendToChannel(messageToSend, messageChannelUnion)).thenReturn(Arrays.asList(CompletableFuture.completedFuture(null)));
|
||||||
CompletableFuture<Void> future = testUnit.sendReminderText(REMINDER_ID, channel, remindedMember);
|
CompletableFuture<Void> future = testUnit.sendReminderText(REMINDER_ID, guildMessageChannelUnion, remindedMember);
|
||||||
future.join();
|
future.join();
|
||||||
Assert.assertFalse(future.isCompletedExceptionally());
|
Assert.assertFalse(future.isCompletedExceptionally());
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -8,7 +8,7 @@ import dev.sheldan.abstracto.core.service.management.ChannelGroupManagementServi
|
|||||||
import dev.sheldan.abstracto.core.service.management.ChannelManagementService;
|
import dev.sheldan.abstracto.core.service.management.ChannelManagementService;
|
||||||
import dev.sheldan.abstracto.repostdetection.model.database.RepostCheckChannelGroup;
|
import dev.sheldan.abstracto.repostdetection.model.database.RepostCheckChannelGroup;
|
||||||
import dev.sheldan.abstracto.repostdetection.service.management.RepostCheckChannelGroupManagement;
|
import dev.sheldan.abstracto.repostdetection.service.management.RepostCheckChannelGroupManagement;
|
||||||
import net.dv8tion.jda.api.entities.TextChannel;
|
import net.dv8tion.jda.api.entities.channel.concrete.TextChannel;
|
||||||
import org.springframework.beans.factory.annotation.Autowired;
|
import org.springframework.beans.factory.annotation.Autowired;
|
||||||
import org.springframework.stereotype.Component;
|
import org.springframework.stereotype.Component;
|
||||||
|
|
||||||
|
|||||||
@@ -8,7 +8,7 @@ import dev.sheldan.abstracto.repostdetection.model.database.RepostCheckChannelGr
|
|||||||
import dev.sheldan.abstracto.repostdetection.model.template.RepostCheckChannelGroupDisplayModel;
|
import dev.sheldan.abstracto.repostdetection.model.template.RepostCheckChannelGroupDisplayModel;
|
||||||
import dev.sheldan.abstracto.repostdetection.model.template.RepostCheckChannelsModel;
|
import dev.sheldan.abstracto.repostdetection.model.template.RepostCheckChannelsModel;
|
||||||
import net.dv8tion.jda.api.entities.Guild;
|
import net.dv8tion.jda.api.entities.Guild;
|
||||||
import net.dv8tion.jda.api.entities.TextChannel;
|
import net.dv8tion.jda.api.entities.channel.concrete.TextChannel;
|
||||||
import org.junit.Assert;
|
import org.junit.Assert;
|
||||||
import org.junit.Test;
|
import org.junit.Test;
|
||||||
import org.junit.runner.RunWith;
|
import org.junit.runner.RunWith;
|
||||||
|
|||||||
@@ -10,7 +10,7 @@ import dev.sheldan.abstracto.repostdetection.service.management.PostedImageManag
|
|||||||
import net.dv8tion.jda.api.entities.EmbedType;
|
import net.dv8tion.jda.api.entities.EmbedType;
|
||||||
import net.dv8tion.jda.api.entities.Message;
|
import net.dv8tion.jda.api.entities.Message;
|
||||||
import net.dv8tion.jda.api.entities.MessageEmbed;
|
import net.dv8tion.jda.api.entities.MessageEmbed;
|
||||||
import net.dv8tion.jda.api.entities.TextChannel;
|
import net.dv8tion.jda.api.entities.channel.concrete.TextChannel;
|
||||||
import org.junit.Assert;
|
import org.junit.Assert;
|
||||||
import org.junit.Test;
|
import org.junit.Test;
|
||||||
import org.junit.runner.RunWith;
|
import org.junit.runner.RunWith;
|
||||||
|
|||||||
@@ -6,6 +6,7 @@ import dev.sheldan.abstracto.core.service.management.ChannelManagementService;
|
|||||||
import dev.sheldan.abstracto.repostdetection.service.RepostCheckChannelService;
|
import dev.sheldan.abstracto.repostdetection.service.RepostCheckChannelService;
|
||||||
import dev.sheldan.abstracto.repostdetection.service.RepostService;
|
import dev.sheldan.abstracto.repostdetection.service.RepostService;
|
||||||
import net.dv8tion.jda.api.entities.*;
|
import net.dv8tion.jda.api.entities.*;
|
||||||
|
import net.dv8tion.jda.api.entities.channel.unions.MessageChannelUnion;
|
||||||
import org.junit.Assert;
|
import org.junit.Assert;
|
||||||
import org.junit.Test;
|
import org.junit.Test;
|
||||||
import org.junit.runner.RunWith;
|
import org.junit.runner.RunWith;
|
||||||
@@ -42,7 +43,7 @@ public class RepostMessageReceivedListenerTest {
|
|||||||
private MessageReceivedModel model;
|
private MessageReceivedModel model;
|
||||||
|
|
||||||
@Mock
|
@Mock
|
||||||
private GuildMessageChannel textChannel;
|
private MessageChannelUnion textChannel;
|
||||||
|
|
||||||
@Captor
|
@Captor
|
||||||
private ArgumentCaptor<List<MessageEmbed>> embedListCaptor;
|
private ArgumentCaptor<List<MessageEmbed>> embedListCaptor;
|
||||||
|
|||||||
@@ -9,7 +9,7 @@ import dev.sheldan.abstracto.core.service.management.ChannelManagementService;
|
|||||||
import dev.sheldan.abstracto.repostdetection.exception.RepostCheckChannelGroupNotFoundException;
|
import dev.sheldan.abstracto.repostdetection.exception.RepostCheckChannelGroupNotFoundException;
|
||||||
import dev.sheldan.abstracto.repostdetection.model.database.RepostCheckChannelGroup;
|
import dev.sheldan.abstracto.repostdetection.model.database.RepostCheckChannelGroup;
|
||||||
import dev.sheldan.abstracto.repostdetection.service.management.RepostCheckChannelGroupManagement;
|
import dev.sheldan.abstracto.repostdetection.service.management.RepostCheckChannelGroupManagement;
|
||||||
import net.dv8tion.jda.api.entities.TextChannel;
|
import net.dv8tion.jda.api.entities.channel.concrete.TextChannel;
|
||||||
import org.junit.Assert;
|
import org.junit.Assert;
|
||||||
import org.junit.Test;
|
import org.junit.Test;
|
||||||
import org.junit.runner.RunWith;
|
import org.junit.runner.RunWith;
|
||||||
|
|||||||
@@ -22,6 +22,7 @@ import dev.sheldan.abstracto.repostdetection.model.database.result.RepostLeaderb
|
|||||||
import dev.sheldan.abstracto.repostdetection.service.management.PostedImageManagement;
|
import dev.sheldan.abstracto.repostdetection.service.management.PostedImageManagement;
|
||||||
import dev.sheldan.abstracto.repostdetection.service.management.RepostManagementService;
|
import dev.sheldan.abstracto.repostdetection.service.management.RepostManagementService;
|
||||||
import net.dv8tion.jda.api.entities.*;
|
import net.dv8tion.jda.api.entities.*;
|
||||||
|
import net.dv8tion.jda.api.entities.channel.unions.MessageChannelUnion;
|
||||||
import org.junit.Assert;
|
import org.junit.Assert;
|
||||||
import org.junit.Test;
|
import org.junit.Test;
|
||||||
import org.junit.runner.RunWith;
|
import org.junit.runner.RunWith;
|
||||||
@@ -107,7 +108,7 @@ public class RepostServiceBeanTest {
|
|||||||
private Message message;
|
private Message message;
|
||||||
|
|
||||||
@Mock
|
@Mock
|
||||||
private MessageChannel messageChannel;
|
private MessageChannelUnion messageChannel;
|
||||||
|
|
||||||
@Mock
|
@Mock
|
||||||
private CachedAuthor author;
|
private CachedAuthor author;
|
||||||
|
|||||||
@@ -4,7 +4,7 @@ import dev.sheldan.abstracto.core.models.database.AChannel;
|
|||||||
import dev.sheldan.abstracto.core.models.database.AChannelGroup;
|
import dev.sheldan.abstracto.core.models.database.AChannelGroup;
|
||||||
import dev.sheldan.abstracto.core.models.database.AServer;
|
import dev.sheldan.abstracto.core.models.database.AServer;
|
||||||
import dev.sheldan.abstracto.repostdetection.model.database.RepostCheckChannelGroup;
|
import dev.sheldan.abstracto.repostdetection.model.database.RepostCheckChannelGroup;
|
||||||
import net.dv8tion.jda.api.entities.TextChannel;
|
import net.dv8tion.jda.api.entities.channel.concrete.TextChannel;
|
||||||
|
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
|
|
||||||
|
|||||||
@@ -38,7 +38,7 @@ public class StarAddedListener extends StarboardListener implements AsyncReactio
|
|||||||
}
|
}
|
||||||
Long serverId = model.getServerId();
|
Long serverId = model.getServerId();
|
||||||
AEmote aEmote = emoteService.getEmoteOrDefaultEmote(StarboardFeatureConfig.STAR_EMOTE, serverId);
|
AEmote aEmote = emoteService.getEmoteOrDefaultEmote(StarboardFeatureConfig.STAR_EMOTE, serverId);
|
||||||
if(emoteService.isReactionEmoteAEmote(model.getReaction().getReactionEmote(), aEmote)) {
|
if(emoteService.isReactionEmoteAEmote(model.getReaction().getEmoji(), aEmote)) {
|
||||||
metricService.incrementCounter(STARBOARD_STARS_ADDED);
|
metricService.incrementCounter(STARBOARD_STARS_ADDED);
|
||||||
log.info("User {} in server {} reacted with star to put a message {} from channel {} on starboard.",
|
log.info("User {} in server {} reacted with star to put a message {} from channel {} on starboard.",
|
||||||
model.getUserReacting().getUserId(), model.getServerId(), model.getMessage().getMessageId(), model.getMessage().getChannelId());
|
model.getUserReacting().getUserId(), model.getServerId(), model.getMessage().getMessageId(), model.getMessage().getChannelId());
|
||||||
|
|||||||
@@ -39,7 +39,7 @@ public class StarRemovedListener extends StarboardListener implements AsyncReact
|
|||||||
}
|
}
|
||||||
Long guildId = model.getServerId();
|
Long guildId = model.getServerId();
|
||||||
AEmote aEmote = emoteService.getEmoteOrDefaultEmote(StarboardFeatureConfig.STAR_EMOTE, guildId);
|
AEmote aEmote = emoteService.getEmoteOrDefaultEmote(StarboardFeatureConfig.STAR_EMOTE, guildId);
|
||||||
if(emoteService.isReactionEmoteAEmote(model.getReaction().getReactionEmote(), aEmote)) {
|
if(emoteService.isReactionEmoteAEmote(model.getReaction().getEmoji(), aEmote)) {
|
||||||
metricService.incrementCounter(STARBOARD_STARS_REMOVED);
|
metricService.incrementCounter(STARBOARD_STARS_REMOVED);
|
||||||
log.info("User {} in server {} removed star reaction from message {} on starboard.",
|
log.info("User {} in server {} removed star reaction from message {} on starboard.",
|
||||||
userRemoving.getUserId(), model.getServerId(), model.getMessage().getMessageId());
|
userRemoving.getUserId(), model.getServerId(), model.getMessage().getMessageId());
|
||||||
|
|||||||
@@ -9,7 +9,6 @@ import dev.sheldan.abstracto.core.models.cache.CachedReactions;
|
|||||||
import dev.sheldan.abstracto.core.models.database.AUserInAServer;
|
import dev.sheldan.abstracto.core.models.database.AUserInAServer;
|
||||||
import dev.sheldan.abstracto.core.service.ConfigService;
|
import dev.sheldan.abstracto.core.service.ConfigService;
|
||||||
import dev.sheldan.abstracto.core.service.EmoteService;
|
import dev.sheldan.abstracto.core.service.EmoteService;
|
||||||
import dev.sheldan.abstracto.core.service.LockService;
|
|
||||||
import dev.sheldan.abstracto.core.service.management.ConfigManagementService;
|
import dev.sheldan.abstracto.core.service.management.ConfigManagementService;
|
||||||
import dev.sheldan.abstracto.core.service.management.UserInServerManagementService;
|
import dev.sheldan.abstracto.core.service.management.UserInServerManagementService;
|
||||||
import dev.sheldan.abstracto.starboard.config.StarboardFeatureConfig;
|
import dev.sheldan.abstracto.starboard.config.StarboardFeatureConfig;
|
||||||
|
|||||||
@@ -26,6 +26,7 @@ import dev.sheldan.abstracto.starboard.service.management.StarboardPostManagemen
|
|||||||
import dev.sheldan.abstracto.starboard.service.management.StarboardPostReactorManagementService;
|
import dev.sheldan.abstracto.starboard.service.management.StarboardPostReactorManagementService;
|
||||||
import lombok.extern.slf4j.Slf4j;
|
import lombok.extern.slf4j.Slf4j;
|
||||||
import net.dv8tion.jda.api.entities.*;
|
import net.dv8tion.jda.api.entities.*;
|
||||||
|
import net.dv8tion.jda.api.entities.channel.middleman.GuildMessageChannel;
|
||||||
import org.springframework.beans.factory.annotation.Autowired;
|
import org.springframework.beans.factory.annotation.Autowired;
|
||||||
import org.springframework.stereotype.Component;
|
import org.springframework.stereotype.Component;
|
||||||
import org.springframework.transaction.annotation.Transactional;
|
import org.springframework.transaction.annotation.Transactional;
|
||||||
|
|||||||
@@ -19,6 +19,7 @@ import dev.sheldan.abstracto.starboard.service.management.StarboardPostReactorMa
|
|||||||
import net.dv8tion.jda.api.entities.Member;
|
import net.dv8tion.jda.api.entities.Member;
|
||||||
import net.dv8tion.jda.api.entities.MessageReaction;
|
import net.dv8tion.jda.api.entities.MessageReaction;
|
||||||
import net.dv8tion.jda.api.entities.User;
|
import net.dv8tion.jda.api.entities.User;
|
||||||
|
import net.dv8tion.jda.api.entities.emoji.EmojiUnion;
|
||||||
import org.junit.Before;
|
import org.junit.Before;
|
||||||
import org.junit.Test;
|
import org.junit.Test;
|
||||||
import org.junit.runner.RunWith;
|
import org.junit.runner.RunWith;
|
||||||
@@ -98,7 +99,7 @@ public class StarAddedListenerTest {
|
|||||||
private StarboardPost post;
|
private StarboardPost post;
|
||||||
|
|
||||||
@Mock
|
@Mock
|
||||||
private MessageReaction.ReactionEmote reactionEmote;
|
private EmojiUnion reactionEmote;
|
||||||
|
|
||||||
@Mock
|
@Mock
|
||||||
private AEmote starEmote;
|
private AEmote starEmote;
|
||||||
@@ -146,7 +147,7 @@ public class StarAddedListenerTest {
|
|||||||
when(model.getUserReacting()).thenReturn(serverUserActing);
|
when(model.getUserReacting()).thenReturn(serverUserActing);
|
||||||
when(model.getServerId()).thenReturn(SERVER_ID);
|
when(model.getServerId()).thenReturn(SERVER_ID);
|
||||||
when(model.getReaction()).thenReturn(reaction);
|
when(model.getReaction()).thenReturn(reaction);
|
||||||
when(reaction.getReactionEmote()).thenReturn(reactionEmote);
|
when(reaction.getEmoji()).thenReturn(reactionEmote);
|
||||||
testUnit.execute(model);
|
testUnit.execute(model);
|
||||||
verify(emoteService, times(1)).getEmoteOrDefaultEmote(StarboardFeatureConfig.STAR_EMOTE, SERVER_ID);
|
verify(emoteService, times(1)).getEmoteOrDefaultEmote(StarboardFeatureConfig.STAR_EMOTE, SERVER_ID);
|
||||||
verify(emoteService, times(0)).getReactionFromMessageByEmote(any(CachedMessage.class), eq(starEmote));
|
verify(emoteService, times(0)).getReactionFromMessageByEmote(any(CachedMessage.class), eq(starEmote));
|
||||||
@@ -214,7 +215,7 @@ public class StarAddedListenerTest {
|
|||||||
when(cachedMessage.getMessageId()).thenReturn(MESSAGE_ID);
|
when(cachedMessage.getMessageId()).thenReturn(MESSAGE_ID);
|
||||||
when(cachedAuthor.getAuthorId()).thenReturn(AUTHOR_ID);
|
when(cachedAuthor.getAuthorId()).thenReturn(AUTHOR_ID);
|
||||||
when(cachedMessage.getAuthor()).thenReturn(cachedAuthor);
|
when(cachedMessage.getAuthor()).thenReturn(cachedAuthor);
|
||||||
when(reaction.getReactionEmote()).thenReturn(reactionEmote);
|
when(reaction.getEmoji()).thenReturn(reactionEmote);
|
||||||
when(emoteService.isReactionEmoteAEmote(reactionEmote, starEmote)).thenReturn(true);
|
when(emoteService.isReactionEmoteAEmote(reactionEmote, starEmote)).thenReturn(true);
|
||||||
when(emoteService.getEmoteOrDefaultEmote(StarboardFeatureConfig.STAR_EMOTE, SERVER_ID)).thenReturn(starEmote);
|
when(emoteService.getEmoteOrDefaultEmote(StarboardFeatureConfig.STAR_EMOTE, SERVER_ID)).thenReturn(starEmote);
|
||||||
when(serverUserActing.getUserId()).thenReturn(USER_ACTING_ID);
|
when(serverUserActing.getUserId()).thenReturn(USER_ACTING_ID);
|
||||||
@@ -240,7 +241,7 @@ public class StarAddedListenerTest {
|
|||||||
private void setupWrongEmote(Long serverId, Long authorId, AEmote starEmote) {
|
private void setupWrongEmote(Long serverId, Long authorId, AEmote starEmote) {
|
||||||
when(cachedAuthor.getAuthorId()).thenReturn(authorId);
|
when(cachedAuthor.getAuthorId()).thenReturn(authorId);
|
||||||
when(cachedMessage.getAuthor()).thenReturn(cachedAuthor);
|
when(cachedMessage.getAuthor()).thenReturn(cachedAuthor);
|
||||||
when(reaction.getReactionEmote()).thenReturn(reactionEmote);
|
when(reaction.getEmoji()).thenReturn(reactionEmote);
|
||||||
when(emoteService.getEmoteOrDefaultEmote(StarboardFeatureConfig.STAR_EMOTE, serverId)).thenReturn(starEmote);
|
when(emoteService.getEmoteOrDefaultEmote(StarboardFeatureConfig.STAR_EMOTE, serverId)).thenReturn(starEmote);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -17,6 +17,7 @@ import dev.sheldan.abstracto.starboard.service.StarboardService;
|
|||||||
import dev.sheldan.abstracto.starboard.service.management.StarboardPostManagementService;
|
import dev.sheldan.abstracto.starboard.service.management.StarboardPostManagementService;
|
||||||
import dev.sheldan.abstracto.starboard.service.management.StarboardPostReactorManagementService;
|
import dev.sheldan.abstracto.starboard.service.management.StarboardPostReactorManagementService;
|
||||||
import net.dv8tion.jda.api.entities.MessageReaction;
|
import net.dv8tion.jda.api.entities.MessageReaction;
|
||||||
|
import net.dv8tion.jda.api.entities.emoji.EmojiUnion;
|
||||||
import org.junit.Before;
|
import org.junit.Before;
|
||||||
import org.junit.Test;
|
import org.junit.Test;
|
||||||
import org.junit.runner.RunWith;
|
import org.junit.runner.RunWith;
|
||||||
@@ -24,7 +25,6 @@ import org.mockito.InjectMocks;
|
|||||||
import org.mockito.Mock;
|
import org.mockito.Mock;
|
||||||
import org.mockito.Mockito;
|
import org.mockito.Mockito;
|
||||||
import org.mockito.junit.MockitoJUnitRunner;
|
import org.mockito.junit.MockitoJUnitRunner;
|
||||||
import org.springframework.beans.factory.annotation.Autowired;
|
|
||||||
|
|
||||||
import java.time.Instant;
|
import java.time.Instant;
|
||||||
import java.util.ArrayList;
|
import java.util.ArrayList;
|
||||||
@@ -98,7 +98,7 @@ public class StarRemovedListenerTest {
|
|||||||
private StarboardPost post;
|
private StarboardPost post;
|
||||||
|
|
||||||
@Mock
|
@Mock
|
||||||
private MessageReaction.ReactionEmote reactionEmote;
|
private EmojiUnion reactionEmote;
|
||||||
|
|
||||||
@Mock
|
@Mock
|
||||||
private AEmote starEmote;
|
private AEmote starEmote;
|
||||||
@@ -135,7 +135,7 @@ public class StarRemovedListenerTest {
|
|||||||
when(model.getMessage()).thenReturn(cachedMessage);
|
when(model.getMessage()).thenReturn(cachedMessage);
|
||||||
when(model.getUserRemoving()).thenReturn(serverUserActing);
|
when(model.getUserRemoving()).thenReturn(serverUserActing);
|
||||||
when(model.getReaction()).thenReturn(reaction);
|
when(model.getReaction()).thenReturn(reaction);
|
||||||
when(reaction.getReactionEmote()).thenReturn(reactionEmote);
|
when(reaction.getEmoji()).thenReturn(reactionEmote);
|
||||||
when(model.getServerId()).thenReturn(SERVER_ID);
|
when(model.getServerId()).thenReturn(SERVER_ID);
|
||||||
testUnit.execute(model);
|
testUnit.execute(model);
|
||||||
verify(emoteService, times(1)).getEmoteOrDefaultEmote(StarboardFeatureConfig.STAR_EMOTE, SERVER_ID);
|
verify(emoteService, times(1)).getEmoteOrDefaultEmote(StarboardFeatureConfig.STAR_EMOTE, SERVER_ID);
|
||||||
@@ -189,7 +189,7 @@ public class StarRemovedListenerTest {
|
|||||||
when(cachedMessage.getMessageId()).thenReturn(MESSAGE_ID);
|
when(cachedMessage.getMessageId()).thenReturn(MESSAGE_ID);
|
||||||
when(cachedAuthor.getAuthorId()).thenReturn(AUTHOR_ID);
|
when(cachedAuthor.getAuthorId()).thenReturn(AUTHOR_ID);
|
||||||
when(cachedMessage.getAuthor()).thenReturn(cachedAuthor);
|
when(cachedMessage.getAuthor()).thenReturn(cachedAuthor);
|
||||||
when(reaction.getReactionEmote()).thenReturn(reactionEmote);
|
when(reaction.getEmoji()).thenReturn(reactionEmote);
|
||||||
when(emoteService.isReactionEmoteAEmote(reactionEmote, starEmote)).thenReturn(true);
|
when(emoteService.isReactionEmoteAEmote(reactionEmote, starEmote)).thenReturn(true);
|
||||||
when(emoteService.getEmoteOrDefaultEmote(StarboardFeatureConfig.STAR_EMOTE, SERVER_ID)).thenReturn(starEmote);
|
when(emoteService.getEmoteOrDefaultEmote(StarboardFeatureConfig.STAR_EMOTE, SERVER_ID)).thenReturn(starEmote);
|
||||||
when(cachedReactions.getUsers()).thenReturn(remainingUsers);
|
when(cachedReactions.getUsers()).thenReturn(remainingUsers);
|
||||||
@@ -217,7 +217,7 @@ public class StarRemovedListenerTest {
|
|||||||
private void setupWrongEmote(Long serverId, Long authorId, AEmote starEmote) {
|
private void setupWrongEmote(Long serverId, Long authorId, AEmote starEmote) {
|
||||||
when(cachedAuthor.getAuthorId()).thenReturn(authorId);
|
when(cachedAuthor.getAuthorId()).thenReturn(authorId);
|
||||||
when(cachedMessage.getAuthor()).thenReturn(cachedAuthor);
|
when(cachedMessage.getAuthor()).thenReturn(cachedAuthor);
|
||||||
when(reaction.getReactionEmote()).thenReturn(reactionEmote);
|
when(reaction.getEmoji()).thenReturn(reactionEmote);
|
||||||
when(emoteService.getEmoteOrDefaultEmote(StarboardFeatureConfig.STAR_EMOTE, serverId)).thenReturn(starEmote);
|
when(emoteService.getEmoteOrDefaultEmote(StarboardFeatureConfig.STAR_EMOTE, serverId)).thenReturn(starEmote);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -21,6 +21,7 @@ import dev.sheldan.abstracto.starboard.model.template.*;
|
|||||||
import dev.sheldan.abstracto.starboard.service.management.StarboardPostManagementService;
|
import dev.sheldan.abstracto.starboard.service.management.StarboardPostManagementService;
|
||||||
import dev.sheldan.abstracto.starboard.service.management.StarboardPostReactorManagementService;
|
import dev.sheldan.abstracto.starboard.service.management.StarboardPostReactorManagementService;
|
||||||
import net.dv8tion.jda.api.entities.*;
|
import net.dv8tion.jda.api.entities.*;
|
||||||
|
import net.dv8tion.jda.api.entities.channel.middleman.GuildMessageChannel;
|
||||||
import org.junit.Assert;
|
import org.junit.Assert;
|
||||||
import org.junit.Test;
|
import org.junit.Test;
|
||||||
import org.junit.runner.RunWith;
|
import org.junit.runner.RunWith;
|
||||||
|
|||||||
@@ -5,8 +5,8 @@ import dev.sheldan.abstracto.core.models.context.ServerContext;
|
|||||||
import lombok.Getter;
|
import lombok.Getter;
|
||||||
import lombok.Setter;
|
import lombok.Setter;
|
||||||
import lombok.experimental.SuperBuilder;
|
import lombok.experimental.SuperBuilder;
|
||||||
import net.dv8tion.jda.api.entities.GuildMessageChannel;
|
|
||||||
import net.dv8tion.jda.api.entities.User;
|
import net.dv8tion.jda.api.entities.User;
|
||||||
|
import net.dv8tion.jda.api.entities.channel.middleman.GuildMessageChannel;
|
||||||
|
|
||||||
@Getter
|
@Getter
|
||||||
@Setter
|
@Setter
|
||||||
|
|||||||
@@ -4,23 +4,23 @@ import dev.sheldan.abstracto.statistic.emote.model.database.TrackedEmote;
|
|||||||
import lombok.Builder;
|
import lombok.Builder;
|
||||||
import lombok.Getter;
|
import lombok.Getter;
|
||||||
import lombok.Setter;
|
import lombok.Setter;
|
||||||
import net.dv8tion.jda.api.entities.Emote;
|
import net.dv8tion.jda.api.entities.emoji.CustomEmoji;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Container class for containing both an {@link Emote} and a {@link TrackedEmote} for the purpose of a {@link dev.sheldan.abstracto.core.command.config.Parameter}.
|
* Container class for containing both an {@link CustomEmoji} and a {@link TrackedEmote} for the purpose of a {@link dev.sheldan.abstracto.core.command.config.Parameter}.
|
||||||
* This is used in {@link dev.sheldan.abstracto.statistic.emote.command.TrackEmote} and is used as a convenience parameter, in which there
|
* This is used in {@link dev.sheldan.abstracto.statistic.emote.command.TrackEmote} and is used as a convenience parameter, in which there
|
||||||
* might both a {@link Emote} and a {@link TrackedEmote} as parameter
|
* might both a {@link CustomEmoji} and a {@link TrackedEmote} as parameter
|
||||||
*/
|
*/
|
||||||
@Getter
|
@Getter
|
||||||
@Setter
|
@Setter
|
||||||
@Builder
|
@Builder
|
||||||
public class TrackEmoteParameter {
|
public class TrackEmoteParameter {
|
||||||
/**
|
/**
|
||||||
* If an {@link Emote} has been used as parameter, this will have the appropriate value
|
* If an {@link CustomEmoji} has been used as parameter, this will have the appropriate value
|
||||||
*/
|
*/
|
||||||
private Emote emote;
|
private CustomEmoji emote;
|
||||||
/**
|
/**
|
||||||
* If a {@link Long} or {@link Emote} has been supplied as the parameter, this will contain a faked instance of the respective values
|
* If a {@link Long} or {@link CustomEmoji} has been supplied as the parameter, this will contain a faked instance of the respective values
|
||||||
*/
|
*/
|
||||||
private TrackedEmote trackedEmote;
|
private TrackedEmote trackedEmote;
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -10,8 +10,8 @@ import dev.sheldan.abstracto.core.command.handler.provided.EmoteParameterHandler
|
|||||||
import dev.sheldan.abstracto.core.command.service.CommandService;
|
import dev.sheldan.abstracto.core.command.service.CommandService;
|
||||||
import dev.sheldan.abstracto.statistic.emote.model.database.TrackedEmote;
|
import dev.sheldan.abstracto.statistic.emote.model.database.TrackedEmote;
|
||||||
import dev.sheldan.abstracto.statistic.emote.service.TrackedEmoteService;
|
import dev.sheldan.abstracto.statistic.emote.service.TrackedEmoteService;
|
||||||
import net.dv8tion.jda.api.entities.Emote;
|
|
||||||
import net.dv8tion.jda.api.entities.Message;
|
import net.dv8tion.jda.api.entities.Message;
|
||||||
|
import net.dv8tion.jda.api.entities.emoji.CustomEmoji;
|
||||||
import org.springframework.beans.factory.annotation.Autowired;
|
import org.springframework.beans.factory.annotation.Autowired;
|
||||||
import org.springframework.stereotype.Component;
|
import org.springframework.stereotype.Component;
|
||||||
|
|
||||||
@@ -44,7 +44,7 @@ public class TrackedEmoteParameterHandler implements CommandParameterHandler {
|
|||||||
|
|
||||||
/**
|
/**
|
||||||
* This will parse the input for potential {@link TrackedEmote} and return a fake instance of such.
|
* This will parse the input for potential {@link TrackedEmote} and return a fake instance of such.
|
||||||
* At first it will see if there are any {@link Emote} directly in the message. If there are none at the current position
|
* At first it will see if there are any {@link CustomEmoji} directly in the message. If there are none at the current position
|
||||||
* it will try to parse the parameter to a {@link Long}. It is *not* guaranteed that a {@link TrackedEmote} with this ID
|
* it will try to parse the parameter to a {@link Long}. It is *not* guaranteed that a {@link TrackedEmote} with this ID
|
||||||
* really exists for this server. So, any commands using this are required to do checks on their own.
|
* really exists for this server. So, any commands using this are required to do checks on their own.
|
||||||
* @param input The {@link String} input at the current position
|
* @param input The {@link String} input at the current position
|
||||||
@@ -59,8 +59,8 @@ public class TrackedEmoteParameterHandler implements CommandParameterHandler {
|
|||||||
@Override
|
@Override
|
||||||
public Object handle(UnparsedCommandParameterPiece input, CommandParameterIterators iterators, Parameter param, Message context, Command command) {
|
public Object handle(UnparsedCommandParameterPiece input, CommandParameterIterators iterators, Parameter param, Message context, Command command) {
|
||||||
Parameter cloned = commandService.cloneParameter(param);
|
Parameter cloned = commandService.cloneParameter(param);
|
||||||
cloned.setType(Emote.class);
|
cloned.setType(CustomEmoji.class);
|
||||||
Emote emote = (Emote) emoteParameterHandler.handle(input, iterators, cloned, context, command);
|
CustomEmoji emote = (CustomEmoji) emoteParameterHandler.handle(input, iterators, cloned, context, command);
|
||||||
if(emote != null) {
|
if(emote != null) {
|
||||||
return trackedEmoteService.getFakeTrackedEmote(emote, context.getGuild());
|
return trackedEmoteService.getFakeTrackedEmote(emote, context.getGuild());
|
||||||
} else {
|
} else {
|
||||||
|
|||||||
@@ -11,16 +11,16 @@ import dev.sheldan.abstracto.core.command.service.CommandService;
|
|||||||
import dev.sheldan.abstracto.statistic.emote.command.parameter.TrackEmoteParameter;
|
import dev.sheldan.abstracto.statistic.emote.command.parameter.TrackEmoteParameter;
|
||||||
import dev.sheldan.abstracto.statistic.emote.model.database.TrackedEmote;
|
import dev.sheldan.abstracto.statistic.emote.model.database.TrackedEmote;
|
||||||
import dev.sheldan.abstracto.statistic.emote.service.TrackedEmoteService;
|
import dev.sheldan.abstracto.statistic.emote.service.TrackedEmoteService;
|
||||||
import net.dv8tion.jda.api.entities.Emote;
|
|
||||||
import net.dv8tion.jda.api.entities.Message;
|
import net.dv8tion.jda.api.entities.Message;
|
||||||
|
import net.dv8tion.jda.api.entities.emoji.CustomEmoji;
|
||||||
import org.springframework.beans.factory.annotation.Autowired;
|
import org.springframework.beans.factory.annotation.Autowired;
|
||||||
import org.springframework.stereotype.Component;
|
import org.springframework.stereotype.Component;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* {@link CommandParameterHandler} for the {@link TrackEmoteParameter} class. It will call the
|
* {@link CommandParameterHandler} for the {@link TrackEmoteParameter} class. It will call the
|
||||||
* {@link EmoteParameterHandler} and use the returned {@link Emote} if one is available. Otherwise it will only use the
|
* {@link EmoteParameterHandler} and use the returned {@link CustomEmoji} if one is available. Otherwise it will only use the
|
||||||
* {@link Long} which was passed. This handler will create a fake instance for the {@link dev.sheldan.abstracto.statistic.emote.model.database.TrackedEmote}
|
* {@link Long} which was passed. This handler will create a fake instance for the {@link dev.sheldan.abstracto.statistic.emote.model.database.TrackedEmote}
|
||||||
* and only make the {@link Emote} available in the result, if it was passed as such. This handler has a slightly higher priority
|
* and only make the {@link CustomEmoji} available in the result, if it was passed as such. This handler has a slightly higher priority
|
||||||
* than medium.
|
* than medium.
|
||||||
*/
|
*/
|
||||||
@Component
|
@Component
|
||||||
@@ -47,8 +47,8 @@ public class TrackedEmoteParameterParameterHandler implements CommandParameterHa
|
|||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* This tries to parse the input and extract an {@link Emote} or just an {@link Long}. It uses a {@link EmoteParameterHandler} at first,
|
* This tries to parse the input and extract an {@link CustomEmoji} or just an {@link Long}. It uses a {@link EmoteParameterHandler} at first,
|
||||||
* and if nothing is found tries to parse the {@link Long} directly from the input. In case an {@link Emote} was used, this will populate the
|
* and if nothing is found tries to parse the {@link Long} directly from the input. In case an {@link CustomEmoji} was used, this will populate the
|
||||||
* respective member variable in {@link TrackEmoteParameter}.
|
* respective member variable in {@link TrackEmoteParameter}.
|
||||||
* @param input The {@link String} input at the current position
|
* @param input The {@link String} input at the current position
|
||||||
* @param iterators The {@link CommandParameterIterators} containing all available iterators to directly retrieve JDA related
|
* @param iterators The {@link CommandParameterIterators} containing all available iterators to directly retrieve JDA related
|
||||||
@@ -56,15 +56,15 @@ public class TrackedEmoteParameterParameterHandler implements CommandParameterHa
|
|||||||
* @param param The {@link Class} which this type should handle
|
* @param param The {@link Class} which this type should handle
|
||||||
* @param context The {@link Message} which caused the command to be executed
|
* @param context The {@link Message} which caused the command to be executed
|
||||||
* @param command
|
* @param command
|
||||||
* @return An instance of {@link TrackEmoteParameter} which contains the available instances. This is an {@link Emote} in case it was
|
* @return An instance of {@link TrackEmoteParameter} which contains the available instances. This is an {@link CustomEmoji} in case it was
|
||||||
* used directly. In every successful case, it will contain a faked {@link TrackedEmote}.
|
* used directly. In every successful case, it will contain a faked {@link TrackedEmote}.
|
||||||
*/
|
*/
|
||||||
@Override
|
@Override
|
||||||
public Object handle(UnparsedCommandParameterPiece input, CommandParameterIterators iterators, Parameter param, Message context, Command command) {
|
public Object handle(UnparsedCommandParameterPiece input, CommandParameterIterators iterators, Parameter param, Message context, Command command) {
|
||||||
TrackEmoteParameter parameter = TrackEmoteParameter.builder().build();
|
TrackEmoteParameter parameter = TrackEmoteParameter.builder().build();
|
||||||
Parameter cloned = commandService.cloneParameter(param);
|
Parameter cloned = commandService.cloneParameter(param);
|
||||||
cloned.setType(Emote.class);
|
cloned.setType(CustomEmoji.class);
|
||||||
Emote emote = (Emote) emoteParameterHandler.handle(input, iterators, cloned, context, command);
|
CustomEmoji emote = (CustomEmoji) emoteParameterHandler.handle(input, iterators, cloned, context, command);
|
||||||
if(emote != null) {
|
if(emote != null) {
|
||||||
parameter.setEmote(emote);
|
parameter.setEmote(emote);
|
||||||
parameter.setTrackedEmote(trackedEmoteService.getFakeTrackedEmote(emote, context.getGuild()));
|
parameter.setTrackedEmote(trackedEmoteService.getFakeTrackedEmote(emote, context.getGuild()));
|
||||||
|
|||||||
@@ -6,8 +6,8 @@ import dev.sheldan.abstracto.statistic.emote.model.EmoteStatsResult;
|
|||||||
import dev.sheldan.abstracto.statistic.emote.model.EmoteStatsResultDisplay;
|
import dev.sheldan.abstracto.statistic.emote.model.EmoteStatsResultDisplay;
|
||||||
import dev.sheldan.abstracto.statistic.emote.model.database.TrackedEmote;
|
import dev.sheldan.abstracto.statistic.emote.model.database.TrackedEmote;
|
||||||
import dev.sheldan.abstracto.statistic.emote.service.management.TrackedEmoteManagementService;
|
import dev.sheldan.abstracto.statistic.emote.service.management.TrackedEmoteManagementService;
|
||||||
import net.dv8tion.jda.api.entities.Emote;
|
|
||||||
import net.dv8tion.jda.api.entities.Guild;
|
import net.dv8tion.jda.api.entities.Guild;
|
||||||
|
import net.dv8tion.jda.api.entities.emoji.CustomEmoji;
|
||||||
import org.springframework.beans.factory.annotation.Autowired;
|
import org.springframework.beans.factory.annotation.Autowired;
|
||||||
import org.springframework.stereotype.Component;
|
import org.springframework.stereotype.Component;
|
||||||
|
|
||||||
@@ -15,7 +15,7 @@ import java.util.List;
|
|||||||
|
|
||||||
/**
|
/**
|
||||||
* Component to convert from a {@link EmoteStatsResult} to a proper instance of {@link EmoteStatsModel}.
|
* Component to convert from a {@link EmoteStatsResult} to a proper instance of {@link EmoteStatsModel}.
|
||||||
* This for example loads the relevant {@link Emote} to be used within the model and also splits it up
|
* This for example loads the relevant {@link net.dv8tion.jda.api.entities.emoji.CustomEmoji} to be used within the model and also splits it up
|
||||||
* into static and animated emotes
|
* into static and animated emotes
|
||||||
*/
|
*/
|
||||||
@Component
|
@Component
|
||||||
@@ -53,10 +53,10 @@ public class EmoteStatsConverter {
|
|||||||
|
|
||||||
private EmoteStatsResultDisplay convertEmoteStatsResult(Guild relevantGuild, EmoteStatsResult emoteStatsResult) {
|
private EmoteStatsResultDisplay convertEmoteStatsResult(Guild relevantGuild, EmoteStatsResult emoteStatsResult) {
|
||||||
TrackedEmote trackedEmote = trackedEmoteManagementService.loadByEmoteId(emoteStatsResult.getEmoteId(), emoteStatsResult.getServerId());
|
TrackedEmote trackedEmote = trackedEmoteManagementService.loadByEmoteId(emoteStatsResult.getEmoteId(), emoteStatsResult.getServerId());
|
||||||
Emote loadedEmote = null;
|
CustomEmoji loadedEmote = null;
|
||||||
// if the emote should still exist, we try to load it
|
// if the emote should still exist, we try to load it
|
||||||
if(!trackedEmote.getExternal() && !trackedEmote.getDeleted()) {
|
if(!trackedEmote.getExternal() && !trackedEmote.getDeleted()) {
|
||||||
loadedEmote = relevantGuild.getEmoteById(trackedEmote.getTrackedEmoteId().getId());
|
loadedEmote = relevantGuild.getEmojiById(trackedEmote.getTrackedEmoteId().getId());
|
||||||
}
|
}
|
||||||
return EmoteStatsResultDisplay
|
return EmoteStatsResultDisplay
|
||||||
.builder()
|
.builder()
|
||||||
|
|||||||
@@ -9,7 +9,6 @@ import dev.sheldan.abstracto.statistic.config.StatisticFeatureDefinition;
|
|||||||
import dev.sheldan.abstracto.statistic.emote.config.EmoteTrackingMode;
|
import dev.sheldan.abstracto.statistic.emote.config.EmoteTrackingMode;
|
||||||
import dev.sheldan.abstracto.statistic.emote.service.management.TrackedEmoteManagementService;
|
import dev.sheldan.abstracto.statistic.emote.service.management.TrackedEmoteManagementService;
|
||||||
import lombok.extern.slf4j.Slf4j;
|
import lombok.extern.slf4j.Slf4j;
|
||||||
import net.dv8tion.jda.api.entities.Emote;
|
|
||||||
import org.springframework.beans.factory.annotation.Autowired;
|
import org.springframework.beans.factory.annotation.Autowired;
|
||||||
import org.springframework.stereotype.Component;
|
import org.springframework.stereotype.Component;
|
||||||
|
|
||||||
@@ -17,7 +16,7 @@ import java.util.Arrays;
|
|||||||
import java.util.List;
|
import java.util.List;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* This listener listens for created {@link Emote} in a {@link net.dv8tion.jda.api.entities.Guild} and creates appropriate
|
* This listener listens for created {@link net.dv8tion.jda.api.entities.emoji.RichCustomEmoji} in a {@link net.dv8tion.jda.api.entities.Guild} and creates appropriate
|
||||||
* {@link dev.sheldan.abstracto.statistic.emote.model.database.TrackedEmote}, if the EMOTE_TRACKING feature is enabled and the AUTO_TRACK
|
* {@link dev.sheldan.abstracto.statistic.emote.model.database.TrackedEmote}, if the EMOTE_TRACKING feature is enabled and the AUTO_TRACK
|
||||||
* feature mode as well.
|
* feature mode as well.
|
||||||
*/
|
*/
|
||||||
|
|||||||
@@ -9,7 +9,6 @@ import dev.sheldan.abstracto.statistic.config.StatisticFeatureDefinition;
|
|||||||
import dev.sheldan.abstracto.statistic.emote.config.EmoteTrackingMode;
|
import dev.sheldan.abstracto.statistic.emote.config.EmoteTrackingMode;
|
||||||
import dev.sheldan.abstracto.statistic.emote.service.management.TrackedEmoteManagementService;
|
import dev.sheldan.abstracto.statistic.emote.service.management.TrackedEmoteManagementService;
|
||||||
import lombok.extern.slf4j.Slf4j;
|
import lombok.extern.slf4j.Slf4j;
|
||||||
import net.dv8tion.jda.api.entities.Emote;
|
|
||||||
import org.springframework.beans.factory.annotation.Autowired;
|
import org.springframework.beans.factory.annotation.Autowired;
|
||||||
import org.springframework.stereotype.Component;
|
import org.springframework.stereotype.Component;
|
||||||
|
|
||||||
@@ -17,7 +16,7 @@ import java.util.Arrays;
|
|||||||
import java.util.List;
|
import java.util.List;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* This listener listens for deleted {@link Emote} in a {@link net.dv8tion.jda.api.entities.Guild} and marks respective
|
* This listener listens for deleted {@link net.dv8tion.jda.api.entities.emoji.CustomEmoji} in a {@link net.dv8tion.jda.api.entities.Guild} and marks respective
|
||||||
* {@link dev.sheldan.abstracto.statistic.emote.model.database.TrackedEmote} as deleted, if the EMOTE_TRACKING feature is enabled and the AUTO_TRACK
|
* {@link dev.sheldan.abstracto.statistic.emote.model.database.TrackedEmote} as deleted, if the EMOTE_TRACKING feature is enabled and the AUTO_TRACK
|
||||||
* feature mode as well.
|
* feature mode as well.
|
||||||
*/
|
*/
|
||||||
|
|||||||
@@ -7,8 +7,8 @@ import dev.sheldan.abstracto.core.models.listener.MessageReceivedModel;
|
|||||||
import dev.sheldan.abstracto.core.service.GuildService;
|
import dev.sheldan.abstracto.core.service.GuildService;
|
||||||
import dev.sheldan.abstracto.statistic.config.StatisticFeatureDefinition;
|
import dev.sheldan.abstracto.statistic.config.StatisticFeatureDefinition;
|
||||||
import dev.sheldan.abstracto.statistic.emote.service.TrackedEmoteService;
|
import dev.sheldan.abstracto.statistic.emote.service.TrackedEmoteService;
|
||||||
import net.dv8tion.jda.api.entities.Emote;
|
|
||||||
import net.dv8tion.jda.api.entities.Message;
|
import net.dv8tion.jda.api.entities.Message;
|
||||||
|
import net.dv8tion.jda.api.entities.emoji.CustomEmoji;
|
||||||
import org.springframework.beans.factory.annotation.Autowired;
|
import org.springframework.beans.factory.annotation.Autowired;
|
||||||
import org.springframework.stereotype.Component;
|
import org.springframework.stereotype.Component;
|
||||||
|
|
||||||
@@ -40,11 +40,11 @@ public class EmoteTrackingListener implements AsyncMessageReceivedListener {
|
|||||||
if(!message.isFromGuild() || message.isWebhookMessage() || message.getType().isSystem()) {
|
if(!message.isFromGuild() || message.isWebhookMessage() || message.getType().isSystem()) {
|
||||||
return DefaultListenerResult.IGNORED;
|
return DefaultListenerResult.IGNORED;
|
||||||
}
|
}
|
||||||
Map<Long, List<Emote>> collect = message
|
Map<Long, List<CustomEmoji>> collect = message
|
||||||
.getMentions()
|
.getMentions()
|
||||||
.getEmotesBag()
|
.getCustomEmojisBag()
|
||||||
.stream()
|
.stream()
|
||||||
.collect(Collectors.groupingBy(Emote::getIdLong));
|
.collect(Collectors.groupingBy(CustomEmoji::getIdLong));
|
||||||
collect.values().forEach(groupedEmotes ->
|
collect.values().forEach(groupedEmotes ->
|
||||||
trackedEmoteService.addEmoteToRuntimeStorage(groupedEmotes.get(0), guildService.getGuildById(model.getServerId()), (long) groupedEmotes.size())
|
trackedEmoteService.addEmoteToRuntimeStorage(groupedEmotes.get(0), guildService.getGuildById(model.getServerId()), (long) groupedEmotes.size())
|
||||||
);
|
);
|
||||||
|
|||||||
@@ -18,8 +18,9 @@ import dev.sheldan.abstracto.statistic.emote.model.database.UsedEmote;
|
|||||||
import dev.sheldan.abstracto.statistic.emote.service.management.TrackedEmoteManagementService;
|
import dev.sheldan.abstracto.statistic.emote.service.management.TrackedEmoteManagementService;
|
||||||
import dev.sheldan.abstracto.statistic.emote.service.management.UsedEmoteManagementService;
|
import dev.sheldan.abstracto.statistic.emote.service.management.UsedEmoteManagementService;
|
||||||
import lombok.extern.slf4j.Slf4j;
|
import lombok.extern.slf4j.Slf4j;
|
||||||
import net.dv8tion.jda.api.entities.Emote;
|
|
||||||
import net.dv8tion.jda.api.entities.Guild;
|
import net.dv8tion.jda.api.entities.Guild;
|
||||||
|
import net.dv8tion.jda.api.entities.emoji.CustomEmoji;
|
||||||
|
import net.dv8tion.jda.api.entities.emoji.RichCustomEmoji;
|
||||||
import org.springframework.beans.factory.annotation.Autowired;
|
import org.springframework.beans.factory.annotation.Autowired;
|
||||||
import org.springframework.stereotype.Component;
|
import org.springframework.stereotype.Component;
|
||||||
import org.springframework.transaction.annotation.Transactional;
|
import org.springframework.transaction.annotation.Transactional;
|
||||||
@@ -87,7 +88,7 @@ public class TrackedEmoteServiceBean implements TrackedEmoteService {
|
|||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void addEmoteToRuntimeStorage(Emote emote, Guild guild, Long count) {
|
public void addEmoteToRuntimeStorage(CustomEmoji emote, Guild guild, Long count) {
|
||||||
addEmoteToRuntimeStorage(cacheEntityService.getCachedEmoteFromEmote(emote, guild), guild, count);
|
addEmoteToRuntimeStorage(cacheEntityService.getCachedEmoteFromEmote(emote, guild), guild, count);
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -141,7 +142,7 @@ public class TrackedEmoteServiceBean implements TrackedEmoteService {
|
|||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public TrackedEmote getFakeTrackedEmote(Emote emote, Guild guild) {
|
public TrackedEmote getFakeTrackedEmote(CustomEmoji emote, Guild guild) {
|
||||||
return getFakeTrackedEmote(emote.getIdLong(), guild);
|
return getFakeTrackedEmote(emote.getIdLong(), guild);
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -158,10 +159,10 @@ public class TrackedEmoteServiceBean implements TrackedEmoteService {
|
|||||||
public TrackedEmoteSynchronizationResult synchronizeTrackedEmotes(Guild guild) {
|
public TrackedEmoteSynchronizationResult synchronizeTrackedEmotes(Guild guild) {
|
||||||
List<TrackedEmote> activeTrackedEmotes = trackedEmoteManagementService.getAllActiveTrackedEmoteForServer(guild.getIdLong());
|
List<TrackedEmote> activeTrackedEmotes = trackedEmoteManagementService.getAllActiveTrackedEmoteForServer(guild.getIdLong());
|
||||||
Long addedEmotes = 0L;
|
Long addedEmotes = 0L;
|
||||||
List<Emote> allExistingEmotes = guild.getEmotes();
|
List<RichCustomEmoji> allExistingEmotes = guild.getEmojis();
|
||||||
log.info("Synchronizing emotes for server {}, currently tracked emotes {}, available emotes for server {}.", guild.getIdLong(), activeTrackedEmotes.size(), allExistingEmotes.size());
|
log.info("Synchronizing emotes for server {}, currently tracked emotes {}, available emotes for server {}.", guild.getIdLong(), activeTrackedEmotes.size(), allExistingEmotes.size());
|
||||||
// iterate over all emotes currently available in the guild
|
// iterate over all emotes currently available in the guild
|
||||||
for (Emote emote : allExistingEmotes) {
|
for (RichCustomEmoji emote : allExistingEmotes) {
|
||||||
// find the emote in the list of known TrackedEmote
|
// find the emote in the list of known TrackedEmote
|
||||||
Optional<TrackedEmote> trackedEmoteOptional = activeTrackedEmotes
|
Optional<TrackedEmote> trackedEmoteOptional = activeTrackedEmotes
|
||||||
.stream()
|
.stream()
|
||||||
@@ -206,13 +207,13 @@ public class TrackedEmoteServiceBean implements TrackedEmoteService {
|
|||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public TrackedEmote createTrackedEmote(Emote emote, Guild guild) {
|
public TrackedEmote createTrackedEmote(CustomEmoji emote, Guild guild) {
|
||||||
boolean external = !emoteService.emoteIsFromGuild(emote, guild);
|
boolean external = !emoteService.emoteIsFromGuild(emote, guild);
|
||||||
return createTrackedEmote(emote, guild, external);
|
return createTrackedEmote(emote, guild, external);
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public TrackedEmote createTrackedEmote(Emote emote, Guild guild, boolean external) {
|
public TrackedEmote createTrackedEmote(CustomEmoji emote, Guild guild, boolean external) {
|
||||||
return trackedEmoteManagementService.createTrackedEmote(emote, guild, external);
|
return trackedEmoteManagementService.createTrackedEmote(emote, guild, external);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -9,8 +9,9 @@ import dev.sheldan.abstracto.statistic.emote.model.PersistingEmote;
|
|||||||
import dev.sheldan.abstracto.statistic.emote.model.database.TrackedEmote;
|
import dev.sheldan.abstracto.statistic.emote.model.database.TrackedEmote;
|
||||||
import dev.sheldan.abstracto.statistic.emote.repository.TrackedEmoteRepository;
|
import dev.sheldan.abstracto.statistic.emote.repository.TrackedEmoteRepository;
|
||||||
import lombok.extern.slf4j.Slf4j;
|
import lombok.extern.slf4j.Slf4j;
|
||||||
import net.dv8tion.jda.api.entities.Emote;
|
|
||||||
import net.dv8tion.jda.api.entities.Guild;
|
import net.dv8tion.jda.api.entities.Guild;
|
||||||
|
import net.dv8tion.jda.api.entities.emoji.CustomEmoji;
|
||||||
|
import net.dv8tion.jda.api.entities.emoji.RichCustomEmoji;
|
||||||
import org.springframework.beans.factory.annotation.Autowired;
|
import org.springframework.beans.factory.annotation.Autowired;
|
||||||
import org.springframework.stereotype.Component;
|
import org.springframework.stereotype.Component;
|
||||||
|
|
||||||
@@ -33,13 +34,13 @@ public class TrackedEmoteManagementServiceBean implements TrackedEmoteManagement
|
|||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public TrackedEmote createTrackedEmote(Emote emote, Guild guild) {
|
public TrackedEmote createTrackedEmote(CustomEmoji emote, Guild guild) {
|
||||||
AServer server = serverManagementService.loadServer(guild.getIdLong());
|
AServer server = serverManagementService.loadServer(guild.getIdLong());
|
||||||
return createTrackedEmote(emote.getIdLong(), emote.getName(), emote.isAnimated(), true, server);
|
return createTrackedEmote(emote.getIdLong(), emote.getName(), emote.isAnimated(), true, server);
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public TrackedEmote createTrackedEmote(Emote emote) {
|
public TrackedEmote createTrackedEmote(RichCustomEmoji emote) {
|
||||||
return createTrackedEmote(emote, emote.getGuild());
|
return createTrackedEmote(emote, emote.getGuild());
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -50,7 +51,7 @@ public class TrackedEmoteManagementServiceBean implements TrackedEmoteManagement
|
|||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public TrackedEmote createTrackedEmote(Emote emote, Guild guild, boolean external) {
|
public TrackedEmote createTrackedEmote(CustomEmoji emote, Guild guild, boolean external) {
|
||||||
if(external) {
|
if(external) {
|
||||||
return createExternalTrackedEmote(emote, guild);
|
return createExternalTrackedEmote(emote, guild);
|
||||||
} else {
|
} else {
|
||||||
@@ -103,7 +104,7 @@ public class TrackedEmoteManagementServiceBean implements TrackedEmoteManagement
|
|||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public TrackedEmote createExternalTrackedEmote(Emote emote, Guild guild) {
|
public TrackedEmote createExternalTrackedEmote(CustomEmoji emote, Guild guild) {
|
||||||
AServer server = serverManagementService.loadServer(guild.getIdLong());
|
AServer server = serverManagementService.loadServer(guild.getIdLong());
|
||||||
return createExternalEmote(emote.getIdLong(), emote.getName(), emote.getImageUrl(), emote.isAnimated(), server, true);
|
return createExternalEmote(emote.getIdLong(), emote.getName(), emote.getImageUrl(), emote.isAnimated(), server, true);
|
||||||
}
|
}
|
||||||
@@ -115,7 +116,7 @@ public class TrackedEmoteManagementServiceBean implements TrackedEmoteManagement
|
|||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void markAsDeleted(Emote emote) {
|
public void markAsDeleted(RichCustomEmoji emote) {
|
||||||
markAsDeleted(emote.getGuild().getIdLong(), emote.getIdLong());
|
markAsDeleted(emote.getGuild().getIdLong(), emote.getIdLong());
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -131,7 +132,7 @@ public class TrackedEmoteManagementServiceBean implements TrackedEmoteManagement
|
|||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public TrackedEmote loadByEmote(Emote emote) {
|
public TrackedEmote loadByEmote(RichCustomEmoji emote) {
|
||||||
return loadByEmoteId(emote.getIdLong(), emote.getGuild().getIdLong());
|
return loadByEmoteId(emote.getIdLong(), emote.getGuild().getIdLong());
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -24,7 +24,6 @@ import org.mockito.junit.MockitoJUnitRunner;
|
|||||||
|
|
||||||
import java.io.File;
|
import java.io.File;
|
||||||
import java.io.IOException;
|
import java.io.IOException;
|
||||||
import java.time.Duration;
|
|
||||||
import java.time.Instant;
|
import java.time.Instant;
|
||||||
import java.util.ArrayList;
|
import java.util.ArrayList;
|
||||||
import java.util.Arrays;
|
import java.util.Arrays;
|
||||||
@@ -32,8 +31,6 @@ import java.util.List;
|
|||||||
import java.util.concurrent.CompletableFuture;
|
import java.util.concurrent.CompletableFuture;
|
||||||
|
|
||||||
import static dev.sheldan.abstracto.statistic.emote.command.ExportEmoteStats.*;
|
import static dev.sheldan.abstracto.statistic.emote.command.ExportEmoteStats.*;
|
||||||
import static org.mockito.ArgumentMatchers.any;
|
|
||||||
import static org.mockito.ArgumentMatchers.eq;
|
|
||||||
import static org.mockito.Mockito.*;
|
import static org.mockito.Mockito.*;
|
||||||
|
|
||||||
@RunWith(MockitoJUnitRunner.class)
|
@RunWith(MockitoJUnitRunner.class)
|
||||||
|
|||||||
@@ -24,8 +24,6 @@ import java.util.Arrays;
|
|||||||
import java.util.concurrent.CompletableFuture;
|
import java.util.concurrent.CompletableFuture;
|
||||||
|
|
||||||
import static dev.sheldan.abstracto.statistic.emote.command.ShowTrackedEmotes.*;
|
import static dev.sheldan.abstracto.statistic.emote.command.ShowTrackedEmotes.*;
|
||||||
import static org.mockito.ArgumentMatchers.any;
|
|
||||||
import static org.mockito.ArgumentMatchers.eq;
|
|
||||||
import static org.mockito.Mockito.*;
|
import static org.mockito.Mockito.*;
|
||||||
|
|
||||||
@RunWith(MockitoJUnitRunner.class)
|
@RunWith(MockitoJUnitRunner.class)
|
||||||
|
|||||||
@@ -15,7 +15,7 @@ import dev.sheldan.abstracto.statistic.emote.config.EmoteTrackingMode;
|
|||||||
import dev.sheldan.abstracto.statistic.emote.model.database.TrackedEmote;
|
import dev.sheldan.abstracto.statistic.emote.model.database.TrackedEmote;
|
||||||
import dev.sheldan.abstracto.statistic.emote.service.TrackedEmoteService;
|
import dev.sheldan.abstracto.statistic.emote.service.TrackedEmoteService;
|
||||||
import dev.sheldan.abstracto.statistic.emote.service.management.TrackedEmoteManagementService;
|
import dev.sheldan.abstracto.statistic.emote.service.management.TrackedEmoteManagementService;
|
||||||
import net.dv8tion.jda.api.entities.Emote;
|
import net.dv8tion.jda.api.entities.emoji.CustomEmoji;
|
||||||
import org.junit.Assert;
|
import org.junit.Assert;
|
||||||
import org.junit.Test;
|
import org.junit.Test;
|
||||||
import org.junit.runner.RunWith;
|
import org.junit.runner.RunWith;
|
||||||
@@ -73,7 +73,7 @@ public class TrackEmoteTest {
|
|||||||
when(commandContext.getGuild().getIdLong()).thenReturn(SERVER_ID);
|
when(commandContext.getGuild().getIdLong()).thenReturn(SERVER_ID);
|
||||||
TrackedEmote trackedEmote = Mockito.mock(TrackedEmote.class);
|
TrackedEmote trackedEmote = Mockito.mock(TrackedEmote.class);
|
||||||
when(trackedEmote.getTrackedEmoteId()).thenReturn(new ServerSpecificId(SERVER_ID, EMOTE_ID));
|
when(trackedEmote.getTrackedEmoteId()).thenReturn(new ServerSpecificId(SERVER_ID, EMOTE_ID));
|
||||||
Emote emoteToTrack = Mockito.mock(Emote.class);
|
CustomEmoji emoteToTrack = Mockito.mock(CustomEmoji.class);
|
||||||
when(trackEmoteParameter.getEmote()).thenReturn(emoteToTrack);
|
when(trackEmoteParameter.getEmote()).thenReturn(emoteToTrack);
|
||||||
when(trackEmoteParameter.getTrackedEmote()).thenReturn(trackedEmote);
|
when(trackEmoteParameter.getTrackedEmote()).thenReturn(trackedEmote);
|
||||||
when(emoteService.emoteIsFromGuild(emoteToTrack, commandContext.getGuild())).thenReturn(false);
|
when(emoteService.emoteIsFromGuild(emoteToTrack, commandContext.getGuild())).thenReturn(false);
|
||||||
@@ -88,7 +88,7 @@ public class TrackEmoteTest {
|
|||||||
when(commandContext.getGuild().getIdLong()).thenReturn(SERVER_ID);
|
when(commandContext.getGuild().getIdLong()).thenReturn(SERVER_ID);
|
||||||
TrackedEmote trackedEmote = Mockito.mock(TrackedEmote.class);
|
TrackedEmote trackedEmote = Mockito.mock(TrackedEmote.class);
|
||||||
when(trackedEmote.getTrackedEmoteId()).thenReturn(new ServerSpecificId(SERVER_ID, EMOTE_ID));
|
when(trackedEmote.getTrackedEmoteId()).thenReturn(new ServerSpecificId(SERVER_ID, EMOTE_ID));
|
||||||
Emote emoteToTrack = Mockito.mock(Emote.class);
|
CustomEmoji emoteToTrack = Mockito.mock(CustomEmoji.class);
|
||||||
when(trackEmoteParameter.getEmote()).thenReturn(emoteToTrack);
|
when(trackEmoteParameter.getEmote()).thenReturn(emoteToTrack);
|
||||||
when(trackEmoteParameter.getTrackedEmote()).thenReturn(trackedEmote);
|
when(trackEmoteParameter.getTrackedEmote()).thenReturn(trackedEmote);
|
||||||
when(emoteService.emoteIsFromGuild(emoteToTrack, commandContext.getGuild())).thenReturn(false);
|
when(emoteService.emoteIsFromGuild(emoteToTrack, commandContext.getGuild())).thenReturn(false);
|
||||||
|
|||||||
@@ -10,9 +10,9 @@ import dev.sheldan.abstracto.core.command.service.CommandService;
|
|||||||
import dev.sheldan.abstracto.statistic.emote.command.parameter.handler.TrackedEmoteParameterHandler;
|
import dev.sheldan.abstracto.statistic.emote.command.parameter.handler.TrackedEmoteParameterHandler;
|
||||||
import dev.sheldan.abstracto.statistic.emote.model.database.TrackedEmote;
|
import dev.sheldan.abstracto.statistic.emote.model.database.TrackedEmote;
|
||||||
import dev.sheldan.abstracto.statistic.emote.service.TrackedEmoteService;
|
import dev.sheldan.abstracto.statistic.emote.service.TrackedEmoteService;
|
||||||
import net.dv8tion.jda.api.entities.Emote;
|
|
||||||
import net.dv8tion.jda.api.entities.Guild;
|
import net.dv8tion.jda.api.entities.Guild;
|
||||||
import net.dv8tion.jda.api.entities.Message;
|
import net.dv8tion.jda.api.entities.Message;
|
||||||
|
import net.dv8tion.jda.api.entities.emoji.RichCustomEmoji;
|
||||||
import org.junit.Assert;
|
import org.junit.Assert;
|
||||||
import org.junit.Test;
|
import org.junit.Test;
|
||||||
import org.junit.runner.RunWith;
|
import org.junit.runner.RunWith;
|
||||||
@@ -78,7 +78,7 @@ public class TrackedEmoteParameterHandlerTest {
|
|||||||
@Test
|
@Test
|
||||||
public void testHandleWithEmote() {
|
public void testHandleWithEmote() {
|
||||||
when(contextMessage.getGuild()).thenReturn(guild);
|
when(contextMessage.getGuild()).thenReturn(guild);
|
||||||
Emote emote = Mockito.mock(Emote.class);
|
RichCustomEmoji emote = Mockito.mock(RichCustomEmoji.class);
|
||||||
UnparsedCommandParameterPiece input = Mockito.mock(UnparsedCommandParameterPiece.class);
|
UnparsedCommandParameterPiece input = Mockito.mock(UnparsedCommandParameterPiece.class);
|
||||||
when(commandService.cloneParameter(parameter)).thenReturn(parameter2);
|
when(commandService.cloneParameter(parameter)).thenReturn(parameter2);
|
||||||
when(emoteParameterHandler.handle(input, iterators, parameter2, contextMessage, command)).thenReturn(emote);
|
when(emoteParameterHandler.handle(input, iterators, parameter2, contextMessage, command)).thenReturn(emote);
|
||||||
@@ -97,7 +97,7 @@ public class TrackedEmoteParameterHandlerTest {
|
|||||||
when(trackedEmoteService.getFakeTrackedEmote(emoteId, guild)).thenReturn(trackedEmote);
|
when(trackedEmoteService.getFakeTrackedEmote(emoteId, guild)).thenReturn(trackedEmote);
|
||||||
when(emoteParameterHandler.handle(input, iterators, parameter2, contextMessage, command)).thenReturn(null);
|
when(emoteParameterHandler.handle(input, iterators, parameter2, contextMessage, command)).thenReturn(null);
|
||||||
TrackedEmote parsedEmote = (TrackedEmote) testUnit.handle(input, iterators, parameter, contextMessage, command);
|
TrackedEmote parsedEmote = (TrackedEmote) testUnit.handle(input, iterators, parameter, contextMessage, command);
|
||||||
verify(trackedEmoteService, times(0)).getFakeTrackedEmote(any(Emote.class), eq(guild));
|
verify(trackedEmoteService, times(0)).getFakeTrackedEmote(any(RichCustomEmoji.class), eq(guild));
|
||||||
Assert.assertEquals(trackedEmote, parsedEmote);
|
Assert.assertEquals(trackedEmote, parsedEmote);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -11,9 +11,9 @@ import dev.sheldan.abstracto.statistic.emote.command.parameter.TrackEmoteParamet
|
|||||||
import dev.sheldan.abstracto.statistic.emote.command.parameter.handler.TrackedEmoteParameterParameterHandler;
|
import dev.sheldan.abstracto.statistic.emote.command.parameter.handler.TrackedEmoteParameterParameterHandler;
|
||||||
import dev.sheldan.abstracto.statistic.emote.model.database.TrackedEmote;
|
import dev.sheldan.abstracto.statistic.emote.model.database.TrackedEmote;
|
||||||
import dev.sheldan.abstracto.statistic.emote.service.TrackedEmoteService;
|
import dev.sheldan.abstracto.statistic.emote.service.TrackedEmoteService;
|
||||||
import net.dv8tion.jda.api.entities.Emote;
|
|
||||||
import net.dv8tion.jda.api.entities.Guild;
|
import net.dv8tion.jda.api.entities.Guild;
|
||||||
import net.dv8tion.jda.api.entities.Message;
|
import net.dv8tion.jda.api.entities.Message;
|
||||||
|
import net.dv8tion.jda.api.entities.emoji.RichCustomEmoji;
|
||||||
import org.junit.Assert;
|
import org.junit.Assert;
|
||||||
import org.junit.Test;
|
import org.junit.Test;
|
||||||
import org.junit.runner.RunWith;
|
import org.junit.runner.RunWith;
|
||||||
@@ -22,8 +22,6 @@ import org.mockito.Mock;
|
|||||||
import org.mockito.Mockito;
|
import org.mockito.Mockito;
|
||||||
import org.mockito.junit.MockitoJUnitRunner;
|
import org.mockito.junit.MockitoJUnitRunner;
|
||||||
|
|
||||||
import static org.mockito.ArgumentMatchers.any;
|
|
||||||
import static org.mockito.ArgumentMatchers.eq;
|
|
||||||
import static org.mockito.Mockito.*;
|
import static org.mockito.Mockito.*;
|
||||||
|
|
||||||
@RunWith(MockitoJUnitRunner.class)
|
@RunWith(MockitoJUnitRunner.class)
|
||||||
@@ -81,7 +79,7 @@ public class TrackedEmoteParameterParameterHandlerTest {
|
|||||||
@Test
|
@Test
|
||||||
public void testHandleWithEmote() {
|
public void testHandleWithEmote() {
|
||||||
when(contextMessage.getGuild()).thenReturn(guild);
|
when(contextMessage.getGuild()).thenReturn(guild);
|
||||||
Emote emote = Mockito.mock(Emote.class);
|
RichCustomEmoji emote = Mockito.mock(RichCustomEmoji.class);
|
||||||
UnparsedCommandParameterPiece input = Mockito.mock(UnparsedCommandParameterPiece.class);
|
UnparsedCommandParameterPiece input = Mockito.mock(UnparsedCommandParameterPiece.class);
|
||||||
when(commandService.cloneParameter(parameter)).thenReturn(parameter2);
|
when(commandService.cloneParameter(parameter)).thenReturn(parameter2);
|
||||||
when(emoteParameterHandler.handle(input, iterators, parameter2, contextMessage, command)).thenReturn(emote);
|
when(emoteParameterHandler.handle(input, iterators, parameter2, contextMessage, command)).thenReturn(emote);
|
||||||
@@ -101,7 +99,7 @@ public class TrackedEmoteParameterParameterHandlerTest {
|
|||||||
when(commandService.cloneParameter(parameter)).thenReturn(parameter2);
|
when(commandService.cloneParameter(parameter)).thenReturn(parameter2);
|
||||||
when(emoteParameterHandler.handle(input, iterators, parameter2, contextMessage, command)).thenReturn(null);
|
when(emoteParameterHandler.handle(input, iterators, parameter2, contextMessage, command)).thenReturn(null);
|
||||||
TrackEmoteParameter parsedEmote = (TrackEmoteParameter) testUnit.handle(input, iterators, parameter, contextMessage, command);
|
TrackEmoteParameter parsedEmote = (TrackEmoteParameter) testUnit.handle(input, iterators, parameter, contextMessage, command);
|
||||||
verify(trackedEmoteService, times(0)).getFakeTrackedEmote(any(Emote.class), eq(guild));
|
verify(trackedEmoteService, times(0)).getFakeTrackedEmote(any(RichCustomEmoji.class), eq(guild));
|
||||||
Assert.assertEquals(trackedEmote, parsedEmote.getTrackedEmote());
|
Assert.assertEquals(trackedEmote, parsedEmote.getTrackedEmote());
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -6,8 +6,8 @@ import dev.sheldan.abstracto.statistic.emote.model.EmoteStatsModel;
|
|||||||
import dev.sheldan.abstracto.statistic.emote.model.EmoteStatsResult;
|
import dev.sheldan.abstracto.statistic.emote.model.EmoteStatsResult;
|
||||||
import dev.sheldan.abstracto.statistic.emote.model.database.TrackedEmote;
|
import dev.sheldan.abstracto.statistic.emote.model.database.TrackedEmote;
|
||||||
import dev.sheldan.abstracto.statistic.emote.service.management.TrackedEmoteManagementService;
|
import dev.sheldan.abstracto.statistic.emote.service.management.TrackedEmoteManagementService;
|
||||||
import net.dv8tion.jda.api.entities.Emote;
|
|
||||||
import net.dv8tion.jda.api.entities.Guild;
|
import net.dv8tion.jda.api.entities.Guild;
|
||||||
|
import net.dv8tion.jda.api.entities.emoji.RichCustomEmoji;
|
||||||
import org.junit.Assert;
|
import org.junit.Assert;
|
||||||
import org.junit.Test;
|
import org.junit.Test;
|
||||||
import org.junit.runner.RunWith;
|
import org.junit.runner.RunWith;
|
||||||
@@ -90,10 +90,10 @@ public class EmoteStatsConverterTest {
|
|||||||
when(trackedEmote2.getDeleted()).thenReturn(false);
|
when(trackedEmote2.getDeleted()).thenReturn(false);
|
||||||
when(trackedEmote2.getTrackedEmoteId()).thenReturn(new ServerSpecificId(SERVER_ID, EMOTE_ID_2));
|
when(trackedEmote2.getTrackedEmoteId()).thenReturn(new ServerSpecificId(SERVER_ID, EMOTE_ID_2));
|
||||||
when(guildService.getGuildById(SERVER_ID)).thenReturn(guild);
|
when(guildService.getGuildById(SERVER_ID)).thenReturn(guild);
|
||||||
Emote emote1 = Mockito.mock(Emote.class);
|
RichCustomEmoji emote1 = Mockito.mock(RichCustomEmoji.class);
|
||||||
when(guild.getEmoteById(EMOTE_ID)).thenReturn(emote1);
|
when(guild.getEmojiById(EMOTE_ID)).thenReturn(emote1);
|
||||||
Emote emote2 = Mockito.mock(Emote.class);
|
RichCustomEmoji emote2 = Mockito.mock(RichCustomEmoji.class);
|
||||||
when(guild.getEmoteById(EMOTE_ID_2)).thenReturn(emote2);
|
when(guild.getEmojiById(EMOTE_ID_2)).thenReturn(emote2);
|
||||||
EmoteStatsModel result = testUnit.fromEmoteStatsResults(Arrays.asList(emoteStatsResult, emoteStatsResult2));
|
EmoteStatsModel result = testUnit.fromEmoteStatsResults(Arrays.asList(emoteStatsResult, emoteStatsResult2));
|
||||||
|
|
||||||
Assert.assertEquals(1, result.getStaticEmotes().size());
|
Assert.assertEquals(1, result.getStaticEmotes().size());
|
||||||
|
|||||||
@@ -3,7 +3,7 @@ package dev.sheldan.abstracto.statistic.emote.listener;
|
|||||||
import dev.sheldan.abstracto.core.models.listener.EmoteCreatedModel;
|
import dev.sheldan.abstracto.core.models.listener.EmoteCreatedModel;
|
||||||
import dev.sheldan.abstracto.statistic.config.StatisticFeatureDefinition;
|
import dev.sheldan.abstracto.statistic.config.StatisticFeatureDefinition;
|
||||||
import dev.sheldan.abstracto.statistic.emote.service.management.TrackedEmoteManagementService;
|
import dev.sheldan.abstracto.statistic.emote.service.management.TrackedEmoteManagementService;
|
||||||
import net.dv8tion.jda.api.entities.Emote;
|
import net.dv8tion.jda.api.entities.emoji.RichCustomEmoji;
|
||||||
import org.junit.Assert;
|
import org.junit.Assert;
|
||||||
import org.junit.Test;
|
import org.junit.Test;
|
||||||
import org.junit.runner.RunWith;
|
import org.junit.runner.RunWith;
|
||||||
@@ -31,7 +31,7 @@ public class CreateTrackedEmoteListenerTest {
|
|||||||
|
|
||||||
@Test
|
@Test
|
||||||
public void testEmoteCreated() {
|
public void testEmoteCreated() {
|
||||||
Emote emote = Mockito.mock(Emote.class);
|
RichCustomEmoji emote = Mockito.mock(RichCustomEmoji.class);
|
||||||
when(emote.getIdLong()).thenReturn(EMOTE_ID);
|
when(emote.getIdLong()).thenReturn(EMOTE_ID);
|
||||||
when(model.getEmote()).thenReturn(emote);
|
when(model.getEmote()).thenReturn(emote);
|
||||||
when(model.getServerId()).thenReturn(SERVER_ID);
|
when(model.getServerId()).thenReturn(SERVER_ID);
|
||||||
|
|||||||
@@ -3,7 +3,7 @@ package dev.sheldan.abstracto.statistic.emote.listener;
|
|||||||
import dev.sheldan.abstracto.core.models.listener.EmoteDeletedModel;
|
import dev.sheldan.abstracto.core.models.listener.EmoteDeletedModel;
|
||||||
import dev.sheldan.abstracto.statistic.config.StatisticFeatureDefinition;
|
import dev.sheldan.abstracto.statistic.config.StatisticFeatureDefinition;
|
||||||
import dev.sheldan.abstracto.statistic.emote.service.management.TrackedEmoteManagementService;
|
import dev.sheldan.abstracto.statistic.emote.service.management.TrackedEmoteManagementService;
|
||||||
import net.dv8tion.jda.api.entities.Emote;
|
import net.dv8tion.jda.api.entities.emoji.RichCustomEmoji;
|
||||||
import org.junit.Assert;
|
import org.junit.Assert;
|
||||||
import org.junit.Test;
|
import org.junit.Test;
|
||||||
import org.junit.runner.RunWith;
|
import org.junit.runner.RunWith;
|
||||||
@@ -28,7 +28,7 @@ public class DeleteTrackedEmoteListenerTest {
|
|||||||
|
|
||||||
@Test
|
@Test
|
||||||
public void testEmoteDeleted() {
|
public void testEmoteDeleted() {
|
||||||
Emote emote = Mockito.mock(Emote.class);
|
RichCustomEmoji emote = Mockito.mock(RichCustomEmoji.class);
|
||||||
when(model.getEmote()).thenReturn(emote);
|
when(model.getEmote()).thenReturn(emote);
|
||||||
testUnit.execute(model);
|
testUnit.execute(model);
|
||||||
verify(trackedEmoteManagementService, times(1)).markAsDeleted(emote);
|
verify(trackedEmoteManagementService, times(1)).markAsDeleted(emote);
|
||||||
|
|||||||
@@ -4,7 +4,7 @@ import dev.sheldan.abstracto.core.models.listener.EmoteNameUpdatedModel;
|
|||||||
import dev.sheldan.abstracto.statistic.config.StatisticFeatureDefinition;
|
import dev.sheldan.abstracto.statistic.config.StatisticFeatureDefinition;
|
||||||
import dev.sheldan.abstracto.statistic.emote.model.database.TrackedEmote;
|
import dev.sheldan.abstracto.statistic.emote.model.database.TrackedEmote;
|
||||||
import dev.sheldan.abstracto.statistic.emote.service.management.TrackedEmoteManagementService;
|
import dev.sheldan.abstracto.statistic.emote.service.management.TrackedEmoteManagementService;
|
||||||
import net.dv8tion.jda.api.entities.Emote;
|
import net.dv8tion.jda.api.entities.emoji.RichCustomEmoji;
|
||||||
import org.junit.Assert;
|
import org.junit.Assert;
|
||||||
import org.junit.Test;
|
import org.junit.Test;
|
||||||
import org.junit.runner.RunWith;
|
import org.junit.runner.RunWith;
|
||||||
@@ -29,7 +29,7 @@ public class UpdateTrackedEmoteListenerTest {
|
|||||||
|
|
||||||
@Test
|
@Test
|
||||||
public void testEmoteUpdated() {
|
public void testEmoteUpdated() {
|
||||||
Emote changedEmote = Mockito.mock(Emote.class);
|
RichCustomEmoji changedEmote = Mockito.mock(RichCustomEmoji.class);
|
||||||
TrackedEmote trackedEmote = Mockito.mock(TrackedEmote.class);
|
TrackedEmote trackedEmote = Mockito.mock(TrackedEmote.class);
|
||||||
when(trackedEmoteManagementService.loadByEmote(changedEmote)).thenReturn(trackedEmote);
|
when(trackedEmoteManagementService.loadByEmote(changedEmote)).thenReturn(trackedEmote);
|
||||||
String newValue = "AFTER";
|
String newValue = "AFTER";
|
||||||
|
|||||||
@@ -15,8 +15,9 @@ import dev.sheldan.abstracto.statistic.emote.model.database.TrackedEmote;
|
|||||||
import dev.sheldan.abstracto.statistic.emote.model.database.UsedEmote;
|
import dev.sheldan.abstracto.statistic.emote.model.database.UsedEmote;
|
||||||
import dev.sheldan.abstracto.statistic.emote.service.management.TrackedEmoteManagementService;
|
import dev.sheldan.abstracto.statistic.emote.service.management.TrackedEmoteManagementService;
|
||||||
import dev.sheldan.abstracto.statistic.emote.service.management.UsedEmoteManagementService;
|
import dev.sheldan.abstracto.statistic.emote.service.management.UsedEmoteManagementService;
|
||||||
import net.dv8tion.jda.api.entities.Emote;
|
|
||||||
import net.dv8tion.jda.api.entities.Guild;
|
import net.dv8tion.jda.api.entities.Guild;
|
||||||
|
import net.dv8tion.jda.api.entities.emoji.CustomEmoji;
|
||||||
|
import net.dv8tion.jda.api.entities.emoji.RichCustomEmoji;
|
||||||
import org.junit.Assert;
|
import org.junit.Assert;
|
||||||
import org.junit.Test;
|
import org.junit.Test;
|
||||||
import org.junit.runner.RunWith;
|
import org.junit.runner.RunWith;
|
||||||
@@ -66,10 +67,10 @@ public class TrackedEmoteServiceBeanTest {
|
|||||||
private CachedEmote secondEmote;
|
private CachedEmote secondEmote;
|
||||||
|
|
||||||
@Mock
|
@Mock
|
||||||
private Emote actualEmote;
|
private RichCustomEmoji actualEmote;
|
||||||
|
|
||||||
@Mock
|
@Mock
|
||||||
private Emote secondActualEmote;
|
private RichCustomEmoji secondActualEmote;
|
||||||
|
|
||||||
@Mock
|
@Mock
|
||||||
private Guild guild;
|
private Guild guild;
|
||||||
@@ -230,14 +231,14 @@ public class TrackedEmoteServiceBeanTest {
|
|||||||
when(secondTrackedEmote.getTrackedEmoteId()).thenReturn(secondTrackedEmoteServer);
|
when(secondTrackedEmote.getTrackedEmoteId()).thenReturn(secondTrackedEmoteServer);
|
||||||
when(secondTrackedEmoteServer.getServerId()).thenReturn(SERVER_ID);
|
when(secondTrackedEmoteServer.getServerId()).thenReturn(SERVER_ID);
|
||||||
when(secondTrackedEmoteServer.getId()).thenReturn(EMOTE_ID_2);
|
when(secondTrackedEmoteServer.getId()).thenReturn(EMOTE_ID_2);
|
||||||
when(guild.getEmotes()).thenReturn(Arrays.asList(actualEmote, secondActualEmote));
|
when(guild.getEmojis()).thenReturn(Arrays.asList(actualEmote, secondActualEmote));
|
||||||
when(actualEmote.getIdLong()).thenReturn(EMOTE_ID);
|
when(actualEmote.getIdLong()).thenReturn(EMOTE_ID);
|
||||||
when(secondActualEmote.getIdLong()).thenReturn(EMOTE_ID_2);
|
when(secondActualEmote.getIdLong()).thenReturn(EMOTE_ID_2);
|
||||||
when(trackedEmoteManagementService.getAllActiveTrackedEmoteForServer(SERVER_ID)).thenReturn(new ArrayList<>(Arrays.asList(trackedEmote, secondTrackedEmote)));
|
when(trackedEmoteManagementService.getAllActiveTrackedEmoteForServer(SERVER_ID)).thenReturn(new ArrayList<>(Arrays.asList(trackedEmote, secondTrackedEmote)));
|
||||||
TrackedEmoteSynchronizationResult result = testUnit.synchronizeTrackedEmotes(guild);
|
TrackedEmoteSynchronizationResult result = testUnit.synchronizeTrackedEmotes(guild);
|
||||||
Assert.assertEquals(0L, result.getEmotesAdded().longValue());
|
Assert.assertEquals(0L, result.getEmotesAdded().longValue());
|
||||||
Assert.assertEquals(0L, result.getEmotesMarkedDeleted().longValue());
|
Assert.assertEquals(0L, result.getEmotesMarkedDeleted().longValue());
|
||||||
verify(trackedEmoteManagementService, times(0)).createTrackedEmote(any(Emote.class), any(Guild.class));
|
verify(trackedEmoteManagementService, times(0)).createTrackedEmote(any(CustomEmoji.class), any(Guild.class));
|
||||||
verify(trackedEmoteManagementService, times(0)).markAsDeleted(any(TrackedEmote.class));
|
verify(trackedEmoteManagementService, times(0)).markAsDeleted(any(TrackedEmote.class));
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -247,7 +248,7 @@ public class TrackedEmoteServiceBeanTest {
|
|||||||
when(trackedEmote.getTrackedEmoteId()).thenReturn(trackedEmoteServer);
|
when(trackedEmote.getTrackedEmoteId()).thenReturn(trackedEmoteServer);
|
||||||
when(trackedEmoteServer.getServerId()).thenReturn(SERVER_ID);
|
when(trackedEmoteServer.getServerId()).thenReturn(SERVER_ID);
|
||||||
when(trackedEmoteServer.getId()).thenReturn(EMOTE_ID);
|
when(trackedEmoteServer.getId()).thenReturn(EMOTE_ID);
|
||||||
when(guild.getEmotes()).thenReturn(Arrays.asList(actualEmote, secondActualEmote));
|
when(guild.getEmojis()).thenReturn(Arrays.asList(actualEmote, secondActualEmote));
|
||||||
when(actualEmote.getIdLong()).thenReturn(EMOTE_ID);
|
when(actualEmote.getIdLong()).thenReturn(EMOTE_ID);
|
||||||
when(trackedEmoteManagementService.getAllActiveTrackedEmoteForServer(SERVER_ID)).thenReturn(new ArrayList<>(Arrays.asList(trackedEmote)));
|
when(trackedEmoteManagementService.getAllActiveTrackedEmoteForServer(SERVER_ID)).thenReturn(new ArrayList<>(Arrays.asList(trackedEmote)));
|
||||||
TrackedEmoteSynchronizationResult result = testUnit.synchronizeTrackedEmotes(guild);
|
TrackedEmoteSynchronizationResult result = testUnit.synchronizeTrackedEmotes(guild);
|
||||||
@@ -263,37 +264,37 @@ public class TrackedEmoteServiceBeanTest {
|
|||||||
when(trackedEmote.getTrackedEmoteId()).thenReturn(trackedEmoteServer);
|
when(trackedEmote.getTrackedEmoteId()).thenReturn(trackedEmoteServer);
|
||||||
when(trackedEmoteServer.getServerId()).thenReturn(SERVER_ID);
|
when(trackedEmoteServer.getServerId()).thenReturn(SERVER_ID);
|
||||||
when(trackedEmoteServer.getId()).thenReturn(EMOTE_ID);
|
when(trackedEmoteServer.getId()).thenReturn(EMOTE_ID);
|
||||||
when(guild.getEmotes()).thenReturn(Arrays.asList(actualEmote));
|
when(guild.getEmojis()).thenReturn(Arrays.asList(actualEmote));
|
||||||
when(actualEmote.getIdLong()).thenReturn(EMOTE_ID);
|
when(actualEmote.getIdLong()).thenReturn(EMOTE_ID);
|
||||||
when(trackedEmoteManagementService.getAllActiveTrackedEmoteForServer(SERVER_ID)).thenReturn(new ArrayList<>(Arrays.asList(trackedEmote, secondTrackedEmote)));
|
when(trackedEmoteManagementService.getAllActiveTrackedEmoteForServer(SERVER_ID)).thenReturn(new ArrayList<>(Arrays.asList(trackedEmote, secondTrackedEmote)));
|
||||||
TrackedEmoteSynchronizationResult result = testUnit.synchronizeTrackedEmotes(guild);
|
TrackedEmoteSynchronizationResult result = testUnit.synchronizeTrackedEmotes(guild);
|
||||||
Assert.assertEquals(0L, result.getEmotesAdded().longValue());
|
Assert.assertEquals(0L, result.getEmotesAdded().longValue());
|
||||||
Assert.assertEquals(1L, result.getEmotesMarkedDeleted().longValue());
|
Assert.assertEquals(1L, result.getEmotesMarkedDeleted().longValue());
|
||||||
verify(trackedEmoteManagementService, times(0)).createTrackedEmote(any(Emote.class), any(Guild.class));
|
verify(trackedEmoteManagementService, times(0)).createTrackedEmote(any(CustomEmoji.class), any(Guild.class));
|
||||||
verify(trackedEmoteManagementService, times(1)).markAsDeleted(secondTrackedEmote);
|
verify(trackedEmoteManagementService, times(1)).markAsDeleted(secondTrackedEmote);
|
||||||
}
|
}
|
||||||
|
|
||||||
@Test
|
@Test
|
||||||
public void testSynchronizeTrackedEmotesNoEmotesLeft() {
|
public void testSynchronizeTrackedEmotesNoEmotesLeft() {
|
||||||
when(guild.getIdLong()).thenReturn(SERVER_ID);
|
when(guild.getIdLong()).thenReturn(SERVER_ID);
|
||||||
when(guild.getEmotes()).thenReturn(new ArrayList<>());
|
when(guild.getEmojis()).thenReturn(new ArrayList<>());
|
||||||
when(trackedEmoteManagementService.getAllActiveTrackedEmoteForServer(SERVER_ID)).thenReturn(new ArrayList<>(Arrays.asList(trackedEmote, secondTrackedEmote)));
|
when(trackedEmoteManagementService.getAllActiveTrackedEmoteForServer(SERVER_ID)).thenReturn(new ArrayList<>(Arrays.asList(trackedEmote, secondTrackedEmote)));
|
||||||
TrackedEmoteSynchronizationResult result = testUnit.synchronizeTrackedEmotes(guild);
|
TrackedEmoteSynchronizationResult result = testUnit.synchronizeTrackedEmotes(guild);
|
||||||
Assert.assertEquals(0L, result.getEmotesAdded().longValue());
|
Assert.assertEquals(0L, result.getEmotesAdded().longValue());
|
||||||
Assert.assertEquals(2L, result.getEmotesMarkedDeleted().longValue());
|
Assert.assertEquals(2L, result.getEmotesMarkedDeleted().longValue());
|
||||||
verify(trackedEmoteManagementService, times(0)).createTrackedEmote(any(Emote.class), any(Guild.class));
|
verify(trackedEmoteManagementService, times(0)).createTrackedEmote(any(CustomEmoji.class), any(Guild.class));
|
||||||
verify(trackedEmoteManagementService, times(2)).markAsDeleted(any(TrackedEmote.class));
|
verify(trackedEmoteManagementService, times(2)).markAsDeleted(any(TrackedEmote.class));
|
||||||
}
|
}
|
||||||
|
|
||||||
@Test
|
@Test
|
||||||
public void testSynchronizeTrackedEmotesAllEmotesAreNew() {
|
public void testSynchronizeTrackedEmotesAllEmotesAreNew() {
|
||||||
when(guild.getIdLong()).thenReturn(SERVER_ID);
|
when(guild.getIdLong()).thenReturn(SERVER_ID);
|
||||||
when(guild.getEmotes()).thenReturn(Arrays.asList(actualEmote, secondActualEmote));
|
when(guild.getEmojis()).thenReturn(Arrays.asList(actualEmote, secondActualEmote));
|
||||||
when(trackedEmoteManagementService.getAllActiveTrackedEmoteForServer(SERVER_ID)).thenReturn(new ArrayList<>());
|
when(trackedEmoteManagementService.getAllActiveTrackedEmoteForServer(SERVER_ID)).thenReturn(new ArrayList<>());
|
||||||
TrackedEmoteSynchronizationResult result = testUnit.synchronizeTrackedEmotes(guild);
|
TrackedEmoteSynchronizationResult result = testUnit.synchronizeTrackedEmotes(guild);
|
||||||
Assert.assertEquals(2L, result.getEmotesAdded().longValue());
|
Assert.assertEquals(2L, result.getEmotesAdded().longValue());
|
||||||
Assert.assertEquals(0L, result.getEmotesMarkedDeleted().longValue());
|
Assert.assertEquals(0L, result.getEmotesMarkedDeleted().longValue());
|
||||||
verify(trackedEmoteManagementService, times(2)).createTrackedEmote(any(Emote.class), any(Guild.class));
|
verify(trackedEmoteManagementService, times(2)).createTrackedEmote(any(CustomEmoji.class), any(Guild.class));
|
||||||
verify(trackedEmoteManagementService, times(0)).markAsDeleted(any(TrackedEmote.class));
|
verify(trackedEmoteManagementService, times(0)).markAsDeleted(any(TrackedEmote.class));
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -483,9 +484,9 @@ public class TrackedEmoteServiceBeanTest {
|
|||||||
when(trackedEmote2.getAnimated()).thenReturn(true);
|
when(trackedEmote2.getAnimated()).thenReturn(true);
|
||||||
when(trackedEmote.getTrackedEmoteId()).thenReturn(new ServerSpecificId(SERVER_ID, EMOTE_ID));
|
when(trackedEmote.getTrackedEmoteId()).thenReturn(new ServerSpecificId(SERVER_ID, EMOTE_ID));
|
||||||
when(trackedEmote2.getTrackedEmoteId()).thenReturn(new ServerSpecificId(SERVER_ID, EMOTE_ID_2));
|
when(trackedEmote2.getTrackedEmoteId()).thenReturn(new ServerSpecificId(SERVER_ID, EMOTE_ID_2));
|
||||||
when(guild.getEmoteById(EMOTE_ID)).thenReturn(actualEmote);
|
when(guild.getEmojiById(EMOTE_ID)).thenReturn(actualEmote);
|
||||||
Emote emote2 = Mockito.mock(Emote.class);
|
RichCustomEmoji emote2 = Mockito.mock(RichCustomEmoji.class);
|
||||||
when(guild.getEmoteById(EMOTE_ID_2)).thenReturn(emote2);
|
when(guild.getEmojiById(EMOTE_ID_2)).thenReturn(emote2);
|
||||||
when(trackedEmoteManagementService.getTrackedEmoteForServer(SERVER_ID, true)).thenReturn(Arrays.asList(trackedEmote, trackedEmote2));
|
when(trackedEmoteManagementService.getTrackedEmoteForServer(SERVER_ID, true)).thenReturn(Arrays.asList(trackedEmote, trackedEmote2));
|
||||||
TrackedEmoteOverview trackedEmoteOverview = testUnit.loadTrackedEmoteOverview(guild, true);
|
TrackedEmoteOverview trackedEmoteOverview = testUnit.loadTrackedEmoteOverview(guild, true);
|
||||||
Assert.assertEquals(actualEmote, trackedEmoteOverview.getStaticEmotes().get(0).getEmote());
|
Assert.assertEquals(actualEmote, trackedEmoteOverview.getStaticEmotes().get(0).getEmote());
|
||||||
|
|||||||
@@ -19,8 +19,6 @@ import java.time.Instant;
|
|||||||
import java.util.Arrays;
|
import java.util.Arrays;
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
|
|
||||||
import static org.mockito.ArgumentMatchers.any;
|
|
||||||
import static org.mockito.ArgumentMatchers.eq;
|
|
||||||
import static org.mockito.Mockito.*;
|
import static org.mockito.Mockito.*;
|
||||||
|
|
||||||
@RunWith(MockitoJUnitRunner.class)
|
@RunWith(MockitoJUnitRunner.class)
|
||||||
|
|||||||
Some files were not shown because too many files have changed in this diff Show More
Reference in New Issue
Block a user