From c0390b806ff9058733e2ee68f326eccf2b39ecde Mon Sep 17 00:00:00 2001 From: ChomeNS <95471003+ChomeNS@users.noreply.github.com> Date: Mon, 7 Apr 2025 07:59:33 +0700 Subject: [PATCH] refactor: replace ONLY `discord.gg` with `discord{zwsp}.{zwsp}gg` instead of every single `.` with `{zwsp}.{zwsp}` the reason i have to do this is because people keep copying players ips from `/seen` logs (which contain zwsp) and put them into ipfilter, and since they contain zwsp, they'll never work, gonna consider adding IP regex check --- build-number.txt | 2 +- .../me/chayapak1/chomens_bot/plugins/DiscordPlugin.java | 6 +++++- 2 files changed, 6 insertions(+), 2 deletions(-) diff --git a/build-number.txt b/build-number.txt index 45663c0b..20ba7d9d 100644 --- a/build-number.txt +++ b/build-number.txt @@ -1 +1 @@ -2396 \ No newline at end of file +2397 \ 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 982b08ba..d5193d9a 100644 --- a/src/main/java/me/chayapak1/chomens_bot/plugins/DiscordPlugin.java +++ b/src/main/java/me/chayapak1/chomens_bot/plugins/DiscordPlugin.java @@ -531,12 +531,16 @@ public class DiscordPlugin extends ListenerAdapter { String message; synchronized (logMessages) { StringBuilder logMessage = logMessages.get(channelId); - message = logMessage.toString().replace(".", "\u200b.\u200b"); // the ZWSP fixes discord.gg showing invite + message = logMessage.toString() + // the ZWSP fixes discord.gg showing invite + .replace("discord.gg", "discord\u200b.\u200bgg"); + final int maxLength = 2_000 - (""" ```ansi ```""" ).length(); // kinda sus + if (message.length() >= maxLength) { message = message.substring(0, maxLength); }