Skip to content

Commit ec062b8

Browse files
committed
Update code to reflect latest changes to the Bot API documentation
1 parent dd74fcf commit ec062b8

7 files changed

Lines changed: 68 additions & 16 deletions

File tree

src/Layers/Generated.php

Lines changed: 55 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -85,7 +85,7 @@ public function getUpdates(
8585
}
8686

8787
/**
88-
* Use this method to specify a URL and receive incoming updates via an outgoing webhook. Whenever there is an update for the bot, we will send an HTTPS POST request to the specified URL, containing a JSON-serialized <a href="https://core.telegram.org/bots/api#update">Update</a>. In case of an unsuccessful request, we will give up after a reasonable amount of attempts. Returns <em>True</em> on success.
88+
* Use this method to specify a URL and receive incoming updates via an outgoing webhook. Whenever there is an update for the bot, we will send an HTTPS POST request to the specified URL, containing a JSON-serialized <a href="https://core.telegram.org/bots/api#update">Update</a>. In case of an unsuccessful request (a request with response <a href="https://en.wikipedia.org/wiki/List_of_HTTP_status_codes">HTTP status code</a> different from 2XY), we will repeat the request and give up after a reasonable amount of attempts. Returns <em>True</em> on success.
8989
*
9090
* @param string $url HTTPS URL to send updates to. Use an empty string to remove webhook integration
9191
* @param InputFile $certificate Upload your public key certificate so that the root certificate in use can be checked. See our <a href="https://core.telegram.org/bots/self-signed">self-signed guide</a> for details.
@@ -2242,8 +2242,8 @@ public function setStickerSetTitle(string $name, string $title): bool
22422242
*
22432243
* @param string $name Sticker set name
22442244
* @param int $user_id User identifier of the sticker set owner
2245-
* @param string $format Format of the thumbnail, must be one of “static” for a .WEBP or .PNG image, “animated” for a .TGS animation, or “video” for a WEBM video
2246-
* @param InputFile|string $thumbnail A .WEBP or .PNG image with the thumbnail, must be up to 128 kilobytes in size and have a width and height of exactly 100px, or a .TGS animation with a thumbnail up to 32 kilobytes in size (see <a href="https://core.telegram.org/stickers#animation-requirements"><a href="https://core.telegram.org/stickers#animation-requirements">https://core.telegram.org/stickers#animation-requirements</a></a> for animated sticker technical requirements), or a WEBM video with the thumbnail up to 32 kilobytes in size; see <a href="https://core.telegram.org/stickers#video-requirements"><a href="https://core.telegram.org/stickers#video-requirements">https://core.telegram.org/stickers#video-requirements</a></a> for video sticker technical requirements. Pass a <em>file_id</em> as a String to send a file that already exists on the Telegram servers, pass an HTTP URL as a String for Telegram to get a file from the Internet, or upload a new one using multipart/form-data. <a href="https://core.telegram.org/bots/api#sending-files">More information on Sending Files &#xBB;</a>. Animated and video sticker set thumbnails can't be uploaded via HTTP URL. If omitted, then the thumbnail is dropped and the first sticker is used as the thumbnail.
2245+
* @param string $format Format of the thumbnail, must be one of “static” for a .WEBP or .PNG image, “animated” for a .TGS animation, or “video” for a .WEBM video
2246+
* @param InputFile|string $thumbnail A .WEBP or .PNG image with the thumbnail, must be up to 128 kilobytes in size and have a width and height of exactly 100px, or a .TGS animation with a thumbnail up to 32 kilobytes in size (see <a href="https://core.telegram.org/stickers#animation-requirements"><a href="https://core.telegram.org/stickers#animation-requirements">https://core.telegram.org/stickers#animation-requirements</a></a> for animated sticker technical requirements), or a .WEBM video with the thumbnail up to 32 kilobytes in size; see <a href="https://core.telegram.org/stickers#video-requirements"><a href="https://core.telegram.org/stickers#video-requirements">https://core.telegram.org/stickers#video-requirements</a></a> for video sticker technical requirements. Pass a <em>file_id</em> as a String to send a file that already exists on the Telegram servers, pass an HTTP URL as a String for Telegram to get a file from the Internet, or upload a new one using multipart/form-data. <a href="https://core.telegram.org/bots/api#sending-files">More information on Sending Files &#xBB;</a>. Animated and video sticker set thumbnails can't be uploaded via HTTP URL. If omitted, then the thumbnail is dropped and the first sticker is used as the thumbnail.
22472247
*
22482248
* @throws TelegramException
22492249
*/
@@ -2286,6 +2286,7 @@ public function deleteStickerSet(string $name): bool
22862286
*
22872287
* @param int $user_id Unique identifier of the target user that will receive the gift
22882288
* @param string $gift_id Identifier of the gift
2289+
* @param bool $pay_for_upgrade Pass <em>True</em> to pay for the gift upgrade from the bot's balance, thereby making the upgrade free for the receiver
22892290
* @param string $text Text that will be shown along with the gift; 0-255 characters
22902291
* @param string $text_parse_mode Mode for parsing entities in the text. See <a href="https://core.telegram.org/bots/api#formatting-options">formatting options</a> for more details. Entities other than “bold”, “italic”, “underline”, “strikethrough”, “spoiler”, and “custom_emoji” are ignored.
22912292
* @param MessageEntity[] $text_entities A JSON-serialized list of special entities that appear in the gift text. It can be specified instead of <em>text_parse_mode</em>. Entities other than “bold”, “italic”, “underline”, “strikethrough”, “spoiler”, and “custom_emoji” are ignored.
@@ -2295,13 +2296,64 @@ public function deleteStickerSet(string $name): bool
22952296
public function sendGift(
22962297
int $user_id,
22972298
string $gift_id,
2299+
?bool $pay_for_upgrade = null,
22982300
?string $text = null,
22992301
?string $text_parse_mode = null,
23002302
?array $text_entities = null,
23012303
): bool {
23022304
return $this->raw('sendGift', func_get_args());
23032305
}
23042306

