diff --git a/README.md b/README.md index f464db46..fc49d074 100644 --- a/README.md +++ b/README.md @@ -1,6 +1,6 @@ # PHP Wrapper for Telegram Bot API -[![Bot Api 7.8](https://img.shields.io/badge/Bot%20API-7.8-0088cc.svg?style=flat)](https://core.telegram.org/bots/api-changelog#july-31-2024) +[![Bot Api 7.9](https://img.shields.io/badge/Bot%20API-7.9-0088cc.svg?style=flat)](https://core.telegram.org/bots/api-changelog#august-14-2024) [![PHP >=8.2](https://img.shields.io/badge/PHP->=8.2-777bb3.svg?style=flat)](https://www.php.net/releases/8.2/en.php) [![Tests Status](https://img.shields.io/github/actions/workflow/status/luzrain/telegram-bot-api/tests.yaml?branch=master)](../../actions/workflows/tests.yaml) diff --git a/src/Method/CreateChatSubscriptionInviteLink.php b/src/Method/CreateChatSubscriptionInviteLink.php new file mode 100644 index 00000000..0293bcd1 --- /dev/null +++ b/src/Method/CreateChatSubscriptionInviteLink.php @@ -0,0 +1,47 @@ + + */ +final class CreateChatSubscriptionInviteLink extends Method +{ + protected static string $methodName = 'createChatSubscriptionInviteLink'; + protected static string $responseClass = ChatInviteLink::class; + + public function __construct( + /** + * Unique identifier for the target channel chat or username of the target channel (in the format @channelusername) + */ + protected int|string $chatId, + + /** + * The number of seconds the subscription will be active for before the next payment. Currently, it must always be 2592000 (30 days). + */ + protected int $subscriptionPeriod, + + /** + * The amount of Telegram Stars a user must pay initially and after each subsequent subscription period to be a member of the chat; 1-2500 + */ + protected int $subscriptionPrice, + + /** + * Invite link name; 0-32 characters + */ + protected string|null $name = null, + ) { + } +} diff --git a/src/Method/EditChatSubscriptionInviteLink.php b/src/Method/EditChatSubscriptionInviteLink.php new file mode 100644 index 00000000..aa0d0e61 --- /dev/null +++ b/src/Method/EditChatSubscriptionInviteLink.php @@ -0,0 +1,39 @@ + + */ +final class EditChatSubscriptionInviteLink extends Method +{ + protected static string $methodName = 'editChatSubscriptionInviteLink'; + protected static string $responseClass = ChatInviteLink::class; + + public function __construct( + /** + * Unique identifier for the target chat or username of the target channel (in the format @channelusername) + */ + protected int|string $chatId, + + /** + * The invite link to edit + */ + protected string $inviteLink, + + /** + * Invite link name; 0-32 characters + */ + protected string|null $name = null, + ) { + } +} diff --git a/src/Method/SendPaidMedia.php b/src/Method/SendPaidMedia.php index 41b0940c..08593d27 100644 --- a/src/Method/SendPaidMedia.php +++ b/src/Method/SendPaidMedia.php @@ -42,6 +42,11 @@ public function __construct( */ protected array $media, + /** + * Unique identifier of the business connection on behalf of which the message will be sent + */ + protected string|null $businessConnectionId = null, + /** * Media caption, 0-1024 characters after entities parsing */ diff --git a/src/Type/ChatInviteLink.php b/src/Type/ChatInviteLink.php index 91b4c45b..46f37b9d 100644 --- a/src/Type/ChatInviteLink.php +++ b/src/Type/ChatInviteLink.php @@ -56,6 +56,17 @@ protected function __construct( * Optional. Number of pending join requests created using this link */ public int|null $pendingJoinRequestCount = null, + + /** + * Optional. The number of seconds the subscription will be active for before the next payment + */ + public int|null $subscriptionPeriod = null, + + /** + * Optional. The amount of Telegram Stars a user must pay initially and after each subsequent subscription period + * to be a member of the chat using the link + */ + public int|null $subscriptionPrice = null, ) { } } diff --git a/src/Type/ChatMemberMember.php b/src/Type/ChatMemberMember.php index 2e7daade..fde62c7a 100644 --- a/src/Type/ChatMemberMember.php +++ b/src/Type/ChatMemberMember.php @@ -16,6 +16,11 @@ protected function __construct( * Information about the user */ public User $user, + + /** + * Optional. Date when the user's subscription will expire; Unix time + */ + public int|null $untilDate = null, ) { parent::__construct(self::STATUS); } diff --git a/src/Type/Payments/TransactionPartnerUser.php b/src/Type/Payments/TransactionPartnerUser.php index 04b9080e..dbeb001a 100644 --- a/src/Type/Payments/TransactionPartnerUser.php +++ b/src/Type/Payments/TransactionPartnerUser.php @@ -4,6 +4,8 @@ namespace Luzrain\TelegramBotApi\Type\Payments; +use Luzrain\TelegramBotApi\Internal\ArrayType; +use Luzrain\TelegramBotApi\Type\PaidMedia; use Luzrain\TelegramBotApi\Type\User; /** @@ -23,6 +25,14 @@ protected function __construct( * Optional. Bot-specified invoice payload */ public string|null $invoicePayload = null, + + /** + * Optional. Information about the paid media bought by the user + * + * @var list|null + */ + #[ArrayType(PaidMedia::class)] + public array|null $paidMedia = null, ) { parent::__construct(self::TYPE); } diff --git a/src/Type/ReactionType.php b/src/Type/ReactionType.php index 9aad3f5f..aad2b78d 100644 --- a/src/Type/ReactionType.php +++ b/src/Type/ReactionType.php @@ -11,6 +11,7 @@ * * @see ReactionTypeEmoji * @see ReactionTypeCustomEmoji + * @see ReactionTypePaid */ readonly class ReactionType extends Type { @@ -34,6 +35,7 @@ public static function fromArray(array $data): static return self::class !== static::class ? $instance : match ($instance->type) { ReactionTypeEmoji::TYPE => ReactionTypeEmoji::fromArray($data), ReactionTypeCustomEmoji::TYPE => ReactionTypeCustomEmoji::fromArray($data), + ReactionTypePaid::TYPE => ReactionTypePaid::fromArray($data), }; } } diff --git a/src/Type/ReactionTypePaid.php b/src/Type/ReactionTypePaid.php new file mode 100644 index 00000000..50e78516 --- /dev/null +++ b/src/Type/ReactionTypePaid.php @@ -0,0 +1,18 @@ +