Added field via_chat_folder_invite_link to \TgBotLib\Objects\Telegram\ChatMemberUpdated to represent the invite link, which was used by the user to join the chat; for joining by invite link events only.

https://git.n64.cc/nosial/libs/tgbot/-/issues/3
This commit is contained in:
Netkas 2023-04-23 18:40:37 -04:00
parent 67b7b68b4c
commit 277a33f2d3
2 changed files with 18 additions and 0 deletions

View file

@ -22,6 +22,7 @@ input objects for methods that require input objects.
* Added object `\TgBotLib\Objects\Telegram\InlineQueryResult\InlineQueryResultGif`, see [InlineQueryResultGif](https://core.telegram.org/bots/api#inlinequeryresultgif) for more information.
* Added abstract class `\TgBotLib\Abstracts\ThumbnailMimeType` to represent the mime type of thumbnail, photo, or a file / sticker thumbnail.
* Added object `\TgBotLib\Objects\Telegram\InlineQueryResult\InlineQueryResultMpeg4Gif`, see [InlineQueryResultMpeg4Gif](https://core.telegram.org/bots/api#inlinequeryresultmpeg4gif) for more information.
* Added field `via_chat_folder_invite_link` to `\TgBotLib\Objects\Telegram\ChatMemberUpdated` to represent the invite link, which was used by the user to join the chat; for joining by invite link events only.
### Changed
* Refactored InputMessageContent types to its own namespace so InputMessageContent can always return the correct InputMessageContent object type when calling `fromArray()`

View file

@ -38,6 +38,11 @@
*/
private $invite_link;
/**
* @var bool
*/
private $via_chat_folder_invite_link;
/**
* Chat the user belongs to
*
@ -99,6 +104,16 @@
return $this->invite_link;
}
/**
* Optional. True, if the user joined the chat via a chat folder invite link
*
* @return bool
*/
public function isViaChatFolderInviteLink(): bool
{
return $this->via_chat_folder_invite_link;
}
/**
* Returns an array representation of the object
*
@ -113,6 +128,7 @@
'old_chat_member' => ($this->old_chat_member instanceof ObjectTypeInterface) ? $this->old_chat_member->toArray() : $this->old_chat_member,
'new_chat_member' => ($this->new_chat_member instanceof ObjectTypeInterface) ? $this->new_chat_member->toArray() : $this->new_chat_member,
'invite_link' => ($this->invite_link instanceof ObjectTypeInterface) ? $this->invite_link->toArray() : $this->invite_link,
'via_chat_folder_invite_link' => $this->via_chat_folder_invite_link,
];
}
@ -132,6 +148,7 @@
$object->old_chat_member = isset($data['old_chat_member']) ? ChatMember::fromArray($data['old_chat_member']) : new ChatMember();
$object->new_chat_member = isset($data['new_chat_member']) ? ChatMember::fromArray($data['new_chat_member']) : new ChatMember();
$object->invite_link = isset($data['invite_link']) ? ChatInviteLink::fromArray($data['invite_link']) : null;
$object->via_chat_folder_invite_link = $data['via_chat_folder_invite_link'] ?? false;
return $object;
}