fix(MatchRaw commands): don't skip matching flags when setting new value

This commit is contained in:
spiral 2021-09-26 17:30:30 -04:00
parent 65b4f0e370
commit e3fa0f3b32
No known key found for this signature in database
GPG Key ID: A6059F0CA0E1BD31
3 changed files with 9 additions and 9 deletions

View File

@ -145,7 +145,7 @@ namespace PluralKit.Bot
} }
else else
{ {
var newDisplayName = ctx.RemainderOrNull(); var newDisplayName = ctx.RemainderOrNull(skipFlags: false).NormalizeLineEndSpacing();
var patch = new GroupPatch { DisplayName = Partial<string>.Present(newDisplayName) }; var patch = new GroupPatch { DisplayName = Partial<string>.Present(newDisplayName) };
await _db.Execute(conn => _repo.UpdateGroup(conn, target.Id, patch)); await _db.Execute(conn => _repo.UpdateGroup(conn, target.Id, patch));
@ -195,7 +195,7 @@ namespace PluralKit.Bot
} }
else else
{ {
var description = ctx.RemainderOrNull().NormalizeLineEndSpacing(); var description = ctx.RemainderOrNull(skipFlags: false).NormalizeLineEndSpacing();
if (description.IsLongerThan(Limits.MaxDescriptionLength)) if (description.IsLongerThan(Limits.MaxDescriptionLength))
throw Errors.StringTooLongError("Description", description.Length, Limits.MaxDescriptionLength); throw Errors.StringTooLongError("Description", description.Length, Limits.MaxDescriptionLength);

View File

@ -99,7 +99,7 @@ namespace PluralKit.Bot
} }
else else
{ {
var description = ctx.RemainderOrNull().NormalizeLineEndSpacing(); var description = ctx.RemainderOrNull(skipFlags: false).NormalizeLineEndSpacing();
if (description.IsLongerThan(Limits.MaxDescriptionLength)) if (description.IsLongerThan(Limits.MaxDescriptionLength))
throw Errors.StringTooLongError("Description", description.Length, Limits.MaxDescriptionLength); throw Errors.StringTooLongError("Description", description.Length, Limits.MaxDescriptionLength);
@ -147,7 +147,7 @@ namespace PluralKit.Bot
} }
else else
{ {
var pronouns = ctx.RemainderOrNull().NormalizeLineEndSpacing(); var pronouns = ctx.RemainderOrNull(skipFlags: false).NormalizeLineEndSpacing();
if (pronouns.IsLongerThan(Limits.MaxPronounsLength)) if (pronouns.IsLongerThan(Limits.MaxPronounsLength))
throw Errors.StringTooLongError("Pronouns", pronouns.Length, Limits.MaxPronounsLength); throw Errors.StringTooLongError("Pronouns", pronouns.Length, Limits.MaxPronounsLength);
@ -385,7 +385,7 @@ namespace PluralKit.Bot
} }
else else
{ {
var newDisplayName = ctx.RemainderOrNull(); var newDisplayName = ctx.RemainderOrNull(skipFlags: false).NormalizeLineEndSpacing();
var patch = new MemberPatch { DisplayName = Partial<string>.Present(newDisplayName) }; var patch = new MemberPatch { DisplayName = Partial<string>.Present(newDisplayName) };
await _db.Execute(conn => _repo.UpdateMember(conn, target.Id, patch)); await _db.Execute(conn => _repo.UpdateMember(conn, target.Id, patch));
@ -437,7 +437,7 @@ namespace PluralKit.Bot
} }
else else
{ {
var newServerName = ctx.RemainderOrNull(); var newServerName = ctx.RemainderOrNull(skipFlags: false).NormalizeLineEndSpacing();
var patch = new MemberGuildPatch { DisplayName = newServerName }; var patch = new MemberGuildPatch { DisplayName = newServerName };
await _db.Execute(conn => _repo.UpsertMemberGuild(conn, target.Id, ctx.Guild.Id, patch)); await _db.Execute(conn => _repo.UpsertMemberGuild(conn, target.Id, ctx.Guild.Id, patch));

View File

@ -59,7 +59,7 @@ namespace PluralKit.Bot
} }
else else
{ {
var newSystemName = ctx.RemainderOrNull(); var newSystemName = ctx.RemainderOrNull(skipFlags: false).NormalizeLineEndSpacing();
if (newSystemName.Length > Limits.MaxSystemNameLength) if (newSystemName.Length > Limits.MaxSystemNameLength)
throw Errors.StringTooLongError("System name", newSystemName.Length, Limits.MaxSystemNameLength); throw Errors.StringTooLongError("System name", newSystemName.Length, Limits.MaxSystemNameLength);
@ -108,7 +108,7 @@ namespace PluralKit.Bot
} }
else else
{ {
var newDescription = ctx.RemainderOrNull()?.NormalizeLineEndSpacing(); var newDescription = ctx.RemainderOrNull(skipFlags: false).NormalizeLineEndSpacing();
if (newDescription.Length > Limits.MaxDescriptionLength) if (newDescription.Length > Limits.MaxDescriptionLength)
throw Errors.StringTooLongError("Description", newDescription.Length, Limits.MaxDescriptionLength); throw Errors.StringTooLongError("Description", newDescription.Length, Limits.MaxDescriptionLength);
@ -193,7 +193,7 @@ namespace PluralKit.Bot
} }
else else
{ {
var newTag = ctx.RemainderOrNull(skipFlags: false); var newTag = ctx.RemainderOrNull(skipFlags: false).NormalizeLineEndSpacing();
if (newTag != null) if (newTag != null)
if (newTag.Length > Limits.MaxSystemTagLength) if (newTag.Length > Limits.MaxSystemTagLength)
throw Errors.StringTooLongError("System tag", newTag.Length, Limits.MaxSystemTagLength); throw Errors.StringTooLongError("System tag", newTag.Length, Limits.MaxSystemTagLength);