feat(bot): basic webhook username templating

This commit is contained in:
libglfw 2024-10-22 03:05:32 -04:00 committed by Iris System
parent 87196e3297
commit 614131265b
16 changed files with 78 additions and 14 deletions

View file

@ -21,6 +21,7 @@ public class SystemConfigPatch: PatchObject
public Partial<bool> ProxyErrorMessageEnabled { get; set; }
public Partial<bool> HidDisplaySplit { get; set; }
public Partial<bool> HidDisplayCaps { get; set; }
public Partial<string?> NameFormat { get; set; }
public Partial<SystemConfig.HidPadFormat> HidListPadding { get; set; }
public Partial<bool> ProxySwitch { get; set; }
@ -40,6 +41,7 @@ public class SystemConfigPatch: PatchObject
.With("hid_display_caps", HidDisplayCaps)
.With("hid_list_padding", HidListPadding)
.With("proxy_switch", ProxySwitch)
.With("name_format", NameFormat)
);
public new void AssertIsValid()
@ -107,6 +109,9 @@ public class SystemConfigPatch: PatchObject
if (ProxySwitch.IsPresent)
o.Add("proxy_switch", ProxySwitch.Value);
if (NameFormat.IsPresent)
o.Add("name_format", NameFormat.Value);
return o;
}
@ -147,6 +152,9 @@ public class SystemConfigPatch: PatchObject
if (o.ContainsKey("proxy_switch"))
patch.ProxySwitch = o.Value<bool>("proxy_switch");
if (o.ContainsKey("name_format"))
patch.NameFormat = o.Value<string>("name_format");
return patch;
}
}

View file

@ -25,6 +25,7 @@ public class SystemConfig
public bool HidDisplayCaps { get; }
public HidPadFormat HidListPadding { get; }
public bool ProxySwitch { get; }
public string NameFormat { get; }
public enum HidPadFormat
{
@ -54,6 +55,7 @@ public static class SystemConfigExt
o.Add("hid_display_caps", cfg.HidDisplayCaps);
o.Add("hid_list_padding", cfg.HidListPadding.ToUserString());
o.Add("proxy_switch", cfg.ProxySwitch);
o.Add("name_format", cfg.NameFormat);
o.Add("description_templates", JArray.FromObject(cfg.DescriptionTemplates));