mirror of
https://github.com/PluralKit/PluralKit.git
synced 2026-02-04 13:06:50 +00:00
Refactor proxy handling code
- Move reaction handlers to the ReactionAdded event instead of ProxyService - Split tag matching off into ProxyTagParser - Split autoproxy matching off into Autoproxier - General cleanup and simplification
This commit is contained in:
parent
4a4d980349
commit
49acc4d9e2
13 changed files with 492 additions and 395 deletions
25
PluralKit.Bot/Proxy/ProxyMatch.cs
Normal file
25
PluralKit.Bot/Proxy/ProxyMatch.cs
Normal file
|
|
@ -0,0 +1,25 @@
|
|||
#nullable enable
|
||||
using PluralKit.Core;
|
||||
|
||||
namespace PluralKit.Bot
|
||||
{
|
||||
public struct ProxyMatch
|
||||
{
|
||||
public PKMember Member;
|
||||
public string? Content;
|
||||
public ProxyTag? ProxyTags;
|
||||
|
||||
public string? ProxyContent
|
||||
{
|
||||
get
|
||||
{
|
||||
// Add the proxy tags into the proxied message if that option is enabled
|
||||
// Also check if the member has any proxy tags - some cases autoproxy can return a member with no tags
|
||||
if (Member.KeepProxy && Content != null && ProxyTags != null)
|
||||
return $"{ProxyTags.Value.Prefix}{Content}{ProxyTags.Value.Suffix}";
|
||||
|
||||
return Content;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
Loading…
Add table
Add a link
Reference in a new issue