From 9aa73daa42d88f2d617bac62dcf5ab09785e7ddb Mon Sep 17 00:00:00 2001 From: Artem Yurov Date: Mon, 19 Aug 2024 19:10:10 +0300 Subject: [PATCH] Update ReplyKeyboard.php added is_persistent field https://core.telegram.org/bots/api#replykeyboardmarkup --- src/Keyboard/ReplyKeyboard.php | 21 ++++++++++++++++----- 1 file changed, 16 insertions(+), 5 deletions(-) diff --git a/src/Keyboard/ReplyKeyboard.php b/src/Keyboard/ReplyKeyboard.php index fbe1a25e..1528af8a 100644 --- a/src/Keyboard/ReplyKeyboard.php +++ b/src/Keyboard/ReplyKeyboard.php @@ -17,6 +17,7 @@ class ReplyKeyboard implements Arrayable protected Collection $buttons; protected bool $rtl = false; + protected bool $isPersistent = false; protected bool $resize = false; protected bool $oneTime = false; protected bool $selective = false; @@ -96,6 +97,15 @@ public static function fromArray(array $arrayKeyboard): self return $keyboard; } + public function isPersistent(bool $isPersistent = true): self + { + $clone = $this->clone(); + + $clone->isPersistent = $isPersistent; + + return $clone; + } + public function resize(bool $resize = true): self { $clone = $this->clone(); @@ -273,10 +283,11 @@ public function toArray(): array public function options(): array { return array_filter([ - 'resize_keyboard' => $this->resize, - 'one_time_keyboard' => $this->oneTime, - 'selective' => $this->selective, - 'input_field_placeholder' => $this->inputPlaceholder, - ]); + 'is_persistent' => $this->isPersistent, + 'resize_keyboard' => $this->resize, + 'one_time_keyboard' => $this->oneTime, + 'selective' => $this->selective, + 'input_field_placeholder' => $this->inputPlaceholder, + ]); } }