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

@ -130,6 +130,13 @@ public class Config
"disabled"
));
items.Add(new(
"Name Format",
"Format string used to display a member's name https://pluralkit.me/guide/#setting-a-custom-name-format",
ctx.Config.NameFormat,
ProxyMember.DefaultFormat
));
await ctx.Paginate<PaginatedConfigItem>(
items.ToAsyncEnumerable(),
items.Count,
@ -558,6 +565,19 @@ public class Config
await ctx.Reply($"Logging a switch every time a proxy tag is used is now {EnabledDisabled(newVal)}.");
}
public async Task NameFormat(Context ctx)
{
if (!ctx.HasNext())
{
await ctx.Reply($"Member names are currently formatted as `{ctx.Config.NameFormat ?? ProxyMember.DefaultFormat}`");
return;
}
var formatString = ctx.RemainderOrNull();
await ctx.Repository.UpdateSystemConfig(ctx.System.Id, new() { NameFormat = formatString });
await ctx.Reply($"Member names are now formatted as `{formatString}`");
}
public Task LimitUpdate(Context ctx)
{
throw new PKError("You cannot update your own member or group limits. If you need a limit update, please join the " +