diff --git a/src/Telegram/Types/Custom/UserArray.php b/src/Telegram/Types/Custom/UserArray.php new file mode 100644 index 0000000..8574e2f --- /dev/null +++ b/src/Telegram/Types/Custom/UserArray.php @@ -0,0 +1,37 @@ + $chatMember) { + $this->data[$id] = new User($chatMember, $logger); + } + } + } + + /** + * Traverses through our $data, yielding the result set + * + * @return ChatMember[] + */ + public function traverseObject() + { + foreach ($this->data as $user) { + yield $user; + } + } +} diff --git a/src/Telegram/Types/Message.php b/src/Telegram/Types/Message.php index 93f03b3..7341005 100644 --- a/src/Telegram/Types/Message.php +++ b/src/Telegram/Types/Message.php @@ -7,6 +7,7 @@ use unreal4u\TelegramAPI\Abstracts\TelegramTypes; use unreal4u\TelegramAPI\Telegram\Types\Custom\PhotoSizeArray; use unreal4u\TelegramAPI\Telegram\Types\Custom\MessageEntityArray; +use unreal4u\TelegramAPI\Telegram\Types\Custom\UserArray; /** * This object represents a message. @@ -139,6 +140,13 @@ class Message extends TelegramTypes */ public $video_note; + /** + * Optional. New members that were added to the group or supergroup and information about them (the bot itself may + * be one of these members) + * @var User[] + */ + public $new_chat_members; + /** * Optional. Caption for the photo or video * @var string @@ -266,6 +274,8 @@ protected function mapSubObjects(string $key, array $data): TelegramTypes case 'new_chat_member': case 'left_chat_member': return new User($data, $this->logger); + case 'new_chat_members': + return new UserArray($data, $this->logger); case 'photo': case 'new_chat_photo': return new PhotoSizeArray($data, $this->logger);