mirror of
https://github.com/Sheldan/abstracto.git
synced 2026-04-05 09:00:24 +00:00
[AB-218] adding ability to split the normal message as well according to custom configuration
adding ability to define the max amount of messages resulting from a template on a server and template base fixing not always considering the server when rendering templates in various places
This commit is contained in:
@@ -48,7 +48,7 @@ public class UrbanDefine extends AbstractConditionableCommand {
|
||||
UrbanDefinition definition = urbanService.getUrbanDefinition(parameter);
|
||||
UrbanResponseModel model = (UrbanResponseModel) ContextConverter.slimFromCommandContext(commandContext, UrbanResponseModel.class);
|
||||
model.setDefinition(definition);
|
||||
MessageToSend message = templateService.renderEmbedTemplate(URBAN_DEFINE_RESPONSE_MODEL_TEMPLATE_KEY, model);
|
||||
MessageToSend message = templateService.renderEmbedTemplate(URBAN_DEFINE_RESPONSE_MODEL_TEMPLATE_KEY, model, commandContext.getGuild().getIdLong());
|
||||
return FutureUtils.toSingleFutureGeneric(channelService.sendMessageToSendToChannel(message, commandContext.getChannel()))
|
||||
.thenApply(unused -> CommandResult.fromSuccess());
|
||||
} catch (IOException e) {
|
||||
|
||||
@@ -30,6 +30,8 @@ import java.util.concurrent.CompletableFuture;
|
||||
@Component
|
||||
public class YoutubeVideoSearch extends AbstractConditionableCommand {
|
||||
|
||||
public static final String YOUTUBE_SEARCH_COMMAND_RESPONSE_TEMPLATE_KEY = "youtube_search_command_response";
|
||||
public static final String YOUTUBE_SEARCH_COMMAND_RESPONSE_LINK_TEMPLATE_KEY = "youtube_search_command_response_link";
|
||||
@Autowired
|
||||
private YoutubeSearchService youtubeSearchService;
|
||||
|
||||
@@ -50,12 +52,12 @@ public class YoutubeVideoSearch extends AbstractConditionableCommand {
|
||||
model.setVideo(foundVideo);
|
||||
CompletableFuture<Void> infoEmbedFuture;
|
||||
if(featureModeService.featureModeActive(WebserviceFeatureDefinition.YOUTUBE, commandContext.getGuild().getIdLong(), YoutubeWebServiceFeatureMode.VIDEO_DETAILS)) {
|
||||
MessageToSend message = templateService.renderEmbedTemplate("youtube_search_command_response", model);
|
||||
MessageToSend message = templateService.renderEmbedTemplate(YOUTUBE_SEARCH_COMMAND_RESPONSE_TEMPLATE_KEY, model, commandContext.getGuild().getIdLong());
|
||||
infoEmbedFuture = FutureUtils.toSingleFutureGeneric(channelService.sendMessageToSendToChannel(message, commandContext.getChannel()));
|
||||
} else {
|
||||
infoEmbedFuture = CompletableFuture.completedFuture(null);
|
||||
}
|
||||
MessageToSend linkEmbed = templateService.renderEmbedTemplate("youtube_search_command_response_link", model);
|
||||
MessageToSend linkEmbed = templateService.renderEmbedTemplate(YOUTUBE_SEARCH_COMMAND_RESPONSE_LINK_TEMPLATE_KEY, model, commandContext.getGuild().getIdLong());
|
||||
CompletableFuture<Void> linkEmbedFuture = FutureUtils.toSingleFutureGeneric(channelService.sendMessageToSendToChannel(linkEmbed, commandContext.getChannel()));
|
||||
return CompletableFuture.allOf(infoEmbedFuture, linkEmbedFuture)
|
||||
.thenApply(unused -> CommandResult.fromSuccess());
|
||||
|
||||
Reference in New Issue
Block a user