Skip to content

Commit 4fada31

Browse files
committed
Update code to reflect latest changes to the Bot API documentation
1 parent 375309e commit 4fada31

10 files changed

Lines changed: 111 additions & 20 deletions

src/Layers/Generated.php

Lines changed: 15 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -205,6 +205,7 @@ public function sendMessage(
205205
* @param int|string $from_chat_id Unique identifier for the chat where the original message was sent (or channel username in the format @channelusername)
206206
* @param int $message_id Message identifier in the chat specified in <em>from_chat_id</em>
207207
* @param int $message_thread_id Unique identifier for the target message thread (topic) of the forum; for forum supergroups only
208+
* @param int $video_start_timestamp New start timestamp for the forwarded video in the message
208209
* @param bool $disable_notification Sends the message <a href="https://telegram.org/blog/channels-2-0#silent-messages">silently</a>. Users will receive a notification with no sound.
209210
* @param bool $protect_content Protects the contents of the forwarded message from forwarding and saving
210211
*
@@ -215,6 +216,7 @@ public function forwardMessage(
215216
int|string $from_chat_id,
216217
int $message_id,
217218
?int $message_thread_id = null,
219+
?int $video_start_timestamp = null,
218220
?bool $disable_notification = null,
219221
?bool $protect_content = null,
220222
): Message {
@@ -251,6 +253,7 @@ public function forwardMessages(
251253
* @param int|string $from_chat_id Unique identifier for the chat where the original message was sent (or channel username in the format @channelusername)
252254
* @param int $message_id Message identifier in the chat specified in <em>from_chat_id</em>
253255
* @param int $message_thread_id Unique identifier for the target message thread (topic) of the forum; for forum supergroups only
256+
* @param int $video_start_timestamp New start timestamp for the copied video in the message
254257
* @param string $caption New caption for media, 0-1024 characters after entities parsing. If not specified, the original caption is kept
255258
* @param ParseMode|string $parse_mode Mode for parsing entities in the new caption. See <a href="https://core.telegram.org/bots/api#formatting-options">formatting options</a> for more details.
256259
* @param MessageEntity[] $caption_entities A JSON-serialized list of special entities that appear in the new caption, which can be specified instead of <em>parse_mode</em>
@@ -268,6 +271,7 @@ public function copyMessage(
268271
int|string $from_chat_id,
269272
int $message_id,
270273
?int $message_thread_id = null,
274+
?int $video_start_timestamp = null,
271275
?string $caption = null,
272276
ParseMode|string|null $parse_mode = null,
273277
?array $caption_entities = null,
@@ -444,6 +448,8 @@ public function sendDocument(
444448
* @param int $width Video width
445449
* @param int $height Video height
446450
* @param InputFile|string $thumbnail Thumbnail of the file sent; can be ignored if thumbnail generation for the file is supported server-side. The thumbnail should be in JPEG format and less than 200 kB in size. A thumbnail's width and height should not exceed 320. Ignored if the file is not uploaded using multipart/form-data. Thumbnails can't be reused and can be only uploaded as a new file, so you can pass “attach://<file_attach_name>” if the thumbnail was uploaded using multipart/form-data under <file_attach_name>. <a href="https://core.telegram.org/bots/api#sending-files">More information on Sending Files &#xBB;</a>
451+
* @param InputFile|string $cover Cover for the video in the message. Pass a file_id to send a file that exists on the Telegram servers (recommended), pass an HTTP URL for Telegram to get a file from the Internet, or pass “attach://<file_attach_name>” to upload a new one using multipart/form-data under <file_attach_name> name. <a href="https://core.telegram.org/bots/api#sending-files">More information on Sending Files &#xBB;</a>
452+
* @param int $start_timestamp Start timestamp for the video in the message
447453
* @param string $caption Video caption (may also be used when resending videos by <em>file_id</em>), 0-1024 characters after entities parsing
448454
* @param ParseMode|string $parse_mode Mode for parsing entities in the video caption. See <a href="https://core.telegram.org/bots/api#formatting-options">formatting options</a> for more details.
449455
* @param MessageEntity[] $caption_entities A JSON-serialized list of special entities that appear in the caption, which can be specified instead of <em>parse_mode</em>
@@ -468,6 +474,8 @@ public function sendVideo(
468474
?int $width = null,
469475
?int $height = null,
470476
InputFile|string|null $thumbnail = null,
477+
InputFile|string|null $cover = null,
478+
?int $start_timestamp = null,
471479
?string $caption = null,
472480
ParseMode|string|null $parse_mode = null,
473481
?array $caption_entities = null,
@@ -909,7 +917,7 @@ public function sendChatAction(
909917
}
910918

911919
/**
912-
* Use this method to change the chosen reactions on a message. Service messages can't be reacted to. Automatically forwarded messages from a channel to its discussion group have the same available reactions as messages in the channel. Bots can't use paid reactions. Returns <em>True</em> on success.
920+
* Use this method to change the chosen reactions on a message. Service messages of some types can't be reacted to. Automatically forwarded messages from a channel to its discussion group have the same available reactions as messages in the channel. Bots can't use paid reactions. Returns <em>True</em> on success.
913921
*
914922
* @param int|string $chat_id Unique identifier for the target chat or username of the target channel (in the format @channelusername)
915923
* @param int $message_id Identifier of the target message. If the message belongs to a media group, the reaction is set to the first non-deleted message in the group instead.
@@ -2282,20 +2290,22 @@ public function deleteStickerSet(string $name): bool
22822290
}
22832291

22842292
/**
2285-
* Sends a gift to the given user. The gift can't be converted to Telegram Stars by the user. Returns <em>True</em> on success.
2293+
* Sends a gift to the given user or channel chat. The gift can't be converted to Telegram Stars by the receiver. Returns <em>True</em> on success.
22862294
*
2287-
* @param int $user_id Unique identifier of the target user that will receive the gift
22882295
* @param string $gift_id Identifier of the gift
2296+
* @param int $user_id Required if <em>chat_id</em> is not specified. Unique identifier of the target user who will receive the gift.
2297+
* @param int|string $chat_id Required if <em>user_id</em> is not specified. Unique identifier for the chat or username of the channel (in the format @channelusername) that will receive the gift.
22892298
* @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
2290-
* @param string $text Text that will be shown along with the gift; 0-255 characters
2299+
* @param string $text Text that will be shown along with the gift; 0-128 characters
22912300
* @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.
22922301
* @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.
22932302
*
22942303
* @throws TelegramException
22952304
*/
22962305
public function sendGift(
2297-
int $user_id,
22982306
string $gift_id,
2307+
?int $user_id = null,
2308+
int|string|null $chat_id = null,
22992309
?bool $pay_for_upgrade = null,
23002310
?string $text = null,
23012311
?string $text_parse_mode = null,

src/Telegram/ChatFullInfo.php

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -114,6 +114,9 @@ class ChatFullInfo extends Type
114114
/** <em>Optional</em>. Default chat member permissions, for groups and supergroups */
115115
public ?ChatPermissions $permissions = null;
116116

117+
/** <em>Optional</em>. <em>True</em>, if gifts can be sent to the chat */
118+
public ?bool $can_send_gift = null;
119+
117120
/** <em>Optional</em>. <em>True</em>, if paid media messages can be sent or forwarded to the channel chat. The field is available only for channel chats. */
118121
public ?bool $can_send_paid_media = null;
119122

@@ -185,6 +188,7 @@ class ChatFullInfo extends Type
185188
* @param string $invite_link <em>Optional</em>. Primary invite link, for groups, supergroups and channel chats
186189
* @param Message $pinned_message <em>Optional</em>. The most recent pinned message (by sending date)
187190
* @param ChatPermissions $permissions <em>Optional</em>. Default chat member permissions, for groups and supergroups
191+
* @param bool $can_send_gift <em>Optional</em>. <em>True</em>, if gifts can be sent to the chat
188192
* @param bool $can_send_paid_media <em>Optional</em>. <em>True</em>, if paid media messages can be sent or forwarded to the channel chat. The field is available only for channel chats.
189193
* @param int $slow_mode_delay <em>Optional</em>. For supergroups, the minimum allowed delay between consecutive messages sent by each unprivileged user; in seconds
190194
* @param int $unrestrict_boost_count <em>Optional</em>. For supergroups, the minimum number of boosts that a non-administrator user needs to add in order to ignore slow mode and chat permissions
@@ -231,6 +235,7 @@ public static function make(
231235
?string $invite_link = null,
232236
?Message $pinned_message = null,
233237
?ChatPermissions $permissions = null,
238+
?bool $can_send_gift = null,
234239
?bool $can_send_paid_media = null,
235240
?int $slow_mode_delay = null,
236241
?int $unrestrict_boost_count = null,
@@ -277,6 +282,7 @@ public static function make(
277282
'invite_link' => $invite_link,
278283
'pinned_message' => $pinned_message,
279284
'permissions' => $permissions,
285+
'can_send_gift' => $can_send_gift,
280286
'can_send_paid_media' => $can_send_paid_media,
281287
'slow_mode_delay' => $slow_mode_delay,
282288
'unrestrict_boost_count' => $unrestrict_boost_count,

src/Telegram/InputMediaAnimation.php

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -17,7 +17,7 @@ class InputMediaAnimation extends InputMedia
1717
public string $type = 'animation';
1818

1919
/** <em>Optional</em>. Thumbnail of the file sent; can be ignored if thumbnail generation for the file is supported server-side. The thumbnail should be in JPEG format and less than 200 kB in size. A thumbnail's width and height should not exceed 320. Ignored if the file is not uploaded using multipart/form-data. Thumbnails can't be reused and can be only uploaded as a new file, so you can pass “attach://<file_attach_name>” if the thumbnail was uploaded using multipart/form-data under <file_attach_name>. <a href="https://core.telegram.org/bots/api#sending-files">More information on Sending Files &#xBB;</a> */
20-
public InputFile|string|null $thumbnail = null;
20+
public string|InputFile|null $thumbnail = null;
2121

2222
/** <em>Optional</em>. Pass <em>True</em>, if the caption must be shown above the message media */
2323
public ?bool $show_caption_above_media = null;
@@ -36,7 +36,7 @@ class InputMediaAnimation extends InputMedia
3636

3737
/**
3838
* @param string|InputFile $media File to send. Pass a file_id to send a file that exists on the Telegram servers (recommended), pass an HTTP URL for Telegram to get a file from the Internet, or pass “attach://<file_attach_name>” to upload a new one using multipart/form-data under <file_attach_name> name. <a href="https://core.telegram.org/bots/api#sending-files">More information on Sending Files &#xBB;</a>
39-
* @param InputFile|string $thumbnail <em>Optional</em>. Thumbnail of the file sent; can be ignored if thumbnail generation for the file is supported server-side. The thumbnail should be in JPEG format and less than 200 kB in size. A thumbnail's width and height should not exceed 320. Ignored if the file is not uploaded using multipart/form-data. Thumbnails can't be reused and can be only uploaded as a new file, so you can pass “attach://<file_attach_name>” if the thumbnail was uploaded using multipart/form-data under <file_attach_name>. <a href="https://core.telegram.org/bots/api#sending-files">More information on Sending Files &#xBB;</a>
39+
* @param string|InputFile $thumbnail <em>Optional</em>. Thumbnail of the file sent; can be ignored if thumbnail generation for the file is supported server-side. The thumbnail should be in JPEG format and less than 200 kB in size. A thumbnail's width and height should not exceed 320. Ignored if the file is not uploaded using multipart/form-data. Thumbnails can't be reused and can be only uploaded as a new file, so you can pass “attach://<file_attach_name>” if the thumbnail was uploaded using multipart/form-data under <file_attach_name>. <a href="https://core.telegram.org/bots/api#sending-files">More information on Sending Files &#xBB;</a>
4040
* @param string $caption <em>Optional</em>. Caption of the animation to be sent, 0-1024 characters after entities parsing
4141
* @param string $parse_mode <em>Optional</em>. Mode for parsing entities in the animation caption. See <a href="https://core.telegram.org/bots/api#formatting-options">formatting options</a> for more details.
4242
* @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>
@@ -48,7 +48,7 @@ class InputMediaAnimation extends InputMedia
4848
*/
4949
public static function make(
5050
string|InputFile $media,
51-
InputFile|string|null $thumbnail = null,
51+
string|InputFile|null $thumbnail = null,
5252
?string $caption = null,
5353
?string $parse_mode = null,
5454
?array $caption_entities = null,

src/Telegram/InputMediaAudio.php

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -17,7 +17,7 @@ class InputMediaAudio extends InputMedia
1717
public string $type = 'audio';
1818

1919
/** <em>Optional</em>. Thumbnail of the file sent; can be ignored if thumbnail generation for the file is supported server-side. The thumbnail should be in JPEG format and less than 200 kB in size. A thumbnail's width and height should not exceed 320. Ignored if the file is not uploaded using multipart/form-data. Thumbnails can't be reused and can be only uploaded as a new file, so you can pass “attach://<file_attach_name>” if the thumbnail was uploaded using multipart/form-data under <file_attach_name>. <a href="https://core.telegram.org/bots/api#sending-files">More information on Sending Files &#xBB;</a> */
20-
public InputFile|string|null $thumbnail = null;
20+
public string|InputFile|null $thumbnail = null;
2121

2222
/** <em>Optional</em>. Duration of the audio in seconds */
2323
public ?int $duration = null;
@@ -30,7 +30,7 @@ class InputMediaAudio extends InputMedia
3030

3131
/**
3232
* @param string|InputFile $media File to send. Pass a file_id to send a file that exists on the Telegram servers (recommended), pass an HTTP URL for Telegram to get a file from the Internet, or pass “attach://<file_attach_name>” to upload a new one using multipart/form-data under <file_attach_name> name. <a href="https://core.telegram.org/bots/api#sending-files">More information on Sending Files &#xBB;</a>
33-
* @param InputFile|string $thumbnail <em>Optional</em>. Thumbnail of the file sent; can be ignored if thumbnail generation for the file is supported server-side. The thumbnail should be in JPEG format and less than 200 kB in size. A thumbnail's width and height should not exceed 320. Ignored if the file is not uploaded using multipart/form-data. Thumbnails can't be reused and can be only uploaded as a new file, so you can pass “attach://<file_attach_name>” if the thumbnail was uploaded using multipart/form-data under <file_attach_name>. <a href="https://core.telegram.org/bots/api#sending-files">More information on Sending Files &#xBB;</a>
33+
* @param string|InputFile $thumbnail <em>Optional</em>. Thumbnail of the file sent; can be ignored if thumbnail generation for the file is supported server-side. The thumbnail should be in JPEG format and less than 200 kB in size. A thumbnail's width and height should not exceed 320. Ignored if the file is not uploaded using multipart/form-data. Thumbnails can't be reused and can be only uploaded as a new file, so you can pass “attach://<file_attach_name>” if the thumbnail was uploaded using multipart/form-data under <file_attach_name>. <a href="https://core.telegram.org/bots/api#sending-files">More information on Sending Files &#xBB;</a>
3434
* @param string $caption <em>Optional</em>. Caption of the audio to be sent, 0-1024 characters after entities parsing
3535
* @param string $parse_mode <em>Optional</em>. Mode for parsing entities in the audio caption. See <a href="https://core.telegram.org/bots/api#formatting-options">formatting options</a> for more details.
3636
* @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>
@@ -40,7 +40,7 @@ class InputMediaAudio extends InputMedia
4040
*/
4141
public static function make(
4242
string|InputFile $media,
43-
InputFile|string|null $thumbnail = null,
43+
string|InputFile|null $thumbnail = null,
4444
?string $caption = null,
4545
?string $parse_mode = null,
4646
?array $caption_entities = null,

0 commit comments

Comments
 (0)