import org.asamk.signal.commands.exceptions.UnexpectedErrorException;
import org.asamk.signal.commands.exceptions.UserErrorException;
import org.asamk.signal.manager.Manager;
import org.asamk.signal.commands.exceptions.UnexpectedErrorException;
import org.asamk.signal.commands.exceptions.UserErrorException;
import org.asamk.signal.manager.Manager;
) throws CommandException {
final var contacts = ns.<String>getList("recipient");
final var recipients = CommandUtil.getSingleRecipientIdentifiers(contacts, m.getSelfNumber());
try {
m.setContactsBlocked(recipients, true);
) throws CommandException {
final var contacts = ns.<String>getList("recipient");
final var recipients = CommandUtil.getSingleRecipientIdentifiers(contacts, m.getSelfNumber());
try {
m.setContactsBlocked(recipients, true);
throw new UserErrorException("This command doesn't work on linked devices.");
} catch (IOException e) {
throw new UnexpectedErrorException("Failed to sync block to linked devices: " + e.getMessage(), e);
throw new UserErrorException("This command doesn't work on linked devices.");
} catch (IOException e) {
throw new UnexpectedErrorException("Failed to sync block to linked devices: " + e.getMessage(), e);
final var groupIds = CommandUtil.getGroupIds(groupIdStrings);
try {
m.setGroupsBlocked(groupIds, true);
final var groupIds = CommandUtil.getGroupIds(groupIdStrings);
try {
m.setGroupsBlocked(groupIds, true);
throw new UserErrorException("This command doesn't work on linked devices.");
} catch (GroupNotFoundException e) {
logger.warn("Unknown group id: {}", e.getMessage());
throw new UserErrorException("This command doesn't work on linked devices.");
} catch (GroupNotFoundException e) {
logger.warn("Unknown group id: {}", e.getMessage());