update JDA and jda Utilities version

fixed typos in the code
This commit is contained in:
Sheldan
2020-06-28 12:04:34 +02:00
parent c44eb80fc5
commit e8767429bf
40 changed files with 106 additions and 107 deletions

View File

@@ -14,7 +14,7 @@ An example implementation of this bot can be seen [here](https://github.com/Shel
## Technologies ## Technologies
* [JDA](https://github.com/DV8FromTheWorld/JDA/) The Discord API Wrapper in the version 4.1.1_155 * [JDA](https://github.com/DV8FromTheWorld/JDA/) The Discord API Wrapper in the version 4.1.1_167
* [Spring boot](https://github.com/spring-projects/spring-boot) is used as a framework to create standalone application in Java with Java EE methods. (including Dependency injection and more) * [Spring boot](https://github.com/spring-projects/spring-boot) is used as a framework to create standalone application in Java with Java EE methods. (including Dependency injection and more)
* [Hibernate](https://github.com/hibernate/hibernate-orm) is used as a reference implementation of JPA. * [Hibernate](https://github.com/hibernate/hibernate-orm) is used as a reference implementation of JPA.
* [Freemarker](https://github.com/apache/freemarker) is used as a templating engine. This is used to provide internationalization for user facing text and enable dynamic embed configuration. * [Freemarker](https://github.com/apache/freemarker) is used as a templating engine. This is used to provide internationalization for user facing text and enable dynamic embed configuration.

View File

@@ -31,7 +31,7 @@ import java.util.List;
@Slf4j @Slf4j
public class LeaderBoardCommand extends AbstractConditionableCommand { public class LeaderBoardCommand extends AbstractConditionableCommand {
public static final String LEADERBOARD_POST_EMBED_TEMPLATE = "leaderboard_post"; public static final String LEADER_BOARD_POST_EMBED_TEMPLATE = "leaderboard_post";
@Autowired @Autowired
private AUserExperienceService userExperienceService; private AUserExperienceService userExperienceService;
@@ -57,7 +57,7 @@ public class LeaderBoardCommand extends AbstractConditionableCommand {
LeaderBoardEntry userRank = userExperienceService.getRankOfUserInServer(commandContext.getUserInitiatedContext().getAUserInAServer()); LeaderBoardEntry userRank = userExperienceService.getRankOfUserInServer(commandContext.getUserInitiatedContext().getAUserInAServer());
leaderBoardModel.setUserExecuting(converter.fromLeaderBoardEntry(userRank)); leaderBoardModel.setUserExecuting(converter.fromLeaderBoardEntry(userRank));
MessageToSend messageToSend = templateService.renderEmbedTemplate(LEADERBOARD_POST_EMBED_TEMPLATE, leaderBoardModel); MessageToSend messageToSend = templateService.renderEmbedTemplate(LEADER_BOARD_POST_EMBED_TEMPLATE, leaderBoardModel);
channelService.sendMessageToSendToChannel(messageToSend, commandContext.getChannel()); channelService.sendMessageToSendToChannel(messageToSend, commandContext.getChannel());
return CommandResult.fromSuccess(); return CommandResult.fromSuccess();

View File

@@ -21,7 +21,7 @@ public interface UserExperienceRepository extends JpaRepository<AUserExperience
/** /**
* Finds all {@link AUserExperience} of the given {@link AServer} * Finds all {@link AUserExperience} of the given {@link AServer}
* @param server The {@link AServer} to retriev ethe {@link AUserExperience} for * @param server The {@link AServer} to retrieve ethe {@link AUserExperience} for
* @return A complete list of {@link AUserExperience} of the given {@link AServer} * @return A complete list of {@link AUserExperience} of the given {@link AServer}
*/ */
@QueryHints(@QueryHint(name = org.hibernate.annotations.QueryHints.CACHEABLE, value = "true")) @QueryHints(@QueryHint(name = org.hibernate.annotations.QueryHints.CACHEABLE, value = "true"))
@@ -30,7 +30,7 @@ public interface UserExperienceRepository extends JpaRepository<AUserExperience
/** /**
* Retrieves the {@link AUserExperience} ordered by experience, and applies the {@link Pageable} to only filter out certain pages. * Retrieves the {@link AUserExperience} ordered by experience, and applies the {@link Pageable} to only filter out certain pages.
* @param server The {@link AServer} to retrieve the {@link AUserExperience} information for * @param server The {@link AServer} to retrieve the {@link AUserExperience} information for
* @param pageable A {@link Pageable} object to indicate the pages which should be retrieved, pagesize is 10 * @param pageable A {@link Pageable} object to indicate the pages which should be retrieved, page size is 10
* @return A list of {@link AUserExperience} of the given {@link AServer} ordered by the experience of the users, paginated by the given * @return A list of {@link AUserExperience} of the given {@link AServer} ordered by the experience of the users, paginated by the given
* configuration * configuration
*/ */

View File

@@ -302,10 +302,10 @@ public class AUserExperienceServiceBean implements AUserExperienceService {
} }
/** /**
* Retrieves the leaderboard data for the given page of the given server * Retrieves the leader board data for the given page of the given server
* @param server The {@link AServer} to retrieve the leaderboard for * @param server The {@link AServer} to retrieve the leader board for
* @param page The desired page on the leaderboard. The pagesize is 10 * @param page The desired page on the leader board. The page size is 10
* @return The {@link LeaderBoard} containing all necessary information concerning the leaderboard * @return The {@link LeaderBoard} containing all necessary information concerning the leader board
*/ */
@Override @Override
public LeaderBoard findLeaderBoardData(AServer server, Integer page) { public LeaderBoard findLeaderBoardData(AServer server, Integer page) {
@@ -326,7 +326,7 @@ public class AUserExperienceServiceBean implements AUserExperienceService {
/** /**
* Builds an {@link AUserExperience} and loads the appropriate rank of the passed {@link AUserInAServer} * Builds an {@link AUserExperience} and loads the appropriate rank of the passed {@link AUserInAServer}
* @param userInAServer The {@link AUserInAServer} to retrieve the {@link LeaderBoardEntry} for * @param userInAServer The {@link AUserInAServer} to retrieve the {@link LeaderBoardEntry} for
* @return The {@link LeaderBoardEntry} representing one single row in the leaderboard * @return The {@link LeaderBoardEntry} representing one single row in the leader board
*/ */
@Override @Override
public LeaderBoardEntry getRankOfUserInServer(AUserInAServer userInAServer) { public LeaderBoardEntry getRankOfUserInServer(AUserInAServer userInAServer) {

View File

@@ -30,10 +30,10 @@ public class ExperienceRoleServiceBean implements ExperienceRoleService {
private AUserExperienceService userExperienceService; private AUserExperienceService userExperienceService;
/** /**
* Unsets the current configuration for the passed level, and sets the {@link ARole} to be used for this level * UnSets the current configuration for the passed level, and sets the {@link ARole} to be used for this level
* in the given {@link AServer} * in the given {@link AServer}
* @param role The {@link ARole} to set the level to * @param role The {@link ARole} to set the level to
* @param level The level the {@link ARole} should be awareded at * @param level The level the {@link ARole} should be awarded at
*/ */
@Override @Override
public void setRoleToLevel(ARole role, Integer level, AChannel feedbackChannel) { public void setRoleToLevel(ARole role, Integer level, AChannel feedbackChannel) {

View File

@@ -58,7 +58,7 @@ public class UserExperienceManagementServiceBean implements UserExperienceManage
* Creates or updates the {@link AUserExperience} object. Does not change the level or the role. * Creates or updates the {@link AUserExperience} object. Does not change the level or the role.
* @param user The {@link AUserInAServer} to increase the experience for * @param user The {@link AUserInAServer} to increase the experience for
* @param experience The experience amount to increase by * @param experience The experience amount to increase by
* @param messageCount The amount of messags to increase the count by * @param messageCount The amount of messages to increase the count by
* @return The created/changed {@link AUserExperience} object * @return The created/changed {@link AUserExperience} object
*/ */
@Override @Override

View File

@@ -67,7 +67,7 @@ public class LeaderBoardCommandTest {
LeaderBoardEntryModel leaderBoardEntryModel = LeaderBoardEntryModel.builder().build(); LeaderBoardEntryModel leaderBoardEntryModel = LeaderBoardEntryModel.builder().build();
when(converter.fromLeaderBoardEntry(executingUserRank)).thenReturn(leaderBoardEntryModel); when(converter.fromLeaderBoardEntry(executingUserRank)).thenReturn(leaderBoardEntryModel);
MessageToSend messageToSend = MessageToSend.builder().build(); MessageToSend messageToSend = MessageToSend.builder().build();
when(templateService.renderEmbedTemplate(eq(LeaderBoardCommand.LEADERBOARD_POST_EMBED_TEMPLATE), any(LeaderBoardModel.class))).thenReturn(messageToSend); when(templateService.renderEmbedTemplate(eq(LeaderBoardCommand.LEADER_BOARD_POST_EMBED_TEMPLATE), any(LeaderBoardModel.class))).thenReturn(messageToSend);
CommandResult result = testUnit.execute(context); CommandResult result = testUnit.execute(context);
verify(channelService, times(1)).sendMessageToSendToChannel(messageToSend, context.getChannel()); verify(channelService, times(1)).sendMessageToSendToChannel(messageToSend, context.getChannel());
CommandTestUtilities.checkSuccessfulCompletion(result); CommandTestUtilities.checkSuccessfulCompletion(result);

View File

@@ -7,14 +7,14 @@ import lombok.Setter;
import java.util.List; import java.util.List;
/** /**
* Wrapper object containing a list of {@link LeaderBoardEntry} representing a leaderboard. * Wrapper object containing a list of {@link LeaderBoardEntry} representing a leader board.
*/ */
@Getter @Getter
@Setter @Setter
@Builder @Builder
public class LeaderBoard { public class LeaderBoard {
/** /**
* List of {@link LeaderBoardEntry} representing the leaderboard. * List of {@link LeaderBoardEntry} representing the leader board.
*/ */
private List<LeaderBoardEntry> entries; private List<LeaderBoardEntry> entries;
} }

View File

@@ -29,7 +29,7 @@ public interface LeaderBoardEntryResult {
Long getMessageCount(); Long getMessageCount();
/** /**
* The current position of the {@link dev.sheldan.abstracto.core.models.database.AUserInAServer} in the leaderboard * The current position of the {@link dev.sheldan.abstracto.core.models.database.AUserInAServer} in the leader board
* ordered by experience count * ordered by experience count
*/ */
Integer getRank(); Integer getRank();

View File

@@ -7,7 +7,7 @@ import lombok.Setter;
import net.dv8tion.jda.api.entities.Member; import net.dv8tion.jda.api.entities.Member;
/** /**
* Model used in the list of members when rendering the leaderboard template. The reason this is necessary, * Model used in the list of members when rendering the leader board template. The reason this is necessary,
* is because we need more than just the {@link AUserExperience} object, we also need the position of the user in this * is because we need more than just the {@link AUserExperience} object, we also need the position of the user in this
* guild and the {@link Member} for convenience in the templates. * guild and the {@link Member} for convenience in the templates.
*/ */

View File

@@ -8,8 +8,8 @@ import lombok.experimental.SuperBuilder;
import java.util.List; import java.util.List;
/** /**
* Object containing the complete information passed to the leaderboard template. It contains the leaderboard * Object containing the complete information passed to the leader board template. It contains the leader board
* information of the requested page of the total users and the leaderboard information of the user executing the * information of the requested page of the total users and the leader board information of the user executing the
* command. * command.
*/ */
@Getter @Getter

View File

@@ -32,7 +32,7 @@ public interface ExperienceRoleService {
* Calculates the appropriate {@link AExperienceRole} based on the provided list of {@link AExperienceRole} * Calculates the appropriate {@link AExperienceRole} based on the provided list of {@link AExperienceRole}
* @param userExperience The {@link AUserExperience} containing the level to calculate the {@link AExperienceRole} * @param userExperience The {@link AUserExperience} containing the level to calculate the {@link AExperienceRole}
* @param roles The role configuration to be used when calculating the appropriate {@link AExperienceRole} * @param roles The role configuration to be used when calculating the appropriate {@link AExperienceRole}
* @return The best matching {@link AExperienceRole} accordign to the experience in the provided {@link AUserExperience} * @return The best matching {@link AExperienceRole} according to the experience in the provided {@link AUserExperience}
*/ */
AExperienceRole calculateRole(AUserExperience userExperience, List<AExperienceRole> roles); AExperienceRole calculateRole(AUserExperience userExperience, List<AExperienceRole> roles);

View File

@@ -11,7 +11,7 @@ import java.util.Optional;
public interface ExperienceLevelManagementService { public interface ExperienceLevelManagementService {
/** /**
* Creates the level referenced by the level and the needed experience in the database. * Creates the level referenced by the level and the needed experience in the database.
* @param level The unique level this level should reprsent. * @param level The unique level this level should represent.
* @param neededExperience The total amount of experience required to reach this level. * @param neededExperience The total amount of experience required to reach this level.
* @return A newly created {@link AExperienceLevel} instance. * @return A newly created {@link AExperienceLevel} instance.
*/ */

View File

@@ -44,7 +44,7 @@ public interface ExperienceRoleManagementService {
AExperienceRole getRoleInServer(ARole role); AExperienceRole getRoleInServer(ARole role);
/** /**
* Retrives all {@link AExperienceRole} configured in the given {@link AServer} * Retrieves all {@link AExperienceRole} configured in the given {@link AServer}
* @param server The server to retrieve the list of {@link AExperienceRole} for * @param server The server to retrieve the list of {@link AExperienceRole} for
* @return A list of {@link AExperienceRole} which are currently configured for the {@link AServer} * @return A list of {@link AExperienceRole} which are currently configured for the {@link AServer}
*/ */

View File

@@ -39,7 +39,7 @@ public interface UserExperienceManagementService {
* are not changed. * are not changed.
* @param user The {@link AUserInAServer} to increase the experience for * @param user The {@link AUserInAServer} to increase the experience for
* @param experience The experience amount to increase by * @param experience The experience amount to increase by
* @param messageCount The amount of messags to increase the count by * @param messageCount The amount of messages to increase the count by
* @return The changed/creates {@link AUserExperience} object containing the values. * @return The changed/creates {@link AUserExperience} object containing the values.
*/ */
AUserExperience incrementExpForUser(AUserInAServer user, Long experience, Long messageCount); AUserExperience incrementExpForUser(AUserInAServer user, Long experience, Long messageCount);

View File

@@ -42,8 +42,8 @@ public class UnMute extends AbstractConditionableCommand {
return CommandResult.fromError(templateService.renderSimpleTemplate(NO_ACTIVE_MUTE)); return CommandResult.fromError(templateService.renderSimpleTemplate(NO_ACTIVE_MUTE));
} }
Mute mute = muteManagementService.getAMuteOf(member); Mute mute = muteManagementService.getAMuteOf(member);
muteService.unmuteUser(mute); muteService.unMuteUser(mute);
muteService.cancelUnmuteJob(mute); muteService.cancelUnMuteJob(mute);
muteService.completelyUnMuteMember(member); muteService.completelyUnMuteMember(member);
return CommandResult.fromSuccess(); return CommandResult.fromSuccess();
} }

View File

@@ -23,7 +23,7 @@ public class UnMuteJob extends QuartzJobBean {
@Override @Override
protected void executeInternal(JobExecutionContext context) throws JobExecutionException { protected void executeInternal(JobExecutionContext context) throws JobExecutionException {
log.info("Executing unmute job for mute {}", muteId); log.info("Executing unMute job for mute {}", muteId);
muteService.endMute(muteId); muteService.endMute(muteId);
} }

View File

@@ -79,11 +79,11 @@ public class MuteServiceBean implements MuteService {
private ChannelManagementService channelManagementService; private ChannelManagementService channelManagementService;
public static final String MUTE_LOG_TEMPLATE = "mute_log"; public static final String MUTE_LOG_TEMPLATE = "mute_log";
public static final String UNMUTE_LOG_TEMPLATE = "unmute_log"; public static final String UN_MUTE_LOG_TEMPLATE = "unmute_log";
public static final String MUTE_NOTIFICATION_TEMPLATE = "mute_notification"; public static final String MUTE_NOTIFICATION_TEMPLATE = "mute_notification";
@Override @Override
public Mute muteMember(Member memberToMute, Member mutingMember, String reason, Instant unmuteDate, Message message) { public Mute muteMember(Member memberToMute, Member mutingMember, String reason, Instant unMuteDate, Message message) {
FullUser mutedUser = FullUser FullUser mutedUser = FullUser
.builder() .builder()
.aUserInAServer(userInServerManagementService.loadUser(memberToMute)) .aUserInAServer(userInServerManagementService.loadUser(memberToMute))
@@ -95,11 +95,11 @@ public class MuteServiceBean implements MuteService {
.aUserInAServer(userInServerManagementService.loadUser(mutingMember)) .aUserInAServer(userInServerManagementService.loadUser(mutingMember))
.member(mutingMember) .member(mutingMember)
.build(); .build();
return muteUser(mutedUser, mutingUser, reason, unmuteDate, message); return muteUser(mutedUser, mutingUser, reason, unMuteDate, message);
} }
@Override @Override
public Mute muteAUserInAServer(AUserInAServer userBeingMuted, AUserInAServer userMuting, String reason, Instant unmuteDate, Message message) { public Mute muteAUserInAServer(AUserInAServer userBeingMuted, AUserInAServer userMuting, String reason, Instant unMuteDate, Message message) {
FullUser mutedUser = FullUser FullUser mutedUser = FullUser
.builder() .builder()
.aUserInAServer(userBeingMuted) .aUserInAServer(userBeingMuted)
@@ -111,11 +111,11 @@ public class MuteServiceBean implements MuteService {
.aUserInAServer(userMuting) .aUserInAServer(userMuting)
.member(botService.getMemberInServer(userMuting)) .member(botService.getMemberInServer(userMuting))
.build(); .build();
return muteUser(mutedUser, mutingUser, reason, unmuteDate, message); return muteUser(mutedUser, mutingUser, reason, unMuteDate, message);
} }
@Override @Override
public Mute muteUser(FullUser userBeingMuted, FullUser userMuting, String reason, Instant unmuteDate, Message message) { public Mute muteUser(FullUser userBeingMuted, FullUser userMuting, String reason, Instant unMuteDate, Message message) {
AServer serverBeingMutedIn = userBeingMuted.getAUserInAServer().getServerReference(); AServer serverBeingMutedIn = userBeingMuted.getAUserInAServer().getServerReference();
if(!muteRoleManagementService.muteRoleForServerExists(serverBeingMutedIn)) { if(!muteRoleManagementService.muteRoleForServerExists(serverBeingMutedIn)) {
log.error("Mute role for server {} has not been setup.", serverBeingMutedIn.getId()); log.error("Mute role for server {} has not been setup.", serverBeingMutedIn.getId());
@@ -123,7 +123,7 @@ public class MuteServiceBean implements MuteService {
} }
Member memberBeingMuted = userBeingMuted.getMember(); Member memberBeingMuted = userBeingMuted.getMember();
log.info("User {} mutes user {} until {}", log.info("User {} mutes user {} until {}",
memberBeingMuted.getIdLong(), userMuting.getMember().getIdLong(), unmuteDate); memberBeingMuted.getIdLong(), userMuting.getMember().getIdLong(), unMuteDate);
if(message != null) { if(message != null) {
log.trace("because of message {} in channel {} in server {}", message.getId(), message.getChannel().getId(), message.getGuild().getId()); log.trace("because of message {} in channel {} in server {}", message.getId(), message.getChannel().getId(), message.getGuild().getId());
} else { } else {
@@ -132,14 +132,14 @@ public class MuteServiceBean implements MuteService {
AUserInAServer userInServerBeingMuted = userBeingMuted.getAUserInAServer(); AUserInAServer userInServerBeingMuted = userBeingMuted.getAUserInAServer();
applyMuteRole(userInServerBeingMuted); applyMuteRole(userInServerBeingMuted);
Mute mute = createMuteObject(userMuting, reason, unmuteDate, message, userInServerBeingMuted); Mute mute = createMuteObject(userMuting, reason, unMuteDate, message, userInServerBeingMuted);
Guild guild = memberBeingMuted.getGuild(); Guild guild = memberBeingMuted.getGuild();
if(memberBeingMuted.getVoiceState() != null && memberBeingMuted.getVoiceState().getChannel() != null) { if(memberBeingMuted.getVoiceState() != null && memberBeingMuted.getVoiceState().getChannel() != null) {
guild.kickVoiceMember(memberBeingMuted).queue(); guild.kickVoiceMember(memberBeingMuted).queue();
} }
sendMuteNotification(message, memberBeingMuted, mute, guild); sendMuteNotification(message, memberBeingMuted, mute, guild);
String triggerKey = startUnmuteJobFor(unmuteDate, mute); String triggerKey = startUnMuteJobFor(unMuteDate, mute);
mute.setTriggerKey(triggerKey); mute.setTriggerKey(triggerKey);
muteManagementService.saveMute(mute); muteManagementService.saveMute(mute);
return mute; return mute;
@@ -153,7 +153,7 @@ public class MuteServiceBean implements MuteService {
messageService.sendMessageToUser(memberBeingMuted.getUser(), muteNotificationMessage, textChannel); messageService.sendMessageToUser(memberBeingMuted.getUser(), muteNotificationMessage, textChannel);
} }
private Mute createMuteObject(FullUser userMuting, String reason, Instant unmuteDate, Message message, AUserInAServer userInServerBeingMuted) { private Mute createMuteObject(FullUser userMuting, String reason, Instant unMuteDate, Message message, AUserInAServer userInServerBeingMuted) {
AServerAChannelMessage origin = null; AServerAChannelMessage origin = null;
if(message != null) { if(message != null) {
long channelId = message.getChannel().getIdLong(); long channelId = message.getChannel().getIdLong();
@@ -166,7 +166,7 @@ public class MuteServiceBean implements MuteService {
.messageId(message.getIdLong()) .messageId(message.getIdLong())
.build(); .build();
} }
return muteManagementService.createMute(userInServerBeingMuted, userMuting.getAUserInAServer(), reason, unmuteDate, origin); return muteManagementService.createMute(userInServerBeingMuted, userMuting.getAUserInAServer(), reason, unMuteDate, origin);
} }
@Override @Override
@@ -176,10 +176,10 @@ public class MuteServiceBean implements MuteService {
} }
@Override @Override
public String startUnmuteJobFor(Instant unmuteDate, Mute mute) { public String startUnMuteJobFor(Instant unMuteDate, Mute mute) {
Duration muteDuration = Duration.between(Instant.now(), unmuteDate); Duration muteDuration = Duration.between(Instant.now(), unMuteDate);
if(muteDuration.getSeconds() < 60) { if(muteDuration.getSeconds() < 60) {
log.trace("Directly scheduling the unmute, because it was below the threshold."); log.trace("Directly scheduling the unMute, because it was below the threshold.");
unMuteScheduler.schedule(() -> { unMuteScheduler.schedule(() -> {
try { try {
self.endMute(mute.getId()); self.endMute(mute.getId());
@@ -189,24 +189,24 @@ public class MuteServiceBean implements MuteService {
}, muteDuration.toNanos(), TimeUnit.NANOSECONDS); }, muteDuration.toNanos(), TimeUnit.NANOSECONDS);
return null; return null;
} else { } else {
log.trace("Starting scheduled job to execute unmute."); log.trace("Starting scheduled job to execute unMute.");
JobDataMap parameters = new JobDataMap(); JobDataMap parameters = new JobDataMap();
parameters.putAsString("muteId", mute.getId()); parameters.putAsString("muteId", mute.getId());
return schedulerService.executeJobWithParametersOnce("unMuteJob", "moderation", parameters, Date.from(unmuteDate)); return schedulerService.executeJobWithParametersOnce("unMuteJob", "moderation", parameters, Date.from(unMuteDate));
} }
} }
@Override @Override
public void cancelUnmuteJob(Mute mute) { public void cancelUnMuteJob(Mute mute) {
if(mute.getTriggerKey() != null) { if(mute.getTriggerKey() != null) {
schedulerService.stopTrigger(mute.getTriggerKey()); schedulerService.stopTrigger(mute.getTriggerKey());
} }
} }
@Override @Override
public void muteMemberWithLog(Member memberToMute, Member memberMuting, String reason, Instant unmuteDate, MuteLog muteLog, Message message) { public void muteMemberWithLog(Member memberToMute, Member memberMuting, String reason, Instant unMuteDate, MuteLog muteLog, Message message) {
log.trace("Muting member with sending a mute log"); log.trace("Muting member with sending a mute log");
Mute mute = muteMember(memberToMute, memberMuting, reason, unmuteDate, message); Mute mute = muteMember(memberToMute, memberMuting, reason, unMuteDate, message);
muteLog.setMute(mute); muteLog.setMute(mute);
sendMuteLog(muteLog); sendMuteLog(muteLog);
} }
@@ -217,28 +217,28 @@ public class MuteServiceBean implements MuteService {
postTargetService.sendEmbedInPostTarget(message, MutingPostTarget.MUTE_LOG, muteLogModel.getServer().getId()); postTargetService.sendEmbedInPostTarget(message, MutingPostTarget.MUTE_LOG, muteLogModel.getServer().getId());
} }
private void sendUnmuteLog(UnMuteLog muteLogModel) { private void sendUnMuteLog(UnMuteLog muteLogModel) {
log.trace("Sending unmute log to the mute posttarget"); log.trace("Sending unMute log to the mute posttarget");
MessageToSend message = templateService.renderEmbedTemplate(UNMUTE_LOG_TEMPLATE, muteLogModel); MessageToSend message = templateService.renderEmbedTemplate(UN_MUTE_LOG_TEMPLATE, muteLogModel);
postTargetService.sendEmbedInPostTarget(message, MutingPostTarget.MUTE_LOG, muteLogModel.getServer().getId()); postTargetService.sendEmbedInPostTarget(message, MutingPostTarget.MUTE_LOG, muteLogModel.getServer().getId());
} }
@Override @Override
@Transactional @Transactional
public void unmuteUser(Mute mute) { public void unMuteUser(Mute mute) {
if(Boolean.TRUE.equals(mute.getMuteEnded())) { if(Boolean.TRUE.equals(mute.getMuteEnded())) {
log.info("Mute {} has ended already, user {} does not need to be unmuted anymore.", mute.getId(), mute.getMutedUser().getUserReference().getId()); log.info("Mute {} has ended already, user {} does not need to be unMuted anymore.", mute.getId(), mute.getMutedUser().getUserReference().getId());
return; return;
} }
AServer mutingServer = mute.getMutingServer(); AServer mutingServer = mute.getMutingServer();
log.info("Unmuting {} in server {}", mute.getMutedUser().getUserReference().getId(), mutingServer.getId()); log.info("UnMuting {} in server {}", mute.getMutedUser().getUserReference().getId(), mutingServer.getId());
MuteRole muteRole = muteRoleManagementService.retrieveMuteRoleForServer(mutingServer); MuteRole muteRole = muteRoleManagementService.retrieveMuteRoleForServer(mutingServer);
log.trace("Using the mute role {} mapping to role {}", muteRole.getId(), muteRole.getRole().getId()); log.trace("Using the mute role {} mapping to role {}", muteRole.getId(), muteRole.getRole().getId());
Guild guild = botService.getGuildByIdNullable(mute.getMutingServer().getId()); Guild guild = botService.getGuildByIdNullable(mute.getMutingServer().getId());
if(botService.isUserInGuild(guild, mute.getMutedUser())) { if(botService.isUserInGuild(guild, mute.getMutedUser())) {
roleService.removeRoleFromUser(mute.getMutedUser(), muteRole.getRole()); roleService.removeRoleFromUser(mute.getMutedUser(), muteRole.getRole());
} else { } else {
log.info("User to unmute left the guild."); log.info("User to unMute left the guild.");
} }
UnMuteLog unMuteLog = UnMuteLog UnMuteLog unMuteLog = UnMuteLog
.builder() .builder()
@@ -248,7 +248,7 @@ public class MuteServiceBean implements MuteService {
.guild(guild) .guild(guild)
.server(mute.getMutingServer()) .server(mute.getMutingServer())
.build(); .build();
sendUnmuteLog(unMuteLog); sendUnMuteLog(unMuteLog);
mute.setMuteEnded(true); mute.setMuteEnded(true);
muteManagementService.saveMute(mute); muteManagementService.saveMute(mute);
} }
@@ -256,9 +256,9 @@ public class MuteServiceBean implements MuteService {
@Override @Override
@Transactional @Transactional
public void endMute(Long muteId) { public void endMute(Long muteId) {
log.info("Unmuting the mute {}", muteId); log.info("UnMuting the mute {}", muteId);
Optional<Mute> mute = muteManagementService.findMute(muteId); Optional<Mute> mute = muteManagementService.findMute(muteId);
mute.ifPresent(this::unmuteUser); mute.ifPresent(this::unMuteUser);
} }
@Override @Override
@@ -266,7 +266,7 @@ public class MuteServiceBean implements MuteService {
List<Mute> allMutesOfUser = muteManagementService.getAllMutesOf(aUserInAServer); List<Mute> allMutesOfUser = muteManagementService.getAllMutesOf(aUserInAServer);
allMutesOfUser.forEach(mute -> { allMutesOfUser.forEach(mute -> {
mute.setMuteEnded(true); mute.setMuteEnded(true);
cancelUnmuteJob(mute); cancelUnMuteJob(mute);
muteManagementService.saveMute(mute); muteManagementService.saveMute(mute);
}); });
} }

View File

@@ -25,14 +25,14 @@ public class MuteManagementServiceBean implements MuteManagementService {
private UserInServerManagementService userInServerManagementService; private UserInServerManagementService userInServerManagementService;
@Override @Override
public Mute createMute(AUserInAServer mutedUser, AUserInAServer mutingUser, String reason, Instant unmuteDate, AServerAChannelMessage muteMessage) { public Mute createMute(AUserInAServer mutedUser, AUserInAServer mutingUser, String reason, Instant unMuteDate, AServerAChannelMessage muteMessage) {
log.trace("Creating mute for user {} executed by user {} in server {}, user will be un-muted at {}", log.trace("Creating mute for user {} executed by user {} in server {}, user will be un-muted at {}",
mutedUser.getUserReference().getId(), mutingUser.getUserReference().getId(), mutedUser.getServerReference().getId(), unmuteDate); mutedUser.getUserReference().getId(), mutingUser.getUserReference().getId(), mutedUser.getServerReference().getId(), unMuteDate);
Mute mute = Mute Mute mute = Mute
.builder() .builder()
.mutedUser(mutedUser) .mutedUser(mutedUser)
.mutingUser(mutingUser) .mutingUser(mutingUser)
.muteTargetDate(unmuteDate) .muteTargetDate(unMuteDate)
.mutingServer(mutedUser.getServerReference()) .mutingServer(mutedUser.getServerReference())
.mutingChannel(muteMessage.getChannel()) .mutingChannel(muteMessage.getChannel())
.messageId(muteMessage.getMessageId()) .messageId(muteMessage.getMessageId())

View File

@@ -49,8 +49,8 @@ public class UnMuteTest {
Mute mute = Mute.builder().build(); Mute mute = Mute.builder().build();
when(muteManagementService.getAMuteOf(memberToUnMute)).thenReturn(mute); when(muteManagementService.getAMuteOf(memberToUnMute)).thenReturn(mute);
CommandResult result = testUnit.execute(parameters); CommandResult result = testUnit.execute(parameters);
verify(muteService, times(1)).unmuteUser(mute); verify(muteService, times(1)).unMuteUser(mute);
verify(muteService, times(1)).cancelUnmuteJob(mute); verify(muteService, times(1)).cancelUnMuteJob(mute);
verify(muteService, times(1)).completelyUnMuteMember(memberToUnMute); verify(muteService, times(1)).completelyUnMuteMember(memberToUnMute);
CommandTestUtilities.checkSuccessfulCompletion(result); CommandTestUtilities.checkSuccessfulCompletion(result);
} }

View File

@@ -185,14 +185,14 @@ public class MuteServiceBeanTest {
@Test @Test
public void testCancelUnMuteJob() { public void testCancelUnMuteJob() {
Mute mute = Mute.builder().triggerKey(TRIGGER).build(); Mute mute = Mute.builder().triggerKey(TRIGGER).build();
testUnit.cancelUnmuteJob(mute); testUnit.cancelUnMuteJob(mute);
verify(schedulerService, times(1)).stopTrigger(TRIGGER); verify(schedulerService, times(1)).stopTrigger(TRIGGER);
} }
@Test @Test
public void testCancelNotExistingJob() { public void testCancelNotExistingJob() {
Mute mute = Mute.builder().build(); Mute mute = Mute.builder().build();
testUnit.cancelUnmuteJob(mute); testUnit.cancelUnMuteJob(mute);
verify(schedulerService, times(0)).stopTrigger(anyString()); verify(schedulerService, times(0)).stopTrigger(anyString());
} }
@@ -235,7 +235,7 @@ public class MuteServiceBeanTest {
Mute mute = Mockito.mock(Mute.class); Mute mute = Mockito.mock(Mute.class);
when(mute.getMuteEnded()).thenReturn(true); when(mute.getMuteEnded()).thenReturn(true);
when(mute.getMutedUser()).thenReturn(userBeingMuted); when(mute.getMutedUser()).thenReturn(userBeingMuted);
testUnit.unmuteUser(mute); testUnit.unMuteUser(mute);
verifyNoUnMuteHappened(); verifyNoUnMuteHappened();
} }
@@ -319,7 +319,7 @@ public class MuteServiceBeanTest {
when(mute.getMutingServer()).thenReturn(server); when(mute.getMutingServer()).thenReturn(server);
setupUnMuteMocks(stillInGuild); setupUnMuteMocks(stillInGuild);
testUnit.unmuteUser(mute); testUnit.unMuteUser(mute);
verifyUnMute(roleRemovals); verifyUnMute(roleRemovals);
} }
@@ -329,7 +329,7 @@ public class MuteServiceBeanTest {
when(botService.getGuildByIdNullable(server.getId())).thenReturn(guild); when(botService.getGuildByIdNullable(server.getId())).thenReturn(guild);
when(botService.isUserInGuild(guild, userBeingMuted)).thenReturn(stillInGuild); when(botService.isUserInGuild(guild, userBeingMuted)).thenReturn(stillInGuild);
when(botService.getMemberInServer(userBeingMuted)).thenReturn(memberBeingMuted); when(botService.getMemberInServer(userBeingMuted)).thenReturn(memberBeingMuted);
when(templateService.renderEmbedTemplate(eq(MuteServiceBean.UNMUTE_LOG_TEMPLATE), any(UnMuteLog.class))).thenReturn(messageToSend); when(templateService.renderEmbedTemplate(eq(MuteServiceBean.UN_MUTE_LOG_TEMPLATE), any(UnMuteLog.class))).thenReturn(messageToSend);
} }
private void verifyUnMute(int roleRemovals) { private void verifyUnMute(int roleRemovals) {

View File

@@ -10,14 +10,14 @@ import net.dv8tion.jda.api.entities.Message;
import java.time.Instant; import java.time.Instant;
public interface MuteService { public interface MuteService {
Mute muteMember(Member memberToMute, Member userMuting, String reason, Instant unmuteDate, Message message); Mute muteMember(Member memberToMute, Member userMuting, String reason, Instant unMuteDate, Message message);
Mute muteAUserInAServer(AUserInAServer member, AUserInAServer userMuting, String reason, Instant unmuteDate, Message message); Mute muteAUserInAServer(AUserInAServer member, AUserInAServer userMuting, String reason, Instant unMuteDate, Message message);
Mute muteUser(FullUser userToMute, FullUser userMuting, String reason, Instant unmuteDate, Message message); Mute muteUser(FullUser userToMute, FullUser userMuting, String reason, Instant unMuteDate, Message message);
void applyMuteRole(AUserInAServer aUserInAServer); void applyMuteRole(AUserInAServer aUserInAServer);
void muteMemberWithLog(Member memberToMute, Member memberMuting, String reason, Instant unmuteDate, MuteLog log, Message message); void muteMemberWithLog(Member memberToMute, Member memberMuting, String reason, Instant unMuteDate, MuteLog log, Message message);
String startUnmuteJobFor(Instant unmuteDate, Mute mute); String startUnMuteJobFor(Instant unMuteDate, Mute mute);
void cancelUnmuteJob(Mute mute); void cancelUnMuteJob(Mute mute);
void unmuteUser(Mute mute); void unMuteUser(Mute mute);
void endMute(Long muteId); void endMute(Long muteId);
void completelyUnMuteUser(AUserInAServer aUserInAServer); void completelyUnMuteUser(AUserInAServer aUserInAServer);
void completelyUnMuteMember(Member member); void completelyUnMuteMember(Member member);

View File

@@ -18,11 +18,11 @@ public interface MuteManagementService {
* @param mutedUser The member which is being muted * @param mutedUser The member which is being muted
* @param mutingUser The member which mutes * @param mutingUser The member which mutes
* @param reason The reason why this user is getting muted * @param reason The reason why this user is getting muted
* @param unmuteDate The date at which the mute should end * @param unMuteDate The date at which the mute should end
* @param muteMessage The message containing the command which caused the mute * @param muteMessage The message containing the command which caused the mute
* @return The created mute object containing the mute ID * @return The created mute object containing the mute ID
*/ */
Mute createMute(AUserInAServer mutedUser, AUserInAServer mutingUser, String reason, Instant unmuteDate, AServerAChannelMessage muteMessage); Mute createMute(AUserInAServer mutedUser, AUserInAServer mutingUser, String reason, Instant unMuteDate, AServerAChannelMessage muteMessage);
/** /**
* Finds the mute from the database by the given ID. * Finds the mute from the database by the given ID.
@@ -60,7 +60,7 @@ public interface MuteManagementService {
Mute getAMuteOf(AUserInAServer userInAServer); Mute getAMuteOf(AUserInAServer userInAServer);
/** /**
* Returns any active {@link Mute} of this {@link Member} in the databaes * Returns any active {@link Mute} of this {@link Member} in the database
* @param member The {@link Member} to search a mute for * @param member The {@link Member} to search a mute for
* @return The found {@link Mute}, and null if none was found * @return The found {@link Mute}, and null if none was found
*/ */
@@ -68,7 +68,7 @@ public interface MuteManagementService {
/** /**
* Retrieves all active mutes of the given {@link AUserInAServer} in a collection * Retrieves all active mutes of the given {@link AUserInAServer} in a collection
* @param aUserInAServer The {@link AUserInAServer} to search the actie mutes for * @param aUserInAServer The {@link AUserInAServer} to search the active mutes for
* @return A collection of {@link Mute} objects of the user which are active * @return A collection of {@link Mute} objects of the user which are active
*/ */
List<Mute> getAllMutesOf(AUserInAServer aUserInAServer); List<Mute> getAllMutesOf(AUserInAServer aUserInAServer);

View File

@@ -44,7 +44,7 @@ public class CloseNoLog extends AbstractConditionableCommand {
@Override @Override
public CommandResult execute(CommandContext commandContext) { public CommandResult execute(CommandContext commandContext) {
ModMailThread thread = modMailThreadManagementService.getByChannel(commandContext.getUserInitiatedContext().getChannel()); ModMailThread thread = modMailThreadManagementService.getByChannel(commandContext.getUserInitiatedContext().getChannel());
// we dont have a note, therefore we cant pass any, the method handles this accordingly // we don't have a note, therefore we cant pass any, the method handles this accordingly
modMailThreadService.closeModMailThread(thread, commandContext.getChannel(), null, false, false); modMailThreadService.closeModMailThread(thread, commandContext.getChannel(), null, false, false);
return CommandResult.fromSuccess(); return CommandResult.fromSuccess();
} }

View File

@@ -22,7 +22,7 @@ import java.util.List;
/** /**
* This command can be used to close the mod mail thread without sending a 'closing' message to the user. * This command can be used to close the mod mail thread without sending a 'closing' message to the user.
* This behaves the same way as the default close commmand otherwise * This behaves the same way as the default close command otherwise
*/ */
@Component @Component
public class CloseSilently extends AbstractConditionableCommand { public class CloseSilently extends AbstractConditionableCommand {

View File

@@ -11,7 +11,7 @@ import org.springframework.stereotype.Component;
import static dev.sheldan.abstracto.modmail.service.ModMailThreadServiceBean.MODMAIL_CLOSING_MESSAGE_TEXT; import static dev.sheldan.abstracto.modmail.service.ModMailThreadServiceBean.MODMAIL_CLOSING_MESSAGE_TEXT;
/** /**
* This listener is used to used to set the initial values of some server specific values, so we dont need to fall * This listener is used to used to set the initial values of some server specific values, so we don't need to fall
* back to the default values. The values might not be functional, for example mod mail category id, but their existence * back to the default values. The values might not be functional, for example mod mail category id, but their existence
* makes things easier * makes things easier
*/ */

View File

@@ -152,8 +152,8 @@ public class ModMailThreadServiceBean implements ModMailThreadService {
* this method is responsible for creating the instance in the database, sending the header in the newly created text channel and forwarding the initial message * this method is responsible for creating the instance in the database, sending the header in the newly created text channel and forwarding the initial message
* by the user (if any), after this is complete, this method executes the method to perform the mod mail notification. * by the user (if any), after this is complete, this method executes the method to perform the mod mail notification.
* @param aUserInAServer The {@link FullUser} for which a {@link ModMailThread} is being created * @param aUserInAServer The {@link FullUser} for which a {@link ModMailThread} is being created
* @param initialMessage The {@link Message} which was sent by the user to open a thread, this is null, if the thread was oepend via a command * @param initialMessage The {@link Message} which was sent by the user to open a thread, this is null, if the thread was opened via a command
* @param channel The created {@link TextChannel} in which the mod mail thread is dealth with * @param channel The created {@link TextChannel} in which the mod mail thread is dealt with
* @param userInitiated Whether or not the thread was initiated by a member * @param userInitiated Whether or not the thread was initiated by a member
* @param undoActions The list of actions to undo, in case an exception occurs * @param undoActions The list of actions to undo, in case an exception occurs
*/ */
@@ -229,7 +229,7 @@ public class ModMailThreadServiceBean implements ModMailThreadService {
@Override @Override
public void createModMailPrompt(AUser user, Message initialMessage) { public void createModMailPrompt(AUser user, Message initialMessage) {
List<AUserInAServer> knownServers = userInServerManagementService.getUserInAllServers(user.getId()); List<AUserInAServer> knownServers = userInServerManagementService.getUserInAllServers(user.getId());
// do nothing if we dont know the user // do nothing if we don't know the user
if(!knownServers.isEmpty()) { if(!knownServers.isEmpty()) {
List<ServerChoice> availableGuilds = new ArrayList<>(); List<ServerChoice> availableGuilds = new ArrayList<>();
HashMap<String, AUserInAServer> choices = new HashMap<>(); HashMap<String, AUserInAServer> choices = new HashMap<>();

View File

@@ -8,7 +8,7 @@ import lombok.Setter;
/** /**
* This model is used to render any exception happening when executing a command within a {@link ModMailThread} * This model is used to render any exception happening when executing a command within a {@link ModMailThread}
* and this command failing in any capacity. This model is used to render multiple templates (for differnet kinds of * and this command failing in any capacity. This model is used to render multiple templates (for different kinds of
* exceptions), all of which might use the information or not. * exceptions), all of which might use the information or not.
*/ */
@Getter @Getter

View File

@@ -89,10 +89,10 @@ public class CommandReceivedHandler extends ListenerAdapter {
try { try {
String contentStripped = event.getMessage().getContentStripped(); String contentStripped = event.getMessage().getContentStripped();
List<String> parameters = Arrays.asList(contentStripped.split(" ")); List<String> parameters = Arrays.asList(contentStripped.split(" "));
UnParsedCommandParameter unparsedParameter = new UnParsedCommandParameter(contentStripped); UnParsedCommandParameter unParsedParameter = new UnParsedCommandParameter(contentStripped);
String commandName = commandManager.getCommandName(parameters.get(0), event.getGuild().getIdLong()); String commandName = commandManager.getCommandName(parameters.get(0), event.getGuild().getIdLong());
foundCommand = commandManager.findCommandByParameters(commandName, unparsedParameter); foundCommand = commandManager.findCommandByParameters(commandName, unParsedParameter);
Parameters parsedParameters = getParsedParameters(unparsedParameter, foundCommand, event.getMessage(), userInitiatedContext); Parameters parsedParameters = getParsedParameters(unParsedParameter, foundCommand, event.getMessage(), userInitiatedContext);
CommandContext commandContext = commandContextBuilder.parameters(parsedParameters).build(); CommandContext commandContext = commandContextBuilder.parameters(parsedParameters).build();
ConditionResult conditionResult = commandService.isCommandExecutable(foundCommand, commandContext); ConditionResult conditionResult = commandService.isCommandExecutable(foundCommand, commandContext);
CommandResult commandResult; CommandResult commandResult;

View File

@@ -164,24 +164,24 @@ public class MessageCacheBean implements MessageCache {
ReactionPaginationAction users = reaction.retrieveUsers().cache(false); ReactionPaginationAction users = reaction.retrieveUsers().cache(false);
CachedReaction.CachedReactionBuilder builder = CachedReaction.builder(); CachedReaction.CachedReactionBuilder builder = CachedReaction.builder();
List<Long> ausers = new ArrayList<>(); List<Long> aUsers = new ArrayList<>();
users.forEachAsync(user -> { users.forEachAsync(user -> {
concreteSelf.loadUser(reaction, ausers, user); concreteSelf.loadUser(reaction, aUsers, user);
return false; return false;
}).thenAccept(o -> future.complete(builder.build())) }).thenAccept(o -> future.complete(builder.build()))
.exceptionally(throwable -> { .exceptionally(throwable -> {
log.error("Failed to load reaction users.", throwable); log.error("Failed to load reaction users.", throwable);
return null; return null;
}); });
builder.userInServersIds(ausers); builder.userInServersIds(aUsers);
builder.emote(emoteService.buildAEmoteFromReaction(reaction.getReactionEmote())); builder.emote(emoteService.buildAEmoteFromReaction(reaction.getReactionEmote()));
return future; return future;
} }
@Transactional @Transactional
public void loadUser(MessageReaction reaction, List<Long> ausers, User user) { public void loadUser(MessageReaction reaction, List<Long> aUsers, User user) {
if(reaction.getGuild() != null) { if(reaction.getGuild() != null) {
ausers.add(userInServerManagementService.loadUser(reaction.getGuild().getIdLong(), user.getIdLong()).getUserInServerId()); aUsers.add(userInServerManagementService.loadUser(reaction.getGuild().getIdLong(), user.getIdLong()).getUserInServerId());
} }
} }

View File

@@ -50,8 +50,8 @@
<properties> <properties>
<maven.build.timestamp.format>yyyy/MM/dd HH:mm</maven.build.timestamp.format> <maven.build.timestamp.format>yyyy/MM/dd HH:mm</maven.build.timestamp.format>
<jda.version>4.1.1_155</jda.version> <jda.version>4.1.1_167</jda.version>
<jda.utilities.version>3.0.3</jda.utilities.version> <jda.utilities.version>3.0.4</jda.utilities.version>
<asciidoctor.maven.plugin.version>2.0.0-RC.1</asciidoctor.maven.plugin.version> <asciidoctor.maven.plugin.version>2.0.0-RC.1</asciidoctor.maven.plugin.version>
<asciidoctorj.pdf.version>1.5.3</asciidoctorj.pdf.version> <asciidoctorj.pdf.version>1.5.3</asciidoctorj.pdf.version>
<asciidoctorj.version>2.3.0</asciidoctorj.version> <asciidoctorj.version>2.3.0</asciidoctorj.version>
@@ -166,7 +166,6 @@
<dependency> <dependency>
<groupId>org.projectlombok</groupId> <groupId>org.projectlombok</groupId>
<artifactId>lombok</artifactId> <artifactId>lombok</artifactId>
<optional>true</optional>
</dependency> </dependency>
<dependency> <dependency>
<groupId>org.apache.commons</groupId> <groupId>org.apache.commons</groupId>

View File

@@ -10,7 +10,7 @@ public class SchedulerJobConverter {
/** /**
* Converts a {@link SchedulerJobProperties} instance to a usable {@link SchedulerJob} instance * Converts a {@link SchedulerJobProperties} instance to a usable {@link SchedulerJob} instance
* @param properties The instance directly coming from a property file * @param properties The instance directly coming from a property file
* @return A instanc eof {@link SchedulerJob} which represents an instance from the database * @return A instance eof {@link SchedulerJob} which represents an instance from the database
*/ */
public SchedulerJob fromJobProperties(SchedulerJobProperties properties) { public SchedulerJob fromJobProperties(SchedulerJobProperties properties) {
return SchedulerJob return SchedulerJob

View File

@@ -8,7 +8,7 @@ import org.springframework.stereotype.Repository;
import javax.persistence.QueryHint; import javax.persistence.QueryHint;
/** /**
* Repository repsonsible to access the stored job configuration in the database * Repository responsible to access the stored job configuration in the database
*/ */
@Repository @Repository
public interface SchedulerJobRepository extends JpaRepository<SchedulerJob, Long> { public interface SchedulerJobRepository extends JpaRepository<SchedulerJob, Long> {

View File

@@ -57,7 +57,7 @@ public class SchedulerServiceBean implements SchedulerService {
boolean recurringJob = isRecurringJob(schedulerJob); boolean recurringJob = isRecurringJob(schedulerJob);
jobDetail = scheduleCreator.createJob((Class<? extends QuartzJobBean>) Class.forName(schedulerJob.getClazz()), jobDetail = scheduleCreator.createJob((Class<? extends QuartzJobBean>) Class.forName(schedulerJob.getClazz()),
!recurringJob, context, schedulerJob.getName(), schedulerJob.getGroupName(), schedulerJob.isRecovery()); !recurringJob, context, schedulerJob.getName(), schedulerJob.getGroupName(), schedulerJob.isRecovery());
// if its a cron job, we can schedule it directly, otherwise we just make the scheduler aware of its existance // if its a cron job, we can schedule it directly, otherwise we just make the scheduler aware of its existence
// and trigger it later // and trigger it later
if(recurringJob) { if(recurringJob) {
Trigger trigger = scheduleCreator.createBasicCronTrigger(new Date(), Trigger trigger = scheduleCreator.createBasicCronTrigger(new Date(),

View File

@@ -26,7 +26,7 @@ public interface SchedulerService {
/** /**
* Removes a job from the scheduler. * Removes a job from the scheduler.
* @param triggerKey The key of the trigger to unschedule * @param triggerKey The key of the trigger to unSchedule
* @return if the job was found and unscheduled * @return if the job was found and unscheduled
*/ */
boolean unScheduleJob(String triggerKey); boolean unScheduleJob(String triggerKey);

View File

@@ -48,7 +48,7 @@ public class EmbedConfiguration {
*/ */
private EmbedFooter footer; private EmbedFooter footer;
/** /**
* Thhe {@link OffsetDateTime} object used as the time stamp in the {@link net.dv8tion.jda.api.entities.MessageEmbed} * The {@link OffsetDateTime} object used as the time stamp in the {@link net.dv8tion.jda.api.entities.MessageEmbed}
*/ */
private OffsetDateTime timeStamp; private OffsetDateTime timeStamp;
/** /**

View File

@@ -36,7 +36,7 @@ public class TemplateServiceBean implements TemplateService {
/** /**
* Formats the passed passed count with the embed used for formatting pages. * Formats the passed passed count with the embed used for formatting pages.
* @param count The index of the page you want formated. * @param count The index of the page you want formatted.
* @return The rendered template as a string object * @return The rendered template as a string object
*/ */
private String getPageString(Integer count) { private String getPageString(Integer count) {
@@ -46,8 +46,8 @@ public class TemplateServiceBean implements TemplateService {
} }
/** /**
* Retrieves the key which gets suffixed with '_embed' and this retrives the embed configuration. This configuration is then rendered * Retrieves the key which gets suffixed with '_embed' and this retrieves the embed configuration. This configuration is then rendered
* and deserialized with GSON into a {@link EmbedConfiguration} object. This object is then rendered into a {@link MessageToSend} and returned. * and de-serialized with GSON into a {@link EmbedConfiguration} object. This object is then rendered into a {@link MessageToSend} and returned.
* If the individual element do not fit in an embed, for example, if the field count is to high, another embed will be created in the {@link MessageToSend} object. * If the individual element do not fit in an embed, for example, if the field count is to high, another embed will be created in the {@link MessageToSend} object.
* If multiple embeds are necessary to provide what the {@link EmbedConfiguration} wanted, this method will automatically set the footer of the additional {@link MessageEmbed} * If multiple embeds are necessary to provide what the {@link EmbedConfiguration} wanted, this method will automatically set the footer of the additional {@link MessageEmbed}
* with a formatted page count. * with a formatted page count.

View File

@@ -11,7 +11,7 @@ import java.util.Optional;
/** /**
* ManagementService bean used to retrieve the templates by key from the database. * ManagementService bean used to retrieve the templates by key from the database.
* This class uses the {@link TemplateRepository} bean to laod the {@link Template} objects. * This class uses the {@link TemplateRepository} bean to load the {@link Template} objects.
*/ */
@Component @Component
@Slf4j @Slf4j

View File

@@ -131,7 +131,7 @@ public class SafeFieldIterationsTest {
} }
public List<Object> twoListEntryParameter() { public List<Object> twoListEntryParameter() {
return Arrays.asList(DefaultListAdapter.adapt(Arrays.asList("testing", "othertext"), getWrapper()), new SimpleScalar(TEMPLATE_KEY), new SimpleScalar(FIELD_NAME_TEMPLATE), new SimpleScalar(INLINE_VALUE)); return Arrays.asList(DefaultListAdapter.adapt(Arrays.asList("testing", "otherText"), getWrapper()), new SimpleScalar(TEMPLATE_KEY), new SimpleScalar(FIELD_NAME_TEMPLATE), new SimpleScalar(INLINE_VALUE));
} }
private DefaultObjectWrapper getWrapper() { private DefaultObjectWrapper getWrapper() {