From 2c586266ffe37c139b80197c2c7baaa8daea3e92 Mon Sep 17 00:00:00 2001 From: AsamK Date: Tue, 21 Jun 2022 13:55:34 +0200 Subject: [PATCH] Disallow sending an empty message It would be ignored by the offical apps anyway --- src/main/java/org/asamk/signal/commands/SendCommand.java | 5 +++++ 1 file changed, 5 insertions(+) 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,