Skip to content

Commit 7b8f47d

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

14 files changed

Lines changed: 263 additions & 15 deletions

src/Layers/Generated.php

Lines changed: 28 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -66,6 +66,7 @@
6666
use Telepath\Telegram\Update;
6767
use Telepath\Telegram\User;
6868
use Telepath\Telegram\UserChatBoosts;
69+
use Telepath\Telegram\UserProfileAudios;
6970
use Telepath\Telegram\UserProfilePhotos;
7071
use Telepath\Telegram\WebhookInfo;
7172
use Telepath\Types\Enums\ChatActionType;
@@ -1080,6 +1081,20 @@ public function getUserProfilePhotos(int $user_id, ?int $offset = null, ?int $li
10801081
return $this->raw('getUserProfilePhotos', func_get_args());
10811082
}
10821083

1084+
/**
1085+
* Use this method to get a list of profile audios for a user. Returns a <a href="https://core.telegram.org/bots/api#userprofileaudios">UserProfileAudios</a> object.
1086+
*
1087+
* @param int $user_id Unique identifier of the target user
1088+
* @param int $offset Sequential number of the first audio to be returned. By default, all audios are returned.
1089+
* @param int $limit Limits the number of audios to be retrieved. Values between 1-100 are accepted. Defaults to 100.
1090+
*
1091+
* @throws TelegramException
1092+
*/
1093+
public function getUserProfileAudios(int $user_id, ?int $offset = null, ?int $limit = null): UserProfileAudios
1094+
{
1095+
return $this->raw('getUserProfileAudios', func_get_args());
1096+
}
1097+
10831098
/**
10841099
* Changes the emoji status for a given user that previously allowed the bot to manage their emoji status via the Mini App method <a href="https://core.telegram.org/bots/webapps#initializing-mini-apps">requestEmojiStatusAccess</a>. Returns <em>True</em> on success.
10851100
*
@@ -1597,7 +1612,7 @@ public function getForumTopicIconStickers(): array
15971612
}
15981613

15991614
/**
1600-
* Use this method to create a topic in a forum supergroup chat. The bot must be an administrator in the chat for this to work and must have the <em>can_manage_topics</em> administrator rights. Returns information about the created topic as a <a href="https://core.telegram.org/bots/api#forumtopic">ForumTopic</a> object.
1615+
* Use this method to create a topic in a forum supergroup chat or a private chat with a user. In the case of a supergroup chat the bot must be an administrator in the chat for this to work and must have the <em>can_manage_topics</em> administrator right. Returns information about the created topic as a <a href="https://core.telegram.org/bots/api#forumtopic">ForumTopic</a> object.
16011616
*
16021617
* @param int|string $chat_id Unique identifier for the target chat or username of the target supergroup (in the format @supergroupusername)
16031618
* @param string $name Topic name, 1-128 characters
@@ -1924,6 +1939,18 @@ public function getMyShortDescription(?string $language_code = null): BotShortDe
19241939
return $this->raw('getMyShortDescription', func_get_args());
19251940
}
19261941

1942+
/**
1943+
* Changes the profile photo of the bot. Returns <em>True</em> on success.
1944+
*
1945+
* @param InputProfilePhoto $photo The new profile photo to set
1946+
*
1947+
* @throws TelegramException
1948+
*/
1949+
public function setMyProfilePhoto(InputProfilePhoto $photo): bool
1950+
{
1951+
return $this->raw('setMyProfilePhoto', func_get_args());
1952+
}
1953+
19271954
/**
19281955
* Use this method to change the bot's menu button in a private chat, or the default menu button. Returns <em>True</em> on success.
19291956
*

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/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/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,

src/Telegram/KeyboardButton.php

Lines changed: 15 additions & 3 deletions
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 the reply keyboard. At most one of the optional fields must be used to specify type of the button. For simple text buttons, <em>String</em> can be used instead of this object to specify the button text.
12+
* This object represents one button of the reply keyboard. At most 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. For simple text buttons, <em>String</em> can be used instead of this object to specify the button text.
1313
*/
1414
class KeyboardButton extends Type
1515
{
16-
/** Text of the button. If none of the optional fields are used, it will be sent as a message when the button is pressed */
16+
/** Text of the button. If none of the fields other than <em>text</em>, <em>icon_custom_emoji_id</em>, and <em>style</em> are used, it will be sent as a message when the button is pressed */
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>. If specified, pressing the button will open a list of suitable users. Identifiers of selected users will be sent to the bot in a “users_shared” service message. Available in private chats only. */
2026
public ?KeyboardButtonRequestUsers $request_users = null;
2127

@@ -35,7 +41,9 @@ class KeyboardButton extends Type
3541
public ?WebAppInfo $web_app = null;
3642

3743
/**
38-
* @param string $text Text of the button. If none of the optional fields are used, it will be sent as a message when the button is pressed
44+
* @param string $text Text of the button. If none of the fields other than <em>text</em>, <em>icon_custom_emoji_id</em>, and <em>style</em> are used, it will be sent as a message when the button is pressed
45+
* @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.
46+
* @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.
3947
* @param KeyboardButtonRequestUsers $request_users <em>Optional</em>. If specified, pressing the button will open a list of suitable users. Identifiers of selected users will be sent to the bot in a “users_shared” service message. Available in private chats only.
4048
* @param KeyboardButtonRequestChat $request_chat <em>Optional</em>. If specified, pressing the button will open a list of suitable chats. Tapping on a chat will send its identifier to the bot in a “chat_shared” service message. Available in private chats only.
4149
* @param bool $request_contact <em>Optional</em>. If <em>True</em>, the user's phone number will be sent as a contact when the button is pressed. Available in private chats only.
@@ -45,6 +53,8 @@ class KeyboardButton extends Type
4553
*/
4654
public static function make(
4755
string $text,
56+
?string $icon_custom_emoji_id = null,
57+
?string $style = null,
4858
?KeyboardButtonRequestUsers $request_users = null,
4959
?KeyboardButtonRequestChat $request_chat = null,
5060
?bool $request_contact = null,
@@ -54,6 +64,8 @@ public static function make(
5464
): static {
5565
return new static([
5666
'text' => $text,
67+
'icon_custom_emoji_id' => $icon_custom_emoji_id,
68+
'style' => $style,
5769
'request_users' => $request_users,
5870
'request_chat' => $request_chat,
5971
'request_contact' => $request_contact,

src/Telegram/Message.php

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -184,6 +184,12 @@ class Message extends MaybeInaccessibleMessage
184184
/** <em>Optional</em>. A member was removed from the group, information about them (this member may be the bot itself) */
185185
public ?User $left_chat_member = null;
186186

187+
/** <em>Optional</em>. Service message: chat owner has left */
188+
public ?ChatOwnerLeft $chat_owner_left = null;
189+
190+
/** <em>Optional</em>. Service message: chat owner has changed */
191+
public ?ChatOwnerChanged $chat_owner_changed = null;
192+
187193
/** <em>Optional</em>. A chat title was changed to this value */
188194
public ?string $new_chat_title = null;
189195

@@ -390,6 +396,8 @@ class Message extends MaybeInaccessibleMessage
390396
* @param Location $location <em>Optional</em>. Message is a shared location, information about the location
391397
* @param User[] $new_chat_members <em>Optional</em>. New members that were added to the group or supergroup and information about them (the bot itself may be one of these members)
392398
* @param User $left_chat_member <em>Optional</em>. A member was removed from the group, information about them (this member may be the bot itself)
399+
* @param ChatOwnerLeft $chat_owner_left <em>Optional</em>. Service message: chat owner has left
400+
* @param ChatOwnerChanged $chat_owner_changed <em>Optional</em>. Service message: chat owner has changed
393401
* @param string $new_chat_title <em>Optional</em>. A chat title was changed to this value
394402
* @param PhotoSize[] $new_chat_photo <em>Optional</em>. A chat photo was change to this value
395403
* @param bool $delete_chat_photo <em>Optional</em>. Service message: the chat photo was deleted
@@ -495,6 +503,8 @@ public static function make(
495503
?Location $location = null,
496504
?array $new_chat_members = null,
497505
?User $left_chat_member = null,
506+
?ChatOwnerLeft $chat_owner_left = null,
507+
?ChatOwnerChanged $chat_owner_changed = null,
498508
?string $new_chat_title = null,
499509
?array $new_chat_photo = null,
500510
?bool $delete_chat_photo = null,
@@ -600,6 +610,8 @@ public static function make(
600610
'location' => $location,
601611
'new_chat_members' => $new_chat_members,
602612
'left_chat_member' => $left_chat_member,
613+
'chat_owner_left' => $chat_owner_left,
614+
'chat_owner_changed' => $chat_owner_changed,
603615
'new_chat_title' => $new_chat_title,
604616
'new_chat_photo' => $new_chat_photo,
605617
'delete_chat_photo' => $delete_chat_photo,

src/Telegram/UniqueGift.php

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -37,6 +37,9 @@ class UniqueGift extends Type
3737
/** <em>Optional</em>. <em>True</em>, if the original regular gift was exclusively purchaseable by Telegram Premium subscribers */
3838
public ?bool $is_premium = null;
3939

40+
/** <em>Optional</em>. <em>True</em>, if the gift was used to craft another gift and isn't available anymore */
41+
public ?bool $is_burned = null;
42+
4043
/** <em>Optional</em>. <em>True</em>, if the gift is assigned from the TON blockchain and can't be resold or transferred in Telegram */
4144
public ?bool $is_from_blockchain = null;
4245

@@ -55,6 +58,7 @@ class UniqueGift extends Type
5558
* @param UniqueGiftSymbol $symbol Symbol of the gift
5659
* @param UniqueGiftBackdrop $backdrop Backdrop of the gift
5760
* @param bool $is_premium <em>Optional</em>. <em>True</em>, if the original regular gift was exclusively purchaseable by Telegram Premium subscribers
61+
* @param bool $is_burned <em>Optional</em>. <em>True</em>, if the gift was used to craft another gift and isn't available anymore
5862
* @param bool $is_from_blockchain <em>Optional</em>. <em>True</em>, if the gift is assigned from the TON blockchain and can't be resold or transferred in Telegram
5963
* @param UniqueGiftColors $colors <em>Optional</em>. The color scheme that can be used by the gift's owner for the chat's name, replies to messages and link previews; for business account gifts and gifts that are currently on sale only
6064
* @param Chat $publisher_chat <em>Optional</em>. Information about the chat that published the gift
@@ -68,6 +72,7 @@ public static function make(
6872
UniqueGiftSymbol $symbol,
6973
UniqueGiftBackdrop $backdrop,
7074
?bool $is_premium = null,
75+
?bool $is_burned = null,
7176
?bool $is_from_blockchain = null,
7277
?UniqueGiftColors $colors = null,
7378
?Chat $publisher_chat = null,
@@ -81,6 +86,7 @@ public static function make(
8186
'symbol' => $symbol,
8287
'backdrop' => $backdrop,
8388
'is_premium' => $is_premium,
89+
'is_burned' => $is_burned,
8490
'is_from_blockchain' => $is_from_blockchain,
8591
'colors' => $colors,
8692
'publisher_chat' => $publisher_chat,

0 commit comments

Comments
 (0)