mirror of
https://github.com/PluralKit/PluralKit.git
synced 2026-02-12 00:30:11 +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));
|
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"))
|
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));
|
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));
|
return ctx.Execute<Config>(null, m => m.NameFormat(ctx));
|
||||||
if (ctx.MatchMultiple(new[] { "member", "group" }, new[] { "limit" }) || ctx.Match("limit"))
|
if (ctx.MatchMultiple(new[] { "member", "group" }, new[] { "limit" }) || ctx.Match("limit"))
|
||||||
return ctx.Execute<Config>(null, m => m.LimitUpdate(ctx));
|
return ctx.Execute<Config>(null, m => m.LimitUpdate(ctx));
|
||||||
|
|
|
||||||
|
|
@ -567,13 +567,19 @@ public class Config
|
||||||
|
|
||||||
public async Task NameFormat(Context ctx)
|
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}`");
|
await ctx.Reply($"Member names are currently formatted as `{ctx.Config.NameFormat ?? ProxyMember.DefaultFormat}`");
|
||||||
return;
|
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.Repository.UpdateSystemConfig(ctx.System.Id, new() { NameFormat = formatString });
|
||||||
await ctx.Reply($"Member names are now formatted as `{formatString}`");
|
await ctx.Reply($"Member names are now formatted as `{formatString}`");
|
||||||
}
|
}
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue