Disallow sending an empty message

It would be ignored by the offical apps anyway
This commit is contained in:
AsamK 2022-06-21 13:55:34 +02:00
parent 4120630309
commit 2c586266ff

View file

@ -170,6 +170,11 @@ public class SendCommand implements JsonRpcLocalCommand {
previews = List.of();
}
if (messageText.isEmpty() && attachments.isEmpty() && sticker == null && quote == null) {
throw new UserErrorException(
"Sending empty message is not allowed, either a message, attachment or sticker must be given.");
}
try {
var results = m.sendMessage(new Message(messageText,
attachments,