mirror of
https://github.com/AsamK/signal-cli
synced 2025-08-29 02:20:39 +00:00
Add simplification for single recipient reactions
This commit is contained in:
parent
26b5a4c582
commit
fe752e0c79
1 changed files with 10 additions and 1 deletions
|
@ -11,6 +11,7 @@ import org.asamk.signal.manager.Manager;
|
|||
import org.asamk.signal.manager.api.GroupNotFoundException;
|
||||
import org.asamk.signal.manager.api.GroupSendingNotAllowedException;
|
||||
import org.asamk.signal.manager.api.NotAGroupMemberException;
|
||||
import org.asamk.signal.manager.api.RecipientIdentifier;
|
||||
import org.asamk.signal.manager.api.UnregisteredRecipientException;
|
||||
import org.asamk.signal.output.OutputWriter;
|
||||
import org.asamk.signal.util.CommandUtil;
|
||||
|
@ -74,10 +75,18 @@ public class SendReactionCommand implements JsonRpcLocalCommand {
|
|||
final var targetTimestamp = ns.getLong("target-timestamp");
|
||||
final var isStory = Boolean.TRUE.equals(ns.getBoolean("story"));
|
||||
|
||||
final RecipientIdentifier.Single targetAuthorIdentifier;
|
||||
if (targetAuthor == null && recipientIdentifiers.size() == 1 && recipientIdentifiers.stream()
|
||||
.findFirst()
|
||||
.get() instanceof RecipientIdentifier.Single single) {
|
||||
targetAuthorIdentifier = single;
|
||||
} else {
|
||||
targetAuthorIdentifier = CommandUtil.getSingleRecipientIdentifier(targetAuthor, m.getSelfNumber());
|
||||
}
|
||||
try {
|
||||
final var results = m.sendMessageReaction(emoji,
|
||||
isRemove,
|
||||
CommandUtil.getSingleRecipientIdentifier(targetAuthor, m.getSelfNumber()),
|
||||
targetAuthorIdentifier,
|
||||
targetTimestamp,
|
||||
recipientIdentifiers,
|
||||
isStory);
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue