From 7be37db679772638e498408b43bbbb3920211c7e Mon Sep 17 00:00:00 2001 From: Netkas Date: Tue, 28 Feb 2023 21:04:00 -0500 Subject: [PATCH] Added \TgBotLib\Objects\Telegram > Poll --- src/TgBotLib/Objects/Telegram/Poll.php | 11 ++++++++++- 1 file changed, 10 insertions(+), 1 deletion(-) diff --git a/src/TgBotLib/Objects/Telegram/Poll.php b/src/TgBotLib/Objects/Telegram/Poll.php index 35a7dfb..81b1b4a 100644 --- a/src/TgBotLib/Objects/Telegram/Poll.php +++ b/src/TgBotLib/Objects/Telegram/Poll.php @@ -247,7 +247,6 @@ $object->id = $data['id'] ?? null; $object->question = $data['question'] ?? null; - $object->options = $data['options'] ?? null; $object->total_voter_count = $data['total_voter_count'] ?? null; $object->is_closed = $data['is_closed'] ?? null; $object->is_anonymous = $data['is_anonymous'] ?? null; @@ -268,6 +267,16 @@ } } + $object->options = null; + if(isset($data['options']) && is_array($data['options'])) + { + $object->options = []; + foreach($data['options'] as $option) + { + $object->options[] = PollOption::fromArray($option); + } + } + return $object; } } \ No newline at end of file