mirror of
https://github.com/PluralKit/PluralKit.git
synced 2026-02-04 13:06:50 +00:00
feat(bot): add option to log a switch when proxying
This commit is contained in:
parent
a0f6ed6f89
commit
e1c2e6b6d6
10 changed files with 50 additions and 3 deletions
|
|
@ -31,5 +31,6 @@ public class MessageContext
|
|||
public int? LatchTimeout { get; }
|
||||
public bool CaseSensitiveProxyTags { get; }
|
||||
public bool ProxyErrorMessageEnabled { get; }
|
||||
public bool ProxySwitch { get; }
|
||||
public bool DenyBotUsage { get; }
|
||||
}
|
||||
|
|
@ -9,6 +9,7 @@
|
|||
latch_timeout integer,
|
||||
case_sensitive_proxy_tags bool,
|
||||
proxy_error_message_enabled bool,
|
||||
proxy_switch bool,
|
||||
|
||||
tag_enabled bool,
|
||||
proxy_enabled bool,
|
||||
|
|
@ -40,6 +41,7 @@ as $$
|
|||
system_config.latch_timeout as latch_timeout,
|
||||
system_config.case_sensitive_proxy_tags as case_sensitive_proxy_tags,
|
||||
system_config.proxy_error_message_enabled as proxy_error_message_enabled,
|
||||
system_config.proxy_switch as proxy_switch,
|
||||
|
||||
-- system_guild table
|
||||
coalesce(system_guild.tag_enabled, true) as tag_enabled,
|
||||
|
|
|
|||
6
PluralKit.Core/Database/Migrations/45.sql
Normal file
6
PluralKit.Core/Database/Migrations/45.sql
Normal file
|
|
@ -0,0 +1,6 @@
|
|||
-- database version 45
|
||||
-- add new config setting "proxy_switch"
|
||||
|
||||
alter table system_config add column proxy_switch bool default false;
|
||||
|
||||
update info set schema_version = 45;
|
||||
|
|
@ -9,7 +9,7 @@ namespace PluralKit.Core;
|
|||
internal class DatabaseMigrator
|
||||
{
|
||||
private const string RootPath = "PluralKit.Core.Database"; // "resource path" root for SQL files
|
||||
private const int TargetSchemaVersion = 44;
|
||||
private const int TargetSchemaVersion = 45;
|
||||
private readonly ILogger _logger;
|
||||
|
||||
public DatabaseMigrator(ILogger logger)
|
||||
|
|
|
|||
|
|
@ -22,7 +22,7 @@ public class SystemConfigPatch: PatchObject
|
|||
public Partial<bool> HidDisplaySplit { get; set; }
|
||||
public Partial<bool> HidDisplayCaps { get; set; }
|
||||
public Partial<SystemConfig.HidPadFormat> HidListPadding { get; set; }
|
||||
|
||||
public Partial<bool> ProxySwitch { get; set; }
|
||||
|
||||
public override Query Apply(Query q) => q.ApplyPatch(wrapper => wrapper
|
||||
.With("ui_tz", UiTz)
|
||||
|
|
@ -39,6 +39,7 @@ public class SystemConfigPatch: PatchObject
|
|||
.With("hid_display_split", HidDisplaySplit)
|
||||
.With("hid_display_caps", HidDisplayCaps)
|
||||
.With("hid_list_padding", HidListPadding)
|
||||
.With("proxy_switch", ProxySwitch)
|
||||
);
|
||||
|
||||
public new void AssertIsValid()
|
||||
|
|
@ -103,6 +104,9 @@ public class SystemConfigPatch: PatchObject
|
|||
if (HidListPadding.IsPresent)
|
||||
o.Add("hid_list_padding", HidListPadding.Value.ToUserString());
|
||||
|
||||
if (ProxySwitch.IsPresent)
|
||||
o.Add("proxy_switch", ProxySwitch.Value);
|
||||
|
||||
return o;
|
||||
}
|
||||
|
||||
|
|
@ -140,6 +144,9 @@ public class SystemConfigPatch: PatchObject
|
|||
if (o.ContainsKey("hid_display_caps"))
|
||||
patch.HidDisplayCaps = o.Value<bool>("hid_display_caps");
|
||||
|
||||
if (o.ContainsKey("proxy_switch"))
|
||||
patch.ProxySwitch = o.Value<bool>("proxy_switch");
|
||||
|
||||
return patch;
|
||||
}
|
||||
}
|
||||
|
|
@ -24,6 +24,7 @@ public class SystemConfig
|
|||
public bool HidDisplaySplit { get; }
|
||||
public bool HidDisplayCaps { get; }
|
||||
public HidPadFormat HidListPadding { get; }
|
||||
public bool ProxySwitch { get; }
|
||||
|
||||
public enum HidPadFormat
|
||||
{
|
||||
|
|
@ -52,6 +53,7 @@ public static class SystemConfigExt
|
|||
o.Add("hid_display_split", cfg.HidDisplaySplit);
|
||||
o.Add("hid_display_caps", cfg.HidDisplayCaps);
|
||||
o.Add("hid_list_padding", cfg.HidListPadding.ToUserString());
|
||||
o.Add("proxy_switch", cfg.ProxySwitch);
|
||||
|
||||
o.Add("description_templates", JArray.FromObject(cfg.DescriptionTemplates));
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue