- try {
- List<String> attachments = ns.getList("attachment");
- if (attachments == null) {
- attachments = new ArrayList<>();
+ List<String> attachments = ns.getList("attachment");
+ if (attachments == null) {
+ attachments = List.of();
+ }
+
+ if (groupIdString != null) {
+ try {
+ byte[] groupId;
+ try {
+ groupId = Util.decodeGroupId(groupIdString).serialize();
+ } catch (GroupIdFormatException e) {
+ handleGroupIdFormatException(e);
+ return 1;
+ }
+
+ long timestamp = signal.sendGroupMessage(messageText, attachments, groupId);
+ System.out.println(timestamp);
+ return 0;
+ } catch (AssertionError e) {
+ handleAssertionError(e);
+ return 1;
+ } catch (DBusExecutionException e) {
+ System.err.println("Failed to send group message: " + e.getMessage());
+ return 2;