mirror of
https://github.com/PluralKit/PluralKit.git
synced 2026-02-04 13:06:50 +00:00
Fix: Escape Backticks (#192)
This commit is contained in:
parent
0d2777c1d1
commit
55ea314b42
6 changed files with 17 additions and 10 deletions
|
|
@ -192,6 +192,13 @@ namespace PluralKit.Bot
|
|||
else return input;
|
||||
}
|
||||
|
||||
public static string EscapeBacktickPair(this string input){
|
||||
Regex doubleBacktick = new Regex(@"``", RegexOptions.Multiline);
|
||||
//Run twice to catch any pairs that are created from the first pass, pairs shouldn't be created in the second as they are created from odd numbers of backticks, even numbers are all caught on the first pass
|
||||
if(input != null) return doubleBacktick.Replace(doubleBacktick.Replace(input, @"``"),@"``");
|
||||
else return input;
|
||||
}
|
||||
|
||||
public static Task<DiscordUser> GetUser(this DiscordRestClient client, ulong id) =>
|
||||
WrapDiscordCall(client.GetUserAsync(id));
|
||||
|
||||
|
|
|
|||
|
|
@ -14,7 +14,7 @@ using PluralKit.Core;
|
|||
namespace PluralKit.Bot
|
||||
{
|
||||
public static class MiscUtils {
|
||||
public static string ProxyTagsString(this PKMember member) => string.Join(", ", member.ProxyTags.Select(t => $"`{t.ProxyString.EscapeMarkdown()}`"));
|
||||
public static string ProxyTagsString(this PKMember member) => string.Join(", ", member.ProxyTags.Select(t => $"``{t.ProxyString.EscapeBacktickPair()}``"));
|
||||
|
||||
public static bool IsOurProblem(this Exception e)
|
||||
{
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue