accountService = $accountService; $this->cacheActorService = $cacheActorService; $this->followService = $followService; $this->configService = $configService; $this->miscService = $miscService; } protected function configure() { parent::configure(); $this->setName('social:account:following') ->addArgument('userId', InputArgument::REQUIRED, 'Nextcloud userid') ->addArgument('account', InputArgument::REQUIRED, 'Account to follow') ->addOption('local', '', InputOption::VALUE_NONE, 'account is local') ->addOption('unfollow', '', InputOption::VALUE_NONE, 'unfollow') ->setDescription('Following a new account'); } /** * @throws Exception */ protected function execute(InputInterface $input, OutputInterface $output): int { $userId = $input->getArgument('userId'); $account = $input->getArgument('account'); $actor = $this->accountService->getActor($userId); if ($input->getOption('local')) { $local = $this->cacheActorService->getFromLocalAccount($account); $account = $local->getAccount(); } if ($input->getOption('unfollow')) { $this->followService->unfollowAccount($actor, $account); } else { $this->followService->followAccount($actor, $account); } return 0; } }