mirror of
https://github.com/PluralKit/PluralKit.git
synced 2026-02-04 04:56:49 +00:00
fix(bot): reinstate alias + add clear flag to nameformat config option
This commit is contained in:
parent
cadd563abd
commit
a8c90cea8e
2 changed files with 9 additions and 3 deletions
|
|
@ -590,7 +590,7 @@ public partial class CommandTree
|
|||
return ctx.Execute<Config>(null, m => m.HidDisplayCaps(ctx));
|
||||
if (ctx.MatchMultiple(new[] { "pad" }, new[] { "id", "ids" }) || ctx.MatchMultiple(new[] { "id" }, new[] { "pad", "padding" }) || ctx.Match("idpad", "padid", "padids"))
|
||||
return ctx.Execute<Config>(null, m => m.HidListPadding(ctx));
|
||||
if (ctx.MatchMultiple(new[] { "name" }, new[] { "format" }) || ctx.Match("nf"))
|
||||
if (ctx.MatchMultiple(new[] { "name" }, new[] { "format" }) || ctx.Match("nameformat", "nf"))
|
||||
return ctx.Execute<Config>(null, m => m.NameFormat(ctx));
|
||||
if (ctx.MatchMultiple(new[] { "member", "group" }, new[] { "limit" }) || ctx.Match("limit"))
|
||||
return ctx.Execute<Config>(null, m => m.LimitUpdate(ctx));
|
||||
|
|
|
|||
|
|
@ -567,13 +567,19 @@ public class Config
|
|||
|
||||
public async Task NameFormat(Context ctx)
|
||||
{
|
||||
if (!ctx.HasNext())
|
||||
var clearFlag = ctx.MatchClear();
|
||||
if (!ctx.HasNext() && !clearFlag)
|
||||
{
|
||||
await ctx.Reply($"Member names are currently formatted as `{ctx.Config.NameFormat ?? ProxyMember.DefaultFormat}`");
|
||||
return;
|
||||
}
|
||||
|
||||
var formatString = ctx.RemainderOrNull();
|
||||
string formatString;
|
||||
if (clearFlag)
|
||||
formatString = ProxyMember.DefaultFormat;
|
||||
else
|
||||
formatString = ctx.RemainderOrNull();
|
||||
|
||||
await ctx.Repository.UpdateSystemConfig(ctx.System.Id, new() { NameFormat = formatString });
|
||||
await ctx.Reply($"Member names are now formatted as `{formatString}`");
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue