Skip to content

Commit fa86cc2

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

27 files changed

Lines changed: 431 additions & 65 deletions

src/Layers/Generated.php

Lines changed: 36 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -32,6 +32,7 @@
3232
use Telepath\Telegram\InputMediaDocument;
3333
use Telepath\Telegram\InputMediaPhoto;
3434
use Telepath\Telegram\InputMediaVideo;
35+
use Telepath\Telegram\InputPaidMedia;
3536
use Telepath\Telegram\InputPollOption;
3637
use Telepath\Telegram\InputSticker;
3738
use Telepath\Telegram\LabeledPrice;
@@ -241,7 +242,7 @@ public function forwardMessages(
241242
}
242243

243244
/**
244-
* Use this method to copy messages of any kind. Service messages, giveaway messages, giveaway winners messages, and invoice messages can't be copied. A quiz <a href="https://core.telegram.org/bots/api#poll">poll</a> can be copied only if the value of the field <em>correct_option_id</em> is known to the bot. The method is analogous to the method <a href="https://core.telegram.org/bots/api#forwardmessage">forwardMessage</a>, but the copied message doesn't have a link to the original message. Returns the <a href="https://core.telegram.org/bots/api#messageid">MessageId</a> of the sent message on success.
245+
* Use this method to copy messages of any kind. Service messages, paid media messages, giveaway messages, giveaway winners messages, and invoice messages can't be copied. A quiz <a href="https://core.telegram.org/bots/api#poll">poll</a> can be copied only if the value of the field <em>correct_option_id</em> is known to the bot. The method is analogous to the method <a href="https://core.telegram.org/bots/api#forwardmessage">forwardMessage</a>, but the copied message doesn't have a link to the original message. Returns the <a href="https://core.telegram.org/bots/api#messageid">MessageId</a> of the sent message on success.
245246
*
246247
* @param int|string $chat_id Unique identifier for the target chat or username of the target channel (in the format @channelusername)
247248
* @param int|string $from_chat_id Unique identifier for the chat where the original message was sent (or channel username in the format @channelusername)
@@ -276,7 +277,7 @@ public function copyMessage(
276277
}
277278

278279
/**
279-
* Use this method to copy messages of any kind. If some of the specified messages can't be found or copied, they are skipped. Service messages, giveaway messages, giveaway winners messages, and invoice messages can't be copied. A quiz <a href="https://core.telegram.org/bots/api#poll">poll</a> can be copied only if the value of the field <em>correct_option_id</em> is known to the bot. The method is analogous to the method <a href="https://core.telegram.org/bots/api#forwardmessages">forwardMessages</a>, but the copied messages don't have a link to the original message. Album grouping is kept for copied messages. On success, an array of <a href="https://core.telegram.org/bots/api#messageid">MessageId</a> of the sent messages is returned.
280+
* Use this method to copy messages of any kind. If some of the specified messages can't be found or copied, they are skipped. Service messages, paid media messages, giveaway messages, giveaway winners messages, and invoice messages can't be copied. A quiz <a href="https://core.telegram.org/bots/api#poll">poll</a> can be copied only if the value of the field <em>correct_option_id</em> is known to the bot. The method is analogous to the method <a href="https://core.telegram.org/bots/api#forwardmessages">forwardMessages</a>, but the copied messages don't have a link to the original message. Album grouping is kept for copied messages. On success, an array of <a href="https://core.telegram.org/bots/api#messageid">MessageId</a> of the sent messages is returned.
280281
*
281282
* @param int|string $chat_id Unique identifier for the target chat or username of the target channel (in the format @channelusername)
282283
* @param int|string $from_chat_id Unique identifier for the chat where the original messages were sent (or channel username in the format @channelusername)
@@ -589,6 +590,39 @@ public function sendVideoNote(
589590
return $this->raw('sendVideoNote', func_get_args());
590591
}
591592

593+
/**
594+
* Use this method to send paid media to channel chats. On success, the sent <a href="https://core.telegram.org/bots/api#message">Message</a> is returned.
595+
*
596+
* @param int|string $chat_id Unique identifier for the target chat or username of the target channel (in the format @channelusername)
597+
* @param int $star_count The number of Telegram Stars that must be paid to buy access to the media
598+
* @param InputPaidMedia[] $media A JSON-serialized array describing the media to be sent; up to 10 items
599+
* @param string $caption Media caption, 0-1024 characters after entities parsing
600+
* @param ParseMode|string $parse_mode Mode for parsing entities in the media caption. See <a href="https://core.telegram.org/bots/api#formatting-options">formatting options</a> for more details.
601+
* @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>
602+
* @param bool $show_caption_above_media Pass <em>True</em>, if the caption must be shown above the message media
603+
* @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.
604+
* @param bool $protect_content Protects the contents of the sent message from forwarding and saving
605+
* @param ReplyParameters $reply_parameters Description of the message to reply to
606+
* @param InlineKeyboardMarkup|ReplyKeyboardMarkup|ReplyKeyboardRemove|ForceReply $reply_markup Additional interface options. A JSON-serialized object for an <a href="https://core.telegram.org/bots/features#inline-keyboards">inline keyboard</a>, <a href="https://core.telegram.org/bots/features#keyboards">custom reply keyboard</a>, instructions to remove a reply keyboard or to force a reply from the user
607+
*
608+
* @throws TelegramException
609+
*/
610+
public function sendPaidMedia(
611+
int|string $chat_id,
612+
int $star_count,
613+
array $media,
614+
?string $caption = null,
615+
ParseMode|string|null $parse_mode = null,
616+
?array $caption_entities = null,
617+
?bool $show_caption_above_media = null,
618+
?bool $disable_notification = null,
619+
?bool $protect_content = null,
620+
?ReplyParameters $reply_parameters = null,
621+
InlineKeyboardMarkup|ReplyKeyboardMarkup|ReplyKeyboardRemove|ForceReply|null $reply_markup = null,
622+
): Message {
623+
return $this->raw('sendPaidMedia', func_get_args());
624+
}
625+
592626
/**
593627
* Use this method to send a group of photos, videos, documents or audios as an album. Documents and audio files can be only grouped in an album with messages of the same type. On success, an array of <a href="https://core.telegram.org/bots/api#message">Messages</a> that were sent is returned.
594628
*

src/Telegram/Animation.php

Lines changed: 12 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -19,22 +19,22 @@ class Animation extends Type
1919
/** Unique identifier for this file, which is supposed to be the same over time and for different bots. Can't be used to download or reuse the file. */
2020
public string $file_unique_id;
2121

