From 6a4128090c95238a779fbb8614e976274dcfcee4 Mon Sep 17 00:00:00 2001 From: Netkas Date: Sun, 23 Apr 2023 16:53:35 -0400 Subject: [PATCH] Added methods `\TgBotLib\Objects\Telegram\InlineKeyboardMarkup::removeRow` & `\TgBotLib\Objects\Telegram\InlineKeyboardMarkup::addRow` to `\TgBotLib\Objects\Telegram\InlineKeyboardMarkup` --- CHANGELOG.md | 1 + .../Objects/Telegram/InlineKeyboardMarkup.php | 24 +++++++++++++++++++ 2 files changed, 25 insertions(+) diff --git a/CHANGELOG.md b/CHANGELOG.md index ac294d3..c500750 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -24,6 +24,7 @@ This update accompanies the release of the [Telegram Bot API 6.7](https://core.t `\TgBotLib\Objects\Telegram\InlineKeyboardButton::setSwitchInlineQuery`, `\TgBotLib\Objects\Telegram\InlineKeyboardButton::setSwitchInlineQueryCurrentChat`, `\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` ## [6.6.0] - 2023-04-10 diff --git a/src/TgBotLib/Objects/Telegram/InlineKeyboardMarkup.php b/src/TgBotLib/Objects/Telegram/InlineKeyboardMarkup.php index fb8b81b..90eba3b 100644 --- a/src/TgBotLib/Objects/Telegram/InlineKeyboardMarkup.php +++ b/src/TgBotLib/Objects/Telegram/InlineKeyboardMarkup.php @@ -24,6 +24,30 @@ return $this->inline_keyboard; } + /** + * Adds a row of buttons + * + * @param InlineKeyboardButton ...$buttons + * @return $this + */ + public function addRow(InlineKeyboardButton ...$buttons): self + { + $this->inline_keyboard[] = $buttons; + return $this; + } + + /** + * Removes a row of buttons by index + * + * @param int $index + * @return $this + */ + public function removeRow(int $index): self + { + unset($this->inline_keyboard[$index]); + return $this; + } + /** * Returns an array representation of the object *