Skip to content

Commit 7d81411

Browse files
TiiFuchsgithub-actions[bot]
authored andcommitted
Update code to reflect latest changes to the Bot API documentation
1 parent 7242e5b commit 7d81411

35 files changed

Lines changed: 801 additions & 88 deletions

src/Layers/Generated.php

Lines changed: 145 additions & 49 deletions
Large diffs are not rendered by default.

src/Telegram/ChatAdministratorRights.php

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -61,6 +61,9 @@ class ChatAdministratorRights extends Type
6161
/** <em>Optional</em>. <em>True</em>, if the administrator can manage direct messages of the channel and decline suggested posts; for channels only */
6262
public ?bool $can_manage_direct_messages = null;
6363

64+
/** <em>Optional</em>. <em>True</em>, if the administrator can edit the tags of regular members; for groups and supergroups only. If omitted defaults to the value of can_pin_messages. */
65+
public ?bool $can_manage_tags = null;
66+
6467
/**
6568
* @param bool $is_anonymous <em>True</em>, if the user's presence in the chat is hidden
6669
* @param bool $can_manage_chat <em>True</em>, if the administrator can access the chat event log, get boost list, see hidden supergroup and channel members, report spam messages, ignore slow mode, and send messages to the chat without paying Telegram Stars. Implied by any other administrator privilege.
@@ -78,6 +81,7 @@ class ChatAdministratorRights extends Type
7881
* @param bool $can_pin_messages <em>Optional</em>. <em>True</em>, if the user is allowed to pin messages; for groups and supergroups only
7982
* @param bool $can_manage_topics <em>Optional</em>. <em>True</em>, if the user is allowed to create, rename, close, and reopen forum topics; for supergroups only
8083
* @param bool $can_manage_direct_messages <em>Optional</em>. <em>True</em>, if the administrator can manage direct messages of the channel and decline suggested posts; for channels only
84+
* @param bool $can_manage_tags <em>Optional</em>. <em>True</em>, if the administrator can edit the tags of regular members; for groups and supergroups only. If omitted defaults to the value of can_pin_messages.
8185
*/
8286
public static function make(
8387
bool $is_anonymous,
@@ -96,6 +100,7 @@ public static function make(
96100
?bool $can_pin_messages = null,
97101
?bool $can_manage_topics = null,
98102
?bool $can_manage_direct_messages = null,
103+
?bool $can_manage_tags = null,
99104
): static {
100105
return new static([
101106
'is_anonymous' => $is_anonymous,
@@ -114,6 +119,7 @@ public static function make(
114119
'can_pin_messages' => $can_pin_messages,
115120
'can_manage_topics' => $can_manage_topics,
116121
'can_manage_direct_messages' => $can_manage_direct_messages,
122+
'can_manage_tags' => $can_manage_tags,
117123
]);
118124
}
119125
}

src/Telegram/ChatFullInfo.php

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -165,6 +165,9 @@ class ChatFullInfo extends Type
165165
/** <em>Optional</em>. For private chats, the rating of the user if any */
166166
public ?UserRating $rating = null;
167167

168+
/** <em>Optional</em>. For private chats, the first audio added to the profile of the user */
169+
public ?Audio $first_profile_audio = null;
170+
168171
/** <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 */
169172
public ?UniqueGiftColors $unique_gift_colors = null;
170173

@@ -220,6 +223,7 @@ class ChatFullInfo extends Type
220223
* @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.
221224
* @param ChatLocation $location <em>Optional</em>. For supergroups, the location to which the supergroup is connected
222225
* @param UserRating $rating <em>Optional</em>. For private chats, the rating of the user if any
226+
* @param Audio $first_profile_audio <em>Optional</em>. For private chats, the first audio added to the profile of the user
223227
* @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
224228
* @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
225229
*/
@@ -272,6 +276,7 @@ public static function make(
272276
?int $linked_chat_id = null,
273277
?ChatLocation $location = null,
274278
?UserRating $rating = null,
279+
?Audio $first_profile_audio = null,
275280
?UniqueGiftColors $unique_gift_colors = null,
276281
?int $paid_message_star_count = null,
277282
): static {
@@ -324,6 +329,7 @@ public static function make(
324329
'linked_chat_id' => $linked_chat_id,
325330
'location' => $location,
326331
'rating' => $rating,
332+
'first_profile_audio' => $first_profile_audio,
327333
'unique_gift_colors' => $unique_gift_colors,
328334
'paid_message_star_count' => $paid_message_star_count,
329335
]);

src/Telegram/ChatMemberAdministrator.php

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -65,6 +65,9 @@ class ChatMemberAdministrator extends ChatMember
6565
/** <em>Optional</em>. <em>True</em>, if the administrator can manage direct messages of the channel and decline suggested posts; for channels only */
6666
public ?bool $can_manage_direct_messages = null;
6767

68+
/** <em>Optional</em>. <em>True</em>, if the administrator can edit the tags of regular members; for groups and supergroups only. If omitted defaults to the value of can_pin_messages. */
69+
public ?bool $can_manage_tags = null;
70+
6871
/** <em>Optional</em>. Custom title for this user */
6972
public ?string $custom_title = null;
7073

@@ -87,6 +90,7 @@ class ChatMemberAdministrator extends ChatMember
8790
* @param bool $can_pin_messages <em>Optional</em>. <em>True</em>, if the user is allowed to pin messages; for groups and supergroups only
8891
* @param bool $can_manage_topics <em>Optional</em>. <em>True</em>, if the user is allowed to create, rename, close, and reopen forum topics; for supergroups only
8992
* @param bool $can_manage_direct_messages <em>Optional</em>. <em>True</em>, if the administrator can manage direct messages of the channel and decline suggested posts; for channels only
93+
* @param bool $can_manage_tags <em>Optional</em>. <em>True</em>, if the administrator can edit the tags of regular members; for groups and supergroups only. If omitted defaults to the value of can_pin_messages.
9094
* @param string $custom_title <em>Optional</em>. Custom title for this user
9195
*/
9296
public static function make(
@@ -108,6 +112,7 @@ public static function make(
108112
?bool $can_pin_messages = null,
109113
?bool $can_manage_topics = null,
110114
?bool $can_manage_direct_messages = null,
115+
?bool $can_manage_tags = null,
111116
?string $custom_title = null,
112117
): static {
113118
return new static([
@@ -129,6 +134,7 @@ public static function make(
129134
'can_pin_messages' => $can_pin_messages,
130135
'can_manage_topics' => $can_manage_topics,
131136
'can_manage_direct_messages' => $can_manage_direct_messages,
137+
'can_manage_tags' => $can_manage_tags,
132138
'custom_title' => $custom_title,
133139
]);
134140
}

src/Telegram/ChatMemberMember.php

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -14,17 +14,22 @@ class ChatMemberMember extends ChatMember
1414
/** The member's status in the chat, always “member” */
1515
public string $status = 'member';
1616

17+
/** <em>Optional</em>. Tag of the member */
18+
public ?string $tag = null;
19+
1720
/** <em>Optional</em>. Date when the user's subscription will expire; Unix time */
1821
public ?int $until_date = null;
1922

2023
/**
2124
* @param User $user Information about the user
25+
* @param string $tag <em>Optional</em>. Tag of the member
2226
* @param int $until_date <em>Optional</em>. Date when the user's subscription will expire; Unix time
2327
*/
24-
public static function make(User $user, ?int $until_date = null): static
28+
public static function make(User $user, ?string $tag = null, ?int $until_date = null): static
2529
{
2630
return new static([
2731
'user' => $user,
32+
'tag' => $tag,
2833
'until_date' => $until_date,
2934
]);
3035
}

src/Telegram/ChatMemberRestricted.php

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -47,6 +47,9 @@ class ChatMemberRestricted extends ChatMember
4747
/** <em>True</em>, if the user is allowed to add web page previews to their messages */
4848
public bool $can_add_web_page_previews;
4949

50+
/** <em>True</em>, if the user is allowed to edit their own tag */
51+
public bool $can_edit_tag;
52+
5053
/** <em>True</em>, if the user is allowed to change the chat title, photo and other settings */
5154
public bool $can_change_info;
5255

@@ -62,6 +65,9 @@ class ChatMemberRestricted extends ChatMember
6265
/** Date when restrictions will be lifted for this user; Unix time. If 0, then the user is restricted forever */
6366
public int $until_date;
6467

68+
/** <em>Optional</em>. Tag of the member */
69+
public ?string $tag = null;
70+
6571
/**
6672
* @param User $user Information about the user
6773
* @param bool $is_member <em>True</em>, if the user is a member of the chat at the moment of the request
@@ -75,11 +81,13 @@ class ChatMemberRestricted extends ChatMember
7581
* @param bool $can_send_polls <em>True</em>, if the user is allowed to send polls and checklists
7682
* @param bool $can_send_other_messages <em>True</em>, if the user is allowed to send animations, games, stickers and use inline bots
7783
* @param bool $can_add_web_page_previews <em>True</em>, if the user is allowed to add web page previews to their messages
84+
* @param bool $can_edit_tag <em>True</em>, if the user is allowed to edit their own tag
7885
* @param bool $can_change_info <em>True</em>, if the user is allowed to change the chat title, photo and other settings
7986
* @param bool $can_invite_users <em>True</em>, if the user is allowed to invite new users to the chat
8087
* @param bool $can_pin_messages <em>True</em>, if the user is allowed to pin messages
8188
* @param bool $can_manage_topics <em>True</em>, if the user is allowed to create forum topics
8289
* @param int $until_date Date when restrictions will be lifted for this user; Unix time. If 0, then the user is restricted forever
90+
* @param string $tag <em>Optional</em>. Tag of the member
8391
*/
8492
public static function make(
8593
User $user,
@@ -94,11 +102,13 @@ public static function make(
94102
bool $can_send_polls,
95103
bool $can_send_other_messages,
96104
bool $can_add_web_page_previews,
105+
bool $can_edit_tag,
97106
bool $can_change_info,
98107
bool $can_invite_users,
99108
bool $can_pin_messages,
100109
bool $can_manage_topics,
101110
int $until_date,
111+
?string $tag = null,
102112
): static {
103113
return new static([
104114
'user' => $user,
@@ -113,11 +123,13 @@ public static function make(
113123
'can_send_polls' => $can_send_polls,
114124
'can_send_other_messages' => $can_send_other_messages,
115125
'can_add_web_page_previews' => $can_add_web_page_previews,
126+
'can_edit_tag' => $can_edit_tag,
116127
'can_change_info' => $can_change_info,
117128
'can_invite_users' => $can_invite_users,
118129
'can_pin_messages' => $can_pin_messages,
119130
'can_manage_topics' => $can_manage_topics,
120131
'until_date' => $until_date,
132+
'tag' => $tag,
121133
]);
122134
}
123135
}

src/Telegram/ChatOwnerChanged.php

Lines changed: 28 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,28 @@
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+
* Describes a service message about an ownership change in the chat.
13+
*/
14+
class ChatOwnerChanged extends Type
15+
{
16+
/** The new owner of the chat */
17+
public User $new_owner;
18+
19+
/**
20+
* @param User $new_owner The new owner of the chat
21+
*/
22+
public static function make(User $new_owner): static
23+
{
24+
return new static([
25+
'new_owner' => $new_owner,
26+
]);
27+
}
28+
}

src/Telegram/ChatOwnerLeft.php

Lines changed: 28 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,28 @@
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+
* Describes a service message about the chat owner leaving the chat.
13+
*/
14+
class ChatOwnerLeft extends Type
15+
{
16+
/** <em>Optional</em>. The user which will be the new owner of the chat if the previous owner does not return to the chat */
17+
public ?User $new_owner = null;
18+
19+
/**
20+
* @param User $new_owner <em>Optional</em>. The user which will be the new owner of the chat if the previous owner does not return to the chat
21+
*/
22+
public static function make(?User $new_owner = null): static
23+
{
24+
return new static([
25+
'new_owner' => $new_owner,
26+
]);
27+
}
28+
}

src/Telegram/ChatPermissions.php

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -43,6 +43,9 @@ class ChatPermissions extends Type
4343
/** <em>Optional</em>. <em>True</em>, if the user is allowed to add web page previews to their messages */
4444
public ?bool $can_add_web_page_previews = null;
4545

46+
/** <em>Optional</em>. <em>True</em>, if the user is allowed to edit their own tag */
47+
public ?bool $can_edit_tag = null;
48+
4649
/** <em>Optional</em>. <em>True</em>, if the user is allowed to change the chat title, photo and other settings. Ignored in public supergroups */
4750
public ?bool $can_change_info = null;
4851

@@ -66,6 +69,7 @@ class ChatPermissions extends Type
6669
* @param bool $can_send_polls <em>Optional</em>. <em>True</em>, if the user is allowed to send polls and checklists
6770
* @param bool $can_send_other_messages <em>Optional</em>. <em>True</em>, if the user is allowed to send animations, games, stickers and use inline bots
6871
* @param bool $can_add_web_page_previews <em>Optional</em>. <em>True</em>, if the user is allowed to add web page previews to their messages
72+
* @param bool $can_edit_tag <em>Optional</em>. <em>True</em>, if the user is allowed to edit their own tag
6973
* @param bool $can_change_info <em>Optional</em>. <em>True</em>, if the user is allowed to change the chat title, photo and other settings. Ignored in public supergroups
7074
* @param bool $can_invite_users <em>Optional</em>. <em>True</em>, if the user is allowed to invite new users to the chat
7175
* @param bool $can_pin_messages <em>Optional</em>. <em>True</em>, if the user is allowed to pin messages. Ignored in public supergroups
@@ -82,6 +86,7 @@ public static function make(
8286
?bool $can_send_polls = null,
8387
?bool $can_send_other_messages = null,
8488
?bool $can_add_web_page_previews = null,
89+
?bool $can_edit_tag = null,
8590
?bool $can_change_info = null,
8691
?bool $can_invite_users = null,
8792
?bool $can_pin_messages = null,
@@ -98,6 +103,7 @@ public static function make(
98103
'can_send_polls' => $can_send_polls,
99104
'can_send_other_messages' => $can_send_other_messages,
100105
'can_add_web_page_previews' => $can_add_web_page_previews,
106+
'can_edit_tag' => $can_edit_tag,
101107
'can_change_info' => $can_change_info,
102108
'can_invite_users' => $can_invite_users,
103109
'can_pin_messages' => $can_pin_messages,

src/Telegram/InlineKeyboardButton.php

Lines changed: 13 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -9,13 +9,19 @@
99
use Telepath\Types\Type;
1010

1111
/**
12-
* This object represents one button of an inline keyboard. Exactly one of the optional fields must be used to specify type of the button.
12+
* This object represents one button of an inline keyboard. Exactly one of the fields other than <em>text</em>, <em>icon_custom_emoji_id</em>, and <em>style</em> must be used to specify the type of the button.
1313
*/
1414
class InlineKeyboardButton extends Type
1515
{
1616
/** Label text on the button */
1717
public string $text;
1818

19+
/** <em>Optional</em>. Unique identifier of the custom emoji shown before the text of the button. Can only be used by bots that purchased additional usernames on <a href="https://fragment.com">Fragment</a> or in the messages directly sent by the bot to private, group and supergroup chats if the owner of the bot has a Telegram Premium subscription. */
20+
public ?string $icon_custom_emoji_id = null;
21+
22+
/** <em>Optional</em>. Style of the button. Must be one of “danger” (red), “success” (green) or “primary” (blue). If omitted, then an app-specific style is used. */
23+
public ?string $style = null;
24+
1925
/** <em>Optional</em>. HTTP or tg:// URL to be opened when the button is pressed. Links tg://user?id=<user_id> can be used to mention a user by their identifier without using a username, if this is allowed by their privacy settings. */
2026
public ?string $url = null;
2127

@@ -48,6 +54,8 @@ class InlineKeyboardButton extends Type
4854

4955
/**
5056
* @param string $text Label text on the button
57+
* @param string $icon_custom_emoji_id <em>Optional</em>. Unique identifier of the custom emoji shown before the text of the button. Can only be used by bots that purchased additional usernames on <a href="https://fragment.com">Fragment</a> or in the messages directly sent by the bot to private, group and supergroup chats if the owner of the bot has a Telegram Premium subscription.
58+
* @param string $style <em>Optional</em>. Style of the button. Must be one of “danger” (red), “success” (green) or “primary” (blue). If omitted, then an app-specific style is used.
5159
* @param string $url <em>Optional</em>. HTTP or tg:// URL to be opened when the button is pressed. Links tg://user?id=<user_id> can be used to mention a user by their identifier without using a username, if this is allowed by their privacy settings.
5260
* @param string $callback_data <em>Optional</em>. Data to be sent in a <a href="https://core.telegram.org/bots/api#callbackquery">callback query</a> to the bot when the button is pressed, 1-64 bytes
5361
* @param WebAppInfo $web_app <em>Optional</em>. Description of the <a href="https://core.telegram.org/bots/webapps">Web App</a> that will be launched when the user presses the button. The Web App will be able to send an arbitrary message on behalf of the user using the method <a href="https://core.telegram.org/bots/api#answerwebappquery">answerWebAppQuery</a>. Available only in private chats between a user and the bot. Not supported for messages sent on behalf of a Telegram Business account.
@@ -61,6 +69,8 @@ class InlineKeyboardButton extends Type
6169
*/
6270
public static function make(
6371
string $text,
72+
?string $icon_custom_emoji_id = null,
73+
?string $style = null,
6474
?string $url = null,
6575
?string $callback_data = null,
6676
?WebAppInfo $web_app = null,
@@ -74,6 +84,8 @@ public static function make(
7484
): static {
7585
return new static([
7686
'text' => $text,
87+
'icon_custom_emoji_id' => $icon_custom_emoji_id,
88+
'style' => $style,
7789
'url' => $url,
7890
'callback_data' => $callback_data,
7991
'web_app' => $web_app,

0 commit comments

Comments
 (0)