Fix format escape and update test.

Ready for first release.

Signed-off-by: Etzelia <etzelia@hotmail.com>
main
Etzelia 2020-07-30 17:00:54 -05:00
parent 21a139cd1e
commit 6e20ef32b7
No known key found for this signature in database
GPG Key ID: 3CAEB74806C4ADE5
3 changed files with 6 additions and 3 deletions

View File

@ -6,7 +6,7 @@
<groupId>xyz.etztech</groupId> <groupId>xyz.etztech</groupId>
<artifactId>javacord</artifactId> <artifactId>javacord</artifactId>
<packaging>jar</packaging> <packaging>jar</packaging>
<version>0.0.2</version> <version>0.1.0</version>
<developers> <developers>
<developer> <developer>

View File

@ -6,7 +6,8 @@ public class Javacord {
return input return input
.replaceAll("_", "\\\\\\\\_") .replaceAll("_", "\\\\\\\\_")
.replaceAll("\\*", "\\\\\\\\*") .replaceAll("\\*", "\\\\\\\\*")
.replaceAll("~", "\\\\\\\\~"); .replaceAll("~", "\\\\\\\\~")
.replaceAll("\\|", "\\\\\\\\|");
} }
public static String escapeQuote(String input) { public static String escapeQuote(String input) {

View File

@ -1,3 +1,4 @@
import xyz.etztech.Javacord;
import xyz.etztech.embed.Author; import xyz.etztech.embed.Author;
import xyz.etztech.embed.Embed; import xyz.etztech.embed.Embed;
import xyz.etztech.embed.Webhook; import xyz.etztech.embed.Webhook;
@ -10,8 +11,9 @@ public class Test {
Embed embed = new Embed() Embed embed = new Embed()
.color(3306460) .color(3306460)
.timestamp(OffsetDateTime.now()) .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", "")); .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); Webhook webhook = new Webhook("@here", embed);
System.out.println(webhook); System.out.println(webhook);
} }