mirror of
https://github.com/PluralKit/PluralKit.git
synced 2026-02-12 16:50:10 +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.
|
// 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 both flags are specified. the message will be prepended AND appended
|
||||||
if (append && prepend)
|
if (append && prepend)
|
||||||
newContent = $"{newContent}{mutateSpace}{originalContent}{mutateSpace}{newContent}";
|
newContent = $"{newContent}{mutateSpace}{originalContent}{mutateSpace}{newContent}";
|
||||||
|
|
@ -216,6 +216,12 @@ public class ProxiedMessage
|
||||||
if (newContent.Length > 2000)
|
if (newContent.Length > 2000)
|
||||||
throw new PKError("PluralKit cannot proxy messages over 2000 characters in length.");
|
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
|
try
|
||||||
{
|
{
|
||||||
var editedMsg =
|
var editedMsg =
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue