package stream.flarebot.flarebot.util;

import net.dv8tion.jda.core.entities.TextChannel;
import stream.flarebot.flarebot.FlareBot;

import java.util.regex.Matcher;

public class HelpFormatter {
    public static String on(TextChannel channel, String description) {
        return description.replaceAll("(?<!\\\\)%p", Matcher.quoteReplacement(String.valueOf(get(channel))));
    }

    private static char get(TextChannel channel) {
        if (channel.getGuild() != null) {
            return FlareBot.getPrefixes().get(channel.getGuild().getId());
        }
        return FlareBot.getPrefixes().get(null);
    }

    public static String formatCommandUsage(TextChannel channel, String usage) {
        String prefix = String.valueOf(get(channel));
        return usage.replace("{%}", prefix);
    }
}

@@ -191,195 +191,8 @@
 er %7B
-%0A    public static String on(TextChannel channel, String description) %7B%0A        return description.replaceAll(%22(?%3C!%5C%5C%5C%5C)%25p%22, Matcher.quoteReplacement(String.valueOf(get(channel))));%0A    %7D
 %0A%0A  
@@ -465,13 +465,14 @@
 mand
-Usage
+Prefix
 (Tex
@@ -591,12 +591,19 @@
 lace
-(%22%7B%25
+All(%22%5C%5C%7B%25%5C%5C
 %7D%22, 

Make prefix placeholder "{%}" for everything