- m.deleteRecipient(getSingleRecipientIdentifier(recipient, m.getSelfNumber()));
- } catch (IOException e) {
- throw new Error.Failure("Recipient not found");
+ var results = m.sendMessage(new Message(message,
+ attachments,
+ List.of(),
+ Optional.empty(),
+ Optional.empty()), Set.of(getGroupRecipientIdentifier(groupId)));
+ checkSendMessageResults(results);
+ return results.timestamp();
+ } catch (IOException | InvalidStickerException e) {
+ throw new Error.Failure(e.getMessage());
+ } catch (GroupNotFoundException | NotAGroupMemberException | GroupSendingNotAllowedException e) {
+ throw new Error.GroupNotFound(e.getMessage());
+ } catch (AttachmentInvalidException e) {
+ throw new Error.AttachmentInvalid(e.getMessage());
+ } catch (UnregisteredRecipientException e) {
+ throw new Error.UntrustedIdentity(e.getSender().getIdentifier() + " is not registered.");