fix: incorrect pk;config private <target> command parsing

This commit is contained in:
spiral 2021-12-07 01:58:05 -05:00
parent ad6addc2fd
commit cb1d4c98c7
No known key found for this signature in database
GPG Key ID: A6059F0CA0E1BD31
2 changed files with 4 additions and 15 deletions

View File

@ -476,16 +476,9 @@ public partial class CommandTree
return ctx.Execute<Config>(null, m => m.SystemTimezone(ctx));
if (ctx.Match("ping"))
return ctx.Execute<Config>(null, m => m.SystemPing(ctx));
if (ctx.Match("private"))
{
if (ctx.Match("member"))
return ctx.Execute<Config>(null, m => m.MemberDefaultPrivacy(ctx));
if (ctx.Match("group"))
return ctx.Execute<Config>(null, m => m.GroupDefaultPrivacy(ctx));
}
if (ctx.Match("mp"))
if (ctx.MatchMultiple(new[] { "private" }, new[] { "member" }) || ctx.Match("mp"))
return ctx.Execute<Config>(null, m => m.MemberDefaultPrivacy(ctx));
if (ctx.Match("gp"))
if (ctx.MatchMultiple(new[] { "private" }, new[] { "group" }) || ctx.Match("gp"))
return ctx.Execute<Config>(null, m => m.GroupDefaultPrivacy(ctx));
if (ctx.MatchMultiple(new[] { "show" }, new[] { "private" }) || ctx.Match("sp"))
return ctx.Execute<Config>(null, m => m.ShowPrivateInfo(ctx));

View File

@ -320,10 +320,10 @@ public class Config
});
}
// todo: this command parsing is really messy
public async Task MemberDefaultPrivacy(Context ctx)
{
ctx.CheckSystem();
if (!ctx.HasNext())
{
if (ctx.Config.MemberDefaultPrivate) { await ctx.Reply("Newly created members will currently have their privacy settings set to private. To change this, type `pk;config private member off`"); }
@ -348,8 +348,6 @@ public class Config
public async Task GroupDefaultPrivacy(Context ctx)
{
ctx.CheckSystem();
if (!ctx.HasNext())
{
if (ctx.Config.GroupDefaultPrivate) { await ctx.Reply("Newly created groups will currently have their privacy settings set to private. To change this, type `pk;config private group off`"); }
@ -374,8 +372,6 @@ public class Config
public async Task ShowPrivateInfo(Context ctx)
{
ctx.CheckSystem();
if (!ctx.HasNext())
{
if (ctx.Config.ShowPrivateInfo) await ctx.Reply("Private information is currently **shown** when looking up your own info. Use the `-public` flag to hide it.");