mirror of
https://github.com/PluralKit/PluralKit.git
synced 2026-02-04 04:56:49 +00:00
fix(bot): make tag enforcement check name formatting
This commit is contained in:
parent
a8c90cea8e
commit
b26ca69071
2 changed files with 28 additions and 4 deletions
18
PluralKit.Core/Database/Functions/MessageContextExt.cs
Normal file
18
PluralKit.Core/Database/Functions/MessageContextExt.cs
Normal file
|
|
@ -0,0 +1,18 @@
|
|||
#nullable enable
|
||||
|
||||
namespace PluralKit.Core;
|
||||
public static class MessageContextExt
|
||||
{
|
||||
public static bool HasProxyableTag(this MessageContext ctx)
|
||||
{
|
||||
var tag = ctx.SystemGuildTag ?? ctx.SystemTag;
|
||||
if (!ctx.TagEnabled || tag == null)
|
||||
return false;
|
||||
|
||||
var format = ctx.NameFormat ?? ProxyMember.DefaultFormat;
|
||||
if (!format.Contains("{tag}"))
|
||||
return false;
|
||||
|
||||
return true;
|
||||
}
|
||||
}
|
||||
Loading…
Add table
Add a link
Reference in a new issue