mirror of
https://github.com/PluralKit/PluralKit.git
synced 2026-02-04 13:06:50 +00:00
feat: throw user-readable error for editing a message to be empty
This commit is contained in:
parent
2b5fab9689
commit
b602b4a85c
1 changed files with 7 additions and 1 deletions
|
|
@ -204,7 +204,7 @@ public class ProxiedMessage
|
|||
}
|
||||
|
||||
// Append or prepend the new content to the original message content if needed.
|
||||
// If no flag is supplied, the new contents will completly overwrite the old contents
|
||||
// If no flag is supplied, the new contents will completely overwrite the old contents
|
||||
// If both flags are specified. the message will be prepended AND appended
|
||||
if (append && prepend)
|
||||
newContent = $"{newContent}{mutateSpace}{originalContent}{mutateSpace}{newContent}";
|
||||
|
|
@ -216,6 +216,12 @@ public class ProxiedMessage
|
|||
if (newContent.Length > 2000)
|
||||
throw new PKError("PluralKit cannot proxy messages over 2000 characters in length.");
|
||||
|
||||
// We count as an empty message even if there's an embed because the only embeds pk proxies are reply embeds and those aren't message content
|
||||
if (newContent.Trim().Length == 0 && (originalMsg.Attachments.Length == 0 || clearAttachments))
|
||||
{
|
||||
throw new PKError("This action would result in an empty message. If you wish to delete the message, react to it with \u274C.");
|
||||
}
|
||||
|
||||
try
|
||||
{
|
||||
var editedMsg =
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue