diff --git a/src/Layers/Generated.php b/src/Layers/Generated.php index 02e05b3..4463fca 100644 --- a/src/Layers/Generated.php +++ b/src/Layers/Generated.php @@ -594,9 +594,10 @@ public function sendVideoNote( * Use this method to send paid media. On success, the sent Message is returned. * * @param int|string $chat_id Unique identifier for the target chat or username of the target channel (in the format @channelusername). If the chat is a channel, all Telegram Star proceeds from this media will be credited to the chat's balance. Otherwise, they will be credited to the bot's balance. - * @param int $star_count The number of Telegram Stars that must be paid to buy access to the media + * @param int $star_count The number of Telegram Stars that must be paid to buy access to the media; 1-2500 * @param InputPaidMedia[] $media A JSON-serialized array describing the media to be sent; up to 10 items * @param string $business_connection_id Unique identifier of the business connection on behalf of which the message will be sent + * @param string $payload Bot-defined paid media payload, 0-128 bytes. This will not be displayed to the user, use it for your internal processes. * @param string $caption Media caption, 0-1024 characters after entities parsing * @param ParseMode|string $parse_mode Mode for parsing entities in the media caption. See formatting options for more details. * @param MessageEntity[] $caption_entities A JSON-serialized list of special entities that appear in the caption, which can be specified instead of parse_mode @@ -613,6 +614,7 @@ public function sendPaidMedia( int $star_count, array $media, ?string $business_connection_id = null, + ?string $payload = null, ?string $caption = null, ParseMode|string|null $parse_mode = null, ?array $caption_entities = null, diff --git a/src/Telegram/ChatBoostSourceGiveaway.php b/src/Telegram/ChatBoostSourceGiveaway.php index 76b7df3..fee912b 100644 --- a/src/Telegram/ChatBoostSourceGiveaway.php +++ b/src/Telegram/ChatBoostSourceGiveaway.php @@ -7,7 +7,7 @@ namespace Telepath\Telegram; /** - * The boost was obtained by the creation of a Telegram Premium giveaway. This boosts the chat 4 times for the duration of the corresponding Telegram Premium subscription. + * The boost was obtained by the creation of a Telegram Premium or a Telegram Star giveaway. This boosts the chat 4 times for the duration of the corresponding Telegram Premium subscription for Telegram Premium giveaways and prize_star_count / 500 times for one year for Telegram Star giveaways. */ class ChatBoostSourceGiveaway extends ChatBoostSource { @@ -17,19 +17,28 @@ class ChatBoostSourceGiveaway extends ChatBoostSource /** Identifier of a message in the chat with the giveaway; the message could have been deleted already. May be 0 if the message isn't sent yet. */ public int $giveaway_message_id; + /** Optional. The number of Telegram Stars to be split between giveaway winners; for Telegram Star giveaways only */ + public ?int $prize_star_count = null; + /** Optional. True, if the giveaway was completed, but there was no user to win the prize */ public ?bool $is_unclaimed = null; /** * @param int $giveaway_message_id Identifier of a message in the chat with the giveaway; the message could have been deleted already. May be 0 if the message isn't sent yet. - * @param User $user Optional. User that won the prize in the giveaway if any + * @param User $user Optional. User that won the prize in the giveaway if any; for Telegram Premium giveaways only + * @param int $prize_star_count Optional. The number of Telegram Stars to be split between giveaway winners; for Telegram Star giveaways only * @param bool $is_unclaimed Optional. True, if the giveaway was completed, but there was no user to win the prize */ - public static function make(int $giveaway_message_id, ?User $user = null, ?bool $is_unclaimed = null): static - { + public static function make( + int $giveaway_message_id, + ?User $user = null, + ?int $prize_star_count = null, + ?bool $is_unclaimed = null, + ): static { return new static([ 'giveaway_message_id' => $giveaway_message_id, 'user' => $user, + 'prize_star_count' => $prize_star_count, 'is_unclaimed' => $is_unclaimed, ]); } diff --git a/src/Telegram/Giveaway.php b/src/Telegram/Giveaway.php index 68b1f65..022e810 100644 --- a/src/Telegram/Giveaway.php +++ b/src/Telegram/Giveaway.php @@ -42,7 +42,10 @@ class Giveaway extends Type */ public ?array $country_codes = null; - /** Optional. The number of months the Telegram Premium subscription won from the giveaway will be active for */ + /** Optional. The number of Telegram Stars to be split between giveaway winners; for Telegram Star giveaways only */ + public ?int $prize_star_count = null; + + /** Optional. The number of months the Telegram Premium subscription won from the giveaway will be active for; for Telegram Premium giveaways only */ public ?int $premium_subscription_month_count = null; /** @@ -53,7 +56,8 @@ class Giveaway extends Type * @param bool $has_public_winners Optional. True, if the list of giveaway winners will be visible to everyone * @param string $prize_description Optional. Description of additional giveaway prize * @param string[] $country_codes Optional. A list of two-letter ISO 3166-1 alpha-2 country codes indicating the countries from which eligible users for the giveaway must come. If empty, then all users can participate in the giveaway. Users with a phone number that was bought on Fragment can always participate in giveaways. - * @param int $premium_subscription_month_count Optional. The number of months the Telegram Premium subscription won from the giveaway will be active for + * @param int $prize_star_count Optional. The number of Telegram Stars to be split between giveaway winners; for Telegram Star giveaways only + * @param int $premium_subscription_month_count Optional. The number of months the Telegram Premium subscription won from the giveaway will be active for; for Telegram Premium giveaways only */ public static function make( array $chats, @@ -63,6 +67,7 @@ public static function make( ?bool $has_public_winners = null, ?string $prize_description = null, ?array $country_codes = null, + ?int $prize_star_count = null, ?int $premium_subscription_month_count = null, ): static { return new static([ @@ -73,6 +78,7 @@ public static function make( 'has_public_winners' => $has_public_winners, 'prize_description' => $prize_description, 'country_codes' => $country_codes, + 'prize_star_count' => $prize_star_count, 'premium_subscription_month_count' => $premium_subscription_month_count, ]); } diff --git a/src/Telegram/GiveawayCompleted.php b/src/Telegram/GiveawayCompleted.php index 2dbca5e..957a071 100644 --- a/src/Telegram/GiveawayCompleted.php +++ b/src/Telegram/GiveawayCompleted.php @@ -22,20 +22,26 @@ class GiveawayCompleted extends Type /** Optional. Message with the giveaway that was completed, if it wasn't deleted */ public ?Message $giveaway_message = null; + /** Optional. True, if the giveaway is a Telegram Star giveaway. Otherwise, currently, the giveaway is a Telegram Premium giveaway. */ + public ?bool $is_star_giveaway = null; + /** * @param int $winner_count Number of winners in the giveaway * @param int $unclaimed_prize_count Optional. Number of undistributed prizes * @param Message $giveaway_message Optional. Message with the giveaway that was completed, if it wasn't deleted + * @param bool $is_star_giveaway Optional. True, if the giveaway is a Telegram Star giveaway. Otherwise, currently, the giveaway is a Telegram Premium giveaway. */ public static function make( int $winner_count, ?int $unclaimed_prize_count = null, ?Message $giveaway_message = null, + ?bool $is_star_giveaway = null, ): static { return new static([ 'winner_count' => $winner_count, 'unclaimed_prize_count' => $unclaimed_prize_count, 'giveaway_message' => $giveaway_message, + 'is_star_giveaway' => $is_star_giveaway, ]); } } diff --git a/src/Telegram/GiveawayCreated.php b/src/Telegram/GiveawayCreated.php index 1b2c75c..9a5e455 100644 --- a/src/Telegram/GiveawayCreated.php +++ b/src/Telegram/GiveawayCreated.php @@ -9,13 +9,20 @@ use Telepath\Types\Type; /** - * This object represents a service message about the creation of a scheduled giveaway. Currently holds no information. + * This object represents a service message about the creation of a scheduled giveaway. */ class GiveawayCreated extends Type { - public static function make(): static + /** Optional. The number of Telegram Stars to be split between giveaway winners; for Telegram Star giveaways only */ + public ?int $prize_star_count = null; + + /** + * @param int $prize_star_count Optional. The number of Telegram Stars to be split between giveaway winners; for Telegram Star giveaways only + */ + public static function make(?int $prize_star_count = null): static { return new static([ + 'prize_star_count' => $prize_star_count, ]); } } diff --git a/src/Telegram/GiveawayWinners.php b/src/Telegram/GiveawayWinners.php index bc5b033..ae51a7e 100644 --- a/src/Telegram/GiveawayWinners.php +++ b/src/Telegram/GiveawayWinners.php @@ -35,7 +35,10 @@ class GiveawayWinners extends Type /** Optional. The number of other chats the user had to join in order to be eligible for the giveaway */ public ?int $additional_chat_count = null; - /** Optional. The number of months the Telegram Premium subscription won from the giveaway will be active for */ + /** Optional. The number of Telegram Stars that were split between giveaway winners; for Telegram Star giveaways only */ + public ?int $prize_star_count = null; + + /** Optional. The number of months the Telegram Premium subscription won from the giveaway will be active for; for Telegram Premium giveaways only */ public ?int $premium_subscription_month_count = null; /** Optional. Number of undistributed prizes */ @@ -57,7 +60,8 @@ class GiveawayWinners extends Type * @param int $winner_count Total number of winners in the giveaway * @param User[] $winners List of up to 100 winners of the giveaway * @param int $additional_chat_count Optional. The number of other chats the user had to join in order to be eligible for the giveaway - * @param int $premium_subscription_month_count Optional. The number of months the Telegram Premium subscription won from the giveaway will be active for + * @param int $prize_star_count Optional. The number of Telegram Stars that were split between giveaway winners; for Telegram Star giveaways only + * @param int $premium_subscription_month_count Optional. The number of months the Telegram Premium subscription won from the giveaway will be active for; for Telegram Premium giveaways only * @param int $unclaimed_prize_count Optional. Number of undistributed prizes * @param bool $only_new_members Optional. True, if only users who had joined the chats after the giveaway started were eligible to win * @param bool $was_refunded Optional. True, if the giveaway was canceled because the payment for it was refunded @@ -70,6 +74,7 @@ public static function make( int $winner_count, array $winners, ?int $additional_chat_count = null, + ?int $prize_star_count = null, ?int $premium_subscription_month_count = null, ?int $unclaimed_prize_count = null, ?bool $only_new_members = null, @@ -83,6 +88,7 @@ public static function make( 'winner_count' => $winner_count, 'winners' => $winners, 'additional_chat_count' => $additional_chat_count, + 'prize_star_count' => $prize_star_count, 'premium_subscription_month_count' => $premium_subscription_month_count, 'unclaimed_prize_count' => $unclaimed_prize_count, 'only_new_members' => $only_new_members, diff --git a/src/Telegram/PaidMediaPurchased.php b/src/Telegram/PaidMediaPurchased.php new file mode 100644 index 0000000..95846f9 --- /dev/null +++ b/src/Telegram/PaidMediaPurchased.php @@ -0,0 +1,33 @@ + $from, + 'paid_media_payload' => $paid_media_payload, + ]); + } +} diff --git a/src/Telegram/TransactionPartnerUser.php b/src/Telegram/TransactionPartnerUser.php index e21bcfb..ef95170 100644 --- a/src/Telegram/TransactionPartnerUser.php +++ b/src/Telegram/TransactionPartnerUser.php @@ -27,17 +27,26 @@ class TransactionPartnerUser extends TransactionPartner */ public ?array $paid_media = null; + /** Optional. Bot-specified paid media payload */ + public ?string $paid_media_payload = null; + /** * @param User $user Information about the user * @param string $invoice_payload Optional. Bot-specified invoice payload * @param PaidMedia[] $paid_media Optional. Information about the paid media bought by the user + * @param string $paid_media_payload Optional. Bot-specified paid media payload */ - public static function make(User $user, ?string $invoice_payload = null, ?array $paid_media = null): static - { + public static function make( + User $user, + ?string $invoice_payload = null, + ?array $paid_media = null, + ?string $paid_media_payload = null, + ): static { return new static([ 'user' => $user, 'invoice_payload' => $invoice_payload, 'paid_media' => $paid_media, + 'paid_media_payload' => $paid_media_payload, ]); } } diff --git a/src/Telegram/Update.php b/src/Telegram/Update.php index 78a914e..7d4e1d1 100644 --- a/src/Telegram/Update.php +++ b/src/Telegram/Update.php @@ -64,6 +64,9 @@ class Update extends Type /** Optional. New incoming pre-checkout query. Contains full information about checkout */ public ?PreCheckoutQuery $pre_checkout_query = null; + /** Optional. A user purchased paid media with a non-empty payload sent by the bot in a non-channel chat */ + public ?PaidMediaPurchased $purchased_paid_media = null; + /** Optional. New poll state. Bots receive only updates about manually stopped polls and polls, which are sent by the bot */ public ?Poll $poll = null; @@ -102,6 +105,7 @@ class Update extends Type * @param CallbackQuery $callback_query Optional. New incoming callback query * @param ShippingQuery $shipping_query Optional. New incoming shipping query. Only for invoices with flexible price * @param PreCheckoutQuery $pre_checkout_query Optional. New incoming pre-checkout query. Contains full information about checkout + * @param PaidMediaPurchased $purchased_paid_media Optional. A user purchased paid media with a non-empty payload sent by the bot in a non-channel chat * @param Poll $poll Optional. New poll state. Bots receive only updates about manually stopped polls and polls, which are sent by the bot * @param PollAnswer $poll_answer Optional. A user changed their answer in a non-anonymous poll. Bots receive new votes only in polls that were sent by the bot itself. * @param ChatMemberUpdated $my_chat_member Optional. The bot's chat member status was updated in a chat. For private chats, this update is received only when the bot is blocked or unblocked by the user. @@ -127,6 +131,7 @@ public static function make( ?CallbackQuery $callback_query = null, ?ShippingQuery $shipping_query = null, ?PreCheckoutQuery $pre_checkout_query = null, + ?PaidMediaPurchased $purchased_paid_media = null, ?Poll $poll = null, ?PollAnswer $poll_answer = null, ?ChatMemberUpdated $my_chat_member = null, @@ -152,6 +157,7 @@ public static function make( 'callback_query' => $callback_query, 'shipping_query' => $shipping_query, 'pre_checkout_query' => $pre_checkout_query, + 'purchased_paid_media' => $purchased_paid_media, 'poll' => $poll, 'poll_answer' => $poll_answer, 'my_chat_member' => $my_chat_member,