From f8c02bceb3369c998bb9ea53c2ced58f94f5575b Mon Sep 17 00:00:00 2001 From: Netkas Date: Sun, 23 Apr 2023 17:33:26 -0400 Subject: [PATCH] Added methods `\TgBotLib\Objects\Telegram\InlineKeyboardMarkup::removeRow` & `\TgBotLib\Objects\Telegram\InlineKeyboardMarkup::addRow` to `\TgBotLib\Objects\Telegram\InlineKeyboardMarkup` --- CHANGELOG.md | 1 + src/TgBotLib/Objects/Telegram/WebAppInfo.php | 17 +++++++++++++++++ 2 files changed, 18 insertions(+) diff --git a/CHANGELOG.md b/CHANGELOG.md index c500750..09121fc 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -25,6 +25,7 @@ This update accompanies the release of the [Telegram Bot API 6.7](https://core.t `\TgBotLib\Objects\Telegram\InlineKeyboardButton::setCallbackGame`, `\TgBotLib\Objects\Telegram\InlineKeyboardButton::setPay` to `\TgBotLib\Objects\Telegram\InlineKeyboardButton` * Added methods `\TgBotLib\Objects\Telegram\InlineKeyboardMarkup::removeRow` & `\TgBotLib\Objects\Telegram\InlineKeyboardMarkup::addRow` to `\TgBotLib\Objects\Telegram\InlineKeyboardMarkup` + * Added method `\TgBotLib\Objects\Telegram\WebAppInfo::setUrl` to `\TgBotLib\Objects\Telegram\WebAppInfo` ## [6.6.0] - 2023-04-10 diff --git a/src/TgBotLib/Objects/Telegram/WebAppInfo.php b/src/TgBotLib/Objects/Telegram/WebAppInfo.php index 52a9c35..20a069b 100644 --- a/src/TgBotLib/Objects/Telegram/WebAppInfo.php +++ b/src/TgBotLib/Objects/Telegram/WebAppInfo.php @@ -2,6 +2,8 @@ namespace TgBotLib\Objects\Telegram; + use InvalidArgumentException; + use TgBotLib\Classes\Validate; use TgBotLib\Interfaces\ObjectTypeInterface; class WebAppInfo implements ObjectTypeInterface @@ -22,6 +24,21 @@ return $this->url; } + /** + * An HTTPS URL of a Web App to be opened with additional data as specified in Initializing Web Apps + * + * @param string $url + * @return $this + */ + public function setUrl(string $url): self + { + if(!Validate::url($url)) + throw new InvalidArgumentException('Invalid url format'); + + $this->url = $url; + return $this; + } + /** * Returns an array representation of the object. *