Fix Discord webhook embed formatting
Some checks failed
Deploy / docker (17, 3.8.5) (push) Failing after 56s

This commit is contained in:
Braydon 2024-06-21 01:32:28 -04:00
parent 5838f4b895
commit d757b05bd7

@ -3,7 +3,6 @@ package me.braydon.profanity.notification.impl;
import jakarta.annotation.PostConstruct; import jakarta.annotation.PostConstruct;
import lombok.NonNull; import lombok.NonNull;
import lombok.SneakyThrows; import lombok.SneakyThrows;
import me.braydon.profanity.common.ContentTag;
import me.braydon.profanity.common.DiscordWebhook; import me.braydon.profanity.common.DiscordWebhook;
import me.braydon.profanity.model.response.ContentProcessResponse; import me.braydon.profanity.model.response.ContentProcessResponse;
import me.braydon.profanity.notification.INotificationSource; import me.braydon.profanity.notification.INotificationSource;
@ -68,10 +67,10 @@ public final class DiscordSource implements INotificationSource {
embed.addField("Content", "`" + response.getContent() + "`", false); embed.addField("Content", "`" + response.getContent() + "`", false);
} }
if (content.isDisplayMatched()) { if (content.isDisplayMatched()) {
embed.addField("Matched", String.join("`, `", response.getMatched()), false); embed.addField("Matched", response.getMatched().stream().map(matched -> "`" + matched + "`").collect(Collectors.joining(", ")), false);
} }
if (content.isDisplayTags()) { if (content.isDisplayTags()) {
embed.addField("Tags", response.getTags().stream().map(ContentTag::name).collect(Collectors.joining("`, `")), false); embed.addField("Tags", response.getTags().stream().map(tag -> "`" + tag.name() + "`").collect(Collectors.joining(", ")), false);
} }
if (content.isDisplayTags()) { if (content.isDisplayTags()) {
embed.addField("Score", "`" + response.getScore() + "`", false); embed.addField("Score", "`" + response.getScore() + "`", false);