2307+
/**
2308+
* Verifies a user on behalf of the organization which is represented by the bot. Returns <em>True</em> on success.
2309+
*
2310+
* @param int $user_id Unique identifier of the target user
2311+
* @param string $custom_description Custom description for the verification; 0-70 characters. Must be empty if the organization isn't allowed to provide a custom verification description.
2312+
*
2313+
* @throws TelegramException
2314+
*/
2315+
public function verifyUser(int $user_id, ?string $custom_description = null): bool
2316+
{
2317+
return $this->raw('verifyUser', func_get_args());
2318+
}
2319+
2320+
/**
2321+
* Verifies a chat on behalf of the organization which is represented by the bot. Returns <em>True</em> on success.
2322+
*
2323+
* @param int|string $chat_id Unique identifier for the target chat or username of the target channel (in the format @channelusername)
2324+
* @param string $custom_description Custom description for the verification; 0-70 characters. Must be empty if the organization isn't allowed to provide a custom verification description.
2325+
*
2326+
* @throws TelegramException
2327+
*/
2328+
public function verifyChat(int|string $chat_id, ?string $custom_description = null): bool
2329+
{
2330+
return $this->raw('verifyChat', func_get_args());
2331+
}
2332+
2333+
/**
2334+
* Removes verification from a user who is currently verified on behalf of the organization represented by the bot. Returns <em>True</em> on success.
2335+
*
2336+
* @param int $user_id Unique identifier of the target user
2337+
*
2338+
* @throws TelegramException
2339+
*/
2340+
public function removeUserVerification(int $user_id): bool
2341+
{
2342+
return $this->raw('removeUserVerification', func_get_args());
2343+
}
2344+
2345+
/**
2346+
* Removes verification from a chat that is currently verified on behalf of the organization represented by the bot. Returns <em>True</em> on success.
2347+
*
2348+
* @param int|string $chat_id Unique identifier for the target chat or username of the target channel (in the format @channelusername)
2349+
*
2350+
* @throws TelegramException
2351+
*/
2352+
public function removeChatVerification(int|string $chat_id): bool
2353+
{
2354+
return $this->raw('removeChatVerification', func_get_args());
2355+
}
2356+
23052357
/**
23062358
* Use this method to send answers to an inline query. On success, <em>True</em> is returned.No more than 50 results per query are allowed.
23072359
*

src/Telegram/BackgroundTypePattern.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@
77
namespace Telepath\Telegram;
88

99
/**
10-
* The background is a PNG or TGV (gzipped subset of SVG with MIME type “application/x-tgwallpattern”) pattern to be combined with the background fill chosen by the user.
10+
* The background is a .PNG or .TGV (gzipped subset of SVG with MIME type “application/x-tgwallpattern”) pattern to be combined with the background fill chosen by the user.
1111
*/
1212
class BackgroundTypePattern extends BackgroundType
1313
{

src/Telegram/Gift.php

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -22,6 +22,9 @@ class Gift extends Type
2222
/** The number of Telegram Stars that must be paid to send the sticker */
2323
public int $star_count;
2424

25+
/** <em>Optional</em>. The number of Telegram Stars that must be paid to upgrade the gift to a unique one */
26+
public ?int $upgrade_star_count = null;
27+
2528
/** <em>Optional</em>. The total number of the gifts of this type that can be sent; for limited gifts only */
2629
public ?int $total_count = null;
2730

@@ -32,20 +35,23 @@ class Gift extends Type
3235
* @param string $id Unique identifier of the gift
3336
* @param Sticker $sticker The sticker that represents the gift
3437
* @param int $star_count The number of Telegram Stars that must be paid to send the sticker
38+
* @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
3539
* @param int $total_count <em>Optional</em>. The total number of the gifts of this type that can be sent; for limited gifts only
3640
* @param int $remaining_count <em>Optional</em>. The number of remaining gifts of this type that can be sent; for limited gifts only
3741
*/
3842
public static function make(
3943
string $id,
4044
Sticker $sticker,
4145
int $star_count,
46+
?int $upgrade_star_count = null,
4247
?int $total_count = null,
4348
?int $remaining_count = null,
4449
): static {
4550
return new static([
4651
'id' => $id,
4752
'sticker' => $sticker,
4853
'star_count' => $star_count,
54+
'upgrade_star_count' => $upgrade_star_count,
4955
'total_count' => $total_count,
5056
'remaining_count' => $remaining_count,
5157
]);

src/Telegram/InlineQueryResultArticle.php

Lines changed: 0 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -23,9 +23,6 @@ class InlineQueryResultArticle extends InlineQueryResult
2323
/** <em>Optional</em>. URL of the result */
2424
public ?string $url = null;
2525

26-
/** <em>Optional</em>. Pass <em>True</em> if you don't want the URL to be shown in the message */
27-
public ?bool $hide_url = null;
28-
2926
/** <em>Optional</em>. Short description of the result */
3027
public ?string $description = null;
3128

@@ -44,7 +41,6 @@ class InlineQueryResultArticle extends InlineQueryResult
4441
* @param InputMessageContent $input_message_content Content of the message to be sent
4542
* @param InlineKeyboardMarkup $reply_markup <em>Optional</em>. <a href="https://core.telegram.org/bots/features#inline-keyboards">Inline keyboard</a> attached to the message
4643
* @param string $url <em>Optional</em>. URL of the result
47-
* @param bool $hide_url <em>Optional</em>. Pass <em>True</em> if you don't want the URL to be shown in the message
4844
* @param string $description <em>Optional</em>. Short description of the result
4945
* @param string $thumbnail_url <em>Optional</em>. Url of the thumbnail for the result
5046
* @param int $thumbnail_width <em>Optional</em>. Thumbnail width
@@ -56,7 +52,6 @@ public static function make(
5652
InputMessageContent $input_message_content,
5753
?InlineKeyboardMarkup $reply_markup = null,
5854
?string $url = null,
59-
?bool $hide_url = null,
6055
?string $description = null,
6156
?string $thumbnail_url = null,
6257
?int $thumbnail_width = null,
@@ -68,7 +63,6 @@ public static function make(
6863
'input_message_content' => $input_message_content,
6964
'reply_markup' => $reply_markup,
7065
'url' => $url,
71-
'hide_url' => $hide_url,
7266
'description' => $description,
7367
'thumbnail_url' => $thumbnail_url,
7468
'thumbnail_width' => $thumbnail_width,

src/Telegram/InlineQueryResultGif.php

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,7 @@ class InlineQueryResultGif extends InlineQueryResult
1414
/** Type of the result, must be <em>gif</em> */
1515
public string $type = 'gif';
1616

17-
/** A valid URL for the GIF file. File size must not exceed 1MB */
17+
/** A valid URL for the GIF file */
1818
public string $gif_url;
1919

2020
/** URL of the static (JPEG or GIF) or animated (MPEG4) thumbnail for the result */
@@ -56,7 +56,7 @@ class InlineQueryResultGif extends InlineQueryResult
5656

5757
/**
5858
* @param string $id Unique identifier for this result, 1-64 bytes
59-
* @param string $gif_url A valid URL for the GIF file. File size must not exceed 1MB
59+
* @param string $gif_url A valid URL for the GIF file
6060
* @param string $thumbnail_url URL of the static (JPEG or GIF) or animated (MPEG4) thumbnail for the result
6161
* @param int $gif_width <em>Optional</em>. Width of the GIF
6262
* @param int $gif_height <em>Optional</em>. Height of the GIF

src/Telegram/InlineQueryResultMpeg4Gif.php

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,7 @@ class InlineQueryResultMpeg4Gif extends InlineQueryResult
1414
/** Type of the result, must be <em>mpeg4_gif</em> */
1515
public string $type = 'mpeg4_gif';
1616

17-
/** A valid URL for the MPEG4 file. File size must not exceed 1MB */
17+
/** A valid URL for the MPEG4 file */
1818
public string $mpeg4_url;
1919

2020
/** URL of the static (JPEG or GIF) or animated (MPEG4) thumbnail for the result */
@@ -56,7 +56,7 @@ class InlineQueryResultMpeg4Gif extends InlineQueryResult
5656

5757
/**
5858
* @param string $id Unique identifier for this result, 1-64 bytes
59-
* @param string $mpeg4_url A valid URL for the MPEG4 file. File size must not exceed 1MB
59+
* @param string $mpeg4_url A valid URL for the MPEG4 file
6060
* @param string $thumbnail_url URL of the static (JPEG or GIF) or animated (MPEG4) thumbnail for the result
6161
* @param int $mpeg4_width <em>Optional</em>. Video width
6262
* @param int $mpeg4_height <em>Optional</em>. Video height

src/Telegram/InputSticker.php

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -17,7 +17,7 @@ class InputSticker extends Type
1717
/** The added sticker. Pass a <em>file_id</em> as a String to send a file that already exists on the Telegram servers, pass an HTTP URL as a String for Telegram to get a file from the Internet, upload a new one using multipart/form-data, or pass “attach://<file_attach_name>” to upload a new one using multipart/form-data under <file_attach_name> name. Animated and video stickers can't be uploaded via HTTP URL. <a href="https://core.telegram.org/bots/api#sending-files">More information on Sending Files &#xBB;</a> */
1818
public InputFile|string $sticker;
1919

20-
/** Format of the added sticker, must be one of “static” for a .WEBP or .PNG image, “animated” for a .TGS animation, “video” for a WEBM video */
20+
/** Format of the added sticker, must be one of “static” for a .WEBP or .PNG image, “animated” for a .TGS animation, “video” for a .WEBM video */
2121
public string $format;
2222

2323
/**
@@ -39,7 +39,7 @@ class InputSticker extends Type
3939

4040
/**
4141
* @param InputFile|string $sticker The added sticker. Pass a <em>file_id</em> as a String to send a file that already exists on the Telegram servers, pass an HTTP URL as a String for Telegram to get a file from the Internet, upload a new one using multipart/form-data, or pass “attach://<file_attach_name>” to upload a new one using multipart/form-data under <file_attach_name> name. Animated and video stickers can't be uploaded via HTTP URL. <a href="https://core.telegram.org/bots/api#sending-files">More information on Sending Files &#xBB;</a>
42-
* @param string $format Format of the added sticker, must be one of “static” for a .WEBP or .PNG image, “animated” for a .TGS animation, “video” for a WEBM video
42+
* @param string $format Format of the added sticker, must be one of “static” for a .WEBP or .PNG image, “animated” for a .TGS animation, “video” for a .WEBM video
4343
* @param string[] $emoji_list List of 1-20 emoji associated with the sticker
4444
* @param MaskPosition $mask_position <em>Optional</em>. Position where the mask should be placed on faces. For “mask” stickers only.
4545
* @param string[] $keywords <em>Optional</em>. List of 0-20 search keywords for the sticker with total length of up to 64 characters. For “regular” and “custom_emoji” stickers only.

0 commit comments

Comments
 (0)