diff --git a/pom.xml b/pom.xml index b30ffd9..150a23b 100644 --- a/pom.xml +++ b/pom.xml @@ -176,5 +176,10 @@ 2.1.1 compile + + org.apache.commons + commons-text + 1.12.0 + diff --git a/src/main/java/cc/fascinated/bat/features/base/commands/general/LookupUserCommand.java b/src/main/java/cc/fascinated/bat/features/base/commands/general/LookupUserCommand.java index 1293a9d..61b4a6d 100644 --- a/src/main/java/cc/fascinated/bat/features/base/commands/general/LookupUserCommand.java +++ b/src/main/java/cc/fascinated/bat/features/base/commands/general/LookupUserCommand.java @@ -17,6 +17,7 @@ import net.dv8tion.jda.api.interactions.commands.OptionMapping; import net.dv8tion.jda.api.interactions.commands.OptionType; import net.dv8tion.jda.api.interactions.commands.SlashCommandInteraction; import net.dv8tion.jda.api.interactions.commands.build.OptionData; +import org.apache.commons.text.StringEscapeUtils; import org.springframework.stereotype.Component; /** @@ -55,7 +56,7 @@ public class LookupUserCommand extends BatCommand { return; } - // The flags of the user (eg. Discord Partner, Hypesquad Events, etc.) + // The flags of the user (example: Discord Partner, Hypesquad Events, etc.) StringBuilder flags = new StringBuilder(); for (User.UserFlag flag : target.getFlags()) { flags.append(flag.getName()).append(", "); @@ -63,8 +64,8 @@ public class LookupUserCommand extends BatCommand { target.retrieveProfile().queue(profile -> event.replyEmbeds(EmbedUtils.genericEmbed() .setDescription(new EmbedDescriptionBuilder("User Lookup") - .appendLine("Name: `%s`".formatted(target.getGlobalName()), true) - .appendLine("Username: `%s`".formatted(target.getName()), true) + .appendLine("Name: `%s`".formatted(StringEscapeUtils.escapeJava(target.getGlobalName())), true) + .appendLine("Username: `%s`".formatted(StringEscapeUtils.escapeJava(target.getName())), true) .appendLine("ID: `%s`".formatted(target.getId()), true) .appendLine("Flags: `%s`".formatted(flags.toString().isEmpty() ? "None" : flags.substring(0, flags.length() - 2)), true) .appendLine("Joined Discord: ".formatted(target.getTimeCreated().toEpochSecond()), true)