From b0787772f10ac02be8738bc6ba5d4ea8a73886bd Mon Sep 17 00:00:00 2001 From: FerroEduardo <47820549+FerroEduardo@users.noreply.github.com> Date: Sun, 4 Feb 2024 18:27:11 -0300 Subject: [PATCH] feat(twitter): cleaner message --- .../capivara/listeners/events/TwitterListener.java | 8 +++----- 1 file changed, 3 insertions(+), 5 deletions(-) diff --git a/src/main/java/com/softawii/capivara/listeners/events/TwitterListener.java b/src/main/java/com/softawii/capivara/listeners/events/TwitterListener.java index d6cf718..b785edc 100644 --- a/src/main/java/com/softawii/capivara/listeners/events/TwitterListener.java +++ b/src/main/java/com/softawii/capivara/listeners/events/TwitterListener.java @@ -22,6 +22,7 @@ public class TwitterListener extends ListenerAdapter { private final Pattern twitterPattern; private final TwitterParserConfigService service; + private static final char invisibleChar = '⠀'; // https://www.compart.com/en/unicode/U+2800 public TwitterListener(JDA jda, TwitterParserConfigService service) { this.service = service; @@ -70,13 +71,10 @@ private Optional parseMessage(String twitterLink, User author) { if (matcher.find()) { String twitterUsername = matcher.group("username"); String twitterPostId = matcher.group("postId"); - String result = String.format( """ - Autor: %s - Link original: `%s` - [Postagem](https://fxtwitter.com/%s/status/%s) - """, author.getAsMention(), twitterLink, twitterUsername, twitterPostId); + Autor: %s | [Link original](<%s>) [%c](https://fxtwitter.com/%s/status/%s) + """, author.getAsMention(), twitterLink, invisibleChar, twitterUsername, twitterPostId); return Optional.of(result); }