mirror of
https://github.com/PluralKit/PluralKit.git
synced 2026-02-17 03:00:13 +00:00
Escape Discord usernames in system embed.
This commit is contained in:
parent
d305faf401
commit
54adf8cf12
2 changed files with 8 additions and 1 deletions
|
|
@ -43,7 +43,7 @@ public class EmbedService
|
|||
{
|
||||
// Fetch/render info for all accounts simultaneously
|
||||
var accounts = await _repo.GetSystemAccounts(system.Id);
|
||||
var users = (await GetUsers(accounts)).Select(x => x.User?.NameAndMention() ?? $"(deleted account {x.Id})");
|
||||
var users = (await GetUsers(accounts)).Select(x => x.User?.NameAndMention().EscapeMarkdownExcludingMentions() ?? $"(deleted account {x.Id})");
|
||||
|
||||
var countctx = LookupContext.ByNonOwner;
|
||||
if (cctx.MatchFlag("a", "all"))
|
||||
|
|
|
|||
|
|
@ -156,6 +156,13 @@ public static class DiscordUtils
|
|||
return input;
|
||||
}
|
||||
|
||||
public static string EscapeMarkdownExcludingMentions(this string input)
|
||||
{
|
||||
var pattern = new Regex(@"[*_~`(||)\\]", RegexOptions.Multiline);
|
||||
if (input != null) return pattern.Replace(input, @"\$&");
|
||||
return input;
|
||||
}
|
||||
|
||||
public static string EscapeBacktickPair(this string input)
|
||||
{
|
||||
if (input == null)
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue