Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 3 additions & 1 deletion src/Layers/Generated.php
Original file line number Diff line number Diff line change
Expand Up @@ -594,9 +594,10 @@ public function sendVideoNote(
* Use this method to send paid media. On success, the sent <a href="https://core.telegram.org/bots/api#message">Message</a> 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 <a href="https://core.telegram.org/bots/api#formatting-options">formatting options</a> 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 <em>parse_mode</em>
Expand All @@ -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,
Expand Down
17 changes: 13 additions & 4 deletions src/Telegram/ChatBoostSourceGiveaway.php
Original file line number Diff line number Diff line change
Expand Up @@ -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 <em>prize_star_count</em> / 500 times for one year for Telegram Star giveaways.
*/
class ChatBoostSourceGiveaway extends ChatBoostSource
{
Expand All @@ -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;

/** <em>Optional</em>. The number of Telegram Stars to be split between giveaway winners; for Telegram Star giveaways only */
public ?int $prize_star_count = null;

/** <em>Optional</em>. 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 <em>Optional</em>. User that won the prize in the giveaway if any
* @param User $user <em>Optional</em>. User that won the prize in the giveaway if any; for Telegram Premium giveaways only
* @param int $prize_star_count <em>Optional</em>. The number of Telegram Stars to be split between giveaway winners; for Telegram Star giveaways only
* @param bool $is_unclaimed <em>Optional</em>. 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,
]);
}
Expand Down
10 changes: 8 additions & 2 deletions src/Telegram/Giveaway.php
Original file line number Diff line number Diff line change
Expand Up @@ -42,7 +42,10 @@ class Giveaway extends Type
*/
public ?array $country_codes = null;

/** <em>Optional</em>. The number of months the Telegram Premium subscription won from the giveaway will be active for */
/** <em>Optional</em>. The number of Telegram Stars to be split between giveaway winners; for Telegram Star giveaways only */
public ?int $prize_star_count = null;

/** <em>Optional</em>. 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;

/**
Expand All @@ -53,7 +56,8 @@ class Giveaway extends Type
* @param bool $has_public_winners <em>Optional</em>. <em>True</em>, if the list of giveaway winners will be visible to everyone
* @param string $prize_description <em>Optional</em>. Description of additional giveaway prize
* @param string[] $country_codes <em>Optional</em>. A list of two-letter <a href="https://en.wikipedia.org/wiki/ISO_3166-1_alpha-2">ISO 3166-1 alpha-2</a> 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 <em>Optional</em>. The number of months the Telegram Premium subscription won from the giveaway will be active for
* @param int $prize_star_count <em>Optional</em>. The number of Telegram Stars to be split between giveaway winners; for Telegram Star giveaways only
* @param int $premium_subscription_month_count <em>Optional</em>. 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,
Expand All @@ -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([
Expand All @@ -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,
]);
}
Expand Down
6 changes: 6 additions & 0 deletions src/Telegram/GiveawayCompleted.php
Original file line number Diff line number Diff line change
Expand Up @@ -22,20 +22,26 @@ class GiveawayCompleted extends Type
/** <em>Optional</em>. Message with the giveaway that was completed, if it wasn't deleted */
public ?Message $giveaway_message = null;

/** <em>Optional</em>. <em>True</em>, 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 <em>Optional</em>. Number of undistributed prizes
* @param Message $giveaway_message <em>Optional</em>. Message with the giveaway that was completed, if it wasn't deleted
* @param bool $is_star_giveaway <em>Optional</em>. <em>True</em>, 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,
]);
}
}
11 changes: 9 additions & 2 deletions src/Telegram/GiveawayCreated.php
Original file line number Diff line number Diff line change
Expand Up @@ -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
/** <em>Optional</em>. 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 <em>Optional</em>. 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,
]);
}
}
10 changes: 8 additions & 2 deletions src/Telegram/GiveawayWinners.php
Original file line number Diff line number Diff line change
Expand Up @@ -35,7 +35,10 @@ class GiveawayWinners extends Type
/** <em>Optional</em>. The number of other chats the user had to join in order to be eligible for the giveaway */
public ?int $additional_chat_count = null;

/** <em>Optional</em>. The number of months the Telegram Premium subscription won from the giveaway will be active for */
/** <em>Optional</em>. The number of Telegram Stars that were split between giveaway winners; for Telegram Star giveaways only */
public ?int $prize_star_count = null;

/** <em>Optional</em>. 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;

/** <em>Optional</em>. Number of undistributed prizes */
Expand All @@ -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 <em>Optional</em>. The number of other chats the user had to join in order to be eligible for the giveaway
* @param int $premium_subscription_month_count <em>Optional</em>. The number of months the Telegram Premium subscription won from the giveaway will be active for
* @param int $prize_star_count <em>Optional</em>. The number of Telegram Stars that were split between giveaway winners; for Telegram Star giveaways only
* @param int $premium_subscription_month_count <em>Optional</em>. 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 <em>Optional</em>. Number of undistributed prizes
* @param bool $only_new_members <em>Optional</em>. <em>True</em>, if only users who had joined the chats after the giveaway started were eligible to win
* @param bool $was_refunded <em>Optional</em>. <em>True</em>, if the giveaway was canceled because the payment for it was refunded
Expand All @@ -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,
Expand All @@ -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,
Expand Down
33 changes: 33 additions & 0 deletions src/Telegram/PaidMediaPurchased.php
Original file line number Diff line number Diff line change
@@ -0,0 +1,33 @@
<?php

/**
* This file is auto-generated.
*/

namespace Telepath\Telegram;

use Telepath\Types\Type;

/**
* This object contains information about a paid media purchase.
*/
class PaidMediaPurchased extends Type
{
/** User who purchased the media */
public User $from;

/** Bot-specified paid media payload */
public string $paid_media_payload;

/**
* @param User $from User who purchased the media
* @param string $paid_media_payload Bot-specified paid media payload
*/
public static function make(User $from, string $paid_media_payload): static
{
return new static([
'from' => $from,
'paid_media_payload' => $paid_media_payload,
]);
}
}
13 changes: 11 additions & 2 deletions src/Telegram/TransactionPartnerUser.php
Original file line number Diff line number Diff line change
Expand Up @@ -27,17 +27,26 @@ class TransactionPartnerUser extends TransactionPartner
*/
public ?array $paid_media = null;

/** <em>Optional</em>. Bot-specified paid media payload */
public ?string $paid_media_payload = null;

/**
* @param User $user Information about the user
* @param string $invoice_payload <em>Optional</em>. Bot-specified invoice payload
* @param PaidMedia[] $paid_media <em>Optional</em>. Information about the paid media bought by the user
* @param string $paid_media_payload <em>Optional</em>. 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,
]);
}
}
6 changes: 6 additions & 0 deletions src/Telegram/Update.php
Original file line number Diff line number Diff line change
Expand Up @@ -64,6 +64,9 @@ class Update extends Type
/** <em>Optional</em>. New incoming pre-checkout query. Contains full information about checkout */
public ?PreCheckoutQuery $pre_checkout_query = null;

/** <em>Optional</em>. 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;

/** <em>Optional</em>. New poll state. Bots receive only updates about manually stopped polls and polls, which are sent by the bot */
public ?Poll $poll = null;

Expand Down Expand Up @@ -102,6 +105,7 @@ class Update extends Type
* @param CallbackQuery $callback_query <em>Optional</em>. New incoming callback query
* @param ShippingQuery $shipping_query <em>Optional</em>. New incoming shipping query. Only for invoices with flexible price
* @param PreCheckoutQuery $pre_checkout_query <em>Optional</em>. New incoming pre-checkout query. Contains full information about checkout
* @param PaidMediaPurchased $purchased_paid_media <em>Optional</em>. A user purchased paid media with a non-empty payload sent by the bot in a non-channel chat
* @param Poll $poll <em>Optional</em>. New poll state. Bots receive only updates about manually stopped polls and polls, which are sent by the bot
* @param PollAnswer $poll_answer <em>Optional</em>. 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 <em>Optional</em>. 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.
Expand All @@ -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,
Expand All @@ -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,
Expand Down