maybe fix this?

This commit is contained in:
Lee 2024-07-05 22:33:00 +01:00
parent 36d29caa7a
commit 0e33179260
2 changed files with 9 additions and 3 deletions

@ -176,5 +176,10 @@
<version>2.1.1</version>
<scope>compile</scope>
</dependency>
<dependency>
<groupId>org.apache.commons</groupId>
<artifactId>commons-text</artifactId>
<version>1.12.0</version>
</dependency>
</dependencies>
</project>

@ -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: <t:%s:R>".formatted(target.getTimeCreated().toEpochSecond()), true)