use of com.demod.dcba.MessageCommandEvent in project Factorio-FBSR by demodude4u.
the class BlueprintBotDiscordService method handleBlueprintMessageCommand.
private void handleBlueprintMessageCommand(MessageCommandEvent event) throws IOException {
String content = event.getMessage().getContentDisplay();
for (Attachment attachment : event.getMessage().getAttachments()) {
content += " " + attachment.getUrl();
}
JSONObject options = new JSONObject();
findDebugOptions(event.getReporting(), content, options);
List<BlueprintStringData> blueprintStringDatas = BlueprintFinder.search(content, event.getReporting());
List<EmbedBuilder> embedBuilders = processBlueprints(blueprintStringDatas, event.getReporting(), options);
embedBuilders.get(0).setAuthor(event.getMessage().getAuthor().getName(), event.getMessage().getJumpUrl(), event.getMessage().getAuthor().getEffectiveAvatarUrl());
if (blueprintStringDatas.stream().anyMatch(d -> d.getBlueprints().stream().anyMatch(b -> b.isModsDetected()))) {
embedBuilders.get(embedBuilders.size() - 1).setFooter("(Modded features are shown as question marks)");
}
List<MessageEmbed> embeds = embedBuilders.stream().map(EmbedBuilder::build).collect(Collectors.toList());
for (MessageEmbed embed : embeds) {
event.replyEmbed(embed);
}
}
Aggregations