client = $client; } public function sendMessageToUser( Account $account, string $text, string $parseMode = self::PARSE_MODE_NOPARSE, KeyboardMethods $keyboardMarkup = null, bool $disableWebPreview = false, bool $disableNotifications = false ): bool { return $this->sendMessageToChat($account->getChatId(), $text, $parseMode, $keyboardMarkup, $disableWebPreview, $disableNotifications); } public function sendMessageToChat( int $chatId, string $text, string $parseMode = self::PARSE_MODE_NOPARSE, KeyboardMethods $keyboardMarkup = null, bool $disableWebPreview = false, bool $disableNotifications = false ): bool { $sendMessage = new SendMessage(); $sendMessage->chat_id = (string) $chatId; $sendMessage->text = $text; $sendMessage->parse_mode = $parseMode; $sendMessage->disable_web_page_preview = $disableWebPreview; $sendMessage->disable_notification = $disableNotifications; $sendMessage->reply_markup = $keyboardMarkup; try { $this->client->performApiRequest($sendMessage); return true; } catch (ClientException $e) { return false; } } }