Skip to content

Commit

Permalink
Fix Discord /list command showing tags in output (#5698)
Browse files Browse the repository at this point in the history
  • Loading branch information
pop4959 authored Feb 25, 2024
1 parent 185b4e2 commit d4b72c8
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 2 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -40,6 +40,13 @@ public static String stripFormat(final String input) {
return ChatColor.stripColor(input);
}

public static String stripMiniFormat(final String input) {
if (input == null) {
return null;
}
return AdventureUtil.miniMessage().stripTags(input);
}

//This method is used to simply strip the & convention colour codes
public static String stripEssentialsFormat(final String input) {
if (input == null) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@
import com.earth2me.essentials.IEssentials;
import com.earth2me.essentials.PlayerList;
import com.earth2me.essentials.User;
import com.earth2me.essentials.utils.FormatUtil;
import net.essentialsx.api.v2.services.discord.InteractionCommandArgument;
import net.essentialsx.api.v2.services.discord.InteractionCommandArgumentType;
import net.essentialsx.api.v2.services.discord.InteractionEvent;
Expand Down Expand Up @@ -45,8 +46,8 @@ public void onCommand(InteractionEvent event) {

final StringBuilder stringBuilder = new StringBuilder();
for (final String str : output) {
stringBuilder.append(str).append("\n");
stringBuilder.append(FormatUtil.stripMiniFormat(str)).append("\n");
}
event.reply(MessageUtil.sanitizeDiscordMarkdown(stringBuilder.substring(0, stringBuilder.length() - 2)));
event.reply(MessageUtil.sanitizeDiscordMarkdown(stringBuilder.substring(0, stringBuilder.length() - 1)));
}
}

0 comments on commit d4b72c8

Please sign in to comment.