Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Bot API 8.2 #76

Merged
merged 1 commit into from
Jan 7, 2025
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
58 changes: 55 additions & 3 deletions src/Layers/Generated.php
Original file line number Diff line number Diff line change
Expand Up @@ -85,7 +85,7 @@ public function getUpdates(
}

/**
* 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.
* 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.
*
* @param string $url HTTPS URL to send updates to. Use an empty string to remove webhook integration
* @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.
Expand Down Expand Up @@ -2242,8 +2242,8 @@ public function setStickerSetTitle(string $name, string $title): bool
*
* @param string $name Sticker set name
* @param int $user_id User identifier of the sticker set owner
* @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
* @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.
* @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
* @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.
*
* @throws TelegramException
*/
Expand Down Expand Up @@ -2286,6 +2286,7 @@ public function deleteStickerSet(string $name): bool
*
* @param int $user_id Unique identifier of the target user that will receive the gift
* @param string $gift_id Identifier of the gift
* @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
* @param string $text Text that will be shown along with the gift; 0-255 characters
* @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.
* @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.
Expand All @@ -2295,13 +2296,64 @@ public function deleteStickerSet(string $name): bool
public function sendGift(
int $user_id,
string $gift_id,
?bool $pay_for_upgrade = null,
?string $text = null,
?string $text_parse_mode = null,
?array $text_entities = null,
): bool {
return $this->raw('sendGift', func_get_args());
}

/**
* Verifies a user on behalf of the organization which is represented by the bot. Returns <em>True</em> on success.
*
* @param int $user_id Unique identifier of the target user
* @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.
*
* @throws TelegramException
*/
public function verifyUser(int $user_id, ?string $custom_description = null): bool
{
return $this->raw('verifyUser', func_get_args());
}

/**
* Verifies a chat on behalf of the organization which is represented by the bot. Returns <em>True</em> on success.
*
* @param int|string $chat_id Unique identifier for the target chat or username of the target channel (in the format @channelusername)
* @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.
*
* @throws TelegramException
*/
public function verifyChat(int|string $chat_id, ?string $custom_description = null): bool
{
return $this->raw('verifyChat', func_get_args());
}

/**
* Removes verification from a user who is currently verified on behalf of the organization represented by the bot. Returns <em>True</em> on success.
*
* @param int $user_id Unique identifier of the target user
*
* @throws TelegramException
*/
public function removeUserVerification(int $user_id): bool
{
return $this->raw('removeUserVerification', func_get_args());
}

/**
* Removes verification from a chat that is currently verified on behalf of the organization represented by the bot. Returns <em>True</em> on success.
*
* @param int|string $chat_id Unique identifier for the target chat or username of the target channel (in the format @channelusername)
*
* @throws TelegramException
*/
public function removeChatVerification(int|string $chat_id): bool
{
return $this->raw('removeChatVerification', func_get_args());
}

/**
* 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.
*
Expand Down
2 changes: 1 addition & 1 deletion src/Telegram/BackgroundTypePattern.php
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@
namespace Telepath\Telegram;

/**
* 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.
* 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.
*/
class BackgroundTypePattern extends BackgroundType
{
Expand Down
6 changes: 6 additions & 0 deletions src/Telegram/Gift.php
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,9 @@ class Gift extends Type
/** The number of Telegram Stars that must be paid to send the sticker */
public int $star_count;

/** <em>Optional</em>. The number of Telegram Stars that must be paid to upgrade the gift to a unique one */
public ?int $upgrade_star_count = null;

/** <em>Optional</em>. The total number of the gifts of this type that can be sent; for limited gifts only */
public ?int $total_count = null;

Expand All @@ -32,20 +35,23 @@ class Gift extends Type
* @param string $id Unique identifier of the gift
* @param Sticker $sticker The sticker that represents the gift
* @param int $star_count The number of Telegram Stars that must be paid to send the sticker
* @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
* @param int $total_count <em>Optional</em>. The total number of the gifts of this type that can be sent; for limited gifts only
* @param int $remaining_count <em>Optional</em>. The number of remaining gifts of this type that can be sent; for limited gifts only
*/
public static function make(
string $id,
Sticker $sticker,
int $star_count,
?int $upgrade_star_count = null,
?int $total_count = null,
?int $remaining_count = null,
): static {
return new static([
'id' => $id,
'sticker' => $sticker,
'star_count' => $star_count,
'upgrade_star_count' => $upgrade_star_count,
'total_count' => $total_count,
'remaining_count' => $remaining_count,
]);
Expand Down
6 changes: 0 additions & 6 deletions src/Telegram/InlineQueryResultArticle.php
Original file line number Diff line number Diff line change
Expand Up @@ -23,9 +23,6 @@ class InlineQueryResultArticle extends InlineQueryResult
/** <em>Optional</em>. URL of the result */
public ?string $url = null;

/** <em>Optional</em>. Pass <em>True</em> if you don't want the URL to be shown in the message */
public ?bool $hide_url = null;

/** <em>Optional</em>. Short description of the result */
public ?string $description = null;

Expand All @@ -44,7 +41,6 @@ class InlineQueryResultArticle extends InlineQueryResult
* @param InputMessageContent $input_message_content Content of the message to be sent
* @param InlineKeyboardMarkup $reply_markup <em>Optional</em>. <a href="https://core.telegram.org/bots/features#inline-keyboards">Inline keyboard</a> attached to the message
* @param string $url <em>Optional</em>. URL of the result
* @param bool $hide_url <em>Optional</em>. Pass <em>True</em> if you don't want the URL to be shown in the message
* @param string $description <em>Optional</em>. Short description of the result
* @param string $thumbnail_url <em>Optional</em>. Url of the thumbnail for the result
* @param int $thumbnail_width <em>Optional</em>. Thumbnail width
Expand All @@ -56,7 +52,6 @@ public static function make(
InputMessageContent $input_message_content,
?InlineKeyboardMarkup $reply_markup = null,
?string $url = null,
?bool $hide_url = null,
?string $description = null,
?string $thumbnail_url = null,
?int $thumbnail_width = null,
Expand All @@ -68,7 +63,6 @@ public static function make(
'input_message_content' => $input_message_content,
'reply_markup' => $reply_markup,
'url' => $url,
'hide_url' => $hide_url,
'description' => $description,
'thumbnail_url' => $thumbnail_url,
'thumbnail_width' => $thumbnail_width,
Expand Down
4 changes: 2 additions & 2 deletions src/Telegram/InlineQueryResultGif.php
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@ class InlineQueryResultGif extends InlineQueryResult
/** Type of the result, must be <em>gif</em> */
public string $type = 'gif';

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

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

/**
* @param string $id Unique identifier for this result, 1-64 bytes
* @param string $gif_url A valid URL for the GIF file. File size must not exceed 1MB
* @param string $gif_url A valid URL for the GIF file
* @param string $thumbnail_url URL of the static (JPEG or GIF) or animated (MPEG4) thumbnail for the result
* @param int $gif_width <em>Optional</em>. Width of the GIF
* @param int $gif_height <em>Optional</em>. Height of the GIF
Expand Down
4 changes: 2 additions & 2 deletions src/Telegram/InlineQueryResultMpeg4Gif.php
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@ class InlineQueryResultMpeg4Gif extends InlineQueryResult
/** Type of the result, must be <em>mpeg4_gif</em> */
public string $type = 'mpeg4_gif';

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

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

/**
* @param string $id Unique identifier for this result, 1-64 bytes
* @param string $mpeg4_url A valid URL for the MPEG4 file. File size must not exceed 1MB
* @param string $mpeg4_url A valid URL for the MPEG4 file
* @param string $thumbnail_url URL of the static (JPEG or GIF) or animated (MPEG4) thumbnail for the result
* @param int $mpeg4_width <em>Optional</em>. Video width
* @param int $mpeg4_height <em>Optional</em>. Video height
Expand Down
4 changes: 2 additions & 2 deletions src/Telegram/InputSticker.php
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@ class InputSticker extends Type
/** 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> */
public InputFile|string $sticker;

/** 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 */
/** 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 */
public string $format;

/**
Expand All @@ -39,7 +39,7 @@ class InputSticker extends Type

/**
* @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>
* @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
* @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
* @param string[] $emoji_list List of 1-20 emoji associated with the sticker
* @param MaskPosition $mask_position <em>Optional</em>. Position where the mask should be placed on faces. For “mask” stickers only.
* @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.
Expand Down
Loading