+ public void handleCommand(
+ final Namespace ns, final Manager m, final OutputWriter outputWriter
+ ) throws CommandException {
+ final var isNoteToSelf = ns.getBoolean("note-to-self");
+ final var recipientStrings = ns.<String>getList("recipient");
+ final var groupIdStrings = ns.<String>getList("group-id");
+
+ final var recipientIdentifiers = CommandUtil.getRecipientIdentifiers(m,
+ isNoteToSelf,
+ recipientStrings,
+ groupIdStrings);
+
+ final var emoji = ns.getString("emoji");
+ final var isRemove = ns.getBoolean("remove");
+ final var targetAuthor = ns.getString("target-author");
+ final var targetTimestamp = ns.getLong("target-timestamp");
+
+ try {
+ final var results = m.sendMessageReaction(emoji,
+ isRemove,
+ CommandUtil.getSingleRecipientIdentifier(targetAuthor, m.getUsername()),
+ targetTimestamp,
+ recipientIdentifiers);
+ outputResult(outputWriter, results.getTimestamp());
+ ErrorUtils.handleSendMessageResults(results.getResults());
+ } catch (GroupNotFoundException | NotAGroupMemberException | GroupSendingNotAllowedException e) {
+ throw new UserErrorException(e.getMessage());
+ } catch (IOException e) {
+ throw new UnexpectedErrorException("Failed to send message: " + e.getMessage() + " (" + e.getClass()
+ .getSimpleName() + ")");
+ }
+ }
+
+ @Override
+ public void handleCommand(
+ final Namespace ns, final Signal signal, final OutputWriter outputWriter
+ ) throws CommandException {
+ final var recipients = ns.<String>getList("recipient");
+ final var groupIdStrings = ns.<String>getList("group-id");