Skip to content

Commit af951a5

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

15 files changed

Lines changed: 268 additions & 20 deletions

src/Layers/Generated.php

Lines changed: 30 additions & 3 deletions
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;
@@ -953,7 +954,7 @@ public function sendPoll(
953954
* @param bool $protect_content Protects the contents of the sent message from forwarding and saving
954955
* @param string $message_effect_id Unique identifier of the message effect to be added to the message
955956
* @param ReplyParameters $reply_parameters A JSON-serialized object for description of the message to reply to
956-
* @param InlineKeyboardMarkup $reply_markup A JSON-serialized object for an inline keyboard
957+
* @param InlineKeyboardMarkup $reply_markup A JSON-serialized object for an <a href="https://core.telegram.org/bots/features#inline-keyboards">inline keyboard</a>
957958
*
958959
* @throws TelegramException
959960
*/
@@ -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
*
@@ -2594,7 +2621,7 @@ public function stopMessageLiveLocation(
25942621
* @param int $chat_id Unique identifier for the target chat
25952622
* @param int $message_id Unique identifier for the target message
25962623
* @param InputChecklist $checklist A JSON-serialized object for the new checklist
2597-
* @param InlineKeyboardMarkup $reply_markup A JSON-serialized object for the new inline keyboard for the message
2624+
* @param InlineKeyboardMarkup $reply_markup A JSON-serialized object for the new <a href="https://core.telegram.org/bots/features#inline-keyboards">inline keyboard</a> for the message
25982625
*
25992626
* @throws TelegramException
26002627
*/

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/InlineQueryResultDocument.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -60,7 +60,7 @@ class InlineQueryResultDocument extends InlineQueryResult
6060
* @param string $parse_mode <em>Optional</em>. Mode for parsing entities in the document caption. See <a href="https://core.telegram.org/bots/api#formatting-options">formatting options</a> for more details.
6161
* @param MessageEntity[] $caption_entities <em>Optional</em>. List of special entities that appear in the caption, which can be specified instead of <em>parse_mode</em>
6262
* @param string $description <em>Optional</em>. Short description of the result
63-
* @param InlineKeyboardMarkup $reply_markup <em>Optional</em>. Inline keyboard attached to the message
63+
* @param InlineKeyboardMarkup $reply_markup <em>Optional</em>. <a href="https://core.telegram.org/bots/features#inline-keyboards">Inline keyboard</a> attached to the message
6464
* @param InputMessageContent $input_message_content <em>Optional</em>. Content of the message to be sent instead of the file
6565
* @param string $thumbnail_url <em>Optional</em>. URL of the thumbnail (JPEG only) for the file
6666
* @param int $thumbnail_width <em>Optional</em>. Thumbnail width

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,

0 commit comments

Comments
 (0)