- byte[] groupId = Util.decodeGroupId(ns.getString("group"));
- signal.sendGroupMessage(messageText, attachments, groupId);
- } else {
- signal.sendMessage(messageText, attachments, ns.<String>getList("recipient"));
+ byte[] groupId;
+ try {
+ groupId = Util.decodeGroupId(ns.getString("group"));
+ } catch (GroupIdFormatException e) {
+ handleGroupIdFormatException(e);
+ return 1;
+ }
+
+ long timestamp = signal.sendGroupMessage(messageText, attachments, groupId);
+ System.out.println(timestamp);
+ return 0;