From 6e20ef32b772df85cfc19d84a3fea854ee1dfe5a Mon Sep 17 00:00:00 2001 From: Etzelia Date: Thu, 30 Jul 2020 17:00:54 -0500 Subject: [PATCH] Fix format escape and update test. Ready for first release. Signed-off-by: Etzelia --- pom.xml | 2 +- src/main/java/xyz/etztech/Javacord.java | 3 ++- src/test/java/Test.java | 4 +++- 3 files changed, 6 insertions(+), 3 deletions(-) diff --git a/pom.xml b/pom.xml index c223e68..5c2e3f6 100644 --- a/pom.xml +++ b/pom.xml @@ -6,7 +6,7 @@ xyz.etztech javacord jar - 0.0.2 + 0.1.0 diff --git a/src/main/java/xyz/etztech/Javacord.java b/src/main/java/xyz/etztech/Javacord.java index cd1de57..77a0bce 100644 --- a/src/main/java/xyz/etztech/Javacord.java +++ b/src/main/java/xyz/etztech/Javacord.java @@ -6,7 +6,8 @@ public class Javacord { return input .replaceAll("_", "\\\\\\\\_") .replaceAll("\\*", "\\\\\\\\*") - .replaceAll("~", "\\\\\\\\~"); + .replaceAll("~", "\\\\\\\\~") + .replaceAll("\\|", "\\\\\\\\|"); } public static String escapeQuote(String input) { diff --git a/src/test/java/Test.java b/src/test/java/Test.java index 9ad6830..acd0921 100644 --- a/src/test/java/Test.java +++ b/src/test/java/Test.java @@ -1,3 +1,4 @@ +import xyz.etztech.Javacord; import xyz.etztech.embed.Author; import xyz.etztech.embed.Embed; import xyz.etztech.embed.Webhook; @@ -10,8 +11,9 @@ public class Test { Embed embed = new Embed() .color(3306460) .timestamp(OffsetDateTime.now()) - .description("Etzelia found some \"diamond\" ore") + .title("Etzelia found some \"diamond\" ore") .author(new Author("Etzelia", "", "https://minotar.net/helm/Etzelia/100.png", "")); + embed.description(Javacord.escapeFormat("*Test* **Test** _Test_ __Test__ ~Test~ ~~Test~~ |Test| ||Test||")); Webhook webhook = new Webhook("@here", embed); System.out.println(webhook); }