From e3fa0f3b325d4ef3a7539f4386f247c75a4eefd5 Mon Sep 17 00:00:00 2001 From: spiral Date: Sun, 26 Sep 2021 17:30:30 -0400 Subject: [PATCH] fix(MatchRaw commands): don't skip matching flags when setting new value --- PluralKit.Bot/Commands/Groups.cs | 4 ++-- PluralKit.Bot/Commands/MemberEdit.cs | 8 ++++---- PluralKit.Bot/Commands/SystemEdit.cs | 6 +++--- 3 files changed, 9 insertions(+), 9 deletions(-) diff --git a/PluralKit.Bot/Commands/Groups.cs b/PluralKit.Bot/Commands/Groups.cs index bdf5b0fc..7c35dd6f 100644 --- a/PluralKit.Bot/Commands/Groups.cs +++ b/PluralKit.Bot/Commands/Groups.cs @@ -145,7 +145,7 @@ namespace PluralKit.Bot } else { - var newDisplayName = ctx.RemainderOrNull(); + var newDisplayName = ctx.RemainderOrNull(skipFlags: false).NormalizeLineEndSpacing(); var patch = new GroupPatch { DisplayName = Partial.Present(newDisplayName) }; await _db.Execute(conn => _repo.UpdateGroup(conn, target.Id, patch)); @@ -195,7 +195,7 @@ namespace PluralKit.Bot } else { - var description = ctx.RemainderOrNull().NormalizeLineEndSpacing(); + var description = ctx.RemainderOrNull(skipFlags: false).NormalizeLineEndSpacing(); if (description.IsLongerThan(Limits.MaxDescriptionLength)) throw Errors.StringTooLongError("Description", description.Length, Limits.MaxDescriptionLength); diff --git a/PluralKit.Bot/Commands/MemberEdit.cs b/PluralKit.Bot/Commands/MemberEdit.cs index edbd54f8..4d3f9941 100644 --- a/PluralKit.Bot/Commands/MemberEdit.cs +++ b/PluralKit.Bot/Commands/MemberEdit.cs @@ -99,7 +99,7 @@ namespace PluralKit.Bot } else { - var description = ctx.RemainderOrNull().NormalizeLineEndSpacing(); + var description = ctx.RemainderOrNull(skipFlags: false).NormalizeLineEndSpacing(); if (description.IsLongerThan(Limits.MaxDescriptionLength)) throw Errors.StringTooLongError("Description", description.Length, Limits.MaxDescriptionLength); @@ -147,7 +147,7 @@ namespace PluralKit.Bot } else { - var pronouns = ctx.RemainderOrNull().NormalizeLineEndSpacing(); + var pronouns = ctx.RemainderOrNull(skipFlags: false).NormalizeLineEndSpacing(); if (pronouns.IsLongerThan(Limits.MaxPronounsLength)) throw Errors.StringTooLongError("Pronouns", pronouns.Length, Limits.MaxPronounsLength); @@ -385,7 +385,7 @@ namespace PluralKit.Bot } else { - var newDisplayName = ctx.RemainderOrNull(); + var newDisplayName = ctx.RemainderOrNull(skipFlags: false).NormalizeLineEndSpacing(); var patch = new MemberPatch { DisplayName = Partial.Present(newDisplayName) }; await _db.Execute(conn => _repo.UpdateMember(conn, target.Id, patch)); @@ -437,7 +437,7 @@ namespace PluralKit.Bot } else { - var newServerName = ctx.RemainderOrNull(); + var newServerName = ctx.RemainderOrNull(skipFlags: false).NormalizeLineEndSpacing(); var patch = new MemberGuildPatch { DisplayName = newServerName }; await _db.Execute(conn => _repo.UpsertMemberGuild(conn, target.Id, ctx.Guild.Id, patch)); diff --git a/PluralKit.Bot/Commands/SystemEdit.cs b/PluralKit.Bot/Commands/SystemEdit.cs index 31d1f0a2..0dc684ae 100644 --- a/PluralKit.Bot/Commands/SystemEdit.cs +++ b/PluralKit.Bot/Commands/SystemEdit.cs @@ -59,7 +59,7 @@ namespace PluralKit.Bot } else { - var newSystemName = ctx.RemainderOrNull(); + var newSystemName = ctx.RemainderOrNull(skipFlags: false).NormalizeLineEndSpacing(); if (newSystemName.Length > Limits.MaxSystemNameLength) throw Errors.StringTooLongError("System name", newSystemName.Length, Limits.MaxSystemNameLength); @@ -108,7 +108,7 @@ namespace PluralKit.Bot } else { - var newDescription = ctx.RemainderOrNull()?.NormalizeLineEndSpacing(); + var newDescription = ctx.RemainderOrNull(skipFlags: false).NormalizeLineEndSpacing(); if (newDescription.Length > Limits.MaxDescriptionLength) throw Errors.StringTooLongError("Description", newDescription.Length, Limits.MaxDescriptionLength); @@ -193,7 +193,7 @@ namespace PluralKit.Bot } else { - var newTag = ctx.RemainderOrNull(skipFlags: false); + var newTag = ctx.RemainderOrNull(skipFlags: false).NormalizeLineEndSpacing(); if (newTag != null) if (newTag.Length > Limits.MaxSystemTagLength) throw Errors.StringTooLongError("System tag", newTag.Length, Limits.MaxSystemTagLength);