From 70c6181cd8a27d9bbd5e53c24170d2d13ada2967 Mon Sep 17 00:00:00 2001 From: Netkas Date: Mon, 10 Apr 2023 19:13:27 -0400 Subject: [PATCH] Renamed `thumb` field in `TgBotLib\Objects\Telegram > Sticker` to `thumbnail` & Fixed `TgBotLib\Objects\Telegram > Sticker > toArray()` to properly return the `premium_animation` field --- CHANGELOG.md | 4 ++++ src/TgBotLib/Objects/Telegram/Sticker.php | 12 ++++++------ 2 files changed, 10 insertions(+), 6 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index 725401b..30d2782 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -36,6 +36,10 @@ This update accompanies the release of the [Telegram Bot API 6.6](https://core.t * Renamed `thumb` field in `TgBotLib\Objects\Telegram > Animation` to `thumbnail` * Renamed `thumb` field in `TgBotLib\Objects\Telegram > Audio` to `thumbnail` * Renamed `thumb` field in `TgBotLib\Objects\Telegram > Document` to `thumbnail` + * Renamed `thumb` field in `TgBotLib\Objects\Telegram > Sticker` to `thumbnail` + +## Fixed + * Fixed `TgBotLib\Objects\Telegram > Sticker > toArray()` to properly return the `premium_animation` field ## [6.5.2] - 2023-02-26 diff --git a/src/TgBotLib/Objects/Telegram/Sticker.php b/src/TgBotLib/Objects/Telegram/Sticker.php index 8b9ebe8..8d797ed 100644 --- a/src/TgBotLib/Objects/Telegram/Sticker.php +++ b/src/TgBotLib/Objects/Telegram/Sticker.php @@ -46,7 +46,7 @@ /** * @var PhotoSize|null */ - private $thumb; + private $thumbnail; /** * @var string|null @@ -162,9 +162,9 @@ * * @return PhotoSize|null */ - public function getThumb(): ?PhotoSize + public function getThumbnail(): ?PhotoSize { - return $this->thumb; + return $this->thumbnail; } /** @@ -253,10 +253,10 @@ 'height' => $this->height, 'is_animated' => $this->is_animated, 'is_video' => $this->is_video, - 'thumb' => ($this->thumb instanceof ObjectTypeInterface) ? $this->thumb->toArray() : $this->thumb, + 'thumbnail' => ($this->thumbnail instanceof ObjectTypeInterface) ? $this->thumbnail->toArray() : $this->thumbnail, 'emoji' => $this->emoji, 'set_name' => $this->set_name, - 'premium_animation' => ($this->premium_animation instanceof ObjectTypeInterface) ? $this->premium_animation->toArray() : $this->thumb, + 'premium_animation' => ($this->premium_animation instanceof ObjectTypeInterface) ? $this->premium_animation->toArray() : $this->premium_animation, 'mask_position' => ($this->mask_position instanceof ObjectTypeInterface) ? $this->mask_position->toArray() : $this->mask_position, 'custom_emoji_id' => $this->custom_emoji_id, 'needs_repainting' => $this->needs_repainting, @@ -281,7 +281,7 @@ $object->height = $data['height']; $object->is_animated = $data['is_animated']; $object->is_video = $data['is_video']; - $object->thumb = isset($data['thumb']) ? PhotoSize::fromArray($data['thumb']) : null; + $object->thumbnail = isset($data['thumbnail']) ? PhotoSize::fromArray($data['thumbnail']) : null; $object->emoji = $data['emoji'] ?? null; $object->set_name = $data['set_name'] ?? null; $object->premium_animation = isset($data['premium_animation']) ? File::fromArray($data['premium_animation']) : null;