Skip to content

Commit 7242e5b

Browse files
committed
Update code to reflect latest changes to the Bot API documentation
1 parent c05487c commit 7242e5b

18 files changed

Lines changed: 478 additions & 63 deletions

src/Layers/Generated.php

Lines changed: 147 additions & 31 deletions
Large diffs are not rendered by default.

src/Telegram/AcceptedGiftTypes.php

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -25,23 +25,29 @@ class AcceptedGiftTypes extends Type
2525
/** <em>True</em>, if a Telegram Premium subscription is accepted */
2626
public bool $premium_subscription;
2727

28+
/** <em>True</em>, if transfers of unique gifts from channels are accepted */
29+
public bool $gifts_from_channels;
30+
2831
/**
2932
* @param bool $unlimited_gifts <em>True</em>, if unlimited regular gifts are accepted
3033
* @param bool $limited_gifts <em>True</em>, if limited regular gifts are accepted
3134
* @param bool $unique_gifts <em>True</em>, if unique gifts or gifts that can be upgraded to unique for free are accepted
3235
* @param bool $premium_subscription <em>True</em>, if a Telegram Premium subscription is accepted
36+
* @param bool $gifts_from_channels <em>True</em>, if transfers of unique gifts from channels are accepted
3337
*/
3438
public static function make(
3539
bool $unlimited_gifts,
3640
bool $limited_gifts,
3741
bool $unique_gifts,
3842
bool $premium_subscription,
43+
bool $gifts_from_channels,
3944
): static {
4045
return new static([
4146
'unlimited_gifts' => $unlimited_gifts,
4247
'limited_gifts' => $limited_gifts,
4348
'unique_gifts' => $unique_gifts,
4449
'premium_subscription' => $premium_subscription,
50+
'gifts_from_channels' => $gifts_from_channels,
4551
]);
4652
}
4753
}

src/Telegram/ChatFullInfo.php

Lines changed: 18 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -162,6 +162,15 @@ class ChatFullInfo extends Type
162162
/** <em>Optional</em>. For supergroups, the location to which the supergroup is connected */
163163
public ?ChatLocation $location = null;
164164

165+
/** <em>Optional</em>. For private chats, the rating of the user if any */
166+
public ?UserRating $rating = null;
167+
168+
/** <em>Optional</em>. The color scheme based on a unique gift that must be used for the chat's name, message replies and link previews */
169+
public ?UniqueGiftColors $unique_gift_colors = null;
170+
171+
/** <em>Optional</em>. The number of Telegram Stars a general user have to pay to send a message to the chat */
172+
public ?int $paid_message_star_count = null;
173+
165174
/**
166175
* @param int $id Unique identifier for this chat. This number may have more than 32 significant bits and some programming languages may have difficulty/silent defects in interpreting it. But it has at most 52 significant bits, so a signed 64-bit integer or double-precision float type are safe for storing this identifier.
167176
* @param string $type Type of the chat, can be either “private”, “group”, “supergroup” or “channel”
@@ -210,6 +219,9 @@ class ChatFullInfo extends Type
210219
* @param string $custom_emoji_sticker_set_name <em>Optional</em>. For supergroups, the name of the group's custom emoji sticker set. Custom emoji from this set can be used by all users and bots in the group.
211220
* @param int $linked_chat_id <em>Optional</em>. Unique identifier for the linked chat, i.e. the discussion group identifier for a channel and vice versa; for supergroups and channel chats. This identifier may be greater than 32 bits and some programming languages may have difficulty/silent defects in interpreting it. But it is smaller than 52 bits, so a signed 64 bit integer or double-precision float type are safe for storing this identifier.
212221
* @param ChatLocation $location <em>Optional</em>. For supergroups, the location to which the supergroup is connected
222+
* @param UserRating $rating <em>Optional</em>. For private chats, the rating of the user if any
223+
* @param UniqueGiftColors $unique_gift_colors <em>Optional</em>. The color scheme based on a unique gift that must be used for the chat's name, message replies and link previews
224+
* @param int $paid_message_star_count <em>Optional</em>. The number of Telegram Stars a general user have to pay to send a message to the chat
213225
*/
214226
public static function make(
215227
int $id,
@@ -259,6 +271,9 @@ public static function make(
259271
?string $custom_emoji_sticker_set_name = null,
260272
?int $linked_chat_id = null,
261273
?ChatLocation $location = null,
274+
?UserRating $rating = null,
275+
?UniqueGiftColors $unique_gift_colors = null,
276+
?int $paid_message_star_count = null,
262277
): static {
263278
return new static([
264279
'id' => $id,
@@ -308,6 +323,9 @@ public static function make(
308323
'custom_emoji_sticker_set_name' => $custom_emoji_sticker_set_name,
309324
'linked_chat_id' => $linked_chat_id,
310325
'location' => $location,
326+
'rating' => $rating,
327+
'unique_gift_colors' => $unique_gift_colors,
328+
'paid_message_star_count' => $paid_message_star_count,
311329
]);
312330
}
313331
}

src/Telegram/ChecklistTask.php

Lines changed: 8 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -26,31 +26,37 @@ class ChecklistTask extends Type
2626
*/
2727
public ?array $text_entities = null;
2828

29-
/** <em>Optional</em>. User that completed the task; omitted if the task wasn't completed */
29+
/** <em>Optional</em>. User that completed the task; omitted if the task wasn't completed by a user */
3030
public ?User $completed_by_user = null;
3131

32+
/** <em>Optional</em>. Chat that completed the task; omitted if the task wasn't completed by a chat */
33+
public ?Chat $completed_by_chat = null;
34+
3235
/** <em>Optional</em>. Point in time (Unix timestamp) when the task was completed; 0 if the task wasn't completed */
3336
public ?int $completion_date = null;
3437

3538
/**
3639
* @param int $id Unique identifier of the task
3740
* @param string $text Text of the task
3841
* @param MessageEntity[] $text_entities <em>Optional</em>. Special entities that appear in the task text
39-
* @param User $completed_by_user <em>Optional</em>. User that completed the task; omitted if the task wasn't completed
42+
* @param User $completed_by_user <em>Optional</em>. User that completed the task; omitted if the task wasn't completed by a user
43+
* @param Chat $completed_by_chat <em>Optional</em>. Chat that completed the task; omitted if the task wasn't completed by a chat
4044
* @param int $completion_date <em>Optional</em>. Point in time (Unix timestamp) when the task was completed; 0 if the task wasn't completed
4145
*/
4246
public static function make(
4347
int $id,
4448
string $text,
4549
?array $text_entities = null,
4650
?User $completed_by_user = null,
51+
?Chat $completed_by_chat = null,
4752
?int $completion_date = null,
4853
): static {
4954
return new static([
5055
'id' => $id,
5156
'text' => $text,
5257
'text_entities' => $text_entities,
5358
'completed_by_user' => $completed_by_user,
59+
'completed_by_chat' => $completed_by_chat,
5460
'completion_date' => $completion_date,
5561
]);
5662
}

src/Telegram/ForumTopic.php

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -25,23 +25,29 @@ class ForumTopic extends Type
2525
/** <em>Optional</em>. Unique identifier of the custom emoji shown as the topic icon */
2626
public ?string $icon_custom_emoji_id = null;
2727

28+
/** <em>Optional</em>. <em>True</em>, if the name of the topic wasn't specified explicitly by its creator and likely needs to be changed by the bot */
29+
public ?bool $is_name_implicit = null;
30+
2831
/**
2932
* @param int $message_thread_id Unique identifier of the forum topic
3033
* @param string $name Name of the topic
3134
* @param int $icon_color Color of the topic icon in RGB format
3235
* @param string $icon_custom_emoji_id <em>Optional</em>. Unique identifier of the custom emoji shown as the topic icon
36+
* @param bool $is_name_implicit <em>Optional</em>. <em>True</em>, if the name of the topic wasn't specified explicitly by its creator and likely needs to be changed by the bot
3337
*/
3438
public static function make(
3539
int $message_thread_id,
3640
string $name,
3741
int $icon_color,
3842
?string $icon_custom_emoji_id = null,
43+
?bool $is_name_implicit = null,
3944
): static {
4045
return new static([
4146
'message_thread_id' => $message_thread_id,
4247
'name' => $name,
4348
'icon_color' => $icon_color,
4449
'icon_custom_emoji_id' => $icon_custom_emoji_id,
50+
'is_name_implicit' => $is_name_implicit,
4551
]);
4652
}
4753
}

src/Telegram/ForumTopicCreated.php

Lines changed: 11 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -22,17 +22,26 @@ class ForumTopicCreated extends Type
2222
/** <em>Optional</em>. Unique identifier of the custom emoji shown as the topic icon */
2323
public ?string $icon_custom_emoji_id = null;
2424

25+
/** <em>Optional</em>. <em>True</em>, if the name of the topic wasn't specified explicitly by its creator and likely needs to be changed by the bot */
26+
public ?bool $is_name_implicit = null;
27+
2528
/**
2629
* @param string $name Name of the topic
2730
* @param int $icon_color Color of the topic icon in RGB format
2831
* @param string $icon_custom_emoji_id <em>Optional</em>. Unique identifier of the custom emoji shown as the topic icon
32+
* @param bool $is_name_implicit <em>Optional</em>. <em>True</em>, if the name of the topic wasn't specified explicitly by its creator and likely needs to be changed by the bot
2933
*/
30-
public static function make(string $name, int $icon_color, ?string $icon_custom_emoji_id = null): static
31-
{
34+
public static function make(
35+
string $name,
36+
int $icon_color,
37+
?string $icon_custom_emoji_id = null,
38+
?bool $is_name_implicit = null,
39+
): static {
3240
return new static([
3341
'name' => $name,
3442
'icon_color' => $icon_color,
3543
'icon_custom_emoji_id' => $icon_custom_emoji_id,
44+
'is_name_implicit' => $is_name_implicit,
3645
]);
3746
}
3847
}

src/Telegram/Gift.php

Lines changed: 40 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -25,12 +25,30 @@ class Gift extends Type
2525
/** <em>Optional</em>. The number of Telegram Stars that must be paid to upgrade the gift to a unique one */
2626
public ?int $upgrade_star_count = null;
2727

28-
/** <em>Optional</em>. The total number of the gifts of this type that can be sent; for limited gifts only */
28+
/** <em>Optional</em>. <em>True</em>, if the gift can only be purchased by Telegram Premium subscribers */
29+
public ?bool $is_premium = null;
30+
31+
/** <em>Optional</em>. <em>True</em>, if the gift can be used (after being upgraded) to customize a user's appearance */
32+
public ?bool $has_colors = null;
33+
34+
/** <em>Optional</em>. The total number of gifts of this type that can be sent by all users; for limited gifts only */
2935
public ?int $total_count = null;
3036

31-
/** <em>Optional</em>. The number of remaining gifts of this type that can be sent; for limited gifts only */
37+
/** <em>Optional</em>. The number of remaining gifts of this type that can be sent by all users; for limited gifts only */
3238
public ?int $remaining_count = null;
3339

40+
/** <em>Optional</em>. The total number of gifts of this type that can be sent by the bot; for limited gifts only */
41+
public ?int $personal_total_count = null;
42+
43+
/** <em>Optional</em>. The number of remaining gifts of this type that can be sent by the bot; for limited gifts only */
44+
public ?int $personal_remaining_count = null;
45+
46+
/** <em>Optional</em>. Background of the gift */
47+
public ?GiftBackground $background = null;
48+
49+
/** <em>Optional</em>. The total number of different unique gifts that can be obtained by upgrading the gift */
50+
public ?int $unique_gift_variant_count = null;
51+
3452
/** <em>Optional</em>. Information about the chat that published the gift */
3553
public ?Chat $publisher_chat = null;
3654

@@ -39,26 +57,44 @@ class Gift extends Type
3957
* @param Sticker $sticker The sticker that represents the gift
4058
* @param int $star_count The number of Telegram Stars that must be paid to send the sticker
4159
* @param int $upgrade_star_count <em>Optional</em>. The number of Telegram Stars that must be paid to upgrade the gift to a unique one
42-
* @param int $total_count <em>Optional</em>. The total number of the gifts of this type that can be sent; for limited gifts only
43-
* @param int $remaining_count <em>Optional</em>. The number of remaining gifts of this type that can be sent; for limited gifts only
60+
* @param bool $is_premium <em>Optional</em>. <em>True</em>, if the gift can only be purchased by Telegram Premium subscribers
61+
* @param bool $has_colors <em>Optional</em>. <em>True</em>, if the gift can be used (after being upgraded) to customize a user's appearance
62+
* @param int $total_count <em>Optional</em>. The total number of gifts of this type that can be sent by all users; for limited gifts only
63+
* @param int $remaining_count <em>Optional</em>. The number of remaining gifts of this type that can be sent by all users; for limited gifts only
64+
* @param int $personal_total_count <em>Optional</em>. The total number of gifts of this type that can be sent by the bot; for limited gifts only
65+
* @param int $personal_remaining_count <em>Optional</em>. The number of remaining gifts of this type that can be sent by the bot; for limited gifts only
66+
* @param GiftBackground $background <em>Optional</em>. Background of the gift
67+
* @param int $unique_gift_variant_count <em>Optional</em>. The total number of different unique gifts that can be obtained by upgrading the gift
4468
* @param Chat $publisher_chat <em>Optional</em>. Information about the chat that published the gift
4569
*/
4670
public static function make(
4771
string $id,
4872
Sticker $sticker,
4973
int $star_count,
5074
?int $upgrade_star_count = null,
75+
?bool $is_premium = null,
76+
?bool $has_colors = null,
5177
?int $total_count = null,
5278
?int $remaining_count = null,
79+
?int $personal_total_count = null,
80+
?int $personal_remaining_count = null,
81+
?GiftBackground $background = null,
82+
?int $unique_gift_variant_count = null,
5383
?Chat $publisher_chat = null,
5484
): static {
5585
return new static([
5686
'id' => $id,
5787
'sticker' => $sticker,
5888
'star_count' => $star_count,
5989
'upgrade_star_count' => $upgrade_star_count,
90+
'is_premium' => $is_premium,
91+
'has_colors' => $has_colors,
6092
'total_count' => $total_count,
6193
'remaining_count' => $remaining_count,
94+
'personal_total_count' => $personal_total_count,
95+
'personal_remaining_count' => $personal_remaining_count,
96+
'background' => $background,
97+
'unique_gift_variant_count' => $unique_gift_variant_count,
6298
'publisher_chat' => $publisher_chat,
6399
]);
64100
}

src/Telegram/GiftBackground.php

Lines changed: 38 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,38 @@
1+
<?php
2+
3+
/**
4+
* This file is auto-generated.
5+
*/
6+
7+
namespace Telepath\Telegram;
8+
9+
use Telepath\Types\Type;
10+
11+
/**
12+
* This object describes the background of a gift.
13+
*/
14+
class GiftBackground extends Type
15+
{
16+
/** Center color of the background in RGB format */
17+
public int $center_color;
18+
19+
/** Edge color of the background in RGB format */
20+
public int $edge_color;
21+
22+
/** Text color of the background in RGB format */
23+
public int $text_color;
24+
25+
/**
26+
* @param int $center_color Center color of the background in RGB format
27+
* @param int $edge_color Edge color of the background in RGB format
28+
* @param int $text_color Text color of the background in RGB format
29+
*/
30+
public static function make(int $center_color, int $edge_color, int $text_color): static
31+
{
32+
return new static([
33+
'center_color' => $center_color,
34+
'edge_color' => $edge_color,
35+
'text_color' => $text_color,
36+
]);
37+
}
38+
}

src/Telegram/GiftInfo.php

