diff --git a/src/Layers/Generated.php b/src/Layers/Generated.php index ef81669..aebaeb3 100644 --- a/src/Layers/Generated.php +++ b/src/Layers/Generated.php @@ -176,7 +176,7 @@ public function close(): bool * @param int|string $chat_id Unique identifier for the target chat or username of the target channel (in the format @channelusername) * @param string $text Text of the message to be sent, 1-4096 characters after entities parsing * @param string $business_connection_id Unique identifier of the business connection on behalf of which the message will be sent - * @param int $message_thread_id Unique identifier for the target message thread (topic) of the forum; for forum supergroups only + * @param int $message_thread_id Unique identifier for the target message thread (topic) of a forum; for forum supergroups and private chats of bots with forum topic mode enabled only * @param int $direct_messages_topic_id Identifier of the direct messages topic to which the message will be sent; required if the message is sent to a direct messages chat * @param ParseMode|string $parse_mode Mode for parsing entities in the message text. See formatting options for more details. * @param MessageEntity[] $entities A JSON-serialized list of special entities that appear in message text, which can be specified instead of parse_mode @@ -217,11 +217,12 @@ public function sendMessage( * @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) * @param int $message_id Message identifier in the chat specified in from_chat_id - * @param int $message_thread_id Unique identifier for the target message thread (topic) of the forum; for forum supergroups only + * @param int $message_thread_id Unique identifier for the target message thread (topic) of a forum; for forum supergroups and private chats of bots with forum topic mode enabled only * @param int $direct_messages_topic_id Identifier of the direct messages topic to which the message will be forwarded; required if the message is forwarded to a direct messages chat * @param int $video_start_timestamp New start timestamp for the forwarded video in the message * @param bool $disable_notification Sends the message silently. Users will receive a notification with no sound. * @param bool $protect_content Protects the contents of the forwarded message from forwarding and saving + * @param string $message_effect_id Unique identifier of the message effect to be added to the message; only available when forwarding to private chats * @param SuggestedPostParameters $suggested_post_parameters A JSON-serialized object containing the parameters of the suggested post to send; for direct messages chats only * * @throws TelegramException @@ -235,6 +236,7 @@ public function forwardMessage( ?int $video_start_timestamp = null, ?bool $disable_notification = null, ?bool $protect_content = null, + ?string $message_effect_id = null, ?SuggestedPostParameters $suggested_post_parameters = null, ): Message { return $this->raw('forwardMessage', func_get_args()); @@ -246,7 +248,7 @@ public function forwardMessage( * @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) * @param int[] $message_ids A JSON-serialized list of 1-100 identifiers of messages in the chat from_chat_id to forward. The identifiers must be specified in a strictly increasing order. - * @param int $message_thread_id Unique identifier for the target message thread (topic) of the forum; for forum supergroups only + * @param int $message_thread_id Unique identifier for the target message thread (topic) of a forum; for forum supergroups and private chats of bots with forum topic mode enabled only * @param int $direct_messages_topic_id Identifier of the direct messages topic to which the messages will be forwarded; required if the messages are forwarded to a direct messages chat * @param bool $disable_notification Sends the messages silently. Users will receive a notification with no sound. * @param bool $protect_content Protects the contents of the forwarded messages from forwarding and saving @@ -271,7 +273,7 @@ public function forwardMessages( * @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) * @param int $message_id Message identifier in the chat specified in from_chat_id - * @param int $message_thread_id Unique identifier for the target message thread (topic) of the forum; for forum supergroups only + * @param int $message_thread_id Unique identifier for the target message thread (topic) of a forum; for forum supergroups and private chats of bots with forum topic mode enabled only * @param int $direct_messages_topic_id Identifier of the direct messages topic to which the message will be sent; required if the message is sent to a direct messages chat * @param int $video_start_timestamp New start timestamp for the copied video in the message * @param string $caption New caption for media, 0-1024 characters after entities parsing. If not specified, the original caption is kept @@ -281,6 +283,7 @@ public function forwardMessages( * @param bool $disable_notification Sends the message silently. Users will receive a notification with no sound. * @param bool $protect_content Protects the contents of the sent message from forwarding and saving * @param bool $allow_paid_broadcast Pass True to allow up to 1000 messages per second, ignoring broadcasting limits for a fee of 0.1 Telegram Stars per message. The relevant Stars will be withdrawn from the bot's balance + * @param string $message_effect_id Unique identifier of the message effect to be added to the message; only available when copying to private chats * @param SuggestedPostParameters $suggested_post_parameters A JSON-serialized object containing the parameters of the suggested post to send; for direct messages chats only. If the message is sent as a reply to another suggested post, then that suggested post is automatically declined. * @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 inline keyboard, custom reply keyboard, instructions to remove a reply keyboard or to force a reply from the user @@ -301,6 +304,7 @@ public function copyMessage( ?bool $disable_notification = null, ?bool $protect_content = null, ?bool $allow_paid_broadcast = null, + ?string $message_effect_id = null, ?SuggestedPostParameters $suggested_post_parameters = null, ?ReplyParameters $reply_parameters = null, InlineKeyboardMarkup|ReplyKeyboardMarkup|ReplyKeyboardRemove|ForceReply|null $reply_markup = null, @@ -314,7 +318,7 @@ public function copyMessage( * @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) * @param int[] $message_ids A JSON-serialized list of 1-100 identifiers of messages in the chat from_chat_id to copy. The identifiers must be specified in a strictly increasing order. - * @param int $message_thread_id Unique identifier for the target message thread (topic) of the forum; for forum supergroups only + * @param int $message_thread_id Unique identifier for the target message thread (topic) of a forum; for forum supergroups and private chats of bots with forum topic mode enabled only * @param int $direct_messages_topic_id Identifier of the direct messages topic to which the messages will be sent; required if the messages are sent to a direct messages chat * @param bool $disable_notification Sends the messages silently. Users will receive a notification with no sound. * @param bool $protect_content Protects the contents of the sent messages from forwarding and saving @@ -341,7 +345,7 @@ public function copyMessages( * @param int|string $chat_id Unique identifier for the target chat or username of the target channel (in the format @channelusername) * @param InputFile|string $photo Photo to send. Pass a file_id as String to send a photo that exists on the Telegram servers (recommended), pass an HTTP URL as a String for Telegram to get a photo from the Internet, or upload a new photo using multipart/form-data. The photo must be at most 10 MB in size. The photo's width and height must not exceed 10000 in total. Width and height ratio must be at most 20. More information on Sending Files » * @param string $business_connection_id Unique identifier of the business connection on behalf of which the message will be sent - * @param int $message_thread_id Unique identifier for the target message thread (topic) of the forum; for forum supergroups only + * @param int $message_thread_id Unique identifier for the target message thread (topic) of a forum; for forum supergroups and private chats of bots with forum topic mode enabled only * @param int $direct_messages_topic_id Identifier of the direct messages topic to which the message will be sent; required if the message is sent to a direct messages chat * @param string $caption Photo caption (may also be used when resending photos by file_id), 0-1024 characters after entities parsing * @param ParseMode|string $parse_mode Mode for parsing entities in the photo caption. See formatting options for more details. @@ -386,7 +390,7 @@ public function sendPhoto( * @param int|string $chat_id Unique identifier for the target chat or username of the target channel (in the format @channelusername) * @param InputFile|string $audio Audio file to send. Pass a file_id as String to send an audio file that exists on the Telegram servers (recommended), pass an HTTP URL as a String for Telegram to get an audio file from the Internet, or upload a new one using multipart/form-data. More information on Sending Files » * @param string $business_connection_id Unique identifier of the business connection on behalf of which the message will be sent - * @param int $message_thread_id Unique identifier for the target message thread (topic) of the forum; for forum supergroups only + * @param int $message_thread_id Unique identifier for the target message thread (topic) of a forum; for forum supergroups and private chats of bots with forum topic mode enabled only * @param int $direct_messages_topic_id Identifier of the direct messages topic to which the message will be sent; required if the message is sent to a direct messages chat * @param string $caption Audio caption, 0-1024 characters after entities parsing * @param ParseMode|string $parse_mode Mode for parsing entities in the audio caption. See formatting options for more details. @@ -435,7 +439,7 @@ public function sendAudio( * @param int|string $chat_id Unique identifier for the target chat or username of the target channel (in the format @channelusername) * @param InputFile|string $document File to send. Pass a file_id as String to send a file that exists on the Telegram servers (recommended), 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. More information on Sending Files » * @param string $business_connection_id Unique identifier of the business connection on behalf of which the message will be sent - * @param int $message_thread_id Unique identifier for the target message thread (topic) of the forum; for forum supergroups only + * @param int $message_thread_id Unique identifier for the target message thread (topic) of a forum; for forum supergroups and private chats of bots with forum topic mode enabled only * @param int $direct_messages_topic_id Identifier of the direct messages topic to which the message will be sent; required if the message is sent to a direct messages chat * @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://” if the thumbnail was uploaded using multipart/form-data under . More information on Sending Files » * @param string $caption Document caption (may also be used when resending documents by file_id), 0-1024 characters after entities parsing @@ -480,7 +484,7 @@ public function sendDocument( * @param int|string $chat_id Unique identifier for the target chat or username of the target channel (in the format @channelusername) * @param InputFile|string $video Video to send. Pass a file_id as String to send a video that exists on the Telegram servers (recommended), pass an HTTP URL as a String for Telegram to get a video from the Internet, or upload a new video using multipart/form-data. More information on Sending Files » * @param string $business_connection_id Unique identifier of the business connection on behalf of which the message will be sent - * @param int $message_thread_id Unique identifier for the target message thread (topic) of the forum; for forum supergroups only + * @param int $message_thread_id Unique identifier for the target message thread (topic) of a forum; for forum supergroups and private chats of bots with forum topic mode enabled only * @param int $direct_messages_topic_id Identifier of the direct messages topic to which the message will be sent; required if the message is sent to a direct messages chat * @param int $duration Duration of sent video in seconds * @param int $width Video width @@ -539,7 +543,7 @@ public function sendVideo( * @param int|string $chat_id Unique identifier for the target chat or username of the target channel (in the format @channelusername) * @param InputFile|string $animation Animation to send. Pass a file_id as String to send an animation that exists on the Telegram servers (recommended), pass an HTTP URL as a String for Telegram to get an animation from the Internet, or upload a new animation using multipart/form-data. More information on Sending Files » * @param string $business_connection_id Unique identifier of the business connection on behalf of which the message will be sent - * @param int $message_thread_id Unique identifier for the target message thread (topic) of the forum; for forum supergroups only + * @param int $message_thread_id Unique identifier for the target message thread (topic) of a forum; for forum supergroups and private chats of bots with forum topic mode enabled only * @param int $direct_messages_topic_id Identifier of the direct messages topic to which the message will be sent; required if the message is sent to a direct messages chat * @param int $duration Duration of sent animation in seconds * @param int $width Animation width @@ -592,7 +596,7 @@ public function sendAnimation( * @param int|string $chat_id Unique identifier for the target chat or username of the target channel (in the format @channelusername) * @param InputFile|string $voice Audio file to send. Pass a file_id as String to send a file that exists on the Telegram servers (recommended), 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. More information on Sending Files » * @param string $business_connection_id Unique identifier of the business connection on behalf of which the message will be sent - * @param int $message_thread_id Unique identifier for the target message thread (topic) of the forum; for forum supergroups only + * @param int $message_thread_id Unique identifier for the target message thread (topic) of a forum; for forum supergroups and private chats of bots with forum topic mode enabled only * @param int $direct_messages_topic_id Identifier of the direct messages topic to which the message will be sent; required if the message is sent to a direct messages chat * @param string $caption Voice message caption, 0-1024 characters after entities parsing * @param ParseMode|string $parse_mode Mode for parsing entities in the voice message caption. See formatting options for more details. @@ -635,7 +639,7 @@ public function sendVoice( * @param int|string $chat_id Unique identifier for the target chat or username of the target channel (in the format @channelusername) * @param InputFile|string $video_note Video note to send. Pass a file_id as String to send a video note that exists on the Telegram servers (recommended) or upload a new video using multipart/form-data. More information on Sending Files ». Sending video notes by a URL is currently unsupported * @param string $business_connection_id Unique identifier of the business connection on behalf of which the message will be sent - * @param int $message_thread_id Unique identifier for the target message thread (topic) of the forum; for forum supergroups only + * @param int $message_thread_id Unique identifier for the target message thread (topic) of a forum; for forum supergroups and private chats of bots with forum topic mode enabled only * @param int $direct_messages_topic_id Identifier of the direct messages topic to which the message will be sent; required if the message is sent to a direct messages chat * @param int $duration Duration of sent video in seconds * @param int $length Video width and height, i.e. diameter of the video message @@ -674,10 +678,10 @@ public function sendVideoNote( * Use this method to send paid media. On success, the sent Message is returned. * * @param int|string $chat_id Unique identifier for the target chat or username of the target channel (in the format @channelusername). If the chat is a channel, all Telegram Star proceeds from this media will be credited to the chat's balance. Otherwise, they will be credited to the bot's balance. - * @param int $star_count The number of Telegram Stars that must be paid to buy access to the media; 1-10000 + * @param int $star_count The number of Telegram Stars that must be paid to buy access to the media; 1-25000 * @param InputPaidMedia[] $media A JSON-serialized array describing the media to be sent; up to 10 items * @param string $business_connection_id Unique identifier of the business connection on behalf of which the message will be sent - * @param int $message_thread_id Unique identifier for the target message thread (topic) of the forum; for forum supergroups only + * @param int $message_thread_id Unique identifier for the target message thread (topic) of a forum; for forum supergroups and private chats of bots with forum topic mode enabled only * @param int $direct_messages_topic_id Identifier of the direct messages topic to which the message will be sent; required if the message is sent to a direct messages chat * @param string $payload Bot-defined paid media payload, 0-128 bytes. This will not be displayed to the user, use it for your internal processes. * @param string $caption Media caption, 0-1024 characters after entities parsing @@ -721,7 +725,7 @@ public function sendPaidMedia( * @param int|string $chat_id Unique identifier for the target chat or username of the target channel (in the format @channelusername) * @param InputMediaAudio[]|InputMediaDocument[]|InputMediaPhoto[]|InputMediaVideo[] $media A JSON-serialized array describing messages to be sent, must include 2-10 items * @param string $business_connection_id Unique identifier of the business connection on behalf of which the message will be sent - * @param int $message_thread_id Unique identifier for the target message thread (topic) of the forum; for forum supergroups only + * @param int $message_thread_id Unique identifier for the target message thread (topic) of a forum; for forum supergroups and private chats of bots with forum topic mode enabled only * @param int $direct_messages_topic_id Identifier of the direct messages topic to which the messages will be sent; required if the messages are sent to a direct messages chat * @param bool $disable_notification Sends messages silently. Users will receive a notification with no sound. * @param bool $protect_content Protects the contents of the sent messages from forwarding and saving @@ -754,7 +758,7 @@ public function sendMediaGroup( * @param float $latitude Latitude of the location * @param float $longitude Longitude of the location * @param string $business_connection_id Unique identifier of the business connection on behalf of which the message will be sent - * @param int $message_thread_id Unique identifier for the target message thread (topic) of the forum; for forum supergroups only + * @param int $message_thread_id Unique identifier for the target message thread (topic) of a forum; for forum supergroups and private chats of bots with forum topic mode enabled only * @param int $direct_messages_topic_id Identifier of the direct messages topic to which the message will be sent; required if the message is sent to a direct messages chat * @param float $horizontal_accuracy The radius of uncertainty for the location, measured in meters; 0-1500 * @param int $live_period Period in seconds during which the location will be updated (see Live Locations, should be between 60 and 86400, or 0x7FFFFFFF for live locations that can be edited indefinitely. @@ -801,7 +805,7 @@ public function sendLocation( * @param string $title Name of the venue * @param string $address Address of the venue * @param string $business_connection_id Unique identifier of the business connection on behalf of which the message will be sent - * @param int $message_thread_id Unique identifier for the target message thread (topic) of the forum; for forum supergroups only + * @param int $message_thread_id Unique identifier for the target message thread (topic) of a forum; for forum supergroups and private chats of bots with forum topic mode enabled only * @param int $direct_messages_topic_id Identifier of the direct messages topic to which the message will be sent; required if the message is sent to a direct messages chat * @param string $foursquare_id Foursquare identifier of the venue * @param string $foursquare_type Foursquare type of the venue, if known. (For example, “arts_entertainment/default”, “arts_entertainment/aquarium” or “food/icecream”.) @@ -848,7 +852,7 @@ public function sendVenue( * @param string $phone_number Contact's phone number * @param string $first_name Contact's first name * @param string $business_connection_id Unique identifier of the business connection on behalf of which the message will be sent - * @param int $message_thread_id Unique identifier for the target message thread (topic) of the forum; for forum supergroups only + * @param int $message_thread_id Unique identifier for the target message thread (topic) of a forum; for forum supergroups and private chats of bots with forum topic mode enabled only * @param int $direct_messages_topic_id Identifier of the direct messages topic to which the message will be sent; required if the message is sent to a direct messages chat * @param string $last_name Contact's last name * @param string $vcard Additional data about the contact in the form of a vCard, 0-2048 bytes @@ -889,7 +893,7 @@ public function sendContact( * @param string $question Poll question, 1-300 characters * @param InputPollOption[] $options A JSON-serialized list of 2-12 answer options * @param string $business_connection_id Unique identifier of the business connection on behalf of which the message will be sent - * @param int $message_thread_id Unique identifier for the target message thread (topic) of the forum; for forum supergroups only + * @param int $message_thread_id Unique identifier for the target message thread (topic) of a forum; for forum supergroups and private chats of bots with forum topic mode enabled only * @param string $question_parse_mode Mode for parsing entities in the question. See formatting options for more details. Currently, only custom emoji entities are allowed * @param MessageEntity[] $question_entities A JSON-serialized list of special entities that appear in the poll question. It can be specified instead of question_parse_mode * @param bool $is_anonymous True, if the poll needs to be anonymous, defaults to True @@ -971,7 +975,7 @@ public function sendChecklist( * * @param int|string $chat_id Unique identifier for the target chat or username of the target channel (in the format @channelusername) * @param string $business_connection_id Unique identifier of the business connection on behalf of which the message will be sent - * @param int $message_thread_id Unique identifier for the target message thread (topic) of the forum; for forum supergroups only + * @param int $message_thread_id Unique identifier for the target message thread (topic) of a forum; for forum supergroups and private chats of bots with forum topic mode enabled only * @param int $direct_messages_topic_id Identifier of the direct messages topic to which the message will be sent; required if the message is sent to a direct messages chat * @param string $emoji Emoji on which the dice throw animation is based. Currently, must be one of “🎲”, “🎯”, “🏀”, “⚽”, “🎳”, or “🎰”. Dice can have values 1-6 for “🎲”, “🎯” and “🎳”, values 1-5 for “🏀” and “⚽”, and values 1-64 for “🎰”. Defaults to “🎲” * @param bool $disable_notification Sends the message silently. Users will receive a notification with no sound. @@ -1001,13 +1005,36 @@ public function sendDice( return $this->raw('sendDice', func_get_args()); } + /** + * Use this method to stream a partial message to a user while the message is being generated; supported only for bots with forum topic mode enabled. Returns True on success. + * + * @param int $chat_id Unique identifier for the target private chat + * @param int $draft_id Unique identifier of the message draft; must be non-zero. Changes of drafts with the same identifier are animated + * @param string $text Text of the message to be sent, 1-4096 characters after entities parsing + * @param int $message_thread_id Unique identifier for the target message thread + * @param ParseMode|string $parse_mode Mode for parsing entities in the message text. See formatting options for more details. + * @param MessageEntity[] $entities A JSON-serialized list of special entities that appear in message text, which can be specified instead of parse_mode + * + * @throws TelegramException + */ + public function sendMessageDraft( + int $chat_id, + int $draft_id, + string $text, + ?int $message_thread_id = null, + ParseMode|string|null $parse_mode = null, + ?array $entities = null, + ): bool { + return $this->raw('sendMessageDraft', func_get_args()); + } + /** * Use this method when you need to tell the user that something is happening on the bot's side. The status is set for 5 seconds or less (when a message arrives from your bot, Telegram clients clear its typing status). Returns True on success. * * @param int|string $chat_id Unique identifier for the target chat or username of the target supergroup (in the format @supergroupusername). Channel chats and channel direct messages chats aren't supported. * @param ChatActionType|string $action Type of action to broadcast. Choose one, depending on what the user is about to receive: typing for text messages, upload_photo for photos, record_video or upload_video for videos, record_voice or upload_voice for voice notes, upload_document for general files, choose_sticker for stickers, find_location for location data, record_video_note or upload_video_note for video notes. * @param string $business_connection_id Unique identifier of the business connection on behalf of which the action will be sent - * @param int $message_thread_id Unique identifier for the target message thread; for supergroups only + * @param int $message_thread_id Unique identifier for the target message thread or topic of a forum; for supergroups and private chats of bots with forum topic mode enabled only * * @throws TelegramException */ @@ -1145,7 +1172,7 @@ public function restrictChatMember( * @param bool $can_manage_chat Pass True if the administrator can access the chat event log, get boost list, see hidden supergroup and channel members, report spam messages, ignore slow mode, and send messages to the chat without paying Telegram Stars. Implied by any other administrator privilege. * @param bool $can_delete_messages Pass True if the administrator can delete messages of other users * @param bool $can_manage_video_chats Pass True if the administrator can manage video chats - * @param bool $can_restrict_members Pass True if the administrator can restrict, ban or unban chat members, or access supergroup statistics + * @param bool $can_restrict_members Pass True if the administrator can restrict, ban or unban chat members, or access supergroup statistics. For backward compatibility, defaults to True for promotions of channel administrators * @param bool $can_promote_members Pass True if the administrator can add new administrators with a subset of their own privileges or demote administrators that they have promoted, directly or indirectly (promoted by administrators that were appointed by him) * @param bool $can_change_info Pass True if the administrator can change chat title, photo and other settings * @param bool $can_invite_users Pass True if the administrator can invite new users to the chat @@ -1589,7 +1616,7 @@ public function createForumTopic( } /** - * Use this method to edit name and icon of a topic in a forum supergroup chat. The bot must be an administrator in the chat for this to work and must have the can_manage_topics administrator rights, unless it is the creator of the topic. Returns True on success. + * Use this method to edit name and icon of a topic in a forum supergroup chat or a private chat with a user. In the case of a supergroup chat the bot must be an administrator in the chat for this to work and must have the can_manage_topics administrator rights, unless it is the creator of the topic. Returns True on success. * * @param int|string $chat_id Unique identifier for the target chat or username of the target supergroup (in the format @supergroupusername) * @param int $message_thread_id Unique identifier for the target message thread of the forum topic @@ -1634,7 +1661,7 @@ public function reopenForumTopic(int|string $chat_id, int $message_thread_id): b } /** - * Use this method to delete a forum topic along with all its messages in a forum supergroup chat. The bot must be an administrator in the chat for this to work and must have the can_delete_messages administrator rights. Returns True on success. + * Use this method to delete a forum topic along with all its messages in a forum supergroup chat or a private chat with a user. In the case of a supergroup chat the bot must be an administrator in the chat for this to work and must have the can_delete_messages administrator rights. Returns True on success. * * @param int|string $chat_id Unique identifier for the target chat or username of the target supergroup (in the format @supergroupusername) * @param int $message_thread_id Unique identifier for the target message thread of the forum topic @@ -1647,7 +1674,7 @@ public function deleteForumTopic(int|string $chat_id, int $message_thread_id): b } /** - * Use this method to clear the list of pinned messages in a forum topic. The bot must be an administrator in the chat for this to work and must have the can_pin_messages administrator right in the supergroup. Returns True on success. + * Use this method to clear the list of pinned messages in a forum topic in a forum supergroup chat or a private chat with a user. In the case of a supergroup chat the bot must be an administrator in the chat for this to work and must have the can_pin_messages administrator right in the supergroup. Returns True on success. * * @param int|string $chat_id Unique identifier for the target chat or username of the target supergroup (in the format @supergroupusername) * @param int $message_thread_id Unique identifier for the target message thread of the forum topic @@ -1952,7 +1979,7 @@ public function getMyDefaultAdministratorRights(?bool $for_channels = null): Cha /** * Sends a gift to the given user or channel chat. The gift can't be converted to Telegram Stars by the receiver. Returns True on success. * - * @param string $gift_id Identifier of the gift + * @param string $gift_id Identifier of the gift; limited gifts can't be sent to channel chats * @param int $user_id Required if chat_id is not specified. Unique identifier of the target user who will receive the gift. * @param int|string $chat_id Required if user_id is not specified. Unique identifier for the chat or username of the channel (in the format @channelusername) that will receive the gift. * @param bool $pay_for_upgrade Pass True to pay for the gift upgrade from the bot's balance, thereby making the upgrade free for the receiver @@ -2196,8 +2223,10 @@ public function transferBusinessAccountStars(string $business_connection_id, int * @param bool $exclude_unsaved Pass True to exclude gifts that aren't saved to the account's profile page * @param bool $exclude_saved Pass True to exclude gifts that are saved to the account's profile page * @param bool $exclude_unlimited Pass True to exclude gifts that can be purchased an unlimited number of times - * @param bool $exclude_limited Pass True to exclude gifts that can be purchased a limited number of times + * @param bool $exclude_limited_upgradable Pass True to exclude gifts that can be purchased a limited number of times and can be upgraded to unique + * @param bool $exclude_limited_non_upgradable Pass True to exclude gifts that can be purchased a limited number of times and can't be upgraded to unique * @param bool $exclude_unique Pass True to exclude unique gifts + * @param bool $exclude_from_blockchain Pass True to exclude gifts that were assigned from the TON blockchain and can't be resold or transferred in Telegram * @param bool $sort_by_price Pass True to sort results by gift price instead of send date. Sorting is applied before pagination. * @param string $offset Offset of the first entry to return as received from the previous request; use empty string to get the first chunk of results * @param int $limit The maximum number of gifts to be returned; 1-100. Defaults to 100 @@ -2209,8 +2238,10 @@ public function getBusinessAccountGifts( ?bool $exclude_unsaved = null, ?bool $exclude_saved = null, ?bool $exclude_unlimited = null, - ?bool $exclude_limited = null, + ?bool $exclude_limited_upgradable = null, + ?bool $exclude_limited_non_upgradable = null, ?bool $exclude_unique = null, + ?bool $exclude_from_blockchain = null, ?bool $sort_by_price = null, ?string $offset = null, ?int $limit = null, @@ -2218,6 +2249,68 @@ public function getBusinessAccountGifts( return $this->raw('getBusinessAccountGifts', func_get_args()); } + /** + * Returns the gifts owned and hosted by a user. Returns OwnedGifts on success. + * + * @param int $user_id Unique identifier of the user + * @param bool $exclude_unlimited Pass True to exclude gifts that can be purchased an unlimited number of times + * @param bool $exclude_limited_upgradable Pass True to exclude gifts that can be purchased a limited number of times and can be upgraded to unique + * @param bool $exclude_limited_non_upgradable Pass True to exclude gifts that can be purchased a limited number of times and can't be upgraded to unique + * @param bool $exclude_from_blockchain Pass True to exclude gifts that were assigned from the TON blockchain and can't be resold or transferred in Telegram + * @param bool $exclude_unique Pass True to exclude unique gifts + * @param bool $sort_by_price Pass True to sort results by gift price instead of send date. Sorting is applied before pagination. + * @param string $offset Offset of the first entry to return as received from the previous request; use an empty string to get the first chunk of results + * @param int $limit The maximum number of gifts to be returned; 1-100. Defaults to 100 + * + * @throws TelegramException + */ + public function getUserGifts( + int $user_id, + ?bool $exclude_unlimited = null, + ?bool $exclude_limited_upgradable = null, + ?bool $exclude_limited_non_upgradable = null, + ?bool $exclude_from_blockchain = null, + ?bool $exclude_unique = null, + ?bool $sort_by_price = null, + ?string $offset = null, + ?int $limit = null, + ): OwnedGifts { + return $this->raw('getUserGifts', func_get_args()); + } + + /** + * Returns the gifts owned by a chat. Returns OwnedGifts on success. + * + * @param int|string $chat_id Unique identifier for the target chat or username of the target channel (in the format @channelusername) + * @param bool $exclude_unsaved Pass True to exclude gifts that aren't saved to the chat's profile page. Always True, unless the bot has the can_post_messages administrator right in the channel. + * @param bool $exclude_saved Pass True to exclude gifts that are saved to the chat's profile page. Always False, unless the bot has the can_post_messages administrator right in the channel. + * @param bool $exclude_unlimited Pass True to exclude gifts that can be purchased an unlimited number of times + * @param bool $exclude_limited_upgradable Pass True to exclude gifts that can be purchased a limited number of times and can be upgraded to unique + * @param bool $exclude_limited_non_upgradable Pass True to exclude gifts that can be purchased a limited number of times and can't be upgraded to unique + * @param bool $exclude_from_blockchain Pass True to exclude gifts that were assigned from the TON blockchain and can't be resold or transferred in Telegram + * @param bool $exclude_unique Pass True to exclude unique gifts + * @param bool $sort_by_price Pass True to sort results by gift price instead of send date. Sorting is applied before pagination. + * @param string $offset Offset of the first entry to return as received from the previous request; use an empty string to get the first chunk of results + * @param int $limit The maximum number of gifts to be returned; 1-100. Defaults to 100 + * + * @throws TelegramException + */ + public function getChatGifts( + int|string $chat_id, + ?bool $exclude_unsaved = null, + ?bool $exclude_saved = null, + ?bool $exclude_unlimited = null, + ?bool $exclude_limited_upgradable = null, + ?bool $exclude_limited_non_upgradable = null, + ?bool $exclude_from_blockchain = null, + ?bool $exclude_unique = null, + ?bool $sort_by_price = null, + ?string $offset = null, + ?int $limit = null, + ): OwnedGifts { + return $this->raw('getChatGifts', func_get_args()); + } + /** * Converts a given regular gift to Telegram Stars. Requires the can_convert_gifts_to_stars business bot right. Returns True on success. * @@ -2298,6 +2391,29 @@ public function postStory( return $this->raw('postStory', func_get_args()); } + /** + * Reposts a story on behalf of a business account from another business account. Both business accounts must be managed by the same bot, and the story on the source account must have been posted (or reposted) by the bot. Requires the can_manage_stories business bot right for both business accounts. Returns Story on success. + * + * @param string $business_connection_id Unique identifier of the business connection + * @param int $from_chat_id Unique identifier of the chat which posted the story that should be reposted + * @param int $from_story_id Unique identifier of the story that should be reposted + * @param int $active_period Period after which the story is moved to the archive, in seconds; must be one of 6 * 3600, 12 * 3600, 86400, or 2 * 86400 + * @param bool $post_to_chat_page Pass True to keep the story accessible after it expires + * @param bool $protect_content Pass True if the content of the story must be protected from forwarding and screenshotting + * + * @throws TelegramException + */ + public function repostStory( + string $business_connection_id, + int $from_chat_id, + int $from_story_id, + int $active_period, + ?bool $post_to_chat_page = null, + ?bool $protect_content = null, + ): Story { + return $this->raw('repostStory', func_get_args()); + } + /** * Edits a story previously posted by the bot on behalf of a managed business account. Requires the can_manage_stories business bot right. Returns Story on success. * @@ -2592,7 +2708,7 @@ public function deleteMessages(int|string $chat_id, array $message_ids): bool * @param int|string $chat_id Unique identifier for the target chat or username of the target channel (in the format @channelusername) * @param InputFile|string $sticker Sticker to send. Pass a file_id as String to send a file that exists on the Telegram servers (recommended), pass an HTTP URL as a String for Telegram to get a .WEBP sticker from the Internet, or upload a new .WEBP, .TGS, or .WEBM sticker using multipart/form-data. More information on Sending Files ». Video and animated stickers can't be sent via an HTTP URL. * @param string $business_connection_id Unique identifier of the business connection on behalf of which the message will be sent - * @param int $message_thread_id Unique identifier for the target message thread (topic) of the forum; for forum supergroups only + * @param int $message_thread_id Unique identifier for the target message thread (topic) of a forum; for forum supergroups and private chats of bots with forum topic mode enabled only * @param int $direct_messages_topic_id Identifier of the direct messages topic to which the message will be sent; required if the message is sent to a direct messages chat * @param string $emoji Emoji associated with the sticker; only for just uploaded stickers * @param bool $disable_notification Sends the message silently. Users will receive a notification with no sound. @@ -2903,7 +3019,7 @@ public function savePreparedInlineMessage( * @param string $payload Bot-defined invoice payload, 1-128 bytes. This will not be displayed to the user, use it for your internal processes. * @param string $currency Three-letter ISO 4217 currency code, see more on currencies. Pass “XTR” for payments in Telegram Stars. * @param LabeledPrice[] $prices Price breakdown, a JSON-serialized list of components (e.g. product price, tax, discount, delivery cost, delivery tax, bonus, etc.). Must contain exactly one item for payments in Telegram Stars. - * @param int $message_thread_id Unique identifier for the target message thread (topic) of the forum; for forum supergroups only + * @param int $message_thread_id Unique identifier for the target message thread (topic) of a forum; for forum supergroups and private chats of bots with forum topic mode enabled only * @param int $direct_messages_topic_id Identifier of the direct messages topic to which the message will be sent; required if the message is sent to a direct messages chat * @param string $provider_token Payment provider token, obtained via @BotFather. Pass an empty string for payments in Telegram Stars. * @param int $max_tip_amount The maximum accepted amount for tips in the smallest units of the currency (integer, not float/double). For example, for a maximum tip of US$ 1.45 pass max_tip_amount = 145. See the exp parameter in currencies.json, it shows the number of digits past the decimal point for each currency (2 for the majority of currencies). Defaults to 0. Not supported for payments in Telegram Stars. @@ -3120,7 +3236,7 @@ public function setPassportDataErrors(int $user_id, array $errors): bool * @param int $chat_id Unique identifier for the target chat. Games can't be sent to channel direct messages chats and channel chats. * @param string $game_short_name Short name of the game, serves as the unique identifier for the game. Set up your games via @BotFather. * @param string $business_connection_id Unique identifier of the business connection on behalf of which the message will be sent - * @param int $message_thread_id Unique identifier for the target message thread (topic) of the forum; for forum supergroups only + * @param int $message_thread_id Unique identifier for the target message thread (topic) of a forum; for forum supergroups and private chats of bots with forum topic mode enabled only * @param bool $disable_notification Sends the message silently. Users will receive a notification with no sound. * @param bool $protect_content Protects the contents of the sent message from forwarding and saving * @param bool $allow_paid_broadcast Pass True to allow up to 1000 messages per second, ignoring broadcasting limits for a fee of 0.1 Telegram Stars per message. The relevant Stars will be withdrawn from the bot's balance diff --git a/src/Telegram/AcceptedGiftTypes.php b/src/Telegram/AcceptedGiftTypes.php index 850fbc4..616a070 100644 --- a/src/Telegram/AcceptedGiftTypes.php +++ b/src/Telegram/AcceptedGiftTypes.php @@ -25,23 +25,29 @@ class AcceptedGiftTypes extends Type /** True, if a Telegram Premium subscription is accepted */ public bool $premium_subscription; + /** True, if transfers of unique gifts from channels are accepted */ + public bool $gifts_from_channels; + /** * @param bool $unlimited_gifts True, if unlimited regular gifts are accepted * @param bool $limited_gifts True, if limited regular gifts are accepted * @param bool $unique_gifts True, if unique gifts or gifts that can be upgraded to unique for free are accepted * @param bool $premium_subscription True, if a Telegram Premium subscription is accepted + * @param bool $gifts_from_channels True, if transfers of unique gifts from channels are accepted */ public static function make( bool $unlimited_gifts, bool $limited_gifts, bool $unique_gifts, bool $premium_subscription, + bool $gifts_from_channels, ): static { return new static([ 'unlimited_gifts' => $unlimited_gifts, 'limited_gifts' => $limited_gifts, 'unique_gifts' => $unique_gifts, 'premium_subscription' => $premium_subscription, + 'gifts_from_channels' => $gifts_from_channels, ]); } } diff --git a/src/Telegram/ChatFullInfo.php b/src/Telegram/ChatFullInfo.php index 08e2156..2c092b6 100644 --- a/src/Telegram/ChatFullInfo.php +++ b/src/Telegram/ChatFullInfo.php @@ -162,6 +162,15 @@ class ChatFullInfo extends Type /** Optional. For supergroups, the location to which the supergroup is connected */ public ?ChatLocation $location = null; + /** Optional. For private chats, the rating of the user if any */ + public ?UserRating $rating = null; + + /** Optional. The color scheme based on a unique gift that must be used for the chat's name, message replies and link previews */ + public ?UniqueGiftColors $unique_gift_colors = null; + + /** Optional. The number of Telegram Stars a general user have to pay to send a message to the chat */ + public ?int $paid_message_star_count = null; + /** * @param int $id Unique identifier for this chat. This number may have more than 32 significant bits 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 identifier. * @param string $type Type of the chat, can be either “private”, “group”, “supergroup” or “channel” @@ -210,6 +219,9 @@ class ChatFullInfo extends Type * @param string $custom_emoji_sticker_set_name Optional. For supergroups, the name of the group's custom emoji sticker set. Custom emoji from this set can be used by all users and bots in the group. * @param int $linked_chat_id Optional. Unique identifier for the linked chat, i.e. the discussion group identifier for a channel and vice versa; for supergroups and channel chats. This identifier may be greater than 32 bits and some programming languages may have difficulty/silent defects in interpreting it. But it is smaller than 52 bits, so a signed 64 bit integer or double-precision float type are safe for storing this identifier. * @param ChatLocation $location Optional. For supergroups, the location to which the supergroup is connected + * @param UserRating $rating Optional. For private chats, the rating of the user if any + * @param UniqueGiftColors $unique_gift_colors Optional. The color scheme based on a unique gift that must be used for the chat's name, message replies and link previews + * @param int $paid_message_star_count Optional. The number of Telegram Stars a general user have to pay to send a message to the chat */ public static function make( int $id, @@ -259,6 +271,9 @@ public static function make( ?string $custom_emoji_sticker_set_name = null, ?int $linked_chat_id = null, ?ChatLocation $location = null, + ?UserRating $rating = null, + ?UniqueGiftColors $unique_gift_colors = null, + ?int $paid_message_star_count = null, ): static { return new static([ 'id' => $id, @@ -308,6 +323,9 @@ public static function make( 'custom_emoji_sticker_set_name' => $custom_emoji_sticker_set_name, 'linked_chat_id' => $linked_chat_id, 'location' => $location, + 'rating' => $rating, + 'unique_gift_colors' => $unique_gift_colors, + 'paid_message_star_count' => $paid_message_star_count, ]); } } diff --git a/src/Telegram/ChecklistTask.php b/src/Telegram/ChecklistTask.php index b5c863a..03ed4ee 100644 --- a/src/Telegram/ChecklistTask.php +++ b/src/Telegram/ChecklistTask.php @@ -26,9 +26,12 @@ class ChecklistTask extends Type */ public ?array $text_entities = null; - /** Optional. User that completed the task; omitted if the task wasn't completed */ + /** Optional. User that completed the task; omitted if the task wasn't completed by a user */ public ?User $completed_by_user = null; + /** Optional. Chat that completed the task; omitted if the task wasn't completed by a chat */ + public ?Chat $completed_by_chat = null; + /** Optional. Point in time (Unix timestamp) when the task was completed; 0 if the task wasn't completed */ public ?int $completion_date = null; @@ -36,7 +39,8 @@ class ChecklistTask extends Type * @param int $id Unique identifier of the task * @param string $text Text of the task * @param MessageEntity[] $text_entities Optional. Special entities that appear in the task text - * @param User $completed_by_user Optional. User that completed the task; omitted if the task wasn't completed + * @param User $completed_by_user Optional. User that completed the task; omitted if the task wasn't completed by a user + * @param Chat $completed_by_chat Optional. Chat that completed the task; omitted if the task wasn't completed by a chat * @param int $completion_date Optional. Point in time (Unix timestamp) when the task was completed; 0 if the task wasn't completed */ public static function make( @@ -44,6 +48,7 @@ public static function make( string $text, ?array $text_entities = null, ?User $completed_by_user = null, + ?Chat $completed_by_chat = null, ?int $completion_date = null, ): static { return new static([ @@ -51,6 +56,7 @@ public static function make( 'text' => $text, 'text_entities' => $text_entities, 'completed_by_user' => $completed_by_user, + 'completed_by_chat' => $completed_by_chat, 'completion_date' => $completion_date, ]); } diff --git a/src/Telegram/ForumTopic.php b/src/Telegram/ForumTopic.php index d8b8e9b..730bb8a 100644 --- a/src/Telegram/ForumTopic.php +++ b/src/Telegram/ForumTopic.php @@ -25,23 +25,29 @@ class ForumTopic extends Type /** Optional. Unique identifier of the custom emoji shown as the topic icon */ public ?string $icon_custom_emoji_id = null; + /** Optional. True, if the name of the topic wasn't specified explicitly by its creator and likely needs to be changed by the bot */ + public ?bool $is_name_implicit = null; + /** * @param int $message_thread_id Unique identifier of the forum topic * @param string $name Name of the topic * @param int $icon_color Color of the topic icon in RGB format * @param string $icon_custom_emoji_id Optional. Unique identifier of the custom emoji shown as the topic icon + * @param bool $is_name_implicit Optional. True, if the name of the topic wasn't specified explicitly by its creator and likely needs to be changed by the bot */ public static function make( int $message_thread_id, string $name, int $icon_color, ?string $icon_custom_emoji_id = null, + ?bool $is_name_implicit = null, ): static { return new static([ 'message_thread_id' => $message_thread_id, 'name' => $name, 'icon_color' => $icon_color, 'icon_custom_emoji_id' => $icon_custom_emoji_id, + 'is_name_implicit' => $is_name_implicit, ]); } } diff --git a/src/Telegram/ForumTopicCreated.php b/src/Telegram/ForumTopicCreated.php index 752bb5c..0c5a0d6 100644 --- a/src/Telegram/ForumTopicCreated.php +++ b/src/Telegram/ForumTopicCreated.php @@ -22,17 +22,26 @@ class ForumTopicCreated extends Type /** Optional. Unique identifier of the custom emoji shown as the topic icon */ public ?string $icon_custom_emoji_id = null; + /** Optional. True, if the name of the topic wasn't specified explicitly by its creator and likely needs to be changed by the bot */ + public ?bool $is_name_implicit = null; + /** * @param string $name Name of the topic * @param int $icon_color Color of the topic icon in RGB format * @param string $icon_custom_emoji_id Optional. Unique identifier of the custom emoji shown as the topic icon + * @param bool $is_name_implicit Optional. True, if the name of the topic wasn't specified explicitly by its creator and likely needs to be changed by the bot */ - public static function make(string $name, int $icon_color, ?string $icon_custom_emoji_id = null): static - { + public static function make( + string $name, + int $icon_color, + ?string $icon_custom_emoji_id = null, + ?bool $is_name_implicit = null, + ): static { return new static([ 'name' => $name, 'icon_color' => $icon_color, 'icon_custom_emoji_id' => $icon_custom_emoji_id, + 'is_name_implicit' => $is_name_implicit, ]); } } diff --git a/src/Telegram/Gift.php b/src/Telegram/Gift.php index fb3bdd3..36780f3 100644 --- a/src/Telegram/Gift.php +++ b/src/Telegram/Gift.php @@ -25,12 +25,30 @@ class Gift extends Type /** Optional. The number of Telegram Stars that must be paid to upgrade the gift to a unique one */ public ?int $upgrade_star_count = null; - /** Optional. The total number of the gifts of this type that can be sent; for limited gifts only */ + /** Optional. True, if the gift can only be purchased by Telegram Premium subscribers */ + public ?bool $is_premium = null; + + /** Optional. True, if the gift can be used (after being upgraded) to customize a user's appearance */ + public ?bool $has_colors = null; + + /** Optional. The total number of gifts of this type that can be sent by all users; for limited gifts only */ public ?int $total_count = null; - /** Optional. The number of remaining gifts of this type that can be sent; for limited gifts only */ + /** Optional. The number of remaining gifts of this type that can be sent by all users; for limited gifts only */ public ?int $remaining_count = null; + /** Optional. The total number of gifts of this type that can be sent by the bot; for limited gifts only */ + public ?int $personal_total_count = null; + + /** Optional. The number of remaining gifts of this type that can be sent by the bot; for limited gifts only */ + public ?int $personal_remaining_count = null; + + /** Optional. Background of the gift */ + public ?GiftBackground $background = null; + + /** Optional. The total number of different unique gifts that can be obtained by upgrading the gift */ + public ?int $unique_gift_variant_count = null; + /** Optional. Information about the chat that published the gift */ public ?Chat $publisher_chat = null; @@ -39,8 +57,14 @@ class Gift extends Type * @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 Optional. The number of Telegram Stars that must be paid to upgrade the gift to a unique one - * @param int $total_count Optional. The total number of the gifts of this type that can be sent; for limited gifts only - * @param int $remaining_count Optional. The number of remaining gifts of this type that can be sent; for limited gifts only + * @param bool $is_premium Optional. True, if the gift can only be purchased by Telegram Premium subscribers + * @param bool $has_colors Optional. True, if the gift can be used (after being upgraded) to customize a user's appearance + * @param int $total_count Optional. The total number of gifts of this type that can be sent by all users; for limited gifts only + * @param int $remaining_count Optional. The number of remaining gifts of this type that can be sent by all users; for limited gifts only + * @param int $personal_total_count Optional. The total number of gifts of this type that can be sent by the bot; for limited gifts only + * @param int $personal_remaining_count Optional. The number of remaining gifts of this type that can be sent by the bot; for limited gifts only + * @param GiftBackground $background Optional. Background of the gift + * @param int $unique_gift_variant_count Optional. The total number of different unique gifts that can be obtained by upgrading the gift * @param Chat $publisher_chat Optional. Information about the chat that published the gift */ public static function make( @@ -48,8 +72,14 @@ public static function make( Sticker $sticker, int $star_count, ?int $upgrade_star_count = null, + ?bool $is_premium = null, + ?bool $has_colors = null, ?int $total_count = null, ?int $remaining_count = null, + ?int $personal_total_count = null, + ?int $personal_remaining_count = null, + ?GiftBackground $background = null, + ?int $unique_gift_variant_count = null, ?Chat $publisher_chat = null, ): static { return new static([ @@ -57,8 +87,14 @@ public static function make( 'sticker' => $sticker, 'star_count' => $star_count, 'upgrade_star_count' => $upgrade_star_count, + 'is_premium' => $is_premium, + 'has_colors' => $has_colors, 'total_count' => $total_count, 'remaining_count' => $remaining_count, + 'personal_total_count' => $personal_total_count, + 'personal_remaining_count' => $personal_remaining_count, + 'background' => $background, + 'unique_gift_variant_count' => $unique_gift_variant_count, 'publisher_chat' => $publisher_chat, ]); } diff --git a/src/Telegram/GiftBackground.php b/src/Telegram/GiftBackground.php new file mode 100644 index 0000000..f0ff061 --- /dev/null +++ b/src/Telegram/GiftBackground.php @@ -0,0 +1,38 @@ + $center_color, + 'edge_color' => $edge_color, + 'text_color' => $text_color, + ]); + } +} diff --git a/src/Telegram/GiftInfo.php b/src/Telegram/GiftInfo.php index d106fa8..48dd1e4 100644 --- a/src/Telegram/GiftInfo.php +++ b/src/Telegram/GiftInfo.php @@ -22,9 +22,12 @@ class GiftInfo extends Type /** Optional. Number of Telegram Stars that can be claimed by the receiver by converting the gift; omitted if conversion to Telegram Stars is impossible */ public ?int $convert_star_count = null; - /** Optional. Number of Telegram Stars that were prepaid by the sender for the ability to upgrade the gift */ + /** Optional. Number of Telegram Stars that were prepaid for the ability to upgrade the gift */ public ?int $prepaid_upgrade_star_count = null; + /** Optional. True, if the gift's upgrade was purchased after the gift was sent */ + public ?bool $is_upgrade_separate = null; + /** Optional. True, if the gift can be upgraded to a unique gift */ public ?bool $can_be_upgraded = null; @@ -41,35 +44,44 @@ class GiftInfo extends Type /** Optional. True, if the sender and gift text are shown only to the gift receiver; otherwise, everyone will be able to see them */ public ?bool $is_private = null; + /** Optional. Unique number reserved for this gift when upgraded. See the number field in UniqueGift */ + public ?int $unique_gift_number = null; + /** * @param Gift $gift Information about the gift * @param string $owned_gift_id Optional. Unique identifier of the received gift for the bot; only present for gifts received on behalf of business accounts * @param int $convert_star_count Optional. Number of Telegram Stars that can be claimed by the receiver by converting the gift; omitted if conversion to Telegram Stars is impossible - * @param int $prepaid_upgrade_star_count Optional. Number of Telegram Stars that were prepaid by the sender for the ability to upgrade the gift + * @param int $prepaid_upgrade_star_count Optional. Number of Telegram Stars that were prepaid for the ability to upgrade the gift + * @param bool $is_upgrade_separate Optional. True, if the gift's upgrade was purchased after the gift was sent * @param bool $can_be_upgraded Optional. True, if the gift can be upgraded to a unique gift * @param string $text Optional. Text of the message that was added to the gift * @param MessageEntity[] $entities Optional. Special entities that appear in the text * @param bool $is_private Optional. True, if the sender and gift text are shown only to the gift receiver; otherwise, everyone will be able to see them + * @param int $unique_gift_number Optional. Unique number reserved for this gift when upgraded. See the number field in UniqueGift */ public static function make( Gift $gift, ?string $owned_gift_id = null, ?int $convert_star_count = null, ?int $prepaid_upgrade_star_count = null, + ?bool $is_upgrade_separate = null, ?bool $can_be_upgraded = null, ?string $text = null, ?array $entities = null, ?bool $is_private = null, + ?int $unique_gift_number = null, ): static { return new static([ 'gift' => $gift, 'owned_gift_id' => $owned_gift_id, 'convert_star_count' => $convert_star_count, 'prepaid_upgrade_star_count' => $prepaid_upgrade_star_count, + 'is_upgrade_separate' => $is_upgrade_separate, 'can_be_upgraded' => $can_be_upgraded, 'text' => $text, 'entities' => $entities, 'is_private' => $is_private, + 'unique_gift_number' => $unique_gift_number, ]); } } diff --git a/src/Telegram/Message.php b/src/Telegram/Message.php index 12726e3..251723e 100644 --- a/src/Telegram/Message.php +++ b/src/Telegram/Message.php @@ -15,7 +15,7 @@ class Message extends MaybeInaccessibleMessage { use MessageExtension; - /** Optional. Unique identifier of a message thread to which the message belongs; for supergroups only */ + /** Optional. Unique identifier of a message thread or forum topic to which the message belongs; for supergroups and private chats only */ public ?int $message_thread_id = null; /** Optional. Information about the direct messages chat topic that contains the message */ @@ -39,7 +39,7 @@ class Message extends MaybeInaccessibleMessage /** Optional. Information about the original message for forwarded messages */ public ?MessageOrigin $forward_origin = null; - /** Optional. True, if the message is sent to a forum topic */ + /** Optional. True, if the message is sent to a topic in a forum supergroup or a private chat with the bot */ public ?bool $is_topic_message = null; /** Optional. True, if the message is a channel post that was automatically forwarded to the connected discussion group */ @@ -239,6 +239,9 @@ class Message extends MaybeInaccessibleMessage /** Optional. Service message: a unique gift was sent or received */ public ?UniqueGiftInfo $unique_gift = null; + /** Optional. Service message: upgrade of a gift was purchased after the gift was sent */ + public ?GiftInfo $gift_upgrade_sent = null; + /** Optional. The domain name of the website on which the user has logged in. More about Telegram Login » */ public ?string $connected_website = null; @@ -336,7 +339,7 @@ class Message extends MaybeInaccessibleMessage * @param int $message_id Unique message identifier inside this chat. In specific instances (e.g., message containing a video sent to a big chat), the server might automatically schedule a message instead of sending it immediately. In such cases, this field will be 0 and the relevant message will be unusable until it is actually sent * @param int $date Date the message was sent in Unix time. It is always a positive number, representing a valid date. * @param Chat $chat Chat the message belongs to - * @param int $message_thread_id Optional. Unique identifier of a message thread to which the message belongs; for supergroups only + * @param int $message_thread_id Optional. Unique identifier of a message thread or forum topic to which the message belongs; for supergroups and private chats only * @param DirectMessagesTopic $direct_messages_topic Optional. Information about the direct messages chat topic that contains the message * @param User $from Optional. Sender of the message; may be empty for messages sent to channels. For backward compatibility, if the message was sent on behalf of a chat, the field contains a fake sender user in non-channel chats * @param Chat $sender_chat Optional. Sender of the message when sent on behalf of a chat. For example, the supergroup itself for messages sent by its anonymous administrators or a linked channel for messages automatically forwarded to the channel's discussion group. For backward compatibility, if the message was sent on behalf of a chat, the field from contains a fake sender user in non-channel chats. @@ -344,7 +347,7 @@ class Message extends MaybeInaccessibleMessage * @param User $sender_business_bot Optional. The bot that actually sent the message on behalf of the business account. Available only for outgoing messages sent on behalf of the connected business account. * @param string $business_connection_id Optional. Unique identifier of the business connection from which the message was received. If non-empty, the message belongs to a chat of the corresponding business account that is independent from any potential bot chat which might share the same identifier. * @param MessageOrigin $forward_origin Optional. Information about the original message for forwarded messages - * @param bool $is_topic_message Optional. True, if the message is sent to a forum topic + * @param bool $is_topic_message Optional. True, if the message is sent to a topic in a forum supergroup or a private chat with the bot * @param bool $is_automatic_forward Optional. True, if the message is a channel post that was automatically forwarded to the connected discussion group * @param Message $reply_to_message Optional. For replies in the same chat and message thread, the original message. Note that the Message object in this field will not contain further reply_to_message fields even if it itself is a reply. * @param ExternalReplyInfo $external_reply Optional. Information about the message that is being replied to, which may come from another chat or forum topic @@ -404,6 +407,7 @@ class Message extends MaybeInaccessibleMessage * @param ChatShared $chat_shared Optional. Service message: a chat was shared with the bot * @param GiftInfo $gift Optional. Service message: a regular gift was sent or received * @param UniqueGiftInfo $unique_gift Optional. Service message: a unique gift was sent or received + * @param GiftInfo $gift_upgrade_sent Optional. Service message: upgrade of a gift was purchased after the gift was sent * @param string $connected_website Optional. The domain name of the website on which the user has logged in. More about Telegram Login » * @param WriteAccessAllowed $write_access_allowed Optional. Service message: the user allowed the bot to write messages after adding it to the attachment or side menu, launching a Web App from a link, or accepting an explicit request from a Web App sent by the method requestWriteAccess * @param PassportData $passport_data Optional. Telegram Passport data @@ -508,6 +512,7 @@ public static function make( ?ChatShared $chat_shared = null, ?GiftInfo $gift = null, ?UniqueGiftInfo $unique_gift = null, + ?GiftInfo $gift_upgrade_sent = null, ?string $connected_website = null, ?WriteAccessAllowed $write_access_allowed = null, ?PassportData $passport_data = null, @@ -612,6 +617,7 @@ public static function make( 'chat_shared' => $chat_shared, 'gift' => $gift, 'unique_gift' => $unique_gift, + 'gift_upgrade_sent' => $gift_upgrade_sent, 'connected_website' => $connected_website, 'write_access_allowed' => $write_access_allowed, 'passport_data' => $passport_data, diff --git a/src/Telegram/OwnedGiftRegular.php b/src/Telegram/OwnedGiftRegular.php index 831447a..00c0ab2 100644 --- a/src/Telegram/OwnedGiftRegular.php +++ b/src/Telegram/OwnedGiftRegular.php @@ -36,12 +36,18 @@ class OwnedGiftRegular extends OwnedGift /** Optional. True, if the gift was refunded and isn't available anymore */ public ?bool $was_refunded = null; - /** Optional. Number of Telegram Stars that can be claimed by the receiver instead of the gift; omitted if the gift cannot be converted to Telegram Stars */ + /** Optional. Number of Telegram Stars that can be claimed by the receiver instead of the gift; omitted if the gift cannot be converted to Telegram Stars; for gifts received on behalf of business accounts only */ public ?int $convert_star_count = null; - /** Optional. Number of Telegram Stars that were paid by the sender for the ability to upgrade the gift */ + /** Optional. Number of Telegram Stars that were paid for the ability to upgrade the gift */ public ?int $prepaid_upgrade_star_count = null; + /** Optional. True, if the gift's upgrade was purchased after the gift was sent; for gifts received on behalf of business accounts only */ + public ?bool $is_upgrade_separate = null; + + /** Optional. Unique number reserved for this gift when upgraded. See the number field in UniqueGift */ + public ?int $unique_gift_number = null; + /** * @param Gift $gift Information about the regular gift * @param int $send_date Date the gift was sent in Unix time @@ -53,8 +59,10 @@ class OwnedGiftRegular extends OwnedGift * @param bool $is_saved Optional. True, if the gift is displayed on the account's profile page; for gifts received on behalf of business accounts only * @param bool $can_be_upgraded Optional. True, if the gift can be upgraded to a unique gift; for gifts received on behalf of business accounts only * @param bool $was_refunded Optional. True, if the gift was refunded and isn't available anymore - * @param int $convert_star_count Optional. Number of Telegram Stars that can be claimed by the receiver instead of the gift; omitted if the gift cannot be converted to Telegram Stars - * @param int $prepaid_upgrade_star_count Optional. Number of Telegram Stars that were paid by the sender for the ability to upgrade the gift + * @param int $convert_star_count Optional. Number of Telegram Stars that can be claimed by the receiver instead of the gift; omitted if the gift cannot be converted to Telegram Stars; for gifts received on behalf of business accounts only + * @param int $prepaid_upgrade_star_count Optional. Number of Telegram Stars that were paid for the ability to upgrade the gift + * @param bool $is_upgrade_separate Optional. True, if the gift's upgrade was purchased after the gift was sent; for gifts received on behalf of business accounts only + * @param int $unique_gift_number Optional. Unique number reserved for this gift when upgraded. See the number field in UniqueGift */ public static function make( Gift $gift, @@ -69,6 +77,8 @@ public static function make( ?bool $was_refunded = null, ?int $convert_star_count = null, ?int $prepaid_upgrade_star_count = null, + ?bool $is_upgrade_separate = null, + ?int $unique_gift_number = null, ): static { return new static([ 'gift' => $gift, @@ -83,6 +93,8 @@ public static function make( 'was_refunded' => $was_refunded, 'convert_star_count' => $convert_star_count, 'prepaid_upgrade_star_count' => $prepaid_upgrade_star_count, + 'is_upgrade_separate' => $is_upgrade_separate, + 'unique_gift_number' => $unique_gift_number, ]); } } diff --git a/src/Telegram/UniqueGift.php b/src/Telegram/UniqueGift.php index df2683a..b643b86 100644 --- a/src/Telegram/UniqueGift.php +++ b/src/Telegram/UniqueGift.php @@ -13,6 +13,9 @@ */ class UniqueGift extends Type { + /** Identifier of the regular gift from which the gift was upgraded */ + public string $gift_id; + /** Human-readable name of the regular gift from which this unique gift was upgraded */ public string $base_name; @@ -31,34 +34,55 @@ class UniqueGift extends Type /** Backdrop of the gift */ public UniqueGiftBackdrop $backdrop; + /** Optional. True, if the original regular gift was exclusively purchaseable by Telegram Premium subscribers */ + public ?bool $is_premium = null; + + /** Optional. True, if the gift is assigned from the TON blockchain and can't be resold or transferred in Telegram */ + public ?bool $is_from_blockchain = null; + + /** Optional. The color scheme that can be used by the gift's owner for the chat's name, replies to messages and link previews; for business account gifts and gifts that are currently on sale only */ + public ?UniqueGiftColors $colors = null; + /** Optional. Information about the chat that published the gift */ public ?Chat $publisher_chat = null; /** + * @param string $gift_id Identifier of the regular gift from which the gift was upgraded * @param string $base_name Human-readable name of the regular gift from which this unique gift was upgraded * @param string $name Unique name of the gift. This name can be used in https://t.me/nft/... links and story areas * @param int $number Unique number of the upgraded gift among gifts upgraded from the same regular gift * @param UniqueGiftModel $model Model of the gift * @param UniqueGiftSymbol $symbol Symbol of the gift * @param UniqueGiftBackdrop $backdrop Backdrop of the gift + * @param bool $is_premium Optional. True, if the original regular gift was exclusively purchaseable by Telegram Premium subscribers + * @param bool $is_from_blockchain Optional. True, if the gift is assigned from the TON blockchain and can't be resold or transferred in Telegram + * @param UniqueGiftColors $colors Optional. The color scheme that can be used by the gift's owner for the chat's name, replies to messages and link previews; for business account gifts and gifts that are currently on sale only * @param Chat $publisher_chat Optional. Information about the chat that published the gift */ public static function make( + string $gift_id, string $base_name, string $name, int $number, UniqueGiftModel $model, UniqueGiftSymbol $symbol, UniqueGiftBackdrop $backdrop, + ?bool $is_premium = null, + ?bool $is_from_blockchain = null, + ?UniqueGiftColors $colors = null, ?Chat $publisher_chat = null, ): static { return new static([ + 'gift_id' => $gift_id, 'base_name' => $base_name, 'name' => $name, 'number' => $number, 'model' => $model, 'symbol' => $symbol, 'backdrop' => $backdrop, + 'is_premium' => $is_premium, + 'is_from_blockchain' => $is_from_blockchain, + 'colors' => $colors, 'publisher_chat' => $publisher_chat, ]); } diff --git a/src/Telegram/UniqueGiftColors.php b/src/Telegram/UniqueGiftColors.php new file mode 100644 index 0000000..bbfdc28 --- /dev/null +++ b/src/Telegram/UniqueGiftColors.php @@ -0,0 +1,67 @@ + $model_custom_emoji_id, + 'symbol_custom_emoji_id' => $symbol_custom_emoji_id, + 'light_theme_main_color' => $light_theme_main_color, + 'light_theme_other_colors' => $light_theme_other_colors, + 'dark_theme_main_color' => $dark_theme_main_color, + 'dark_theme_other_colors' => $dark_theme_other_colors, + ]); + } +} diff --git a/src/Telegram/UniqueGiftInfo.php b/src/Telegram/UniqueGiftInfo.php index d9ae51a..665b93f 100644 --- a/src/Telegram/UniqueGiftInfo.php +++ b/src/Telegram/UniqueGiftInfo.php @@ -16,11 +16,14 @@ class UniqueGiftInfo extends Type /** Information about the gift */ public UniqueGift $gift; - /** Origin of the gift. Currently, either “upgrade” for gifts upgraded from regular gifts, “transfer” for gifts transferred from other users or channels, or “resale” for gifts bought from other users */ + /** Origin of the gift. Currently, either “upgrade” for gifts upgraded from regular gifts, “transfer” for gifts transferred from other users or channels, “resale” for gifts bought from other users, “gifted_upgrade” for upgrades purchased after the gift was sent, or “offer” for gifts bought or sold through gift purchase offers */ public string $origin; - /** Optional. For gifts bought from other users, the price paid for the gift */ - public ?int $last_resale_star_count = null; + /** Optional. For gifts bought from other users, the currency in which the payment for the gift was done. Currently, one of “XTR” for Telegram Stars or “TON” for toncoins. */ + public ?string $last_resale_currency = null; + + /** Optional. For gifts bought from other users, the price paid for the gift in either Telegram Stars or nanotoncoins */ + public ?int $last_resale_amount = null; /** Optional. Unique identifier of the received gift for the bot; only present for gifts received on behalf of business accounts */ public ?string $owned_gift_id = null; @@ -33,8 +36,9 @@ class UniqueGiftInfo extends Type /** * @param UniqueGift $gift Information about the gift - * @param string $origin Origin of the gift. Currently, either “upgrade” for gifts upgraded from regular gifts, “transfer” for gifts transferred from other users or channels, or “resale” for gifts bought from other users - * @param int $last_resale_star_count Optional. For gifts bought from other users, the price paid for the gift + * @param string $origin Origin of the gift. Currently, either “upgrade” for gifts upgraded from regular gifts, “transfer” for gifts transferred from other users or channels, “resale” for gifts bought from other users, “gifted_upgrade” for upgrades purchased after the gift was sent, or “offer” for gifts bought or sold through gift purchase offers + * @param string $last_resale_currency Optional. For gifts bought from other users, the currency in which the payment for the gift was done. Currently, one of “XTR” for Telegram Stars or “TON” for toncoins. + * @param int $last_resale_amount Optional. For gifts bought from other users, the price paid for the gift in either Telegram Stars or nanotoncoins * @param string $owned_gift_id Optional. Unique identifier of the received gift for the bot; only present for gifts received on behalf of business accounts * @param int $transfer_star_count Optional. Number of Telegram Stars that must be paid to transfer the gift; omitted if the bot cannot transfer the gift * @param int $next_transfer_date Optional. Point in time (Unix timestamp) when the gift can be transferred. If it is in the past, then the gift can be transferred now @@ -42,7 +46,8 @@ class UniqueGiftInfo extends Type public static function make( UniqueGift $gift, string $origin, - ?int $last_resale_star_count = null, + ?string $last_resale_currency = null, + ?int $last_resale_amount = null, ?string $owned_gift_id = null, ?int $transfer_star_count = null, ?int $next_transfer_date = null, @@ -50,7 +55,8 @@ public static function make( return new static([ 'gift' => $gift, 'origin' => $origin, - 'last_resale_star_count' => $last_resale_star_count, + 'last_resale_currency' => $last_resale_currency, + 'last_resale_amount' => $last_resale_amount, 'owned_gift_id' => $owned_gift_id, 'transfer_star_count' => $transfer_star_count, 'next_transfer_date' => $next_transfer_date, diff --git a/src/Telegram/User.php b/src/Telegram/User.php index 0bb84ce..a570b87 100644 --- a/src/Telegram/User.php +++ b/src/Telegram/User.php @@ -52,6 +52,9 @@ class User extends Type /** Optional. True, if the bot has a main Web App. Returned only in getMe. */ public ?bool $has_main_web_app = null; + /** Optional. True, if the bot has forum topic mode enabled in private chats. Returned only in getMe. */ + public ?bool $has_topics_enabled = null; + /** * @param int $id Unique identifier for this user or bot. This number may have more than 32 significant bits and some programming languages may have difficulty/silent defects in interpreting it. But it has at most 52 significant bits, so a 64-bit integer or double-precision float type are safe for storing this identifier. * @param bool $is_bot True, if this user is a bot @@ -66,6 +69,7 @@ class User extends Type * @param bool $supports_inline_queries Optional. True, if the bot supports inline queries. Returned only in getMe. * @param bool $can_connect_to_business Optional. True, if the bot can be connected to a Telegram Business account to receive its messages. Returned only in getMe. * @param bool $has_main_web_app Optional. True, if the bot has a main Web App. Returned only in getMe. + * @param bool $has_topics_enabled Optional. True, if the bot has forum topic mode enabled in private chats. Returned only in getMe. */ public static function make( int $id, @@ -81,6 +85,7 @@ public static function make( ?bool $supports_inline_queries = null, ?bool $can_connect_to_business = null, ?bool $has_main_web_app = null, + ?bool $has_topics_enabled = null, ): static { return new static([ 'id' => $id, @@ -96,6 +101,7 @@ public static function make( 'supports_inline_queries' => $supports_inline_queries, 'can_connect_to_business' => $can_connect_to_business, 'has_main_web_app' => $has_main_web_app, + 'has_topics_enabled' => $has_topics_enabled, ]); } } diff --git a/src/Telegram/UserRating.php b/src/Telegram/UserRating.php new file mode 100644 index 0000000..b195fa9 --- /dev/null +++ b/src/Telegram/UserRating.php @@ -0,0 +1,47 @@ +Optional. The rating value required to get to the next level; omitted if the maximum level was reached */ + public ?int $next_level_rating = null; + + /** + * @param int $level Current level of the user, indicating their reliability when purchasing digital goods and services. A higher level suggests a more trustworthy customer; a negative level is likely reason for concern. + * @param int $rating Numerical value of the user's rating; the higher the rating, the better + * @param int $current_level_rating The rating value required to get the current level + * @param int $next_level_rating Optional. The rating value required to get to the next level; omitted if the maximum level was reached + */ + public static function make( + int $level, + int $rating, + int $current_level_rating, + ?int $next_level_rating = null, + ): static { + return new static([ + 'level' => $level, + 'rating' => $rating, + 'current_level_rating' => $current_level_rating, + 'next_level_rating' => $next_level_rating, + ]); + } +} diff --git a/src/Types/Enums/ChatActionType.php b/src/Types/Enums/ChatActionType.php index 670fa9d..37c36c7 100644 --- a/src/Types/Enums/ChatActionType.php +++ b/src/Types/Enums/ChatActionType.php @@ -14,16 +14,16 @@ enum ChatActionType: string /** for photos */ case UploadPhoto = 'upload_photo'; - /** for videos */ + /** for recording videos */ case RecordVideo = 'record_video'; - /** for videos */ + /** for uploading videos */ case UploadVideo = 'upload_video'; - /** for voice notes */ + /** for recording voice notes */ case RecordVoice = 'record_voice'; - /** for voice notes */ + /** for uploading voice notes */ case UploadVoice = 'upload_voice'; /** for general files */ @@ -35,9 +35,9 @@ enum ChatActionType: string /** for location data */ case FindLocation = 'find_location'; - /** for video notes */ + /** for recording video notes */ case RecordVideoNote = 'record_video_note'; - /** for video notes */ + /** for uploading video notes */ case UploadVideoNote = 'upload_video_note'; } diff --git a/src/Types/Extensions/RepliesToMessage.php b/src/Types/Extensions/RepliesToMessage.php index e1dd76c..071edc4 100644 --- a/src/Types/Extensions/RepliesToMessage.php +++ b/src/Types/Extensions/RepliesToMessage.php @@ -20,7 +20,7 @@ trait RepliesToMessage { /** * @param string $business_connection_id Unique identifier of the business connection on behalf of which the message will be sent - * @param int $message_thread_id Unique identifier for the target message thread (topic) of the forum; for forum supergroups only + * @param int $message_thread_id Unique identifier for the target message thread (topic) of a forum; for forum supergroups and private chats of bots with forum topic mode enabled only * @param int $direct_messages_topic_id Identifier of the direct messages topic to which the message will be sent; required if the message is sent to a direct messages chat * @param string $text Text of the message to be sent, 1-4096 characters after entities parsing * @param ParseMode|string $parse_mode Mode for parsing entities in the message text. See formatting options for more details.