diff --git a/build-number.txt b/build-number.txt index 0bd8d3cb..84a3f856 100644 --- a/build-number.txt +++ b/build-number.txt @@ -1 +1 @@ -1772 \ No newline at end of file +1774 \ No newline at end of file diff --git a/src/main/java/me/chayapak1/chomens_bot/plugins/DiscordPlugin.java b/src/main/java/me/chayapak1/chomens_bot/plugins/DiscordPlugin.java index 365e4d20..3e9875c2 100644 --- a/src/main/java/me/chayapak1/chomens_bot/plugins/DiscordPlugin.java +++ b/src/main/java/me/chayapak1/chomens_bot/plugins/DiscordPlugin.java @@ -377,17 +377,17 @@ public class DiscordPlugin { if (nameComponent.color() == null) nameComponent = nameComponent.color(NamedTextColor.RED); + final String replacedMessageContent = message.getContentDisplay() + // replaces skull emoji + .replace("\uD83D\uDC80", "☠") + // replaces all ANSI codes (used when a user replies to the bot's log message) with nothing + .replaceAll("\u001B\\[[;\\d]*[ -/]*[@-~]", "") + // replaces all ZWSP with nothing + .replace("\u200b", ""); + final Component deserialized = LegacyComponentSerializer .legacyAmpersand() - .deserialize( - message.getContentDisplay() - // replaces skull emoji - .replace("\uD83D\uDC80", "☠") - // replaces all ANSI codes (used when a user replies to the bot's log message) with nothing - .replaceAll("\u001B\\[[;\\d]*[ -/]*[@-~]", "") - // replaces all ZWSP with nothing - .replace("\u200b", "") - ); + .deserialize(replacedMessageContent); final Component messageComponent = Component .empty() @@ -397,6 +397,18 @@ public class DiscordPlugin { .append(attachmentsComponent) .append(embedsComponent) .append(stickersComponent) + ) + .hoverEvent( + HoverEvent.showText( + Component + .text("Click here to copy the message to your clipboard") + .color(NamedTextColor.GREEN) + ) + ) + .clickEvent( + ClickEvent.copyToClipboard( + replacedMessageContent + ) ); return Component.translatable(