Lines changed: 14 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -22,9 +22,12 @@ class GiftInfo extends Type
2222
/** <em>Optional</em>. Number of Telegram Stars that can be claimed by the receiver by converting the gift; omitted if conversion to Telegram Stars is impossible */
2323
public ?int $convert_star_count = null;
2424

25-
/** <em>Optional</em>. Number of Telegram Stars that were prepaid by the sender for the ability to upgrade the gift */
25+
/** <em>Optional</em>. Number of Telegram Stars that were prepaid for the ability to upgrade the gift */
2626
public ?int $prepaid_upgrade_star_count = null;
2727

28+
/** <em>Optional</em>. <em>True</em>, if the gift's upgrade was purchased after the gift was sent */
29+
public ?bool $is_upgrade_separate = null;
30+
2831
/** <em>Optional</em>. <em>True</em>, if the gift can be upgraded to a unique gift */
2932
public ?bool $can_be_upgraded = null;
3033

@@ -41,35 +44,44 @@ class GiftInfo extends Type
4144
/** <em>Optional</em>. <em>True</em>, if the sender and gift text are shown only to the gift receiver; otherwise, everyone will be able to see them */
4245
public ?bool $is_private = null;
4346

47+
/** <em>Optional</em>. Unique number reserved for this gift when upgraded. See the <em>number</em> field in <a href="https://core.telegram.org/bots/api#uniquegift">UniqueGift</a> */
48+
public ?int $unique_gift_number = null;
49+
4450
/**
4551
* @param Gift $gift Information about the gift
4652
* @param string $owned_gift_id <em>Optional</em>. Unique identifier of the received gift for the bot; only present for gifts received on behalf of business accounts
4753
* @param int $convert_star_count <em>Optional</em>. Number of Telegram Stars that can be claimed by the receiver by converting the gift; omitted if conversion to Telegram Stars is impossible
48-
* @param int $prepaid_upgrade_star_count <em>Optional</em>. Number of Telegram Stars that were prepaid by the sender for the ability to upgrade the gift
54+
* @param int $prepaid_upgrade_star_count <em>Optional</em>. Number of Telegram Stars that were prepaid for the ability to upgrade the gift
55+
* @param bool $is_upgrade_separate <em>Optional</em>. <em>True</em>, if the gift's upgrade was purchased after the gift was sent
4956
* @param bool $can_be_upgraded <em>Optional</em>. <em>True</em>, if the gift can be upgraded to a unique gift
5057
* @param string $text <em>Optional</em>. Text of the message that was added to the gift
5158
* @param MessageEntity[] $entities <em>Optional</em>. Special entities that appear in the text
5259
* @param bool $is_private <em>Optional</em>. <em>True</em>, if the sender and gift text are shown only to the gift receiver; otherwise, everyone will be able to see them
60+
* @param int $unique_gift_number <em>Optional</em>. Unique number reserved for this gift when upgraded. See the <em>number</em> field in <a href="https://core.telegram.org/bots/api#uniquegift">UniqueGift</a>
5361
*/
5462
public static function make(
5563
Gift $gift,
5664
?string $owned_gift_id = null,
5765
?int $convert_star_count = null,
5866
?int $prepaid_upgrade_star_count = null,
67+
?bool $is_upgrade_separate = null,
5968
?bool $can_be_upgraded = null,
6069
?string $text = null,
6170
?array $entities = null,
6271
?bool $is_private = null,
72+
?int $unique_gift_number = null,
6373
): static {
6474
return new static([
6575
'gift' => $gift,
6676
'owned_gift_id' => $owned_gift_id,
6777
'convert_star_count' => $convert_star_count,
6878
'prepaid_upgrade_star_count' => $prepaid_upgrade_star_count,
79+
'is_upgrade_separate' => $is_upgrade_separate,
6980
'can_be_upgraded' => $can_be_upgraded,
7081
'text' => $text,
7182
'entities' => $entities,
7283
'is_private' => $is_private,
84+
'unique_gift_number' => $unique_gift_number,
7385
]);
7486
}
7587
}

0 commit comments

Comments
 (0)