Skip to content

Commit

Permalink
Update code to reflect latest changes to the Bot API documentation
Browse files Browse the repository at this point in the history
  • Loading branch information
TiiFuchs committed Jul 3, 2024
1 parent a107062 commit fa86cc2
Show file tree
Hide file tree
Showing 27 changed files with 431 additions and 65 deletions.
38 changes: 36 additions & 2 deletions src/Layers/Generated.php
Original file line number Diff line number Diff line change
Expand Up @@ -32,6 +32,7 @@
use Telepath\Telegram\InputMediaDocument;
use Telepath\Telegram\InputMediaPhoto;
use Telepath\Telegram\InputMediaVideo;
use Telepath\Telegram\InputPaidMedia;
use Telepath\Telegram\InputPollOption;
use Telepath\Telegram\InputSticker;
use Telepath\Telegram\LabeledPrice;
Expand Down Expand Up @@ -241,7 +242,7 @@ public function forwardMessages(
}

/**
* 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.
* 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.
*
* @param int|string $chat_id Unique identifier for the target chat or username of the target channel (in the format @channelusername)
* @param int|string $from_chat_id Unique identifier for the chat where the original message was sent (or channel username in the format @channelusername)
Expand Down Expand Up @@ -276,7 +277,7 @@ public function copyMessage(
}

/**
* 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.
* 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.
*
* @param int|string $chat_id Unique identifier for the target chat or username of the target channel (in the format @channelusername)
* @param int|string $from_chat_id Unique identifier for the chat where the original messages were sent (or channel username in the format @channelusername)
Expand Down Expand Up @@ -589,6 +590,39 @@ public function sendVideoNote(
return $this->raw('sendVideoNote', func_get_args());
}

/**
* 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.
*
* @param int|string $chat_id Unique identifier for the target chat or username of the target channel (in the format @channelusername)
* @param int $star_count The number of Telegram Stars that must be paid to buy access to the media
* @param InputPaidMedia[] $media A JSON-serialized array describing the media to be sent; up to 10 items
* @param string $caption Media caption, 0-1024 characters after entities parsing
* @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.
* @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>
* @param bool $show_caption_above_media Pass <em>True</em>, if the caption must be shown above the message media
* @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.
* @param bool $protect_content Protects the contents of the sent message from forwarding and saving
* @param ReplyParameters $reply_parameters Description of the message to reply to
* @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
*
* @throws TelegramException
*/
public function sendPaidMedia(
int|string $chat_id,
int $star_count,
array $media,
?string $caption = null,
ParseMode|string|null $parse_mode = null,
?array $caption_entities = null,
?bool $show_caption_above_media = null,
?bool $disable_notification = null,
?bool $protect_content = null,
?ReplyParameters $reply_parameters = null,
InlineKeyboardMarkup|ReplyKeyboardMarkup|ReplyKeyboardRemove|ForceReply|null $reply_markup = null,
): Message {
return $this->raw('sendPaidMedia', func_get_args());
}

/**
* 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.
*
Expand Down
24 changes: 12 additions & 12 deletions src/Telegram/Animation.php
Original file line number Diff line number Diff line change
Expand Up @@ -19,22 +19,22 @@ class Animation extends Type
/** 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. */
public string $file_unique_id;

/** Video width as defined by sender */
/** Video width as defined by the sender */
public int $width;

/** Video height as defined by sender */
/** Video height as defined by the sender */
public int $height;

/** Duration of the video in seconds as defined by sender */
/** Duration of the video in seconds as defined by the sender */
public int $duration;

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

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

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

/** <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. */
Expand All @@ -43,12 +43,12 @@ class Animation extends Type
/**
* @param string $file_id Identifier for this file, which can be used to download or reuse the file
* @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.
* @param int $width Video width as defined by sender
* @param int $height Video height as defined by sender
* @param int $duration Duration of the video in seconds as defined by sender
* @param PhotoSize $thumbnail <em>Optional</em>. Animation thumbnail as defined by sender
* @param string $file_name <em>Optional</em>. Original animation filename as defined by sender
* @param string $mime_type <em>Optional</em>. MIME type of the file as defined by sender
* @param int $width Video width as defined by the sender
* @param int $height Video height as defined by the sender
* @param int $duration Duration of the video in seconds as defined by the sender
* @param PhotoSize $thumbnail <em>Optional</em>. Animation thumbnail as defined by the sender
* @param string $file_name <em>Optional</em>. Original animation filename as defined by the sender
* @param string $mime_type <em>Optional</em>. MIME type of the file as defined by the sender
* @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.
*/
public static function make(
Expand Down
20 changes: 10 additions & 10 deletions src/Telegram/Audio.php
Original file line number Diff line number Diff line change
Expand Up @@ -19,19 +19,19 @@ class Audio extends Type
/** 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. */
public string $file_unique_id;

/** Duration of the audio in seconds as defined by sender */
/** Duration of the audio in seconds as defined by the sender */
public int $duration;

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

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

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

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

/** <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. */
Expand All @@ -43,11 +43,11 @@ class Audio extends Type
/**
* @param string $file_id Identifier for this file, which can be used to download or reuse the file
* @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.
* @param int $duration Duration of the audio in seconds as defined by sender
* @param string $performer <em>Optional</em>. Performer of the audio as defined by sender or by audio tags
* @param string $title <em>Optional</em>. Title of the audio as defined by sender or by audio tags
* @param string $file_name <em>Optional</em>. Original filename as defined by sender
* @param string $mime_type <em>Optional</em>. MIME type of the file as defined by sender
* @param int $duration Duration of the audio in seconds as defined by the sender
* @param string $performer <em>Optional</em>. Performer of the audio as defined by the sender or by audio tags
* @param string $title <em>Optional</em>. Title of the audio as defined by the sender or by audio tags
* @param string $file_name <em>Optional</em>. Original filename as defined by the sender
* @param string $mime_type <em>Optional</em>. MIME type of the file as defined by the sender
* @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.
* @param PhotoSize $thumbnail <em>Optional</em>. Thumbnail of the album cover to which the music file belongs
*/
Expand Down
6 changes: 6 additions & 0 deletions src/Telegram/ChatFullInfo.php
Original file line number Diff line number Diff line change
Expand Up @@ -114,6 +114,9 @@ class ChatFullInfo extends Type
/** <em>Optional</em>. Default chat member permissions, for groups and supergroups */
public ?ChatPermissions $permissions = null;

/** <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. */
public ?bool $can_send_paid_media = null;

/** <em>Optional</em>. For supergroups, the minimum allowed delay between consecutive messages sent by each unprivileged user; in seconds */
public ?int $slow_mode_delay = null;

Expand Down Expand Up @@ -182,6 +185,7 @@ class ChatFullInfo extends Type
* @param string $invite_link <em>Optional</em>. Primary invite link, for groups, supergroups and channel chats
* @param Message $pinned_message <em>Optional</em>. The most recent pinned message (by sending date)
* @param ChatPermissions $permissions <em>Optional</em>. Default chat member permissions, for groups and supergroups
* @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.
* @param int $slow_mode_delay <em>Optional</em>. For supergroups, the minimum allowed delay between consecutive messages sent by each unprivileged user; in seconds
* @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
* @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
Expand Down Expand Up @@ -227,6 +231,7 @@ public static function make(
?string $invite_link = null,
?Message $pinned_message = null,
?ChatPermissions $permissions = null,
?bool $can_send_paid_media = null,
?int $slow_mode_delay = null,
?int $unrestrict_boost_count = null,
?int $message_auto_delete_time = null,
Expand Down Expand Up @@ -272,6 +277,7 @@ public static function make(
'invite_link' => $invite_link,
'pinned_message' => $pinned_message,
'permissions' => $permissions,
'can_send_paid_media' => $can_send_paid_media,
'slow_mode_delay' => $slow_mode_delay,
'unrestrict_boost_count' => $unrestrict_boost_count,
'message_auto_delete_time' => $message_auto_delete_time,
Expand Down
12 changes: 6 additions & 6 deletions src/Telegram/Document.php
Original file line number Diff line number Diff line change
Expand Up @@ -19,13 +19,13 @@ class Document extends Type
/** 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. */
public string $file_unique_id;

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

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

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

/** <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. */
Expand All @@ -34,9 +34,9 @@ class Document extends Type
/**
* @param string $file_id Identifier for this file, which can be used to download or reuse the file
* @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.
* @param PhotoSize $thumbnail <em>Optional</em>. Document thumbnail as defined by sender
* @param string $file_name <em>Optional</em>. Original filename as defined by sender
* @param string $mime_type <em>Optional</em>. MIME type of the file as defined by sender
* @param PhotoSize $thumbnail <em>Optional</em>. Document thumbnail as defined by the sender
* @param string $file_name <em>Optional</em>. Original filename as defined by the sender
* @param string $mime_type <em>Optional</em>. MIME type of the file as defined by the sender
* @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.
*/
public static function make(
Expand Down
6 changes: 6 additions & 0 deletions src/Telegram/ExternalReplyInfo.php
Original file line number Diff line number Diff line change
Expand Up @@ -34,6 +34,9 @@ class ExternalReplyInfo extends Type
/** <em>Optional</em>. Message is a general file, information about the file */
public ?Document $document = null;

/** <em>Optional</em>. Message contains paid media; information about the paid media */
public ?PaidMediaInfo $paid_media = null;

/**
* <em>Optional</em>. Message is a photo, available sizes of the photo
*
Expand Down Expand Up @@ -94,6 +97,7 @@ class ExternalReplyInfo extends Type
* @param Animation $animation <em>Optional</em>. Message is an animation, information about the animation
* @param Audio $audio <em>Optional</em>. Message is an audio file, information about the file
* @param Document $document <em>Optional</em>. Message is a general file, information about the file
* @param PaidMediaInfo $paid_media <em>Optional</em>. Message contains paid media; information about the paid media
* @param PhotoSize[] $photo <em>Optional</em>. Message is a photo, available sizes of the photo
* @param Sticker $sticker <em>Optional</em>. Message is a sticker, information about the sticker
* @param Story $story <em>Optional</em>. Message is a forwarded story
Expand All @@ -119,6 +123,7 @@ public static function make(
?Animation $animation = null,
?Audio $audio = null,
?Document $document = null,
?PaidMediaInfo $paid_media = null,
?array $photo = null,
?Sticker $sticker = null,
?Story $story = null,
Expand All @@ -144,6 +149,7 @@ public static function make(
'animation' => $animation,
'audio' => $audio,
'document' => $document,
'paid_media' => $paid_media,
'photo' => $photo,
'sticker' => $sticker,
'story' => $story,
Expand Down
Loading

0 comments on commit fa86cc2

Please sign in to comment.