mirror of
https://github.com/PluralKit/PluralKit.git
synced 2026-02-04 04:56:49 +00:00
feat: disable autoproxy with 3 backslashes
This commit is contained in:
parent
83dd880374
commit
6a7ab2b853
1 changed files with 12 additions and 0 deletions
|
|
@ -66,6 +66,15 @@ public class ProxyService
|
||||||
|
|
||||||
var autoproxySettings = await _repo.GetAutoproxySettings(ctx.SystemId.Value, guild.Id, null);
|
var autoproxySettings = await _repo.GetAutoproxySettings(ctx.SystemId.Value, guild.Id, null);
|
||||||
|
|
||||||
|
if (IsDisableAutoproxy(message))
|
||||||
|
{
|
||||||
|
await _repo.UpdateAutoproxy(ctx.SystemId.Value, guild.Id, null, new()
|
||||||
|
{
|
||||||
|
AutoproxyMode = AutoproxyMode.Off
|
||||||
|
});
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
if (autoproxySettings.AutoproxyMode == AutoproxyMode.Latch && IsUnlatch(message))
|
if (autoproxySettings.AutoproxyMode == AutoproxyMode.Latch && IsUnlatch(message))
|
||||||
{
|
{
|
||||||
// "unlatch"
|
// "unlatch"
|
||||||
|
|
@ -495,6 +504,9 @@ public class ProxyService
|
||||||
public static bool IsUnlatch(Message message)
|
public static bool IsUnlatch(Message message)
|
||||||
=> message.Content.StartsWith(@"\\") || message.Content.StartsWith("\\\u200b\\");
|
=> message.Content.StartsWith(@"\\") || message.Content.StartsWith("\\\u200b\\");
|
||||||
|
|
||||||
|
public static bool IsDisableAutoproxy(Message message)
|
||||||
|
=> message.Content.StartsWith(@"\\\") || message.Content.StartsWith("\\\u200b\\\u200b\\");
|
||||||
|
|
||||||
private async Task HandleProxyExecutedActions(MessageContext ctx, AutoproxySettings autoproxySettings,
|
private async Task HandleProxyExecutedActions(MessageContext ctx, AutoproxySettings autoproxySettings,
|
||||||
Message triggerMessage, Message proxyMessage, ProxyMatch match,
|
Message triggerMessage, Message proxyMessage, ProxyMatch match,
|
||||||
bool deletePrevious = true)
|
bool deletePrevious = true)
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue