From 4f4784dfebb8026c6a4b365f2836369494ceb203 Mon Sep 17 00:00:00 2001 From: Numair Awan <62851858+NumairAwan@users.noreply.github.com> Date: Mon, 26 Jun 2023 00:16:22 +0500 Subject: [PATCH 1/4] Update ForceReply.php Added input_field_placeholder field to change the reply input placeholder text. --- src/Types/ForceReply.php | 28 +++++++++++++++++++++++++++- 1 file changed, 27 insertions(+), 1 deletion(-) diff --git a/src/Types/ForceReply.php b/src/Types/ForceReply.php index 50f11f54..19c186d6 100644 --- a/src/Types/ForceReply.php +++ b/src/Types/ForceReply.php @@ -28,6 +28,7 @@ class ForceReply extends BaseType */ protected static $map = [ 'force_reply' => true, + 'input_field_placeholder' => true, 'selective' => true ]; @@ -38,6 +39,13 @@ class ForceReply extends BaseType */ protected $forceReply; + /** + * The placeholder to be shown in the input field when the reply is active; 1-64 characters + * + * @var string + */ + protected $inputFieldPlaceholder; + /** * Optional. Use this parameter if you want to show the keyboard to specific users only. * Targets: @@ -52,9 +60,10 @@ class ForceReply extends BaseType * @param bool $forceReply * @param bool|null $selective */ - public function __construct($forceReply = true, $selective = null) + public function __construct($forceReply = true, $inputFieldPlaceholder = false, $selective = null) { $this->forceReply = $forceReply; + $this->inputFieldPlaceholder = $inputFieldPlaceholder; $this->selective = $selective; } @@ -66,6 +75,23 @@ public function isForceReply() return $this->forceReply; } + /** + * @param string $inputFieldPlaceholder + * @return void + */ + public function setInputFieldPlaceholder($inputFieldPlaceholder) + { + $this->inputFieldPlaceholder = $inputFieldPlaceholder; + } + + /** + * @return string|null + */ + public function getInputFieldPlaceholder() + { + return $this->inputFieldPlaceholder; + } + /** * @param bool $forceReply * @return void From 9f75b31322f05913e2b31c2670b537075d532970 Mon Sep 17 00:00:00 2001 From: Numair Awan <62851858+NumairAwan@users.noreply.github.com> Date: Mon, 26 Jun 2023 14:53:44 +0500 Subject: [PATCH 2/4] Update ForceReply.php Moved $inputFieldPlaceholder to the last position. --- src/Types/ForceReply.php | 36 ++++++++++++++++++------------------ 1 file changed, 18 insertions(+), 18 deletions(-) diff --git a/src/Types/ForceReply.php b/src/Types/ForceReply.php index 19c186d6..44315bf6 100644 --- a/src/Types/ForceReply.php +++ b/src/Types/ForceReply.php @@ -60,7 +60,7 @@ class ForceReply extends BaseType * @param bool $forceReply * @param bool|null $selective */ - public function __construct($forceReply = true, $inputFieldPlaceholder = false, $selective = null) + public function __construct($forceReply = true, $selective = null, $inputFieldPlaceholder = false) { $this->forceReply = $forceReply; $this->inputFieldPlaceholder = $inputFieldPlaceholder; @@ -74,23 +74,6 @@ public function isForceReply() { return $this->forceReply; } - - /** - * @param string $inputFieldPlaceholder - * @return void - */ - public function setInputFieldPlaceholder($inputFieldPlaceholder) - { - $this->inputFieldPlaceholder = $inputFieldPlaceholder; - } - - /** - * @return string|null - */ - public function getInputFieldPlaceholder() - { - return $this->inputFieldPlaceholder; - } /** * @param bool $forceReply @@ -117,4 +100,21 @@ public function setSelective($selective) { $this->selective = $selective; } + + /** + * @param string $inputFieldPlaceholder + * @return void + */ + public function setInputFieldPlaceholder($inputFieldPlaceholder) + { + $this->inputFieldPlaceholder = $inputFieldPlaceholder; + } + + /** + * @return string|null + */ + public function getInputFieldPlaceholder() + { + return $this->inputFieldPlaceholder; + } } From 95dae45762a604fcca02eec1df815810b6005ee9 Mon Sep 17 00:00:00 2001 From: Numair Awan <62851858+NumairAwan@users.noreply.github.com> Date: Mon, 26 Jun 2023 15:05:17 +0500 Subject: [PATCH 3/4] Update CHANGELOG.md Added `\TelegramBot\Api\Types\ForceReply::$inputFieldPlaceholder` property --- CHANGELOG.md | 1 + 1 file changed, 1 insertion(+) diff --git a/CHANGELOG.md b/CHANGELOG.md index a71a65d3..c2f448f3 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -15,6 +15,7 @@ All Notable changes to `PHP Telegram Bot Api` will be documented in this file - Add `\TelegramBot\Api\BotApi::getChatMemberCount` method - Add `\TelegramBot\Api\BotApi::banChatMember` method - Add `$messageId` to `\TelegramBot\Api\BotApi::unpinChatMessage` +- Add `\TelegramBot\Api\Types\ForceReply::$inputFieldPlaceholder` property ### Deprecated - Deprecate using `thumb*` methods in `\TelegramBot\Api\BotApi` From 5382dbd42f50cfb62c6120d0414cdf32ccab7114 Mon Sep 17 00:00:00 2001 From: BoShurik Date: Wed, 9 Aug 2023 16:37:21 +0300 Subject: [PATCH 4/4] Fix pipeline checks --- src/Types/ForceReply.php | 15 ++++++++------- tests/Types/ForceReplyTest.php | 7 +++++++ 2 files changed, 15 insertions(+), 7 deletions(-) diff --git a/src/Types/ForceReply.php b/src/Types/ForceReply.php index 44315bf6..1cc04256 100644 --- a/src/Types/ForceReply.php +++ b/src/Types/ForceReply.php @@ -42,10 +42,10 @@ class ForceReply extends BaseType /** * The placeholder to be shown in the input field when the reply is active; 1-64 characters * - * @var string + * @var string|null */ protected $inputFieldPlaceholder; - + /** * Optional. Use this parameter if you want to show the keyboard to specific users only. * Targets: @@ -59,12 +59,13 @@ class ForceReply extends BaseType /** * @param bool $forceReply * @param bool|null $selective + * @param string|null $inputFieldPlaceholder */ - public function __construct($forceReply = true, $selective = null, $inputFieldPlaceholder = false) + public function __construct($forceReply = true, $selective = null, $inputFieldPlaceholder = null) { $this->forceReply = $forceReply; - $this->inputFieldPlaceholder = $inputFieldPlaceholder; $this->selective = $selective; + $this->inputFieldPlaceholder = $inputFieldPlaceholder; } /** @@ -74,7 +75,7 @@ public function isForceReply() { return $this->forceReply; } - + /** * @param bool $forceReply * @return void @@ -102,14 +103,14 @@ public function setSelective($selective) } /** - * @param string $inputFieldPlaceholder + * @param string|null $inputFieldPlaceholder * @return void */ public function setInputFieldPlaceholder($inputFieldPlaceholder) { $this->inputFieldPlaceholder = $inputFieldPlaceholder; } - + /** * @return string|null */ diff --git a/tests/Types/ForceReplyTest.php b/tests/Types/ForceReplyTest.php index 632025be..0215c3d8 100644 --- a/tests/Types/ForceReplyTest.php +++ b/tests/Types/ForceReplyTest.php @@ -23,6 +23,7 @@ public static function getFullResponse() { return [ 'force_reply' => true, + 'input_field_placeholder' => 'input_field_placeholder', 'selective' => true ]; } @@ -35,6 +36,7 @@ protected function assertMinItem($item) { $this->assertEquals(true, $item->isForceReply()); $this->assertEquals(null, $item->isSelective()); + $this->assertEquals(null, $item->getInputFieldPlaceholder()); } /** @@ -45,6 +47,7 @@ protected function assertFullItem($item) { $this->assertEquals(true, $item->isForceReply()); $this->assertEquals(true, $item->isSelective()); + $this->assertEquals('input_field_placeholder', $item->getInputFieldPlaceholder()); } public function testConstructor() @@ -53,6 +56,7 @@ public function testConstructor() $this->assertEquals(true, $item->isForceReply()); $this->assertEquals(null, $item->isSelective()); + $this->assertEquals(null, $item->getInputFieldPlaceholder()); } public function testConstructor2() @@ -61,6 +65,7 @@ public function testConstructor2() $this->assertEquals(true, $item->isForceReply()); $this->assertEquals(true, $item->isSelective()); + $this->assertEquals(null, $item->getInputFieldPlaceholder()); } public function testConstructor3() @@ -69,6 +74,7 @@ public function testConstructor3() $this->assertEquals(false, $item->isForceReply()); $this->assertEquals(true, $item->isSelective()); + $this->assertEquals(null, $item->getInputFieldPlaceholder()); } public function testConstructor4() @@ -77,6 +83,7 @@ public function testConstructor4() $this->assertEquals(true, $item->isForceReply()); $this->assertEquals(null, $item->isSelective()); + $this->assertEquals(null, $item->getInputFieldPlaceholder()); } public function testSetforceReply()