logger = $logger; $serverUrl = "http://synapse:8008"; $user = "upschooling"; $this->client = new MatrixClient($serverUrl); $this->client->login($user, "secret", true); $this->logger->debug("Logged in as " . $user . " on server " . $serverUrl); } /** * Handle invites * * @throws MatrixException */ public function handleInvites(int $roomId, array $someState) { $this->client->joinRoom($roomId); } public static function test() { var_dump("Test"); } public function listen() { $syncResponse = $this->client->api()->sync(); foreach (array_get($syncResponse, 'rooms.invite', []) as $roomId => $inviteRoom) { try { $this->client->joinRoom($roomId); } catch (\Exception $e) { $this->logger->info("Join for room: " . $roomId . " failed."); } $this->logger->debug("joined " . $roomId); } } }