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` diff --git a/src/Types/ForceReply.php b/src/Types/ForceReply.php index 50f11f54..1cc04256 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|null + */ + protected $inputFieldPlaceholder; + /** * Optional. Use this parameter if you want to show the keyboard to specific users only. * Targets: @@ -51,11 +59,13 @@ class ForceReply extends BaseType /** * @param bool $forceReply * @param bool|null $selective + * @param string|null $inputFieldPlaceholder */ - public function __construct($forceReply = true, $selective = null) + public function __construct($forceReply = true, $selective = null, $inputFieldPlaceholder = null) { $this->forceReply = $forceReply; $this->selective = $selective; + $this->inputFieldPlaceholder = $inputFieldPlaceholder; } /** @@ -91,4 +101,21 @@ public function setSelective($selective) { $this->selective = $selective; } + + /** + * @param string|null $inputFieldPlaceholder + * @return void + */ + public function setInputFieldPlaceholder($inputFieldPlaceholder) + { + $this->inputFieldPlaceholder = $inputFieldPlaceholder; + } + + /** + * @return string|null + */ + public function getInputFieldPlaceholder() + { + return $this->inputFieldPlaceholder; + } } 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()