22-
/** Video width as defined by sender */
22+
/** Video width as defined by the sender */
2323
public int $width;
2424

25-
/** Video height as defined by sender */
25+
/** Video height as defined by the sender */
2626
public int $height;
2727

28-
/** Duration of the video in seconds as defined by sender */
28+
/** Duration of the video in seconds as defined by the sender */
2929
public int $duration;
3030

31-
/** <em>Optional</em>. Animation thumbnail as defined by sender */
31+
/** <em>Optional</em>. Animation thumbnail as defined by the sender */
3232
public ?PhotoSize $thumbnail = null;
3333

34-
/** <em>Optional</em>. Original animation filename as defined by sender */
34+
/** <em>Optional</em>. Original animation filename as defined by the sender */
3535
public ?string $file_name = null;
3636

37-
/** <em>Optional</em>. MIME type of the file as defined by sender */
37+
/** <em>Optional</em>. MIME type of the file as defined by the sender */
3838
public ?string $mime_type = null;
3939

4040
/** <em>Optional</em>. File size in bytes. It can be bigger than 2^31 and some programming languages may have difficulty/silent defects in interpreting it. But it has at most 52 significant bits, so a signed 64-bit integer or double-precision float type are safe for storing this value. */
@@ -43,12 +43,12 @@ class Animation extends Type
4343
/**
4444
* @param string $file_id Identifier for this file, which can be used to download or reuse the file
4545
* @param string $file_unique_id Unique identifier for this file, which is supposed to be the same over time and for different bots. Can't be used to download or reuse the file.
46-
* @param int $width Video width as defined by sender
47-
* @param int $height Video height as defined by sender
48-
* @param int $duration Duration of the video in seconds as defined by sender
49-
* @param PhotoSize $thumbnail <em>Optional</em>. Animation thumbnail as defined by sender
50-
* @param string $file_name <em>Optional</em>. Original animation filename as defined by sender
51-
* @param string $mime_type <em>Optional</em>. MIME type of the file as defined by sender
46+
* @param int $width Video width as defined by the sender
47+
* @param int $height Video height as defined by the sender
48+
* @param int $duration Duration of the video in seconds as defined by the sender
49+
* @param PhotoSize $thumbnail <em>Optional</em>. Animation thumbnail as defined by the sender
50+
* @param string $file_name <em>Optional</em>. Original animation filename as defined by the sender
51+
* @param string $mime_type <em>Optional</em>. MIME type of the file as defined by the sender
5252
* @param int $file_size <em>Optional</em>. File size in bytes. It can be bigger than 2^31 and some programming languages may have difficulty/silent defects in interpreting it. But it has at most 52 significant bits, so a signed 64-bit integer or double-precision float type are safe for storing this value.
5353
*/
5454
public static function make(

src/Telegram/Audio.php

Lines changed: 10 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -19,19 +19,19 @@ class Audio extends Type
1919
/** Unique identifier for this file, which is supposed to be the same over time and for different bots. Can't be used to download or reuse the file. */
2020
public string $file_unique_id;
2121

22-
/** Duration of the audio in seconds as defined by sender */
22+
/** Duration of the audio in seconds as defined by the sender */
2323
public int $duration;
2424

25-
/** <em>Optional</em>. Performer of the audio as defined by sender or by audio tags */
25+
/** <em>Optional</em>. Performer of the audio as defined by the sender or by audio tags */
2626
public ?string $performer = null;
2727

28-
/** <em>Optional</em>. Title of the audio as defined by sender or by audio tags */
28+
/** <em>Optional</em>. Title of the audio as defined by the sender or by audio tags */
2929
public ?string $title = null;
3030

31-
/** <em>Optional</em>. Original filename as defined by sender */
31+
/** <em>Optional</em>. Original filename as defined by the sender */
3232
public ?string $file_name = null;
3333

34-
/** <em>Optional</em>. MIME type of the file as defined by sender */
34+
/** <em>Optional</em>. MIME type of the file as defined by the sender */
3535
public ?string $mime_type = null;
3636

3737
/** <em>Optional</em>. File size in bytes. It can be bigger than 2^31 and some programming languages may have difficulty/silent defects in interpreting it. But it has at most 52 significant bits, so a signed 64-bit integer or double-precision float type are safe for storing this value. */
@@ -43,11 +43,11 @@ class Audio extends Type
4343
/**
4444
* @param string $file_id Identifier for this file, which can be used to download or reuse the file
4545
* @param string $file_unique_id Unique identifier for this file, which is supposed to be the same over time and for different bots. Can't be used to download or reuse the file.
46-
* @param int $duration Duration of the audio in seconds as defined by sender
47-
* @param string $performer <em>Optional</em>. Performer of the audio as defined by sender or by audio tags
48-
* @param string $title <em>Optional</em>. Title of the audio as defined by sender or by audio tags
49-
* @param string $file_name <em>Optional</em>. Original filename as defined by sender
50-
* @param string $mime_type <em>Optional</em>. MIME type of the file as defined by sender
46+
* @param int $duration Duration of the audio in seconds as defined by the sender
47+
* @param string $performer <em>Optional</em>. Performer of the audio as defined by the sender or by audio tags
48+
* @param string $title <em>Optional</em>. Title of the audio as defined by the sender or by audio tags
49+
* @param string $file_name <em>Optional</em>. Original filename as defined by the sender
50+
* @param string $mime_type <em>Optional</em>. MIME type of the file as defined by the sender
5151
* @param int $file_size <em>Optional</em>. File size in bytes. It can be bigger than 2^31 and some programming languages may have difficulty/silent defects in interpreting it. But it has at most 52 significant bits, so a signed 64-bit integer or double-precision float type are safe for storing this value.
5252
* @param PhotoSize $thumbnail <em>Optional</em>. Thumbnail of the album cover to which the music file belongs
5353
*/

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 paid media messages can be sent or forwarded to the channel chat. The field is available only for channel chats. */
118+
public ?bool $can_send_paid_media = null;
119+
117120
/** <em>Optional</em>. For supergroups, the minimum allowed delay between consecutive messages sent by each unprivileged user; in seconds */
118121
public ?int $slow_mode_delay = null;
119122

@@ -182,6 +185,7 @@ class ChatFullInfo extends Type
182185
* @param string $invite_link <em>Optional</em>. Primary invite link, for groups, supergroups and channel chats
183186
* @param Message $pinned_message <em>Optional</em>. The most recent pinned message (by sending date)
184187
* @param ChatPermissions $permissions <em>Optional</em>. Default chat member permissions, for groups and supergroups
188+
* @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.
185189
* @param int $slow_mode_delay <em>Optional</em>. For supergroups, the minimum allowed delay between consecutive messages sent by each unprivileged user; in seconds
186190
* @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
187191
* @param int $message_auto_delete_time <em>Optional</em>. The time after which all messages sent to the chat will be automatically deleted; in seconds
@@ -227,6 +231,7 @@ public static function make(
227231
?string $invite_link = null,
228232
?Message $pinned_message = null,
229233
?ChatPermissions $permissions = null,
234+
?bool $can_send_paid_media = null,
230235
?int $slow_mode_delay = null,
231236
?int $unrestrict_boost_count = null,
232237
?int $message_auto_delete_time = null,
@@ -272,6 +277,7 @@ public static function make(
272277
'invite_link' => $invite_link,
273278
'pinned_message' => $pinned_message,
274279
'permissions' => $permissions,
280+
'can_send_paid_media' => $can_send_paid_media,
275281
'slow_mode_delay' => $slow_mode_delay,
276282
'unrestrict_boost_count' => $unrestrict_boost_count,
277283
'message_auto_delete_time' => $message_auto_delete_time,

src/Telegram/Document.php

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -19,13 +19,13 @@ class Document extends Type
1919
/** Unique identifier for this file, which is supposed to be the same over time and for different bots. Can't be used to download or reuse the file. */
2020
public string $file_unique_id;
2121

22-
/** <em>Optional</em>. Document thumbnail as defined by sender */
22+
/** <em>Optional</em>. Document thumbnail as defined by the sender */
2323
public ?PhotoSize $thumbnail = null;
2424

25-
/** <em>Optional</em>. Original filename as defined by sender */
25+
/** <em>Optional</em>. Original filename as defined by the sender */
2626
public ?string $file_name = null;
2727

28-
/** <em>Optional</em>. MIME type of the file as defined by sender */
28+
/** <em>Optional</em>. MIME type of the file as defined by the sender */
2929
public ?string $mime_type = null;
3030

3131
/** <em>Optional</em>. File size in bytes. It can be bigger than 2^31 and some programming languages may have difficulty/silent defects in interpreting it. But it has at most 52 significant bits, so a signed 64-bit integer or double-precision float type are safe for storing this value. */
@@ -34,9 +34,9 @@ class Document extends Type
3434
/**
3535
* @param string $file_id Identifier for this file, which can be used to download or reuse the file
3636
* @param string $file_unique_id Unique identifier for this file, which is supposed to be the same over time and for different bots. Can't be used to download or reuse the file.
37-
* @param PhotoSize $thumbnail <em>Optional</em>. Document thumbnail as defined by sender
38-
* @param string $file_name <em>Optional</em>. Original filename as defined by sender
39-
* @param string $mime_type <em>Optional</em>. MIME type of the file as defined by sender
37+
* @param PhotoSize $thumbnail <em>Optional</em>. Document thumbnail as defined by the sender
38+
* @param string $file_name <em>Optional</em>. Original filename as defined by the sender
39+
* @param string $mime_type <em>Optional</em>. MIME type of the file as defined by the sender
4040
* @param int $file_size <em>Optional</em>. File size in bytes. It can be bigger than 2^31 and some programming languages may have difficulty/silent defects in interpreting it. But it has at most 52 significant bits, so a signed 64-bit integer or double-precision float type are safe for storing this value.
4141
*/
4242
public static function make(

src/Telegram/ExternalReplyInfo.php

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -34,6 +34,9 @@ class ExternalReplyInfo extends Type
3434
/** <em>Optional</em>. Message is a general file, information about the file */
3535
public ?Document $document = null;
3636

37+
/** <em>Optional</em>. Message contains paid media; information about the paid media */
38+
public ?PaidMediaInfo $paid_media = null;
39+
3740
/**
3841
* <em>Optional</em>. Message is a photo, available sizes of the photo
3942
*
@@ -94,6 +97,7 @@ class ExternalReplyInfo extends Type
9497
* @param Animation $animation <em>Optional</em>. Message is an animation, information about the animation
9598
* @param Audio $audio <em>Optional</em>. Message is an audio file, information about the file
9699
* @param Document $document <em>Optional</em>. Message is a general file, information about the file
100+
* @param PaidMediaInfo $paid_media <em>Optional</em>. Message contains paid media; information about the paid media
97101
* @param PhotoSize[] $photo <em>Optional</em>. Message is a photo, available sizes of the photo
98102
* @param Sticker $sticker <em>Optional</em>. Message is a sticker, information about the sticker
99103
* @param Story $story <em>Optional</em>. Message is a forwarded story
@@ -119,6 +123,7 @@ public static function make(
119123
?Animation $animation = null,
120124
?Audio $audio = null,
121125
?Document $document = null,
126+
?PaidMediaInfo $paid_media = null,
122127
?array $photo = null,
123128
?Sticker $sticker = null,
124129
?Story $story = null,
@@ -144,6 +149,7 @@ public static function make(
144149
'animation' => $animation,
145150
'audio' => $audio,
146151
'document' => $document,
152+
'paid_media' => $paid_media,
147153
'photo' => $photo,
148154
'sticker' => $sticker,
149155
'story' => $story,

0 commit comments

Comments
 (0)