Fix <text> brackets also matching markdown
This commit is contained in:
parent
7d60b3e7cf
commit
94f4f970ea
@ -1,6 +1,7 @@
|
||||
#nullable enable
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using System.Text.RegularExpressions;
|
||||
|
||||
using PluralKit.Core;
|
||||
|
||||
@ -8,6 +9,9 @@ namespace PluralKit.Bot
|
||||
{
|
||||
public class ProxyTagParser
|
||||
{
|
||||
private Regex prefixPattern = new Regex(@"^<(?:@!?|#|@&|a?:[\d\w_]+?:)\d+>");
|
||||
private Regex suffixPattern = new Regex(@"<(?:@!?|#|@&|a?:[\d\w_]+?:)\d+>$");
|
||||
|
||||
public bool TryMatch(IEnumerable<ProxyMember> members, string? input, out ProxyMatch result)
|
||||
{
|
||||
result = default;
|
||||
@ -36,6 +40,9 @@ namespace PluralKit.Bot
|
||||
// Skip blank tags (shouldn't ever happen in practice)
|
||||
if (tag.Prefix == null && tag.Suffix == null) continue;
|
||||
|
||||
if(tag.Prefix == "<" && prefixPattern.IsMatch(input)) continue;
|
||||
if(tag.Suffix == ">" && suffixPattern.IsMatch(input)) continue;
|
||||
|
||||
// Can we match with these tags?
|
||||
if (TryMatchTagsInner(input, tag, out result.Content))
|
||||
{
|
||||
|
Loading…
Reference in New Issue
Block a user