[AB-xxx] enabling localization by adding the localization as a system config key

fixing methods which did not provide the server id to template rendering
refactoring channel service method to remove a duplicate
fixing template loading method to not throw an exception when template was not found
This commit is contained in:
Sheldan
2024-11-22 21:54:13 +01:00
parent 0e95ddf198
commit 453378f0b6
72 changed files with 181 additions and 172 deletions

View File

@@ -69,7 +69,7 @@ public class RepostLeaderboard extends AbstractConditionableCommand {
.userExecuting(userFuture.join())
.member(commandContext.getAuthor())
.build();
return FutureUtils.toSingleFutureGeneric(channelService.sendEmbedTemplateInTextChannelList(REPOST_LEADERBOARD_RESPONSE_TEMPLATE_KEY, model, commandContext.getChannel()));
return FutureUtils.toSingleFutureGeneric(channelService.sendEmbedTemplateInMessageChannel(REPOST_LEADERBOARD_RESPONSE_TEMPLATE_KEY, model, commandContext.getChannel()));
}).thenApply(o -> CommandResult.fromIgnored());
}

View File

@@ -37,7 +37,7 @@ public class ShowRepostCheckChannels extends AbstractConditionableCommand {
public CompletableFuture<CommandResult> executeAsync(CommandContext commandContext) {
List<RepostCheckChannelGroup> channelGroups = checkChannelService.getChannelGroupsWithEnabledCheck(commandContext.getGuild().getIdLong());
RepostCheckChannelsModel model = converter.fromRepostCheckChannelGroups(channelGroups, commandContext.getGuild());
return FutureUtils.toSingleFutureGeneric(channelService.sendEmbedTemplateInTextChannelList(SHOW_REPOST_CHECK_CHANNELS_RESPONSE_TEMPLATE_KEY, model, commandContext.getChannel()))
return FutureUtils.toSingleFutureGeneric(channelService.sendEmbedTemplateInMessageChannel(SHOW_REPOST_CHECK_CHANNELS_RESPONSE_TEMPLATE_KEY, model, commandContext.getChannel()))
.thenApply(unused -> CommandResult.fromIgnored());
}

View File

@@ -92,7 +92,7 @@ public class RepostLeaderboardTest {
when(converter.convertSingleUser(userResult)).thenReturn(CompletableFuture.completedFuture(convertedUserResult));
CompletableFuture<CommandResult> resultFuture = testUnit.executeAsync(noParameters);
CommandTestUtilities.checkSuccessfulCompletionAsync(resultFuture);
verify(channelService, times(1)).sendEmbedTemplateInTextChannelList(eq(RepostLeaderboard.REPOST_LEADERBOARD_RESPONSE_TEMPLATE_KEY), modelCaptor.capture(), eq(noParameters.getChannel()));
verify(channelService, times(1)).sendEmbedTemplateInMessageChannel(eq(RepostLeaderboard.REPOST_LEADERBOARD_RESPONSE_TEMPLATE_KEY), modelCaptor.capture(), eq(noParameters.getChannel()));
RepostLeaderboardModel model = modelCaptor.getValue();
Assert.assertEquals(noParameters.getGuild(), model.getGuild());
Assert.assertEquals(convertedList, model.getEntries());

View File

@@ -49,7 +49,7 @@ public class ShowRepostCheckChannelsTest {
when(converter.fromRepostCheckChannelGroups(groupList, noParameters.getGuild())).thenReturn(model);
CompletableFuture<CommandResult> futureResult = testUnit.executeAsync(noParameters);
CommandTestUtilities.checkSuccessfulCompletionAsync(futureResult);
verify(channelService, times(1)).sendEmbedTemplateInTextChannelList(ShowRepostCheckChannels.SHOW_REPOST_CHECK_CHANNELS_RESPONSE_TEMPLATE_KEY, model, noParameters.getChannel());
verify(channelService, times(1)).sendEmbedTemplateInMessageChannel(ShowRepostCheckChannels.SHOW_REPOST_CHECK_CHANNELS_RESPONSE_TEMPLATE_KEY, model, noParameters.getChannel());
}
@Test