From: AsamK Date: Tue, 21 Jun 2022 11:55:34 +0000 (+0200) Subject: Disallow sending an empty message X-Git-Tag: v0.11.0~15 X-Git-Url: https://git.nmode.ca/signal-cli/commitdiff_plain/2c586266ffe37c139b80197c2c7baaa8daea3e92 Disallow sending an empty message It would be ignored by the offical apps anyway --- diff --git a/src/main/java/org/asamk/signal/commands/SendCommand.java b/src/main/java/org/asamk/signal/commands/SendCommand.java index 57c0c5e9..3fd00eaf 100644 --- a/src/main/java/org/asamk/signal/commands/SendCommand.java +++ b/src/main/java/org/asamk/signal/commands/SendCommand.java @@ -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,