fix: throw error when pk;edit message is too long

This commit is contained in:
spiral 2021-12-07 02:02:22 -05:00
parent cb1d4c98c7
commit 91256368f5
No known key found for this signature in database
GPG Key ID: A6059F0CA0E1BD31

View File

@ -55,6 +55,9 @@ public class ProxiedMessage
var newContent = ctx.RemainderOrNull().NormalizeLineEndSpacing(); var newContent = ctx.RemainderOrNull().NormalizeLineEndSpacing();
if (newContent.Length > 2000)
throw new PKError("PluralKit cannot proxy messages over 2000 characters in length.");
var originalMsg = await _rest.GetMessageOrNull(msg.Message.Channel, msg.Message.Mid); var originalMsg = await _rest.GetMessageOrNull(msg.Message.Channel, msg.Message.Mid);
if (originalMsg == null) if (originalMsg == null)
throw new PKError("Could not edit message."); throw new PKError("Could not edit message.");