public function sendMessage(Chat $chat, User $recipient, string $text, Template $template = null): void
    {
        $sendMessage = new SendMessage();

        if ($template !== null) {
            $sendMessage->reply_markup = $this->templateCompiler->compile($template);
        }

        $sendMessage->chat_id = $chat->getId();
        $sendMessage->text = $text;

        $this->client->performApiRequest($sendMessage);
        $this->loop->run();
    }