From aabfceccf0da64b34a7298887d0729a52829217f Mon Sep 17 00:00:00 2001 From: TiiFuchs <1958744+TiiFuchs@users.noreply.github.com> Date: Sun, 9 Nov 2025 16:43:51 +0000 Subject: [PATCH] Update code to reflect latest changes to the Bot API documentation --- src/Layers/Generated.php | 655 +++++++++++++++--- src/Telegram/AcceptedGiftTypes.php | 47 ++ src/Telegram/BotCommandScopeChat.php | 4 +- .../BotCommandScopeChatAdministrators.php | 4 +- src/Telegram/BotCommandScopeChatMember.php | 4 +- src/Telegram/BusinessBotRights.php | 107 +++ src/Telegram/BusinessConnection.php | 16 +- src/Telegram/Chat.php | 6 + src/Telegram/ChatAdministratorRights.php | 14 +- src/Telegram/ChatBoostSourceGiveaway.php | 4 +- src/Telegram/ChatFullInfo.php | 24 +- src/Telegram/ChatMemberAdministrator.php | 14 +- src/Telegram/ChatMemberRestricted.php | 4 +- src/Telegram/ChatMemberUpdated.php | 8 +- src/Telegram/ChatPermissions.php | 4 +- src/Telegram/Checklist.php | 61 ++ src/Telegram/ChecklistTask.php | 57 ++ src/Telegram/ChecklistTasksAdded.php | 37 + src/Telegram/ChecklistTasksDone.php | 49 ++ src/Telegram/DirectMessagePriceChanged.php | 33 + src/Telegram/DirectMessagesTopic.php | 33 + src/Telegram/ExternalReplyInfo.php | 6 + src/Telegram/Gift.php | 6 + src/Telegram/GiftInfo.php | 75 ++ src/Telegram/InlineKeyboardButton.php | 12 +- src/Telegram/InputChecklist.php | 67 ++ src/Telegram/InputChecklistTask.php | 51 ++ src/Telegram/InputProfilePhoto.php | 28 + src/Telegram/InputProfilePhotoAnimated.php | 36 + src/Telegram/InputProfilePhotoStatic.php | 31 + src/Telegram/InputSticker.php | 8 +- src/Telegram/InputStoryContent.php | 28 + src/Telegram/InputStoryContentPhoto.php | 31 + src/Telegram/InputStoryContentVideo.php | 50 ++ src/Telegram/KeyboardButton.php | 8 +- src/Telegram/LocationAddress.php | 47 ++ src/Telegram/Message.php | 118 +++- src/Telegram/OwnedGift.php | 43 ++ src/Telegram/OwnedGiftRegular.php | 88 +++ src/Telegram/OwnedGiftUnique.php | 60 ++ src/Telegram/OwnedGifts.php | 42 ++ src/Telegram/PaidMessagePriceChanged.php | 28 + src/Telegram/ReactionTypeEmoji.php | 4 +- src/Telegram/ReplyParameters.php | 10 +- src/Telegram/StarAmount.php | 33 + src/Telegram/StoryArea.php | 33 + src/Telegram/StoryAreaPosition.php | 59 ++ src/Telegram/StoryAreaType.php | 31 + src/Telegram/StoryAreaTypeLink.php | 29 + src/Telegram/StoryAreaTypeLocation.php | 39 ++ .../StoryAreaTypeSuggestedReaction.php | 39 ++ src/Telegram/StoryAreaTypeUniqueGift.php | 29 + src/Telegram/StoryAreaTypeWeather.php | 39 ++ src/Telegram/SuccessfulPayment.php | 8 +- src/Telegram/SuggestedPostApprovalFailed.php | 33 + src/Telegram/SuggestedPostApproved.php | 41 ++ src/Telegram/SuggestedPostDeclined.php | 33 + src/Telegram/SuggestedPostInfo.php | 38 + src/Telegram/SuggestedPostPaid.php | 47 ++ src/Telegram/SuggestedPostParameters.php | 33 + src/Telegram/SuggestedPostPrice.php | 33 + src/Telegram/SuggestedPostRefunded.php | 33 + src/Telegram/SwitchInlineQueryChosenChat.php | 16 +- src/Telegram/TextQuote.php | 4 +- src/Telegram/TransactionPartnerUser.php | 36 +- src/Telegram/UniqueGift.php | 65 ++ src/Telegram/UniqueGiftBackdrop.php | 38 + src/Telegram/UniqueGiftBackdropColors.php | 43 ++ src/Telegram/UniqueGiftInfo.php | 59 ++ src/Telegram/UniqueGiftModel.php | 38 + src/Telegram/UniqueGiftSymbol.php | 38 + src/Telegram/WriteAccessAllowed.php | 8 +- src/Types/Extensions/RepliesToMessage.php | 7 + 73 files changed, 2860 insertions(+), 184 deletions(-) create mode 100644 src/Telegram/AcceptedGiftTypes.php create mode 100644 src/Telegram/BusinessBotRights.php create mode 100644 src/Telegram/Checklist.php create mode 100644 src/Telegram/ChecklistTask.php create mode 100644 src/Telegram/ChecklistTasksAdded.php create mode 100644 src/Telegram/ChecklistTasksDone.php create mode 100644 src/Telegram/DirectMessagePriceChanged.php create mode 100644 src/Telegram/DirectMessagesTopic.php create mode 100644 src/Telegram/GiftInfo.php create mode 100644 src/Telegram/InputChecklist.php create mode 100644 src/Telegram/InputChecklistTask.php create mode 100644 src/Telegram/InputProfilePhoto.php create mode 100644 src/Telegram/InputProfilePhotoAnimated.php create mode 100644 src/Telegram/InputProfilePhotoStatic.php create mode 100644 src/Telegram/InputStoryContent.php create mode 100644 src/Telegram/InputStoryContentPhoto.php create mode 100644 src/Telegram/InputStoryContentVideo.php create mode 100644 src/Telegram/LocationAddress.php create mode 100644 src/Telegram/OwnedGift.php create mode 100644 src/Telegram/OwnedGiftRegular.php create mode 100644 src/Telegram/OwnedGiftUnique.php create mode 100644 src/Telegram/OwnedGifts.php create mode 100644 src/Telegram/PaidMessagePriceChanged.php create mode 100644 src/Telegram/StarAmount.php create mode 100644 src/Telegram/StoryArea.php create mode 100644 src/Telegram/StoryAreaPosition.php create mode 100644 src/Telegram/StoryAreaType.php create mode 100644 src/Telegram/StoryAreaTypeLink.php create mode 100644 src/Telegram/StoryAreaTypeLocation.php create mode 100644 src/Telegram/StoryAreaTypeSuggestedReaction.php create mode 100644 src/Telegram/StoryAreaTypeUniqueGift.php create mode 100644 src/Telegram/StoryAreaTypeWeather.php create mode 100644 src/Telegram/SuggestedPostApprovalFailed.php create mode 100644 src/Telegram/SuggestedPostApproved.php create mode 100644 src/Telegram/SuggestedPostDeclined.php create mode 100644 src/Telegram/SuggestedPostInfo.php create mode 100644 src/Telegram/SuggestedPostPaid.php create mode 100644 src/Telegram/SuggestedPostParameters.php create mode 100644 src/Telegram/SuggestedPostPrice.php create mode 100644 src/Telegram/SuggestedPostRefunded.php create mode 100644 src/Telegram/UniqueGift.php create mode 100644 src/Telegram/UniqueGiftBackdrop.php create mode 100644 src/Telegram/UniqueGiftBackdropColors.php create mode 100644 src/Telegram/UniqueGiftInfo.php create mode 100644 src/Telegram/UniqueGiftModel.php create mode 100644 src/Telegram/UniqueGiftSymbol.php diff --git a/src/Layers/Generated.php b/src/Layers/Generated.php index 9cef59e..ef81669 100644 --- a/src/Layers/Generated.php +++ b/src/Layers/Generated.php @@ -9,6 +9,7 @@ use Telepath\Exceptions\TelegramException; use Telepath\Files\InputFile; use Telepath\Support\ParseMode\ParseMode; +use Telepath\Telegram\AcceptedGiftTypes; use Telepath\Telegram\BotCommand; use Telepath\Telegram\BotCommandScope; use Telepath\Telegram\BotDescription; @@ -27,6 +28,7 @@ use Telepath\Telegram\InlineKeyboardMarkup; use Telepath\Telegram\InlineQueryResult; use Telepath\Telegram\InlineQueryResultsButton; +use Telepath\Telegram\InputChecklist; use Telepath\Telegram\InputMedia; use Telepath\Telegram\InputMediaAudio; use Telepath\Telegram\InputMediaDocument; @@ -34,7 +36,9 @@ use Telepath\Telegram\InputMediaVideo; use Telepath\Telegram\InputPaidMedia; use Telepath\Telegram\InputPollOption; +use Telepath\Telegram\InputProfilePhoto; use Telepath\Telegram\InputSticker; +use Telepath\Telegram\InputStoryContent; use Telepath\Telegram\LabeledPrice; use Telepath\Telegram\LinkPreviewOptions; use Telepath\Telegram\MaskPosition; @@ -42,6 +46,7 @@ use Telepath\Telegram\Message; use Telepath\Telegram\MessageEntity; use Telepath\Telegram\MessageId; +use Telepath\Telegram\OwnedGifts; use Telepath\Telegram\PassportElementError; use Telepath\Telegram\Poll; use Telepath\Telegram\PreparedInlineMessage; @@ -51,9 +56,13 @@ use Telepath\Telegram\ReplyParameters; use Telepath\Telegram\SentWebAppMessage; use Telepath\Telegram\ShippingOption; +use Telepath\Telegram\StarAmount; use Telepath\Telegram\StarTransactions; use Telepath\Telegram\Sticker; use Telepath\Telegram\StickerSet; +use Telepath\Telegram\Story; +use Telepath\Telegram\StoryArea; +use Telepath\Telegram\SuggestedPostParameters; use Telepath\Telegram\Update; use Telepath\Telegram\User; use Telepath\Telegram\UserChatBoosts; @@ -168,6 +177,7 @@ public function close(): bool * @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 $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 * @param LinkPreviewOptions $link_preview_options Link preview generation options for the message @@ -175,6 +185,7 @@ public function close(): bool * @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; for private chats only + * @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 * @@ -185,6 +196,7 @@ public function sendMessage( string $text, ?string $business_connection_id = null, ?int $message_thread_id = null, + ?int $direct_messages_topic_id = null, ParseMode|string|null $parse_mode = null, ?array $entities = null, ?LinkPreviewOptions $link_preview_options = null, @@ -192,6 +204,7 @@ public function sendMessage( ?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, ): Message { @@ -205,9 +218,11 @@ public function sendMessage( * @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 $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 SuggestedPostParameters $suggested_post_parameters A JSON-serialized object containing the parameters of the suggested post to send; for direct messages chats only * * @throws TelegramException */ @@ -216,9 +231,11 @@ public function forwardMessage( int|string $from_chat_id, int $message_id, ?int $message_thread_id = null, + ?int $direct_messages_topic_id = null, ?int $video_start_timestamp = null, ?bool $disable_notification = null, ?bool $protect_content = null, + ?SuggestedPostParameters $suggested_post_parameters = null, ): Message { return $this->raw('forwardMessage', func_get_args()); } @@ -230,6 +247,7 @@ public function forwardMessage( * @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 $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 * @@ -240,6 +258,7 @@ public function forwardMessages( int|string $from_chat_id, array $message_ids, ?int $message_thread_id = null, + ?int $direct_messages_topic_id = null, ?bool $disable_notification = null, ?bool $protect_content = null, ): Message { @@ -253,6 +272,7 @@ public function forwardMessages( * @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 $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 * @param ParseMode|string $parse_mode Mode for parsing entities in the new caption. See formatting options for more details. @@ -261,6 +281,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 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 * @@ -271,6 +292,7 @@ public function copyMessage( int|string $from_chat_id, int $message_id, ?int $message_thread_id = null, + ?int $direct_messages_topic_id = null, ?int $video_start_timestamp = null, ?string $caption = null, ParseMode|string|null $parse_mode = null, @@ -279,6 +301,7 @@ public function copyMessage( ?bool $disable_notification = null, ?bool $protect_content = null, ?bool $allow_paid_broadcast = null, + ?SuggestedPostParameters $suggested_post_parameters = null, ?ReplyParameters $reply_parameters = null, InlineKeyboardMarkup|ReplyKeyboardMarkup|ReplyKeyboardRemove|ForceReply|null $reply_markup = null, ): MessageId { @@ -292,6 +315,7 @@ public function copyMessage( * @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 $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 * @param bool $remove_caption Pass True to copy the messages without their captions @@ -303,6 +327,7 @@ public function copyMessages( int|string $from_chat_id, array $message_ids, ?int $message_thread_id = null, + ?int $direct_messages_topic_id = null, ?bool $disable_notification = null, ?bool $protect_content = null, ?bool $remove_caption = null, @@ -317,6 +342,7 @@ public function copyMessages( * @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 $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. * @param MessageEntity[] $caption_entities A JSON-serialized list of special entities that appear in the caption, which can be specified instead of parse_mode @@ -326,6 +352,7 @@ public function copyMessages( * @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; for private chats only + * @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 * @@ -336,6 +363,7 @@ public function sendPhoto( InputFile|string $photo, ?string $business_connection_id = null, ?int $message_thread_id = null, + ?int $direct_messages_topic_id = null, ?string $caption = null, ParseMode|string|null $parse_mode = null, ?array $caption_entities = null, @@ -345,6 +373,7 @@ public function sendPhoto( ?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, ): Message { @@ -358,6 +387,7 @@ public function sendPhoto( * @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 $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. * @param MessageEntity[] $caption_entities A JSON-serialized list of special entities that appear in the caption, which can be specified instead of parse_mode @@ -369,6 +399,7 @@ public function sendPhoto( * @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; for private chats only + * @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 * @@ -379,6 +410,7 @@ public function sendAudio( InputFile|string $audio, ?string $business_connection_id = null, ?int $message_thread_id = null, + ?int $direct_messages_topic_id = null, ?string $caption = null, ParseMode|string|null $parse_mode = null, ?array $caption_entities = null, @@ -390,6 +422,7 @@ public function sendAudio( ?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, ): Message { @@ -403,6 +436,7 @@ public function sendAudio( * @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 $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 * @param ParseMode|string $parse_mode Mode for parsing entities in the document caption. See formatting options for more details. @@ -412,6 +446,7 @@ public function sendAudio( * @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; for private chats only + * @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 * @@ -422,6 +457,7 @@ public function sendDocument( InputFile|string $document, ?string $business_connection_id = null, ?int $message_thread_id = null, + ?int $direct_messages_topic_id = null, InputFile|string|null $thumbnail = null, ?string $caption = null, ParseMode|string|null $parse_mode = null, @@ -431,6 +467,7 @@ public function sendDocument( ?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, ): Message { @@ -444,6 +481,7 @@ public function sendDocument( * @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 $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 * @param int $height Video height @@ -460,6 +498,7 @@ public function sendDocument( * @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; for private chats only + * @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 * @@ -470,6 +509,7 @@ public function sendVideo( InputFile|string $video, ?string $business_connection_id = null, ?int $message_thread_id = null, + ?int $direct_messages_topic_id = null, ?int $duration = null, ?int $width = null, ?int $height = null, @@ -486,6 +526,7 @@ public function sendVideo( ?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, ): Message { @@ -499,6 +540,7 @@ public function sendVideo( * @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 $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 * @param int $height Animation height @@ -512,6 +554,7 @@ public function sendVideo( * @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; for private chats only + * @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 * @@ -522,6 +565,7 @@ public function sendAnimation( InputFile|string $animation, ?string $business_connection_id = null, ?int $message_thread_id = null, + ?int $direct_messages_topic_id = null, ?int $duration = null, ?int $width = null, ?int $height = null, @@ -535,6 +579,7 @@ public function sendAnimation( ?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, ): Message { @@ -548,6 +593,7 @@ public function sendAnimation( * @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 $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. * @param MessageEntity[] $caption_entities A JSON-serialized list of special entities that appear in the caption, which can be specified instead of parse_mode @@ -556,6 +602,7 @@ public function sendAnimation( * @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; for private chats only + * @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 * @@ -566,6 +613,7 @@ public function sendVoice( InputFile|string $voice, ?string $business_connection_id = null, ?int $message_thread_id = null, + ?int $direct_messages_topic_id = null, ?string $caption = null, ParseMode|string|null $parse_mode = null, ?array $caption_entities = null, @@ -574,6 +622,7 @@ public function sendVoice( ?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, ): Message { @@ -587,6 +636,7 @@ public function sendVoice( * @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 $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 * @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 » @@ -594,6 +644,7 @@ public function sendVoice( * @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; for private chats only + * @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 * @@ -604,6 +655,7 @@ public function sendVideoNote( InputFile|string $video_note, ?string $business_connection_id = null, ?int $message_thread_id = null, + ?int $direct_messages_topic_id = null, ?int $duration = null, ?int $length = null, InputFile|string|null $thumbnail = null, @@ -611,6 +663,7 @@ public function sendVideoNote( ?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, ): Message { @@ -621,9 +674,11 @@ 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-2500 + * @param int $star_count The number of Telegram Stars that must be paid to buy access to the media; 1-10000 * @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 $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 * @param ParseMode|string $parse_mode Mode for parsing entities in the media caption. See formatting options for more details. @@ -632,6 +687,7 @@ public function sendVideoNote( * @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 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 * @@ -642,6 +698,8 @@ public function sendPaidMedia( int $star_count, array $media, ?string $business_connection_id = null, + ?int $message_thread_id = null, + ?int $direct_messages_topic_id = null, ?string $payload = null, ?string $caption = null, ParseMode|string|null $parse_mode = null, @@ -650,6 +708,7 @@ public function sendPaidMedia( ?bool $disable_notification = null, ?bool $protect_content = null, ?bool $allow_paid_broadcast = null, + ?SuggestedPostParameters $suggested_post_parameters = null, ?ReplyParameters $reply_parameters = null, InlineKeyboardMarkup|ReplyKeyboardMarkup|ReplyKeyboardRemove|ForceReply|null $reply_markup = null, ): Message { @@ -657,12 +716,13 @@ public function sendPaidMedia( } /** - * 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 Messages that were sent is returned. + * 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 Message objects that were sent is returned. * * @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 $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 * @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 @@ -677,6 +737,7 @@ public function sendMediaGroup( array $media, ?string $business_connection_id = null, ?int $message_thread_id = null, + ?int $direct_messages_topic_id = null, ?bool $disable_notification = null, ?bool $protect_content = null, ?bool $allow_paid_broadcast = null, @@ -694,6 +755,7 @@ public function sendMediaGroup( * @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 $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. * @param int $heading For live locations, a direction in which the user is moving, in degrees. Must be between 1 and 360 if specified. @@ -702,6 +764,7 @@ public function sendMediaGroup( * @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; for private chats only + * @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 * @@ -713,6 +776,7 @@ public function sendLocation( float $longitude, ?string $business_connection_id = null, ?int $message_thread_id = null, + ?int $direct_messages_topic_id = null, ?float $horizontal_accuracy = null, ?int $live_period = null, ?int $heading = null, @@ -721,6 +785,7 @@ public function sendLocation( ?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, ): Message { @@ -737,6 +802,7 @@ public function sendLocation( * @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 $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”.) * @param string $google_place_id Google Places identifier of the venue @@ -745,6 +811,7 @@ public function sendLocation( * @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; for private chats only + * @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 * @@ -758,6 +825,7 @@ public function sendVenue( string $address, ?string $business_connection_id = null, ?int $message_thread_id = null, + ?int $direct_messages_topic_id = null, ?string $foursquare_id = null, ?string $foursquare_type = null, ?string $google_place_id = null, @@ -766,6 +834,7 @@ public function sendVenue( ?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, ): Message { @@ -780,12 +849,14 @@ public function sendVenue( * @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 $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 * @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; for private chats only + * @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 * @@ -797,12 +868,14 @@ public function sendContact( string $first_name, ?string $business_connection_id = null, ?int $message_thread_id = null, + ?int $direct_messages_topic_id = null, ?string $last_name = null, ?string $vcard = null, ?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, ): Message { @@ -812,9 +885,9 @@ public function sendContact( /** * Use this method to send a native poll. 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) + * @param int|string $chat_id Unique identifier for the target chat or username of the target channel (in the format @channelusername). Polls can't be sent to channel direct messages chats. * @param string $question Poll question, 1-300 characters - * @param InputPollOption[] $options A JSON-serialized list of 2-10 answer options + * @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 string $question_parse_mode Mode for parsing entities in the question. See formatting options for more details. Currently, only custom emoji entities are allowed @@ -866,17 +939,46 @@ public function sendPoll( return $this->raw('sendPoll', func_get_args()); } + /** + * Use this method to send a checklist on behalf of a connected business account. On success, the sent Message is returned. + * + * @param string $business_connection_id Unique identifier of the business connection on behalf of which the message will be sent + * @param int $chat_id Unique identifier for the target chat + * @param InputChecklist $checklist A JSON-serialized object for the checklist to send + * @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 string $message_effect_id Unique identifier of the message effect to be added to the message + * @param ReplyParameters $reply_parameters A JSON-serialized object for description of the message to reply to + * @param InlineKeyboardMarkup $reply_markup A JSON-serialized object for an inline keyboard + * + * @throws TelegramException + */ + public function sendChecklist( + string $business_connection_id, + int $chat_id, + InputChecklist $checklist, + ?bool $disable_notification = null, + ?bool $protect_content = null, + ?string $message_effect_id = null, + ?ReplyParameters $reply_parameters = null, + ?InlineKeyboardMarkup $reply_markup = null, + ): Message { + return $this->raw('sendChecklist', func_get_args()); + } + /** * Use this method to send an animated emoji that will display a random value. 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) * @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 $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. * @param bool $protect_content Protects the contents of the sent message from forwarding * @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; for private chats only + * @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 * @@ -886,11 +988,13 @@ public function sendDice( int|string $chat_id, ?string $business_connection_id = null, ?int $message_thread_id = null, + ?int $direct_messages_topic_id = null, ?string $emoji = null, ?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, ): Message { @@ -900,7 +1004,7 @@ public function sendDice( /** * 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 channel (in the format @channelusername) + * @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 @@ -1038,7 +1142,7 @@ public function restrictChatMember( * @param int|string $chat_id Unique identifier for the target chat or username of the target channel (in the format @channelusername) * @param int $user_id Unique identifier of the target user * @param bool $is_anonymous Pass True if the administrator's presence in the chat is hidden - * @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 and ignore slow mode. Implied by any other administrator privilege. + * @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 @@ -1048,10 +1152,11 @@ public function restrictChatMember( * @param bool $can_post_stories Pass True if the administrator can post stories to the chat * @param bool $can_edit_stories Pass True if the administrator can edit stories posted by other users, post stories to the chat page, pin chat stories, and access the chat's story archive * @param bool $can_delete_stories Pass True if the administrator can delete stories posted by other users - * @param bool $can_post_messages Pass True if the administrator can post messages in the channel, or access channel statistics; for channels only + * @param bool $can_post_messages Pass True if the administrator can post messages in the channel, approve suggested posts, or access channel statistics; for channels only * @param bool $can_edit_messages Pass True if the administrator can edit messages of other users and can pin messages; for channels only * @param bool $can_pin_messages Pass True if the administrator can pin messages; for supergroups only * @param bool $can_manage_topics Pass True if the user is allowed to create, rename, close, and reopen forum topics; for supergroups only + * @param bool $can_manage_direct_messages Pass True if the administrator can manage direct messages within the channel and decline suggested posts; for channels only * * @throws TelegramException */ @@ -1073,6 +1178,7 @@ public function promoteChatMember( ?bool $can_edit_messages = null, ?bool $can_pin_messages = null, ?bool $can_manage_topics = null, + ?bool $can_manage_direct_messages = null, ): bool { return $this->raw('promoteChatMember', func_get_args()); } @@ -1195,7 +1301,7 @@ public function editChatInviteLink( * * @param int|string $chat_id Unique identifier for the target channel chat or username of the target channel (in the format @channelusername) * @param int $subscription_period The number of seconds the subscription will be active for before the next payment. Currently, it must always be 2592000 (30 days). - * @param int $subscription_price The amount of Telegram Stars a user must pay initially and after each subsequent subscription period to be a member of the chat; 1-2500 + * @param int $subscription_price The amount of Telegram Stars a user must pay initially and after each subsequent subscription period to be a member of the chat; 1-10000 * @param string $name Invite link name; 0-32 characters * * @throws TelegramException @@ -1317,7 +1423,7 @@ public function setChatDescription(int|string $chat_id, ?string $description = n } /** - * Use this method to add a message to the list of pinned messages in a chat. If the chat is not a private chat, the bot must be an administrator in the chat for this to work and must have the 'can_pin_messages' administrator right in a supergroup or 'can_edit_messages' administrator right in a channel. Returns True on success. + * Use this method to add a message to the list of pinned messages in a chat. In private chats and channel direct messages chats, all non-service messages can be pinned. Conversely, the bot must be an administrator with the 'can_pin_messages' right or the 'can_edit_messages' right to pin messages in groups and channels respectively. Returns True 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 $message_id Identifier of a message to pin @@ -1336,7 +1442,7 @@ public function pinChatMessage( } /** - * Use this method to remove a message from the list of pinned messages in a chat. If the chat is not a private chat, the bot must be an administrator in the chat for this to work and must have the 'can_pin_messages' administrator right in a supergroup or 'can_edit_messages' administrator right in a channel. Returns True on success. + * Use this method to remove a message from the list of pinned messages in a chat. In private chats and channel direct messages chats, all messages can be unpinned. Conversely, the bot must be an administrator with the 'can_pin_messages' right or the 'can_edit_messages' right to unpin messages in groups and channels respectively. Returns True on success. * * @param int|string $chat_id Unique identifier for the target chat or username of the target channel (in the format @channelusername) * @param string $business_connection_id Unique identifier of the business connection on behalf of which the message will be unpinned @@ -1353,7 +1459,7 @@ public function unpinChatMessage( } /** - * Use this method to clear the list of pinned messages in a chat. If the chat is not a private chat, the bot must be an administrator in the chat for this to work and must have the 'can_pin_messages' administrator right in a supergroup or 'can_edit_messages' administrator right in a channel. Returns True on success. + * Use this method to clear the list of pinned messages in a chat. In private chats and channel direct messages chats, no additional rights are required to unpin all pinned messages. Conversely, the bot must be an administrator with the 'can_pin_messages' right or the 'can_edit_messages' right to unpin all pinned messages in groups and channels respectively. Returns True on success. * * @param int|string $chat_id Unique identifier for the target chat or username of the target channel (in the format @channelusername) * @@ -1367,7 +1473,7 @@ public function unpinAllChatMessages(int|string $chat_id): bool /** * Use this method for your bot to leave a group, supergroup or channel. Returns True on success. * - * @param int|string $chat_id Unique identifier for the target chat or username of the target supergroup or channel (in the format @channelusername) + * @param int|string $chat_id Unique identifier for the target chat or username of the target supergroup or channel (in the format @channelusername). Channel direct messages chats aren't supported; leave the corresponding channel instead. * * @throws TelegramException */ @@ -1843,6 +1949,393 @@ public function getMyDefaultAdministratorRights(?bool $for_channels = null): Cha return $this->raw('getMyDefaultAdministratorRights', func_get_args()); } + /** + * 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 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 + * @param string $text Text that will be shown along with the gift; 0-128 characters + * @param string $text_parse_mode Mode for parsing entities in the text. See formatting options for more details. Entities other than “bold”, “italic”, “underline”, “strikethrough”, “spoiler”, and “custom_emoji” are ignored. + * @param MessageEntity[] $text_entities A JSON-serialized list of special entities that appear in the gift text. It can be specified instead of text_parse_mode. Entities other than “bold”, “italic”, “underline”, “strikethrough”, “spoiler”, and “custom_emoji” are ignored. + * + * @throws TelegramException + */ + public function sendGift( + string $gift_id, + ?int $user_id = null, + int|string|null $chat_id = null, + ?bool $pay_for_upgrade = null, + ?string $text = null, + ?string $text_parse_mode = null, + ?array $text_entities = null, + ): bool { + return $this->raw('sendGift', func_get_args()); + } + + /** + * Gifts a Telegram Premium subscription to the given user. Returns True on success. + * + * @param int $user_id Unique identifier of the target user who will receive a Telegram Premium subscription + * @param int $month_count Number of months the Telegram Premium subscription will be active for the user; must be one of 3, 6, or 12 + * @param int $star_count Number of Telegram Stars to pay for the Telegram Premium subscription; must be 1000 for 3 months, 1500 for 6 months, and 2500 for 12 months + * @param string $text Text that will be shown along with the service message about the subscription; 0-128 characters + * @param string $text_parse_mode Mode for parsing entities in the text. See formatting options for more details. Entities other than “bold”, “italic”, “underline”, “strikethrough”, “spoiler”, and “custom_emoji” are ignored. + * @param MessageEntity[] $text_entities A JSON-serialized list of special entities that appear in the gift text. It can be specified instead of text_parse_mode. Entities other than “bold”, “italic”, “underline”, “strikethrough”, “spoiler”, and “custom_emoji” are ignored. + * + * @throws TelegramException + */ + public function giftPremiumSubscription( + int $user_id, + int $month_count, + int $star_count, + ?string $text = null, + ?string $text_parse_mode = null, + ?array $text_entities = null, + ): bool { + return $this->raw('giftPremiumSubscription', func_get_args()); + } + + /** + * Verifies a user on behalf of the organization which is represented by the bot. Returns True on success. + * + * @param int $user_id Unique identifier of the target user + * @param string $custom_description Custom description for the verification; 0-70 characters. Must be empty if the organization isn't allowed to provide a custom verification description. + * + * @throws TelegramException + */ + public function verifyUser(int $user_id, ?string $custom_description = null): bool + { + return $this->raw('verifyUser', func_get_args()); + } + + /** + * Verifies a chat on behalf of the organization which is represented by the bot. Returns True on success. + * + * @param int|string $chat_id Unique identifier for the target chat or username of the target channel (in the format @channelusername). Channel direct messages chats can't be verified. + * @param string $custom_description Custom description for the verification; 0-70 characters. Must be empty if the organization isn't allowed to provide a custom verification description. + * + * @throws TelegramException + */ + public function verifyChat(int|string $chat_id, ?string $custom_description = null): bool + { + return $this->raw('verifyChat', func_get_args()); + } + + /** + * Removes verification from a user who is currently verified on behalf of the organization represented by the bot. Returns True on success. + * + * @param int $user_id Unique identifier of the target user + * + * @throws TelegramException + */ + public function removeUserVerification(int $user_id): bool + { + return $this->raw('removeUserVerification', func_get_args()); + } + + /** + * Removes verification from a chat that is currently verified on behalf of the organization represented by the bot. Returns True on success. + * + * @param int|string $chat_id Unique identifier for the target chat or username of the target channel (in the format @channelusername) + * + * @throws TelegramException + */ + public function removeChatVerification(int|string $chat_id): bool + { + return $this->raw('removeChatVerification', func_get_args()); + } + + /** + * Marks incoming message as read on behalf of a business account. Requires the can_read_messages business bot right. Returns True on success. + * + * @param string $business_connection_id Unique identifier of the business connection on behalf of which to read the message + * @param int $chat_id Unique identifier of the chat in which the message was received. The chat must have been active in the last 24 hours. + * @param int $message_id Unique identifier of the message to mark as read + * + * @throws TelegramException + */ + public function readBusinessMessage(string $business_connection_id, int $chat_id, int $message_id): bool + { + return $this->raw('readBusinessMessage', func_get_args()); + } + + /** + * Delete messages on behalf of a business account. Requires the can_delete_sent_messages business bot right to delete messages sent by the bot itself, or the can_delete_all_messages business bot right to delete any message. Returns True on success. + * + * @param string $business_connection_id Unique identifier of the business connection on behalf of which to delete the messages + * @param int[] $message_ids A JSON-serialized list of 1-100 identifiers of messages to delete. All messages must be from the same chat. See deleteMessage for limitations on which messages can be deleted + * + * @throws TelegramException + */ + public function deleteBusinessMessages(string $business_connection_id, array $message_ids): bool + { + return $this->raw('deleteBusinessMessages', func_get_args()); + } + + /** + * Changes the first and last name of a managed business account. Requires the can_change_name business bot right. Returns True on success. + * + * @param string $business_connection_id Unique identifier of the business connection + * @param string $first_name The new value of the first name for the business account; 1-64 characters + * @param string $last_name The new value of the last name for the business account; 0-64 characters + * + * @throws TelegramException + */ + public function setBusinessAccountName( + string $business_connection_id, + string $first_name, + ?string $last_name = null, + ): bool { + return $this->raw('setBusinessAccountName', func_get_args()); + } + + /** + * Changes the username of a managed business account. Requires the can_change_username business bot right. Returns True on success. + * + * @param string $business_connection_id Unique identifier of the business connection + * @param string $username The new value of the username for the business account; 0-32 characters + * + * @throws TelegramException + */ + public function setBusinessAccountUsername(string $business_connection_id, ?string $username = null): bool + { + return $this->raw('setBusinessAccountUsername', func_get_args()); + } + + /** + * Changes the bio of a managed business account. Requires the can_change_bio business bot right. Returns True on success. + * + * @param string $business_connection_id Unique identifier of the business connection + * @param string $bio The new value of the bio for the business account; 0-140 characters + * + * @throws TelegramException + */ + public function setBusinessAccountBio(string $business_connection_id, ?string $bio = null): bool + { + return $this->raw('setBusinessAccountBio', func_get_args()); + } + + /** + * Changes the profile photo of a managed business account. Requires the can_edit_profile_photo business bot right. Returns True on success. + * + * @param string $business_connection_id Unique identifier of the business connection + * @param InputProfilePhoto $photo The new profile photo to set + * @param bool $is_public Pass True to set the public photo, which will be visible even if the main photo is hidden by the business account's privacy settings. An account can have only one public photo. + * + * @throws TelegramException + */ + public function setBusinessAccountProfilePhoto( + string $business_connection_id, + InputProfilePhoto $photo, + ?bool $is_public = null, + ): bool { + return $this->raw('setBusinessAccountProfilePhoto', func_get_args()); + } + + /** + * Removes the current profile photo of a managed business account. Requires the can_edit_profile_photo business bot right. Returns True on success. + * + * @param string $business_connection_id Unique identifier of the business connection + * @param bool $is_public Pass True to remove the public photo, which is visible even if the main photo is hidden by the business account's privacy settings. After the main photo is removed, the previous profile photo (if present) becomes the main photo. + * + * @throws TelegramException + */ + public function removeBusinessAccountProfilePhoto(string $business_connection_id, ?bool $is_public = null): bool + { + return $this->raw('removeBusinessAccountProfilePhoto', func_get_args()); + } + + /** + * Changes the privacy settings pertaining to incoming gifts in a managed business account. Requires the can_change_gift_settings business bot right. Returns True on success. + * + * @param string $business_connection_id Unique identifier of the business connection + * @param bool $show_gift_button Pass True, if a button for sending a gift to the user or by the business account must always be shown in the input field + * @param AcceptedGiftTypes $accepted_gift_types Types of gifts accepted by the business account + * + * @throws TelegramException + */ + public function setBusinessAccountGiftSettings( + string $business_connection_id, + bool $show_gift_button, + AcceptedGiftTypes $accepted_gift_types, + ): bool { + return $this->raw('setBusinessAccountGiftSettings', func_get_args()); + } + + /** + * Returns the amount of Telegram Stars owned by a managed business account. Requires the can_view_gifts_and_stars business bot right. Returns StarAmount on success. + * + * @param string $business_connection_id Unique identifier of the business connection + * + * @throws TelegramException + */ + public function getBusinessAccountStarBalance(string $business_connection_id): StarAmount + { + return $this->raw('getBusinessAccountStarBalance', func_get_args()); + } + + /** + * Transfers Telegram Stars from the business account balance to the bot's balance. Requires the can_transfer_stars business bot right. Returns True on success. + * + * @param string $business_connection_id Unique identifier of the business connection + * @param int $star_count Number of Telegram Stars to transfer; 1-10000 + * + * @throws TelegramException + */ + public function transferBusinessAccountStars(string $business_connection_id, int $star_count): bool + { + return $this->raw('transferBusinessAccountStars', func_get_args()); + } + + /** + * Returns the gifts received and owned by a managed business account. Requires the can_view_gifts_and_stars business bot right. Returns OwnedGifts on success. + * + * @param string $business_connection_id Unique identifier of the business connection + * @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_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 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 getBusinessAccountGifts( + string $business_connection_id, + ?bool $exclude_unsaved = null, + ?bool $exclude_saved = null, + ?bool $exclude_unlimited = null, + ?bool $exclude_limited = null, + ?bool $exclude_unique = null, + ?bool $sort_by_price = null, + ?string $offset = null, + ?int $limit = null, + ): OwnedGifts { + return $this->raw('getBusinessAccountGifts', 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. + * + * @param string $business_connection_id Unique identifier of the business connection + * @param string $owned_gift_id Unique identifier of the regular gift that should be converted to Telegram Stars + * + * @throws TelegramException + */ + public function convertGiftToStars(string $business_connection_id, string $owned_gift_id): bool + { + return $this->raw('convertGiftToStars', func_get_args()); + } + + /** + * Upgrades a given regular gift to a unique gift. Requires the can_transfer_and_upgrade_gifts business bot right. Additionally requires the can_transfer_stars business bot right if the upgrade is paid. Returns True on success. + * + * @param string $business_connection_id Unique identifier of the business connection + * @param string $owned_gift_id Unique identifier of the regular gift that should be upgraded to a unique one + * @param bool $keep_original_details Pass True to keep the original gift text, sender and receiver in the upgraded gift + * @param int $star_count The amount of Telegram Stars that will be paid for the upgrade from the business account balance. If gift.prepaid_upgrade_star_count > 0, then pass 0, otherwise, the can_transfer_stars business bot right is required and gift.upgrade_star_count must be passed. + * + * @throws TelegramException + */ + public function upgradeGift( + string $business_connection_id, + string $owned_gift_id, + ?bool $keep_original_details = null, + ?int $star_count = null, + ): bool { + return $this->raw('upgradeGift', func_get_args()); + } + + /** + * Transfers an owned unique gift to another user. Requires the can_transfer_and_upgrade_gifts business bot right. Requires can_transfer_stars business bot right if the transfer is paid. Returns True on success. + * + * @param string $business_connection_id Unique identifier of the business connection + * @param string $owned_gift_id Unique identifier of the regular gift that should be transferred + * @param int $new_owner_chat_id Unique identifier of the chat which will own the gift. The chat must be active in the last 24 hours. + * @param int $star_count The amount of Telegram Stars that will be paid for the transfer from the business account balance. If positive, then the can_transfer_stars business bot right is required. + * + * @throws TelegramException + */ + public function transferGift( + string $business_connection_id, + string $owned_gift_id, + int $new_owner_chat_id, + ?int $star_count = null, + ): bool { + return $this->raw('transferGift', func_get_args()); + } + + /** + * Posts a story on behalf of a managed business account. Requires the can_manage_stories business bot right. Returns Story on success. + * + * @param string $business_connection_id Unique identifier of the business connection + * @param InputStoryContent $content Content of the story + * @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 string $caption Caption of the story, 0-2048 characters after entities parsing + * @param ParseMode|string $parse_mode Mode for parsing entities in the story caption. See formatting options 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 parse_mode + * @param StoryArea[] $areas A JSON-serialized list of clickable areas to be shown on the story + * @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 postStory( + string $business_connection_id, + InputStoryContent $content, + int $active_period, + ?string $caption = null, + ParseMode|string|null $parse_mode = null, + ?array $caption_entities = null, + ?array $areas = null, + ?bool $post_to_chat_page = null, + ?bool $protect_content = null, + ): Story { + return $this->raw('postStory', 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. + * + * @param string $business_connection_id Unique identifier of the business connection + * @param int $story_id Unique identifier of the story to edit + * @param InputStoryContent $content Content of the story + * @param string $caption Caption of the story, 0-2048 characters after entities parsing + * @param ParseMode|string $parse_mode Mode for parsing entities in the story caption. See formatting options 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 parse_mode + * @param StoryArea[] $areas A JSON-serialized list of clickable areas to be shown on the story + * + * @throws TelegramException + */ + public function editStory( + string $business_connection_id, + int $story_id, + InputStoryContent $content, + ?string $caption = null, + ParseMode|string|null $parse_mode = null, + ?array $caption_entities = null, + ?array $areas = null, + ): Story { + return $this->raw('editStory', func_get_args()); + } + + /** + * Deletes a story previously posted by the bot on behalf of a managed business account. Requires the can_manage_stories business bot right. Returns True on success. + * + * @param string $business_connection_id Unique identifier of the business connection + * @param int $story_id Unique identifier of the story to delete + * + * @throws TelegramException + */ + public function deleteStory(string $business_connection_id, int $story_id): bool + { + return $this->raw('deleteStory', func_get_args()); + } + /** * Use this method to edit text and game messages. On success, if the edited message is not an inline message, the edited Message is returned, otherwise True is returned. Note that business messages that were not sent by the bot and do not contain an inline keyboard can only be edited within 48 hours from the time they were sent. * @@ -1978,6 +2471,27 @@ public function stopMessageLiveLocation( return $this->raw('stopMessageLiveLocation', func_get_args()); } + /** + * Use this method to edit a checklist on behalf of a connected business account. On success, the edited Message is returned. + * + * @param string $business_connection_id Unique identifier of the business connection on behalf of which the message will be sent + * @param int $chat_id Unique identifier for the target chat + * @param int $message_id Unique identifier for the target message + * @param InputChecklist $checklist A JSON-serialized object for the new checklist + * @param InlineKeyboardMarkup $reply_markup A JSON-serialized object for the new inline keyboard for the message + * + * @throws TelegramException + */ + public function editMessageChecklist( + string $business_connection_id, + int $chat_id, + int $message_id, + InputChecklist $checklist, + ?InlineKeyboardMarkup $reply_markup = null, + ): Message { + return $this->raw('editMessageChecklist', func_get_args()); + } + /** * Use this method to edit only the reply markup of messages. On success, if the edited message is not an inline message, the edited Message is returned, otherwise True is returned. Note that business messages that were not sent by the bot and do not contain an inline keyboard can only be edited within 48 hours from the time they were sent. * @@ -2019,7 +2533,35 @@ public function stopPoll( } /** - * Use this method to delete a message, including service messages, with the following limitations:- A message can only be deleted if it was sent less than 48 hours ago.- Service messages about a supergroup, channel, or forum topic creation can't be deleted.- A dice message in a private chat can only be deleted if it was sent more than 24 hours ago.- Bots can delete outgoing messages in private chats, groups, and supergroups.- Bots can delete incoming messages in private chats.- Bots granted can_post_messages permissions can delete outgoing messages in channels.- If the bot is an administrator of a group, it can delete any message there.- If the bot has can_delete_messages permission in a supergroup or a channel, it can delete any message there.Returns True on success. + * Use this method to approve a suggested post in a direct messages chat. The bot must have the 'can_post_messages' administrator right in the corresponding channel chat. Returns True on success. + * + * @param int $chat_id Unique identifier for the target direct messages chat + * @param int $message_id Identifier of a suggested post message to approve + * @param int $send_date Point in time (Unix timestamp) when the post is expected to be published; omit if the date has already been specified when the suggested post was created. If specified, then the date must be not more than 2678400 seconds (30 days) in the future + * + * @throws TelegramException + */ + public function approveSuggestedPost(int $chat_id, int $message_id, ?int $send_date = null): bool + { + return $this->raw('approveSuggestedPost', func_get_args()); + } + + /** + * Use this method to decline a suggested post in a direct messages chat. The bot must have the 'can_manage_direct_messages' administrator right in the corresponding channel chat. Returns True on success. + * + * @param int $chat_id Unique identifier for the target direct messages chat + * @param int $message_id Identifier of a suggested post message to decline + * @param string $comment Comment for the creator of the suggested post; 0-128 characters + * + * @throws TelegramException + */ + public function declineSuggestedPost(int $chat_id, int $message_id, ?string $comment = null): bool + { + return $this->raw('declineSuggestedPost', func_get_args()); + } + + /** + * Use this method to delete a message, including service messages, with the following limitations:- A message can only be deleted if it was sent less than 48 hours ago.- Service messages about a supergroup, channel, or forum topic creation can't be deleted.- A dice message in a private chat can only be deleted if it was sent more than 24 hours ago.- Bots can delete outgoing messages in private chats, groups, and supergroups.- Bots can delete incoming messages in private chats.- Bots granted can_post_messages permissions can delete outgoing messages in channels.- If the bot is an administrator of a group, it can delete any message there.- If the bot has can_delete_messages administrator right in a supergroup or a channel, it can delete any message there.- If the bot has can_manage_direct_messages administrator right in a channel, it can delete any message in the corresponding direct messages chat.Returns True 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 $message_id Identifier of the message to delete @@ -2051,11 +2593,13 @@ public function deleteMessages(int|string $chat_id, array $message_ids): bool * @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 $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. * @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; for private chats only + * @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 * @@ -2066,11 +2610,13 @@ public function sendSticker( InputFile|string $sticker, ?string $business_connection_id = null, ?int $message_thread_id = null, + ?int $direct_messages_topic_id = null, ?string $emoji = null, ?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, ): Message { @@ -2289,81 +2835,6 @@ public function deleteStickerSet(string $name): bool return $this->raw('deleteStickerSet', func_get_args()); } - /** - * 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 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 - * @param string $text Text that will be shown along with the gift; 0-128 characters - * @param string $text_parse_mode Mode for parsing entities in the text. See formatting options for more details. Entities other than “bold”, “italic”, “underline”, “strikethrough”, “spoiler”, and “custom_emoji” are ignored. - * @param MessageEntity[] $text_entities A JSON-serialized list of special entities that appear in the gift text. It can be specified instead of text_parse_mode. Entities other than “bold”, “italic”, “underline”, “strikethrough”, “spoiler”, and “custom_emoji” are ignored. - * - * @throws TelegramException - */ - public function sendGift( - string $gift_id, - ?int $user_id = null, - int|string|null $chat_id = null, - ?bool $pay_for_upgrade = null, - ?string $text = null, - ?string $text_parse_mode = null, - ?array $text_entities = null, - ): bool { - return $this->raw('sendGift', func_get_args()); - } - - /** - * Verifies a user on behalf of the organization which is represented by the bot. Returns True on success. - * - * @param int $user_id Unique identifier of the target user - * @param string $custom_description Custom description for the verification; 0-70 characters. Must be empty if the organization isn't allowed to provide a custom verification description. - * - * @throws TelegramException - */ - public function verifyUser(int $user_id, ?string $custom_description = null): bool - { - return $this->raw('verifyUser', func_get_args()); - } - - /** - * Verifies a chat on behalf of the organization which is represented by the bot. Returns True on success. - * - * @param int|string $chat_id Unique identifier for the target chat or username of the target channel (in the format @channelusername) - * @param string $custom_description Custom description for the verification; 0-70 characters. Must be empty if the organization isn't allowed to provide a custom verification description. - * - * @throws TelegramException - */ - public function verifyChat(int|string $chat_id, ?string $custom_description = null): bool - { - return $this->raw('verifyChat', func_get_args()); - } - - /** - * Removes verification from a user who is currently verified on behalf of the organization represented by the bot. Returns True on success. - * - * @param int $user_id Unique identifier of the target user - * - * @throws TelegramException - */ - public function removeUserVerification(int $user_id): bool - { - return $this->raw('removeUserVerification', func_get_args()); - } - - /** - * Removes verification from a chat that is currently verified on behalf of the organization represented by the bot. Returns True on success. - * - * @param int|string $chat_id Unique identifier for the target chat or username of the target channel (in the format @channelusername) - * - * @throws TelegramException - */ - public function removeChatVerification(int|string $chat_id): bool - { - return $this->raw('removeChatVerification', func_get_args()); - } - /** * Use this method to send answers to an inline query. On success, True is returned.No more than 50 results per query are allowed. * @@ -2433,6 +2904,7 @@ public function savePreparedInlineMessage( * @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 $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. * @param int[] $suggested_tip_amounts A JSON-serialized array of suggested amounts of tips in the smallest units of the currency (integer, not float/double). At most 4 suggested tip amounts can be specified. The suggested tip amounts must be positive, passed in a strictly increased order and must not exceed max_tip_amount. @@ -2453,6 +2925,7 @@ public function savePreparedInlineMessage( * @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; for private chats only + * @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 $reply_markup A JSON-serialized object for an inline keyboard. If empty, one 'Pay total price' button will be shown. If not empty, the first button must be a Pay button. * @@ -2466,6 +2939,7 @@ public function sendInvoice( string $currency, array $prices, ?int $message_thread_id = null, + ?int $direct_messages_topic_id = null, ?string $provider_token = null, ?int $max_tip_amount = null, ?array $suggested_tip_amounts = null, @@ -2486,6 +2960,7 @@ public function sendInvoice( ?bool $protect_content = null, ?bool $allow_paid_broadcast = null, ?string $message_effect_id = null, + ?SuggestedPostParameters $suggested_post_parameters = null, ?ReplyParameters $reply_parameters = null, ?InlineKeyboardMarkup $reply_markup = null, ): Message { @@ -2502,7 +2977,7 @@ public function sendInvoice( * @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 string $business_connection_id Unique identifier of the business connection on behalf of which the link will be created. For payments in Telegram Stars only. * @param string $provider_token Payment provider token, obtained via @BotFather. Pass an empty string for payments in Telegram Stars. - * @param int $subscription_period The number of seconds the subscription will be active for before the next payment. The currency must be set to “XTR” (Telegram Stars) if the parameter is used. Currently, it must always be 2592000 (30 days) if specified. Any number of subscriptions can be active for a given bot at the same time, including multiple concurrent subscriptions from the same user. Subscription price must no exceed 2500 Telegram Stars. + * @param int $subscription_period The number of seconds the subscription will be active for before the next payment. The currency must be set to “XTR” (Telegram Stars) if the parameter is used. Currently, it must always be 2592000 (30 days) if specified. Any number of subscriptions can be active for a given bot at the same time, including multiple concurrent subscriptions from the same user. Subscription price must no exceed 10000 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. * @param int[] $suggested_tip_amounts A JSON-serialized array of suggested amounts of tips in the smallest units of the currency (integer, not float/double). At most 4 suggested tip amounts can be specified. The suggested tip amounts must be positive, passed in a strictly increased order and must not exceed max_tip_amount. * @param string $provider_data JSON-serialized data about the invoice, which will be shared with the payment provider. A detailed description of required fields should be provided by the payment provider. @@ -2642,7 +3117,7 @@ public function setPassportDataErrors(int $user_id, array $errors): bool /** * Use this method to send a game. On success, the sent Message is returned. * - * @param int $chat_id Unique identifier for the target chat + * @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 diff --git a/src/Telegram/AcceptedGiftTypes.php b/src/Telegram/AcceptedGiftTypes.php new file mode 100644 index 0000000..850fbc4 --- /dev/null +++ b/src/Telegram/AcceptedGiftTypes.php @@ -0,0 +1,47 @@ +True, if unlimited regular gifts are accepted */ + public bool $unlimited_gifts; + + /** True, if limited regular gifts are accepted */ + public bool $limited_gifts; + + /** True, if unique gifts or gifts that can be upgraded to unique for free are accepted */ + public bool $unique_gifts; + + /** True, if a Telegram Premium subscription is accepted */ + public bool $premium_subscription; + + /** + * @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 + */ + public static function make( + bool $unlimited_gifts, + bool $limited_gifts, + bool $unique_gifts, + bool $premium_subscription, + ): static { + return new static([ + 'unlimited_gifts' => $unlimited_gifts, + 'limited_gifts' => $limited_gifts, + 'unique_gifts' => $unique_gifts, + 'premium_subscription' => $premium_subscription, + ]); + } +} diff --git a/src/Telegram/BotCommandScopeChat.php b/src/Telegram/BotCommandScopeChat.php index 6c588aa..057053a 100644 --- a/src/Telegram/BotCommandScopeChat.php +++ b/src/Telegram/BotCommandScopeChat.php @@ -14,11 +14,11 @@ class BotCommandScopeChat extends BotCommandScope /** Scope type, must be chat */ public string $type = 'chat'; - /** Unique identifier for the target chat or username of the target supergroup (in the format @supergroupusername) */ + /** Unique identifier for the target chat or username of the target supergroup (in the format @supergroupusername). Channel direct messages chats and channel chats aren't supported. */ public int|string $chat_id; /** - * @param int|string $chat_id Unique identifier for the target chat or username of the target supergroup (in the format @supergroupusername) + * @param int|string $chat_id Unique identifier for the target chat or username of the target supergroup (in the format @supergroupusername). Channel direct messages chats and channel chats aren't supported. */ public static function make(int|string $chat_id): static { diff --git a/src/Telegram/BotCommandScopeChatAdministrators.php b/src/Telegram/BotCommandScopeChatAdministrators.php index 1907945..a5b06cf 100644 --- a/src/Telegram/BotCommandScopeChatAdministrators.php +++ b/src/Telegram/BotCommandScopeChatAdministrators.php @@ -14,11 +14,11 @@ class BotCommandScopeChatAdministrators extends BotCommandScope /** Scope type, must be chat_administrators */ public string $type = 'chat_administrators'; - /** Unique identifier for the target chat or username of the target supergroup (in the format @supergroupusername) */ + /** Unique identifier for the target chat or username of the target supergroup (in the format @supergroupusername). Channel direct messages chats and channel chats aren't supported. */ public int|string $chat_id; /** - * @param int|string $chat_id Unique identifier for the target chat or username of the target supergroup (in the format @supergroupusername) + * @param int|string $chat_id Unique identifier for the target chat or username of the target supergroup (in the format @supergroupusername). Channel direct messages chats and channel chats aren't supported. */ public static function make(int|string $chat_id): static { diff --git a/src/Telegram/BotCommandScopeChatMember.php b/src/Telegram/BotCommandScopeChatMember.php index 4f76a49..9ef6093 100644 --- a/src/Telegram/BotCommandScopeChatMember.php +++ b/src/Telegram/BotCommandScopeChatMember.php @@ -14,14 +14,14 @@ class BotCommandScopeChatMember extends BotCommandScope /** Scope type, must be chat_member */ public string $type = 'chat_member'; - /** Unique identifier for the target chat or username of the target supergroup (in the format @supergroupusername) */ + /** Unique identifier for the target chat or username of the target supergroup (in the format @supergroupusername). Channel direct messages chats and channel chats aren't supported. */ public int|string $chat_id; /** Unique identifier of the target user */ public int $user_id; /** - * @param int|string $chat_id Unique identifier for the target chat or username of the target supergroup (in the format @supergroupusername) + * @param int|string $chat_id Unique identifier for the target chat or username of the target supergroup (in the format @supergroupusername). Channel direct messages chats and channel chats aren't supported. * @param int $user_id Unique identifier of the target user */ public static function make(int|string $chat_id, int $user_id): static diff --git a/src/Telegram/BusinessBotRights.php b/src/Telegram/BusinessBotRights.php new file mode 100644 index 0000000..5ad4bb3 --- /dev/null +++ b/src/Telegram/BusinessBotRights.php @@ -0,0 +1,107 @@ +Optional. True, if the bot can send and edit messages in the private chats that had incoming messages in the last 24 hours */ + public ?bool $can_reply = null; + + /** Optional. True, if the bot can mark incoming private messages as read */ + public ?bool $can_read_messages = null; + + /** Optional. True, if the bot can delete messages sent by the bot */ + public ?bool $can_delete_sent_messages = null; + + /** Optional. True, if the bot can delete all private messages in managed chats */ + public ?bool $can_delete_all_messages = null; + + /** Optional. True, if the bot can edit the first and last name of the business account */ + public ?bool $can_edit_name = null; + + /** Optional. True, if the bot can edit the bio of the business account */ + public ?bool $can_edit_bio = null; + + /** Optional. True, if the bot can edit the profile photo of the business account */ + public ?bool $can_edit_profile_photo = null; + + /** Optional. True, if the bot can edit the username of the business account */ + public ?bool $can_edit_username = null; + + /** Optional. True, if the bot can change the privacy settings pertaining to gifts for the business account */ + public ?bool $can_change_gift_settings = null; + + /** Optional. True, if the bot can view gifts and the amount of Telegram Stars owned by the business account */ + public ?bool $can_view_gifts_and_stars = null; + + /** Optional. True, if the bot can convert regular gifts owned by the business account to Telegram Stars */ + public ?bool $can_convert_gifts_to_stars = null; + + /** Optional. True, if the bot can transfer and upgrade gifts owned by the business account */ + public ?bool $can_transfer_and_upgrade_gifts = null; + + /** Optional. True, if the bot can transfer Telegram Stars received by the business account to its own account, or use them to upgrade and transfer gifts */ + public ?bool $can_transfer_stars = null; + + /** Optional. True, if the bot can post, edit and delete stories on behalf of the business account */ + public ?bool $can_manage_stories = null; + + /** + * @param bool $can_reply Optional. True, if the bot can send and edit messages in the private chats that had incoming messages in the last 24 hours + * @param bool $can_read_messages Optional. True, if the bot can mark incoming private messages as read + * @param bool $can_delete_sent_messages Optional. True, if the bot can delete messages sent by the bot + * @param bool $can_delete_all_messages Optional. True, if the bot can delete all private messages in managed chats + * @param bool $can_edit_name Optional. True, if the bot can edit the first and last name of the business account + * @param bool $can_edit_bio Optional. True, if the bot can edit the bio of the business account + * @param bool $can_edit_profile_photo Optional. True, if the bot can edit the profile photo of the business account + * @param bool $can_edit_username Optional. True, if the bot can edit the username of the business account + * @param bool $can_change_gift_settings Optional. True, if the bot can change the privacy settings pertaining to gifts for the business account + * @param bool $can_view_gifts_and_stars Optional. True, if the bot can view gifts and the amount of Telegram Stars owned by the business account + * @param bool $can_convert_gifts_to_stars Optional. True, if the bot can convert regular gifts owned by the business account to Telegram Stars + * @param bool $can_transfer_and_upgrade_gifts Optional. True, if the bot can transfer and upgrade gifts owned by the business account + * @param bool $can_transfer_stars Optional. True, if the bot can transfer Telegram Stars received by the business account to its own account, or use them to upgrade and transfer gifts + * @param bool $can_manage_stories Optional. True, if the bot can post, edit and delete stories on behalf of the business account + */ + public static function make( + ?bool $can_reply = null, + ?bool $can_read_messages = null, + ?bool $can_delete_sent_messages = null, + ?bool $can_delete_all_messages = null, + ?bool $can_edit_name = null, + ?bool $can_edit_bio = null, + ?bool $can_edit_profile_photo = null, + ?bool $can_edit_username = null, + ?bool $can_change_gift_settings = null, + ?bool $can_view_gifts_and_stars = null, + ?bool $can_convert_gifts_to_stars = null, + ?bool $can_transfer_and_upgrade_gifts = null, + ?bool $can_transfer_stars = null, + ?bool $can_manage_stories = null, + ): static { + return new static([ + 'can_reply' => $can_reply, + 'can_read_messages' => $can_read_messages, + 'can_delete_sent_messages' => $can_delete_sent_messages, + 'can_delete_all_messages' => $can_delete_all_messages, + 'can_edit_name' => $can_edit_name, + 'can_edit_bio' => $can_edit_bio, + 'can_edit_profile_photo' => $can_edit_profile_photo, + 'can_edit_username' => $can_edit_username, + 'can_change_gift_settings' => $can_change_gift_settings, + 'can_view_gifts_and_stars' => $can_view_gifts_and_stars, + 'can_convert_gifts_to_stars' => $can_convert_gifts_to_stars, + 'can_transfer_and_upgrade_gifts' => $can_transfer_and_upgrade_gifts, + 'can_transfer_stars' => $can_transfer_stars, + 'can_manage_stories' => $can_manage_stories, + ]); + } +} diff --git a/src/Telegram/BusinessConnection.php b/src/Telegram/BusinessConnection.php index 2204b82..6285ced 100644 --- a/src/Telegram/BusinessConnection.php +++ b/src/Telegram/BusinessConnection.php @@ -25,35 +25,35 @@ class BusinessConnection extends Type /** Date the connection was established in Unix time */ public int $date; - /** True, if the bot can act on behalf of the business account in chats that were active in the last 24 hours */ - public bool $can_reply; - - /** True, if the connection is active */ + /** True, if the connection is active */ public bool $is_enabled; + /** Optional. Rights of the business bot */ + public ?BusinessBotRights $rights = null; + /** * @param string $id Unique identifier of the business connection * @param User $user Business account user that created the business connection * @param int $user_chat_id Identifier of a private chat with the user who created the business connection. 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 int $date Date the connection was established in Unix time - * @param bool $can_reply True, if the bot can act on behalf of the business account in chats that were active in the last 24 hours - * @param bool $is_enabled True, if the connection is active + * @param bool $is_enabled True, if the connection is active + * @param BusinessBotRights $rights Optional. Rights of the business bot */ public static function make( string $id, User $user, int $user_chat_id, int $date, - bool $can_reply, bool $is_enabled, + ?BusinessBotRights $rights = null, ): static { return new static([ 'id' => $id, 'user' => $user, 'user_chat_id' => $user_chat_id, 'date' => $date, - 'can_reply' => $can_reply, 'is_enabled' => $is_enabled, + 'rights' => $rights, ]); } } diff --git a/src/Telegram/Chat.php b/src/Telegram/Chat.php index 3d37bac..7520a11 100644 --- a/src/Telegram/Chat.php +++ b/src/Telegram/Chat.php @@ -34,6 +34,9 @@ class Chat extends Type /** Optional. True, if the supergroup chat is a forum (has topics enabled) */ public ?bool $is_forum = null; + /** Optional. True, if the chat is the direct messages chat of a channel */ + public ?bool $is_direct_messages = 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” @@ -42,6 +45,7 @@ class Chat extends Type * @param string $first_name Optional. First name of the other party in a private chat * @param string $last_name Optional. Last name of the other party in a private chat * @param bool $is_forum Optional. True, if the supergroup chat is a forum (has topics enabled) + * @param bool $is_direct_messages Optional. True, if the chat is the direct messages chat of a channel */ public static function make( int $id, @@ -51,6 +55,7 @@ public static function make( ?string $first_name = null, ?string $last_name = null, ?bool $is_forum = null, + ?bool $is_direct_messages = null, ): static { return new static([ 'id' => $id, @@ -60,6 +65,7 @@ public static function make( 'first_name' => $first_name, 'last_name' => $last_name, 'is_forum' => $is_forum, + 'is_direct_messages' => $is_direct_messages, ]); } } diff --git a/src/Telegram/ChatAdministratorRights.php b/src/Telegram/ChatAdministratorRights.php index 3e6f699..301f67c 100644 --- a/src/Telegram/ChatAdministratorRights.php +++ b/src/Telegram/ChatAdministratorRights.php @@ -16,7 +16,7 @@ class ChatAdministratorRights extends Type /** True, if the user's presence in the chat is hidden */ public bool $is_anonymous; - /** True, if the administrator can access the chat event log, get boost list, see hidden supergroup and channel members, report spam messages and ignore slow mode. Implied by any other administrator privilege. */ + /** 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. */ public bool $can_manage_chat; /** True, if the administrator can delete messages of other users */ @@ -46,7 +46,7 @@ class ChatAdministratorRights extends Type /** True, if the administrator can delete stories posted by other users */ public bool $can_delete_stories; - /** Optional. True, if the administrator can post messages in the channel, or access channel statistics; for channels only */ + /** Optional. True, if the administrator can post messages in the channel, approve suggested posts, or access channel statistics; for channels only */ public ?bool $can_post_messages = null; /** Optional. True, if the administrator can edit messages of other users and can pin messages; for channels only */ @@ -58,9 +58,12 @@ class ChatAdministratorRights extends Type /** Optional. True, if the user is allowed to create, rename, close, and reopen forum topics; for supergroups only */ public ?bool $can_manage_topics = null; + /** Optional. True, if the administrator can manage direct messages of the channel and decline suggested posts; for channels only */ + public ?bool $can_manage_direct_messages = null; + /** * @param bool $is_anonymous True, if the user's presence in the chat is hidden - * @param bool $can_manage_chat True, if the administrator can access the chat event log, get boost list, see hidden supergroup and channel members, report spam messages and ignore slow mode. Implied by any other administrator privilege. + * @param bool $can_manage_chat 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 True, if the administrator can delete messages of other users * @param bool $can_manage_video_chats True, if the administrator can manage video chats * @param bool $can_restrict_members True, if the administrator can restrict, ban or unban chat members, or access supergroup statistics @@ -70,10 +73,11 @@ class ChatAdministratorRights extends Type * @param bool $can_post_stories True, if the administrator can post stories to the chat * @param bool $can_edit_stories True, if the administrator can edit stories posted by other users, post stories to the chat page, pin chat stories, and access the chat's story archive * @param bool $can_delete_stories True, if the administrator can delete stories posted by other users - * @param bool $can_post_messages Optional. True, if the administrator can post messages in the channel, or access channel statistics; for channels only + * @param bool $can_post_messages Optional. True, if the administrator can post messages in the channel, approve suggested posts, or access channel statistics; for channels only * @param bool $can_edit_messages Optional. True, if the administrator can edit messages of other users and can pin messages; for channels only * @param bool $can_pin_messages Optional. True, if the user is allowed to pin messages; for groups and supergroups only * @param bool $can_manage_topics Optional. True, if the user is allowed to create, rename, close, and reopen forum topics; for supergroups only + * @param bool $can_manage_direct_messages Optional. True, if the administrator can manage direct messages of the channel and decline suggested posts; for channels only */ public static function make( bool $is_anonymous, @@ -91,6 +95,7 @@ public static function make( ?bool $can_edit_messages = null, ?bool $can_pin_messages = null, ?bool $can_manage_topics = null, + ?bool $can_manage_direct_messages = null, ): static { return new static([ 'is_anonymous' => $is_anonymous, @@ -108,6 +113,7 @@ public static function make( 'can_edit_messages' => $can_edit_messages, 'can_pin_messages' => $can_pin_messages, 'can_manage_topics' => $can_manage_topics, + 'can_manage_direct_messages' => $can_manage_direct_messages, ]); } } diff --git a/src/Telegram/ChatBoostSourceGiveaway.php b/src/Telegram/ChatBoostSourceGiveaway.php index fee912b..cce28cf 100644 --- a/src/Telegram/ChatBoostSourceGiveaway.php +++ b/src/Telegram/ChatBoostSourceGiveaway.php @@ -20,14 +20,14 @@ class ChatBoostSourceGiveaway extends ChatBoostSource /** Optional. The number of Telegram Stars to be split between giveaway winners; for Telegram Star giveaways only */ public ?int $prize_star_count = null; - /** Optional. True, if the giveaway was completed, but there was no user to win the prize */ + /** Optional. True, if the giveaway was completed, but there was no user to win the prize */ public ?bool $is_unclaimed = null; /** * @param int $giveaway_message_id Identifier of a message in the chat with the giveaway; the message could have been deleted already. May be 0 if the message isn't sent yet. * @param User $user Optional. User that won the prize in the giveaway if any; for Telegram Premium giveaways only * @param int $prize_star_count Optional. The number of Telegram Stars to be split between giveaway winners; for Telegram Star giveaways only - * @param bool $is_unclaimed Optional. True, if the giveaway was completed, but there was no user to win the prize + * @param bool $is_unclaimed Optional. True, if the giveaway was completed, but there was no user to win the prize */ public static function make( int $giveaway_message_id, diff --git a/src/Telegram/ChatFullInfo.php b/src/Telegram/ChatFullInfo.php index acdb5bd..08e2156 100644 --- a/src/Telegram/ChatFullInfo.php +++ b/src/Telegram/ChatFullInfo.php @@ -25,6 +25,9 @@ class ChatFullInfo extends Type /** The maximum number of reactions that can be set on a message in the chat */ public int $max_reaction_count; + /** Information about types of gifts that are accepted by the chat or by the corresponding user for private chats */ + public AcceptedGiftTypes $accepted_gift_types; + /** Optional. Title, for supergroups, channels and group chats */ public ?string $title = null; @@ -40,6 +43,9 @@ class ChatFullInfo extends Type /** Optional. True, if the supergroup chat is a forum (has topics enabled) */ public ?bool $is_forum = null; + /** Optional. True, if the chat is the direct messages chat of a channel */ + public ?bool $is_direct_messages = null; + /** Optional. Chat photo */ public ?ChatPhoto $photo = null; @@ -65,6 +71,9 @@ class ChatFullInfo extends Type /** Optional. For private chats, the personal channel of the user */ public ?Chat $personal_chat = null; + /** Optional. Information about the corresponding channel chat; for direct messages chats only */ + public ?Chat $parent_chat = null; + /** * Optional. List of available reactions allowed in the chat. If omitted, then all emoji reactions are allowed. * @@ -114,9 +123,6 @@ class ChatFullInfo extends Type /** Optional. Default chat member permissions, for groups and supergroups */ public ?ChatPermissions $permissions = null; - /** Optional. True, if gifts can be sent to the chat */ - public ?bool $can_send_gift = null; - /** Optional. True, 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; @@ -161,11 +167,13 @@ class ChatFullInfo extends Type * @param string $type Type of the chat, can be either “private”, “group”, “supergroup” or “channel” * @param int $accent_color_id Identifier of the accent color for the chat name and backgrounds of the chat photo, reply header, and link preview. See accent colors for more details. * @param int $max_reaction_count The maximum number of reactions that can be set on a message in the chat + * @param AcceptedGiftTypes $accepted_gift_types Information about types of gifts that are accepted by the chat or by the corresponding user for private chats * @param string $title Optional. Title, for supergroups, channels and group chats * @param string $username Optional. Username, for private chats, supergroups and channels if available * @param string $first_name Optional. First name of the other party in a private chat * @param string $last_name Optional. Last name of the other party in a private chat * @param bool $is_forum Optional. True, if the supergroup chat is a forum (has topics enabled) + * @param bool $is_direct_messages Optional. True, if the chat is the direct messages chat of a channel * @param ChatPhoto $photo Optional. Chat photo * @param string[] $active_usernames Optional. If non-empty, the list of all active chat usernames; for private chats, supergroups and channels * @param Birthdate $birthdate Optional. For private chats, the date of birth of the user @@ -173,6 +181,7 @@ class ChatFullInfo extends Type * @param BusinessLocation $business_location Optional. For private chats with business accounts, the location of the business * @param BusinessOpeningHours $business_opening_hours Optional. For private chats with business accounts, the opening hours of the business * @param Chat $personal_chat Optional. For private chats, the personal channel of the user + * @param Chat $parent_chat Optional. Information about the corresponding channel chat; for direct messages chats only * @param ReactionType[] $available_reactions Optional. List of available reactions allowed in the chat. If omitted, then all emoji reactions are allowed. * @param string $background_custom_emoji_id Optional. Custom emoji identifier of the emoji chosen by the chat for the reply header and link preview background * @param int $profile_accent_color_id Optional. Identifier of the accent color for the chat's profile background. See profile accent colors for more details. @@ -188,7 +197,6 @@ class ChatFullInfo extends Type * @param string $invite_link Optional. Primary invite link, for groups, supergroups and channel chats * @param Message $pinned_message Optional. The most recent pinned message (by sending date) * @param ChatPermissions $permissions Optional. Default chat member permissions, for groups and supergroups - * @param bool $can_send_gift Optional. True, if gifts can be sent to the chat * @param bool $can_send_paid_media Optional. True, 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 Optional. For supergroups, the minimum allowed delay between consecutive messages sent by each unprivileged user; in seconds * @param int $unrestrict_boost_count Optional. For supergroups, the minimum number of boosts that a non-administrator user needs to add in order to ignore slow mode and chat permissions @@ -208,11 +216,13 @@ public static function make( string $type, int $accent_color_id, int $max_reaction_count, + AcceptedGiftTypes $accepted_gift_types, ?string $title = null, ?string $username = null, ?string $first_name = null, ?string $last_name = null, ?bool $is_forum = null, + ?bool $is_direct_messages = null, ?ChatPhoto $photo = null, ?array $active_usernames = null, ?Birthdate $birthdate = null, @@ -220,6 +230,7 @@ public static function make( ?BusinessLocation $business_location = null, ?BusinessOpeningHours $business_opening_hours = null, ?Chat $personal_chat = null, + ?Chat $parent_chat = null, ?array $available_reactions = null, ?string $background_custom_emoji_id = null, ?int $profile_accent_color_id = null, @@ -235,7 +246,6 @@ public static function make( ?string $invite_link = null, ?Message $pinned_message = null, ?ChatPermissions $permissions = null, - ?bool $can_send_gift = null, ?bool $can_send_paid_media = null, ?int $slow_mode_delay = null, ?int $unrestrict_boost_count = null, @@ -255,11 +265,13 @@ public static function make( 'type' => $type, 'accent_color_id' => $accent_color_id, 'max_reaction_count' => $max_reaction_count, + 'accepted_gift_types' => $accepted_gift_types, 'title' => $title, 'username' => $username, 'first_name' => $first_name, 'last_name' => $last_name, 'is_forum' => $is_forum, + 'is_direct_messages' => $is_direct_messages, 'photo' => $photo, 'active_usernames' => $active_usernames, 'birthdate' => $birthdate, @@ -267,6 +279,7 @@ public static function make( 'business_location' => $business_location, 'business_opening_hours' => $business_opening_hours, 'personal_chat' => $personal_chat, + 'parent_chat' => $parent_chat, 'available_reactions' => $available_reactions, 'background_custom_emoji_id' => $background_custom_emoji_id, 'profile_accent_color_id' => $profile_accent_color_id, @@ -282,7 +295,6 @@ public static function make( 'invite_link' => $invite_link, 'pinned_message' => $pinned_message, 'permissions' => $permissions, - 'can_send_gift' => $can_send_gift, 'can_send_paid_media' => $can_send_paid_media, 'slow_mode_delay' => $slow_mode_delay, 'unrestrict_boost_count' => $unrestrict_boost_count, diff --git a/src/Telegram/ChatMemberAdministrator.php b/src/Telegram/ChatMemberAdministrator.php index ea6877f..a471fc9 100644 --- a/src/Telegram/ChatMemberAdministrator.php +++ b/src/Telegram/ChatMemberAdministrator.php @@ -20,7 +20,7 @@ class ChatMemberAdministrator extends ChatMember /** True, if the user's presence in the chat is hidden */ public bool $is_anonymous; - /** True, if the administrator can access the chat event log, get boost list, see hidden supergroup and channel members, report spam messages and ignore slow mode. Implied by any other administrator privilege. */ + /** 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. */ public bool $can_manage_chat; /** True, if the administrator can delete messages of other users */ @@ -50,7 +50,7 @@ class ChatMemberAdministrator extends ChatMember /** True, if the administrator can delete stories posted by other users */ public bool $can_delete_stories; - /** Optional. True, if the administrator can post messages in the channel, or access channel statistics; for channels only */ + /** Optional. True, if the administrator can post messages in the channel, approve suggested posts, or access channel statistics; for channels only */ public ?bool $can_post_messages = null; /** Optional. True, if the administrator can edit messages of other users and can pin messages; for channels only */ @@ -62,6 +62,9 @@ class ChatMemberAdministrator extends ChatMember /** Optional. True, if the user is allowed to create, rename, close, and reopen forum topics; for supergroups only */ public ?bool $can_manage_topics = null; + /** Optional. True, if the administrator can manage direct messages of the channel and decline suggested posts; for channels only */ + public ?bool $can_manage_direct_messages = null; + /** Optional. Custom title for this user */ public ?string $custom_title = null; @@ -69,7 +72,7 @@ class ChatMemberAdministrator extends ChatMember * @param User $user Information about the user * @param bool $can_be_edited True, if the bot is allowed to edit administrator privileges of that user * @param bool $is_anonymous True, if the user's presence in the chat is hidden - * @param bool $can_manage_chat True, if the administrator can access the chat event log, get boost list, see hidden supergroup and channel members, report spam messages and ignore slow mode. Implied by any other administrator privilege. + * @param bool $can_manage_chat 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 True, if the administrator can delete messages of other users * @param bool $can_manage_video_chats True, if the administrator can manage video chats * @param bool $can_restrict_members True, if the administrator can restrict, ban or unban chat members, or access supergroup statistics @@ -79,10 +82,11 @@ class ChatMemberAdministrator extends ChatMember * @param bool $can_post_stories True, if the administrator can post stories to the chat * @param bool $can_edit_stories True, if the administrator can edit stories posted by other users, post stories to the chat page, pin chat stories, and access the chat's story archive * @param bool $can_delete_stories True, if the administrator can delete stories posted by other users - * @param bool $can_post_messages Optional. True, if the administrator can post messages in the channel, or access channel statistics; for channels only + * @param bool $can_post_messages Optional. True, if the administrator can post messages in the channel, approve suggested posts, or access channel statistics; for channels only * @param bool $can_edit_messages Optional. True, if the administrator can edit messages of other users and can pin messages; for channels only * @param bool $can_pin_messages Optional. True, if the user is allowed to pin messages; for groups and supergroups only * @param bool $can_manage_topics Optional. True, if the user is allowed to create, rename, close, and reopen forum topics; for supergroups only + * @param bool $can_manage_direct_messages Optional. True, if the administrator can manage direct messages of the channel and decline suggested posts; for channels only * @param string $custom_title Optional. Custom title for this user */ public static function make( @@ -103,6 +107,7 @@ public static function make( ?bool $can_edit_messages = null, ?bool $can_pin_messages = null, ?bool $can_manage_topics = null, + ?bool $can_manage_direct_messages = null, ?string $custom_title = null, ): static { return new static([ @@ -123,6 +128,7 @@ public static function make( 'can_edit_messages' => $can_edit_messages, 'can_pin_messages' => $can_pin_messages, 'can_manage_topics' => $can_manage_topics, + 'can_manage_direct_messages' => $can_manage_direct_messages, 'custom_title' => $custom_title, ]); } diff --git a/src/Telegram/ChatMemberRestricted.php b/src/Telegram/ChatMemberRestricted.php index e9a8574..d8cfece 100644 --- a/src/Telegram/ChatMemberRestricted.php +++ b/src/Telegram/ChatMemberRestricted.php @@ -38,7 +38,7 @@ class ChatMemberRestricted extends ChatMember /** True, if the user is allowed to send voice notes */ public bool $can_send_voice_notes; - /** True, if the user is allowed to send polls */ + /** True, if the user is allowed to send polls and checklists */ public bool $can_send_polls; /** True, if the user is allowed to send animations, games, stickers and use inline bots */ @@ -72,7 +72,7 @@ class ChatMemberRestricted extends ChatMember * @param bool $can_send_videos True, if the user is allowed to send videos * @param bool $can_send_video_notes True, if the user is allowed to send video notes * @param bool $can_send_voice_notes True, if the user is allowed to send voice notes - * @param bool $can_send_polls True, if the user is allowed to send polls + * @param bool $can_send_polls True, if the user is allowed to send polls and checklists * @param bool $can_send_other_messages True, if the user is allowed to send animations, games, stickers and use inline bots * @param bool $can_add_web_page_previews True, if the user is allowed to add web page previews to their messages * @param bool $can_change_info True, if the user is allowed to change the chat title, photo and other settings diff --git a/src/Telegram/ChatMemberUpdated.php b/src/Telegram/ChatMemberUpdated.php index d097148..b61ee7d 100644 --- a/src/Telegram/ChatMemberUpdated.php +++ b/src/Telegram/ChatMemberUpdated.php @@ -31,10 +31,10 @@ class ChatMemberUpdated extends Type /** Optional. Chat invite link, which was used by the user to join the chat; for joining by invite link events only. */ public ?ChatInviteLink $invite_link = null; - /** Optional. True, if the user joined the chat after sending a direct join request without using an invite link and being approved by an administrator */ + /** Optional. True, if the user joined the chat after sending a direct join request without using an invite link and being approved by an administrator */ public ?bool $via_join_request = null; - /** Optional. True, if the user joined the chat via a chat folder invite link */ + /** Optional. True, if the user joined the chat via a chat folder invite link */ public ?bool $via_chat_folder_invite_link = null; /** @@ -44,8 +44,8 @@ class ChatMemberUpdated extends Type * @param ChatMember $old_chat_member Previous information about the chat member * @param ChatMember $new_chat_member New information about the chat member * @param ChatInviteLink $invite_link Optional. Chat invite link, which was used by the user to join the chat; for joining by invite link events only. - * @param bool $via_join_request Optional. True, if the user joined the chat after sending a direct join request without using an invite link and being approved by an administrator - * @param bool $via_chat_folder_invite_link Optional. True, if the user joined the chat via a chat folder invite link + * @param bool $via_join_request Optional. True, if the user joined the chat after sending a direct join request without using an invite link and being approved by an administrator + * @param bool $via_chat_folder_invite_link Optional. True, if the user joined the chat via a chat folder invite link */ public static function make( Chat $chat, diff --git a/src/Telegram/ChatPermissions.php b/src/Telegram/ChatPermissions.php index 4f15b73..06147aa 100644 --- a/src/Telegram/ChatPermissions.php +++ b/src/Telegram/ChatPermissions.php @@ -34,7 +34,7 @@ class ChatPermissions extends Type /** Optional. True, if the user is allowed to send voice notes */ public ?bool $can_send_voice_notes = null; - /** Optional. True, if the user is allowed to send polls */ + /** Optional. True, if the user is allowed to send polls and checklists */ public ?bool $can_send_polls = null; /** Optional. True, if the user is allowed to send animations, games, stickers and use inline bots */ @@ -63,7 +63,7 @@ class ChatPermissions extends Type * @param bool $can_send_videos Optional. True, if the user is allowed to send videos * @param bool $can_send_video_notes Optional. True, if the user is allowed to send video notes * @param bool $can_send_voice_notes Optional. True, if the user is allowed to send voice notes - * @param bool $can_send_polls Optional. True, if the user is allowed to send polls + * @param bool $can_send_polls Optional. True, if the user is allowed to send polls and checklists * @param bool $can_send_other_messages Optional. True, if the user is allowed to send animations, games, stickers and use inline bots * @param bool $can_add_web_page_previews Optional. True, if the user is allowed to add web page previews to their messages * @param bool $can_change_info Optional. True, if the user is allowed to change the chat title, photo and other settings. Ignored in public supergroups diff --git a/src/Telegram/Checklist.php b/src/Telegram/Checklist.php new file mode 100644 index 0000000..415f8a2 --- /dev/null +++ b/src/Telegram/Checklist.php @@ -0,0 +1,61 @@ +Optional. Special entities that appear in the checklist title + * + * @var MessageEntity[] + */ + public ?array $title_entities = null; + + /** Optional. True, if users other than the creator of the list can add tasks to the list */ + public ?bool $others_can_add_tasks = null; + + /** Optional. True, if users other than the creator of the list can mark tasks as done or not done */ + public ?bool $others_can_mark_tasks_as_done = null; + + /** + * @param string $title Title of the checklist + * @param ChecklistTask[] $tasks List of tasks in the checklist + * @param MessageEntity[] $title_entities Optional. Special entities that appear in the checklist title + * @param bool $others_can_add_tasks Optional. True, if users other than the creator of the list can add tasks to the list + * @param bool $others_can_mark_tasks_as_done Optional. True, if users other than the creator of the list can mark tasks as done or not done + */ + public static function make( + string $title, + array $tasks, + ?array $title_entities = null, + ?bool $others_can_add_tasks = null, + ?bool $others_can_mark_tasks_as_done = null, + ): static { + return new static([ + 'title' => $title, + 'tasks' => $tasks, + 'title_entities' => $title_entities, + 'others_can_add_tasks' => $others_can_add_tasks, + 'others_can_mark_tasks_as_done' => $others_can_mark_tasks_as_done, + ]); + } +} diff --git a/src/Telegram/ChecklistTask.php b/src/Telegram/ChecklistTask.php new file mode 100644 index 0000000..b5c863a --- /dev/null +++ b/src/Telegram/ChecklistTask.php @@ -0,0 +1,57 @@ +Optional. Special entities that appear in the task text + * + * @var MessageEntity[] + */ + public ?array $text_entities = null; + + /** Optional. User that completed the task; omitted if the task wasn't completed */ + public ?User $completed_by_user = null; + + /** Optional. Point in time (Unix timestamp) when the task was completed; 0 if the task wasn't completed */ + public ?int $completion_date = null; + + /** + * @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 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( + int $id, + string $text, + ?array $text_entities = null, + ?User $completed_by_user = null, + ?int $completion_date = null, + ): static { + return new static([ + 'id' => $id, + 'text' => $text, + 'text_entities' => $text_entities, + 'completed_by_user' => $completed_by_user, + 'completion_date' => $completion_date, + ]); + } +} diff --git a/src/Telegram/ChecklistTasksAdded.php b/src/Telegram/ChecklistTasksAdded.php new file mode 100644 index 0000000..60c4f5a --- /dev/null +++ b/src/Telegram/ChecklistTasksAdded.php @@ -0,0 +1,37 @@ +Optional. Message containing the checklist to which the tasks were added. Note that the Message object in this field will not contain the reply_to_message field even if it itself is a reply. */ + public ?Message $checklist_message = null; + + /** + * @param ChecklistTask[] $tasks List of tasks added to the checklist + * @param Message $checklist_message Optional. Message containing the checklist to which the tasks were added. Note that the Message object in this field will not contain the reply_to_message field even if it itself is a reply. + */ + public static function make(array $tasks, ?Message $checklist_message = null): static + { + return new static([ + 'tasks' => $tasks, + 'checklist_message' => $checklist_message, + ]); + } +} diff --git a/src/Telegram/ChecklistTasksDone.php b/src/Telegram/ChecklistTasksDone.php new file mode 100644 index 0000000..d602c86 --- /dev/null +++ b/src/Telegram/ChecklistTasksDone.php @@ -0,0 +1,49 @@ +Optional. Message containing the checklist whose tasks were marked as done or not done. Note that the Message object in this field will not contain the reply_to_message field even if it itself is a reply. */ + public ?Message $checklist_message = null; + + /** + * Optional. Identifiers of the tasks that were marked as done + * + * @var int[] + */ + public ?array $marked_as_done_task_ids = null; + + /** + * Optional. Identifiers of the tasks that were marked as not done + * + * @var int[] + */ + public ?array $marked_as_not_done_task_ids = null; + + /** + * @param Message $checklist_message Optional. Message containing the checklist whose tasks were marked as done or not done. Note that the Message object in this field will not contain the reply_to_message field even if it itself is a reply. + * @param int[] $marked_as_done_task_ids Optional. Identifiers of the tasks that were marked as done + * @param int[] $marked_as_not_done_task_ids Optional. Identifiers of the tasks that were marked as not done + */ + public static function make( + ?Message $checklist_message = null, + ?array $marked_as_done_task_ids = null, + ?array $marked_as_not_done_task_ids = null, + ): static { + return new static([ + 'checklist_message' => $checklist_message, + 'marked_as_done_task_ids' => $marked_as_done_task_ids, + 'marked_as_not_done_task_ids' => $marked_as_not_done_task_ids, + ]); + } +} diff --git a/src/Telegram/DirectMessagePriceChanged.php b/src/Telegram/DirectMessagePriceChanged.php new file mode 100644 index 0000000..48c8855 --- /dev/null +++ b/src/Telegram/DirectMessagePriceChanged.php @@ -0,0 +1,33 @@ +True, if direct messages are enabled for the channel chat; false otherwise */ + public bool $are_direct_messages_enabled; + + /** Optional. The new number of Telegram Stars that must be paid by users for each direct message sent to the channel. Does not apply to users who have been exempted by administrators. Defaults to 0. */ + public ?int $direct_message_star_count = null; + + /** + * @param bool $are_direct_messages_enabled True, if direct messages are enabled for the channel chat; false otherwise + * @param int $direct_message_star_count Optional. The new number of Telegram Stars that must be paid by users for each direct message sent to the channel. Does not apply to users who have been exempted by administrators. Defaults to 0. + */ + public static function make(bool $are_direct_messages_enabled, ?int $direct_message_star_count = null): static + { + return new static([ + 'are_direct_messages_enabled' => $are_direct_messages_enabled, + 'direct_message_star_count' => $direct_message_star_count, + ]); + } +} diff --git a/src/Telegram/DirectMessagesTopic.php b/src/Telegram/DirectMessagesTopic.php new file mode 100644 index 0000000..305b33f --- /dev/null +++ b/src/Telegram/DirectMessagesTopic.php @@ -0,0 +1,33 @@ +Optional. Information about the user that created the topic. Currently, it is always present */ + public ?User $user = null; + + /** + * @param int $topic_id Unique identifier of the topic. 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 User $user Optional. Information about the user that created the topic. Currently, it is always present + */ + public static function make(int $topic_id, ?User $user = null): static + { + return new static([ + 'topic_id' => $topic_id, + 'user' => $user, + ]); + } +} diff --git a/src/Telegram/ExternalReplyInfo.php b/src/Telegram/ExternalReplyInfo.php index 8ce3acc..252359c 100644 --- a/src/Telegram/ExternalReplyInfo.php +++ b/src/Telegram/ExternalReplyInfo.php @@ -62,6 +62,9 @@ class ExternalReplyInfo extends Type /** Optional. True, if the message media is covered by a spoiler animation */ public ?bool $has_media_spoiler = null; + /** Optional. Message is a checklist */ + public ?Checklist $checklist = null; + /** Optional. Message is a shared contact, information about the contact */ public ?Contact $contact = null; @@ -105,6 +108,7 @@ class ExternalReplyInfo extends Type * @param VideoNote $video_note Optional. Message is a video note, information about the video message * @param Voice $voice Optional. Message is a voice message, information about the file * @param bool $has_media_spoiler Optional. True, if the message media is covered by a spoiler animation + * @param Checklist $checklist Optional. Message is a checklist * @param Contact $contact Optional. Message is a shared contact, information about the contact * @param Dice $dice Optional. Message is a dice with random value * @param Game $game Optional. Message is a game, information about the game. More about games » @@ -131,6 +135,7 @@ public static function make( ?VideoNote $video_note = null, ?Voice $voice = null, ?bool $has_media_spoiler = null, + ?Checklist $checklist = null, ?Contact $contact = null, ?Dice $dice = null, ?Game $game = null, @@ -157,6 +162,7 @@ public static function make( 'video_note' => $video_note, 'voice' => $voice, 'has_media_spoiler' => $has_media_spoiler, + 'checklist' => $checklist, 'contact' => $contact, 'dice' => $dice, 'game' => $game, diff --git a/src/Telegram/Gift.php b/src/Telegram/Gift.php index d41cd67..fb3bdd3 100644 --- a/src/Telegram/Gift.php +++ b/src/Telegram/Gift.php @@ -31,6 +31,9 @@ class Gift extends Type /** Optional. The number of remaining gifts of this type that can be sent; for limited gifts only */ public ?int $remaining_count = null; + /** Optional. Information about the chat that published the gift */ + public ?Chat $publisher_chat = null; + /** * @param string $id Unique identifier of the gift * @param Sticker $sticker The sticker that represents the gift @@ -38,6 +41,7 @@ class Gift extends Type * @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 Chat $publisher_chat Optional. Information about the chat that published the gift */ public static function make( string $id, @@ -46,6 +50,7 @@ public static function make( ?int $upgrade_star_count = null, ?int $total_count = null, ?int $remaining_count = null, + ?Chat $publisher_chat = null, ): static { return new static([ 'id' => $id, @@ -54,6 +59,7 @@ public static function make( 'upgrade_star_count' => $upgrade_star_count, 'total_count' => $total_count, 'remaining_count' => $remaining_count, + 'publisher_chat' => $publisher_chat, ]); } } diff --git a/src/Telegram/GiftInfo.php b/src/Telegram/GiftInfo.php new file mode 100644 index 0000000..d106fa8 --- /dev/null +++ b/src/Telegram/GiftInfo.php @@ -0,0 +1,75 @@ +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; + + /** 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 */ + public ?int $prepaid_upgrade_star_count = null; + + /** Optional. True, if the gift can be upgraded to a unique gift */ + public ?bool $can_be_upgraded = null; + + /** Optional. Text of the message that was added to the gift */ + public ?string $text = null; + + /** + * Optional. Special entities that appear in the text + * + * @var MessageEntity[] + */ + public ?array $entities = null; + + /** 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; + + /** + * @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 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 + */ + public static function make( + Gift $gift, + ?string $owned_gift_id = null, + ?int $convert_star_count = null, + ?int $prepaid_upgrade_star_count = null, + ?bool $can_be_upgraded = null, + ?string $text = null, + ?array $entities = null, + ?bool $is_private = 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, + 'can_be_upgraded' => $can_be_upgraded, + 'text' => $text, + 'entities' => $entities, + 'is_private' => $is_private, + ]); + } +} diff --git a/src/Telegram/InlineKeyboardButton.php b/src/Telegram/InlineKeyboardButton.php index bb3be95..9eb9f71 100644 --- a/src/Telegram/InlineKeyboardButton.php +++ b/src/Telegram/InlineKeyboardButton.php @@ -28,13 +28,13 @@ class InlineKeyboardButton extends Type /** Optional. An HTTPS URL used to automatically authorize the user. Can be used as a replacement for the Telegram Login Widget. */ public ?LoginUrl $login_url = null; - /** Optional. If set, pressing the button will prompt the user to select one of their chats, open that chat and insert the bot's username and the specified inline query in the input field. May be empty, in which case just the bot's username will be inserted. Not supported for messages sent on behalf of a Telegram Business account. */ + /** Optional. If set, pressing the button will prompt the user to select one of their chats, open that chat and insert the bot's username and the specified inline query in the input field. May be empty, in which case just the bot's username will be inserted. Not supported for messages sent in channel direct messages chats and on behalf of a Telegram Business account. */ public ?string $switch_inline_query = null; - /** Optional. If set, pressing the button will insert the bot's username and the specified inline query in the current chat's input field. May be empty, in which case only the bot's username will be inserted.This offers a quick way for the user to open your bot in inline mode in the same chat - good for selecting something from multiple options. Not supported in channels and for messages sent on behalf of a Telegram Business account. */ + /** Optional. If set, pressing the button will insert the bot's username and the specified inline query in the current chat's input field. May be empty, in which case only the bot's username will be inserted.This offers a quick way for the user to open your bot in inline mode in the same chat - good for selecting something from multiple options. Not supported in channels and for messages sent in channel direct messages chats and on behalf of a Telegram Business account. */ public ?string $switch_inline_query_current_chat = null; - /** Optional. If set, pressing the button will prompt the user to select one of their chats of the specified type, open that chat and insert the bot's username and the specified inline query in the input field. Not supported for messages sent on behalf of a Telegram Business account. */ + /** Optional. If set, pressing the button will prompt the user to select one of their chats of the specified type, open that chat and insert the bot's username and the specified inline query in the input field. Not supported for messages sent in channel direct messages chats and on behalf of a Telegram Business account. */ public ?SwitchInlineQueryChosenChat $switch_inline_query_chosen_chat = null; /** Optional. Description of the button that copies the specified text to the clipboard. */ @@ -52,9 +52,9 @@ class InlineKeyboardButton extends Type * @param string $callback_data Optional. Data to be sent in a callback query to the bot when the button is pressed, 1-64 bytes * @param WebAppInfo $web_app Optional. Description of the Web App that will be launched when the user presses the button. The Web App will be able to send an arbitrary message on behalf of the user using the method answerWebAppQuery. Available only in private chats between a user and the bot. Not supported for messages sent on behalf of a Telegram Business account. * @param LoginUrl $login_url Optional. An HTTPS URL used to automatically authorize the user. Can be used as a replacement for the Telegram Login Widget. - * @param string $switch_inline_query Optional. If set, pressing the button will prompt the user to select one of their chats, open that chat and insert the bot's username and the specified inline query in the input field. May be empty, in which case just the bot's username will be inserted. Not supported for messages sent on behalf of a Telegram Business account. - * @param string $switch_inline_query_current_chat Optional. If set, pressing the button will insert the bot's username and the specified inline query in the current chat's input field. May be empty, in which case only the bot's username will be inserted.This offers a quick way for the user to open your bot in inline mode in the same chat - good for selecting something from multiple options. Not supported in channels and for messages sent on behalf of a Telegram Business account. - * @param SwitchInlineQueryChosenChat $switch_inline_query_chosen_chat Optional. If set, pressing the button will prompt the user to select one of their chats of the specified type, open that chat and insert the bot's username and the specified inline query in the input field. Not supported for messages sent on behalf of a Telegram Business account. + * @param string $switch_inline_query Optional. If set, pressing the button will prompt the user to select one of their chats, open that chat and insert the bot's username and the specified inline query in the input field. May be empty, in which case just the bot's username will be inserted. Not supported for messages sent in channel direct messages chats and on behalf of a Telegram Business account. + * @param string $switch_inline_query_current_chat Optional. If set, pressing the button will insert the bot's username and the specified inline query in the current chat's input field. May be empty, in which case only the bot's username will be inserted.This offers a quick way for the user to open your bot in inline mode in the same chat - good for selecting something from multiple options. Not supported in channels and for messages sent in channel direct messages chats and on behalf of a Telegram Business account. + * @param SwitchInlineQueryChosenChat $switch_inline_query_chosen_chat Optional. If set, pressing the button will prompt the user to select one of their chats of the specified type, open that chat and insert the bot's username and the specified inline query in the input field. Not supported for messages sent in channel direct messages chats and on behalf of a Telegram Business account. * @param CopyTextButton $copy_text Optional. Description of the button that copies the specified text to the clipboard. * @param CallbackGame $callback_game Optional. Description of the game that will be launched when the user presses the button.NOTE: This type of button must always be the first button in the first row. * @param bool $pay Optional. Specify True, to send a Pay button. Substrings “⭐” and “XTR” in the buttons's text will be replaced with a Telegram Star icon.NOTE: This type of button must always be the first button in the first row and can only be used in invoice messages. diff --git a/src/Telegram/InputChecklist.php b/src/Telegram/InputChecklist.php new file mode 100644 index 0000000..d7bab4a --- /dev/null +++ b/src/Telegram/InputChecklist.php @@ -0,0 +1,67 @@ +Optional. Mode for parsing entities in the title. See formatting options for more details. */ + public ?string $parse_mode = null; + + /** + * Optional. List of special entities that appear in the title, which can be specified instead of parse_mode. Currently, only bold, italic, underline, strikethrough, spoiler, and custom_emoji entities are allowed. + * + * @var MessageEntity[] + */ + public ?array $title_entities = null; + + /** Optional. Pass True if other users can add tasks to the checklist */ + public ?bool $others_can_add_tasks = null; + + /** Optional. Pass True if other users can mark tasks as done or not done in the checklist */ + public ?bool $others_can_mark_tasks_as_done = null; + + /** + * @param string $title Title of the checklist; 1-255 characters after entities parsing + * @param InputChecklistTask[] $tasks List of 1-30 tasks in the checklist + * @param string $parse_mode Optional. Mode for parsing entities in the title. See formatting options for more details. + * @param MessageEntity[] $title_entities Optional. List of special entities that appear in the title, which can be specified instead of parse_mode. Currently, only bold, italic, underline, strikethrough, spoiler, and custom_emoji entities are allowed. + * @param bool $others_can_add_tasks Optional. Pass True if other users can add tasks to the checklist + * @param bool $others_can_mark_tasks_as_done Optional. Pass True if other users can mark tasks as done or not done in the checklist + */ + public static function make( + string $title, + array $tasks, + ?string $parse_mode = null, + ?array $title_entities = null, + ?bool $others_can_add_tasks = null, + ?bool $others_can_mark_tasks_as_done = null, + ): static { + return new static([ + 'title' => $title, + 'tasks' => $tasks, + 'parse_mode' => $parse_mode, + 'title_entities' => $title_entities, + 'others_can_add_tasks' => $others_can_add_tasks, + 'others_can_mark_tasks_as_done' => $others_can_mark_tasks_as_done, + ]); + } +} diff --git a/src/Telegram/InputChecklistTask.php b/src/Telegram/InputChecklistTask.php new file mode 100644 index 0000000..48e81b3 --- /dev/null +++ b/src/Telegram/InputChecklistTask.php @@ -0,0 +1,51 @@ +Optional. Mode for parsing entities in the text. See formatting options for more details. */ + public ?string $parse_mode = null; + + /** + * Optional. List of special entities that appear in the text, which can be specified instead of parse_mode. Currently, only bold, italic, underline, strikethrough, spoiler, and custom_emoji entities are allowed. + * + * @var MessageEntity[] + */ + public ?array $text_entities = null; + + /** + * @param int $id Unique identifier of the task; must be positive and unique among all task identifiers currently present in the checklist + * @param string $text Text of the task; 1-100 characters after entities parsing + * @param string $parse_mode Optional. Mode for parsing entities in the text. See formatting options for more details. + * @param MessageEntity[] $text_entities Optional. List of special entities that appear in the text, which can be specified instead of parse_mode. Currently, only bold, italic, underline, strikethrough, spoiler, and custom_emoji entities are allowed. + */ + public static function make( + int $id, + string $text, + ?string $parse_mode = null, + ?array $text_entities = null, + ): static { + return new static([ + 'id' => $id, + 'text' => $text, + 'parse_mode' => $parse_mode, + 'text_entities' => $text_entities, + ]); + } +} diff --git a/src/Telegram/InputProfilePhoto.php b/src/Telegram/InputProfilePhoto.php new file mode 100644 index 0000000..f807a93 --- /dev/null +++ b/src/Telegram/InputProfilePhoto.php @@ -0,0 +1,28 @@ + new InputProfilePhotoStatic($data, $bot), + 'animated' => new InputProfilePhotoAnimated($data, $bot), + }; + } +} diff --git a/src/Telegram/InputProfilePhotoAnimated.php b/src/Telegram/InputProfilePhotoAnimated.php new file mode 100644 index 0000000..16bc63a --- /dev/null +++ b/src/Telegram/InputProfilePhotoAnimated.php @@ -0,0 +1,36 @@ +animated */ + public string $type = 'animated'; + + /** The animated profile photo. Profile photos can't be reused and can only be uploaded as a new file, so you can pass “attach://” if the photo was uploaded using multipart/form-data under . More information on Sending Files » */ + public string|InputFile $animation; + + /** Optional. Timestamp in seconds of the frame that will be used as the static profile photo. Defaults to 0.0. */ + public ?float $main_frame_timestamp = null; + + /** + * @param string|InputFile $animation The animated profile photo. Profile photos can't be reused and can only be uploaded as a new file, so you can pass “attach://” if the photo was uploaded using multipart/form-data under . More information on Sending Files » + * @param float $main_frame_timestamp Optional. Timestamp in seconds of the frame that will be used as the static profile photo. Defaults to 0.0. + */ + public static function make(string|InputFile $animation, ?float $main_frame_timestamp = null): static + { + return new static([ + 'animation' => $animation, + 'main_frame_timestamp' => $main_frame_timestamp, + ]); + } +} diff --git a/src/Telegram/InputProfilePhotoStatic.php b/src/Telegram/InputProfilePhotoStatic.php new file mode 100644 index 0000000..f3581ca --- /dev/null +++ b/src/Telegram/InputProfilePhotoStatic.php @@ -0,0 +1,31 @@ +static */ + public string $type = 'static'; + + /** The static profile photo. Profile photos can't be reused and can only be uploaded as a new file, so you can pass “attach://” if the photo was uploaded using multipart/form-data under . More information on Sending Files » */ + public string|InputFile $photo; + + /** + * @param string|InputFile $photo The static profile photo. Profile photos can't be reused and can only be uploaded as a new file, so you can pass “attach://” if the photo was uploaded using multipart/form-data under . More information on Sending Files » + */ + public static function make(string|InputFile $photo): static + { + return new static([ + 'photo' => $photo, + ]); + } +} diff --git a/src/Telegram/InputSticker.php b/src/Telegram/InputSticker.php index 543c050..5556000 100644 --- a/src/Telegram/InputSticker.php +++ b/src/Telegram/InputSticker.php @@ -14,8 +14,8 @@ */ class InputSticker extends Type { - /** The added sticker. Pass a file_id as a String to send a file that already exists on the Telegram servers, pass an HTTP URL as a String for Telegram to get a file from the Internet, upload a new one using multipart/form-data, or pass “attach://” to upload a new one using multipart/form-data under name. Animated and video stickers can't be uploaded via HTTP URL. More information on Sending Files » */ - public InputFile|string $sticker; + /** The added sticker. Pass a file_id as a String to send a file that already exists on the Telegram servers, pass an HTTP URL as a String for Telegram to get a file from the Internet, or pass “attach://” to upload a new file using multipart/form-data under name. Animated and video stickers can't be uploaded via HTTP URL. More information on Sending Files » */ + public string|InputFile $sticker; /** Format of the added sticker, must be one of “static” for a .WEBP or .PNG image, “animated” for a .TGS animation, “video” for a .WEBM video */ public string $format; @@ -38,14 +38,14 @@ class InputSticker extends Type public ?array $keywords = null; /** - * @param InputFile|string $sticker The added sticker. Pass a file_id as a String to send a file that already exists on the Telegram servers, pass an HTTP URL as a String for Telegram to get a file from the Internet, upload a new one using multipart/form-data, or pass “attach://” to upload a new one using multipart/form-data under name. Animated and video stickers can't be uploaded via HTTP URL. More information on Sending Files » + * @param string|InputFile $sticker The added sticker. Pass a file_id as a String to send a file that already exists on the Telegram servers, pass an HTTP URL as a String for Telegram to get a file from the Internet, or pass “attach://” to upload a new file using multipart/form-data under name. Animated and video stickers can't be uploaded via HTTP URL. More information on Sending Files » * @param string $format Format of the added sticker, must be one of “static” for a .WEBP or .PNG image, “animated” for a .TGS animation, “video” for a .WEBM video * @param string[] $emoji_list List of 1-20 emoji associated with the sticker * @param MaskPosition $mask_position Optional. Position where the mask should be placed on faces. For “mask” stickers only. * @param string[] $keywords Optional. List of 0-20 search keywords for the sticker with total length of up to 64 characters. For “regular” and “custom_emoji” stickers only. */ public static function make( - InputFile|string $sticker, + string|InputFile $sticker, string $format, array $emoji_list, ?MaskPosition $mask_position = null, diff --git a/src/Telegram/InputStoryContent.php b/src/Telegram/InputStoryContent.php new file mode 100644 index 0000000..2e3ed40 --- /dev/null +++ b/src/Telegram/InputStoryContent.php @@ -0,0 +1,28 @@ + new InputStoryContentPhoto($data, $bot), + 'video' => new InputStoryContentVideo($data, $bot), + }; + } +} diff --git a/src/Telegram/InputStoryContentPhoto.php b/src/Telegram/InputStoryContentPhoto.php new file mode 100644 index 0000000..4d1a11a --- /dev/null +++ b/src/Telegram/InputStoryContentPhoto.php @@ -0,0 +1,31 @@ +photo */ + public string $type = 'photo'; + + /** The photo to post as a story. The photo must be of the size 1080x1920 and must not exceed 10 MB. The photo can't be reused and can only be uploaded as a new file, so you can pass “attach://” if the photo was uploaded using multipart/form-data under . More information on Sending Files » */ + public string|InputFile $photo; + + /** + * @param string|InputFile $photo The photo to post as a story. The photo must be of the size 1080x1920 and must not exceed 10 MB. The photo can't be reused and can only be uploaded as a new file, so you can pass “attach://” if the photo was uploaded using multipart/form-data under . More information on Sending Files » + */ + public static function make(string|InputFile $photo): static + { + return new static([ + 'photo' => $photo, + ]); + } +} diff --git a/src/Telegram/InputStoryContentVideo.php b/src/Telegram/InputStoryContentVideo.php new file mode 100644 index 0000000..3c80945 --- /dev/null +++ b/src/Telegram/InputStoryContentVideo.php @@ -0,0 +1,50 @@ +video */ + public string $type = 'video'; + + /** The video to post as a story. The video must be of the size 720x1280, streamable, encoded with H.265 codec, with key frames added each second in the MPEG4 format, and must not exceed 30 MB. The video can't be reused and can only be uploaded as a new file, so you can pass “attach://” if the video was uploaded using multipart/form-data under . More information on Sending Files » */ + public string|InputFile $video; + + /** Optional. Precise duration of the video in seconds; 0-60 */ + public ?float $duration = null; + + /** Optional. Timestamp in seconds of the frame that will be used as the static cover for the story. Defaults to 0.0. */ + public ?float $cover_frame_timestamp = null; + + /** Optional. Pass True if the video has no sound */ + public ?bool $is_animation = null; + + /** + * @param string|InputFile $video The video to post as a story. The video must be of the size 720x1280, streamable, encoded with H.265 codec, with key frames added each second in the MPEG4 format, and must not exceed 30 MB. The video can't be reused and can only be uploaded as a new file, so you can pass “attach://” if the video was uploaded using multipart/form-data under . More information on Sending Files » + * @param float $duration Optional. Precise duration of the video in seconds; 0-60 + * @param float $cover_frame_timestamp Optional. Timestamp in seconds of the frame that will be used as the static cover for the story. Defaults to 0.0. + * @param bool $is_animation Optional. Pass True if the video has no sound + */ + public static function make( + string|InputFile $video, + ?float $duration = null, + ?float $cover_frame_timestamp = null, + ?bool $is_animation = null, + ): static { + return new static([ + 'video' => $video, + 'duration' => $duration, + 'cover_frame_timestamp' => $cover_frame_timestamp, + 'is_animation' => $is_animation, + ]); + } +} diff --git a/src/Telegram/KeyboardButton.php b/src/Telegram/KeyboardButton.php index 5ec2417..7d6e3e7 100644 --- a/src/Telegram/KeyboardButton.php +++ b/src/Telegram/KeyboardButton.php @@ -16,10 +16,10 @@ class KeyboardButton extends Type /** Text of the button. If none of the optional fields are used, it will be sent as a message when the button is pressed */ public string $text; - /** Optional. If specified, pressing the button will open a list of suitable users. Identifiers of selected users will be sent to the bot in a “users_shared” service message. Available in private chats only. */ + /** Optional. If specified, pressing the button will open a list of suitable users. Identifiers of selected users will be sent to the bot in a “users_shared” service message. Available in private chats only. */ public ?KeyboardButtonRequestUsers $request_users = null; - /** Optional. If specified, pressing the button will open a list of suitable chats. Tapping on a chat will send its identifier to the bot in a “chat_shared” service message. Available in private chats only. */ + /** Optional. If specified, pressing the button will open a list of suitable chats. Tapping on a chat will send its identifier to the bot in a “chat_shared” service message. Available in private chats only. */ public ?KeyboardButtonRequestChat $request_chat = null; /** Optional. If True, the user's phone number will be sent as a contact when the button is pressed. Available in private chats only. */ @@ -36,8 +36,8 @@ class KeyboardButton extends Type /** * @param string $text Text of the button. If none of the optional fields are used, it will be sent as a message when the button is pressed - * @param KeyboardButtonRequestUsers $request_users Optional. If specified, pressing the button will open a list of suitable users. Identifiers of selected users will be sent to the bot in a “users_shared” service message. Available in private chats only. - * @param KeyboardButtonRequestChat $request_chat Optional. If specified, pressing the button will open a list of suitable chats. Tapping on a chat will send its identifier to the bot in a “chat_shared” service message. Available in private chats only. + * @param KeyboardButtonRequestUsers $request_users Optional. If specified, pressing the button will open a list of suitable users. Identifiers of selected users will be sent to the bot in a “users_shared” service message. Available in private chats only. + * @param KeyboardButtonRequestChat $request_chat Optional. If specified, pressing the button will open a list of suitable chats. Tapping on a chat will send its identifier to the bot in a “chat_shared” service message. Available in private chats only. * @param bool $request_contact Optional. If True, the user's phone number will be sent as a contact when the button is pressed. Available in private chats only. * @param bool $request_location Optional. If True, the user's current location will be sent when the button is pressed. Available in private chats only. * @param KeyboardButtonPollType $request_poll Optional. If specified, the user will be asked to create a poll and send it to the bot when the button is pressed. Available in private chats only. diff --git a/src/Telegram/LocationAddress.php b/src/Telegram/LocationAddress.php new file mode 100644 index 0000000..cf46b6f --- /dev/null +++ b/src/Telegram/LocationAddress.php @@ -0,0 +1,47 @@ +Optional. State of the location */ + public ?string $state = null; + + /** Optional. City of the location */ + public ?string $city = null; + + /** Optional. Street address of the location */ + public ?string $street = null; + + /** + * @param string $country_code The two-letter ISO 3166-1 alpha-2 country code of the country where the location is located + * @param string $state Optional. State of the location + * @param string $city Optional. City of the location + * @param string $street Optional. Street address of the location + */ + public static function make( + string $country_code, + ?string $state = null, + ?string $city = null, + ?string $street = null, + ): static { + return new static([ + 'country_code' => $country_code, + 'state' => $state, + 'city' => $city, + 'street' => $street, + ]); + } +} diff --git a/src/Telegram/Message.php b/src/Telegram/Message.php index 6bcfa76..12726e3 100644 --- a/src/Telegram/Message.php +++ b/src/Telegram/Message.php @@ -18,6 +18,9 @@ class Message extends MaybeInaccessibleMessage /** Optional. Unique identifier of a message thread to which the message belongs; for supergroups only */ public ?int $message_thread_id = null; + /** Optional. Information about the direct messages chat topic that contains the message */ + public ?DirectMessagesTopic $direct_messages_topic = null; + /** 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 */ public ?User $from = null; @@ -42,7 +45,7 @@ class Message extends MaybeInaccessibleMessage /** Optional. True, if the message is a channel post that was automatically forwarded to the connected discussion group */ public ?bool $is_automatic_forward = null; - /** 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. */ + /** 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. */ public ?Message $reply_to_message = null; /** Optional. Information about the message that is being replied to, which may come from another chat or forum topic */ @@ -54,6 +57,9 @@ class Message extends MaybeInaccessibleMessage /** Optional. For replies to a story, the original story */ public ?Story $reply_to_story = null; + /** Optional. Identifier of the specific checklist task that is being replied to */ + public ?int $reply_to_checklist_task_id = null; + /** Optional. Bot through which the message was sent */ public ?User $via_bot = null; @@ -63,15 +69,21 @@ class Message extends MaybeInaccessibleMessage /** Optional. True, if the message can't be forwarded */ public ?bool $has_protected_content = null; - /** Optional. True, if the message was sent by an implicit action, for example, as an away or a greeting business message, or as a scheduled message */ + /** Optional. True, if the message was sent by an implicit action, for example, as an away or a greeting business message, or as a scheduled message */ public ?bool $is_from_offline = null; + /** Optional. True, if the message is a paid post. Note that such posts must not be deleted for 24 hours to receive the payment and can't be edited. */ + public ?bool $is_paid_post = null; + /** Optional. The unique identifier of a media message group this message belongs to */ public ?string $media_group_id = null; /** Optional. Signature of the post author for messages in channels, or the custom title of an anonymous group administrator */ public ?string $author_signature = null; + /** Optional. The number of Telegram Stars that were paid by the sender of the message to send it */ + public ?int $paid_star_count = null; + /** Optional. For text messages, the actual UTF-8 text of the message */ public ?string $text = null; @@ -85,6 +97,9 @@ class Message extends MaybeInaccessibleMessage /** Optional. Options used for link preview generation for the message, if it is a text message and link preview options were changed */ public ?LinkPreviewOptions $link_preview_options = null; + /** Optional. Information about suggested post parameters if the message is a suggested post in a channel direct messages chat. If the message is an approved or declined suggested post, then it can't be edited. */ + public ?SuggestedPostInfo $suggested_post_info = null; + /** Optional. Unique identifier of the message effect added to the message */ public ?string $effect_id = null; @@ -132,12 +147,15 @@ class Message extends MaybeInaccessibleMessage */ public ?array $caption_entities = null; - /** Optional. True, if the caption must be shown above the message media */ + /** Optional. True, if the caption must be shown above the message media */ public ?bool $show_caption_above_media = null; /** Optional. True, if the message media is covered by a spoiler animation */ public ?bool $has_media_spoiler = null; + /** Optional. Message is a checklist */ + public ?Checklist $checklist = null; + /** Optional. Message is a shared contact, information about the contact */ public ?Contact $contact = null; @@ -197,7 +215,7 @@ class Message extends MaybeInaccessibleMessage /** Optional. The supergroup has been migrated from a group with the specified identifier. 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. */ public ?int $migrate_from_chat_id = null; - /** Optional. Specified message was pinned. Note that the Message object in this field will not contain further reply_to_message fields even if it itself is a reply. */ + /** Optional. Specified message was pinned. Note that the Message object in this field will not contain further reply_to_message fields even if it itself is a reply. */ public ?MaybeInaccessibleMessage $pinned_message = null; /** Optional. Message is an invoice for a payment, information about the invoice. More about payments » */ @@ -215,6 +233,12 @@ class Message extends MaybeInaccessibleMessage /** Optional. Service message: a chat was shared with the bot */ public ?ChatShared $chat_shared = null; + /** Optional. Service message: a regular gift was sent or received */ + public ?GiftInfo $gift = null; + + /** Optional. Service message: a unique gift was sent or received */ + public ?UniqueGiftInfo $unique_gift = null; + /** Optional. The domain name of the website on which the user has logged in. More about Telegram Login » */ public ?string $connected_website = null; @@ -233,6 +257,15 @@ class Message extends MaybeInaccessibleMessage /** Optional. Service message: chat background set */ public ?ChatBackground $chat_background_set = null; + /** Optional. Service message: some tasks in a checklist were marked as done or not done */ + public ?ChecklistTasksDone $checklist_tasks_done = null; + + /** Optional. Service message: tasks were added to a checklist */ + public ?ChecklistTasksAdded $checklist_tasks_added = null; + + /** Optional. Service message: the price for paid messages in the corresponding direct messages chat of a channel has changed */ + public ?DirectMessagePriceChanged $direct_message_price_changed = null; + /** Optional. Service message: forum topic created */ public ?ForumTopicCreated $forum_topic_created = null; @@ -263,6 +296,24 @@ class Message extends MaybeInaccessibleMessage /** Optional. Service message: a giveaway without public winners was completed */ public ?GiveawayCompleted $giveaway_completed = null; + /** Optional. Service message: the price for paid messages has changed in the chat */ + public ?PaidMessagePriceChanged $paid_message_price_changed = null; + + /** Optional. Service message: a suggested post was approved */ + public ?SuggestedPostApproved $suggested_post_approved = null; + + /** Optional. Service message: approval of a suggested post has failed */ + public ?SuggestedPostApprovalFailed $suggested_post_approval_failed = null; + + /** Optional. Service message: a suggested post was declined */ + public ?SuggestedPostDeclined $suggested_post_declined = null; + + /** Optional. Service message: payment for a suggested post was received */ + public ?SuggestedPostPaid $suggested_post_paid = null; + + /** Optional. Service message: payment for a suggested post was refunded */ + public ?SuggestedPostRefunded $suggested_post_refunded = null; + /** Optional. Service message: video chat scheduled */ public ?VideoChatScheduled $video_chat_scheduled = null; @@ -286,6 +337,7 @@ class Message extends MaybeInaccessibleMessage * @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 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. * @param int $sender_boost_count Optional. If the sender of the message boosted the chat, the number of boosts added by the user @@ -294,19 +346,23 @@ class Message extends MaybeInaccessibleMessage * @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_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 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 * @param TextQuote $quote Optional. For replies that quote part of the original message, the quoted part of the message * @param Story $reply_to_story Optional. For replies to a story, the original story + * @param int $reply_to_checklist_task_id Optional. Identifier of the specific checklist task that is being replied to * @param User $via_bot Optional. Bot through which the message was sent * @param int $edit_date Optional. Date the message was last edited in Unix time * @param bool $has_protected_content Optional. True, if the message can't be forwarded - * @param bool $is_from_offline Optional. True, if the message was sent by an implicit action, for example, as an away or a greeting business message, or as a scheduled message + * @param bool $is_from_offline Optional. True, if the message was sent by an implicit action, for example, as an away or a greeting business message, or as a scheduled message + * @param bool $is_paid_post Optional. True, if the message is a paid post. Note that such posts must not be deleted for 24 hours to receive the payment and can't be edited. * @param string $media_group_id Optional. The unique identifier of a media message group this message belongs to * @param string $author_signature Optional. Signature of the post author for messages in channels, or the custom title of an anonymous group administrator + * @param int $paid_star_count Optional. The number of Telegram Stars that were paid by the sender of the message to send it * @param string $text Optional. For text messages, the actual UTF-8 text of the message * @param MessageEntity[] $entities Optional. For text messages, special entities like usernames, URLs, bot commands, etc. that appear in the text * @param LinkPreviewOptions $link_preview_options Optional. Options used for link preview generation for the message, if it is a text message and link preview options were changed + * @param SuggestedPostInfo $suggested_post_info Optional. Information about suggested post parameters if the message is a suggested post in a channel direct messages chat. If the message is an approved or declined suggested post, then it can't be edited. * @param string $effect_id Optional. Unique identifier of the message effect added to the message * @param Animation $animation Optional. Message is an animation, information about the animation. For backward compatibility, when this field is set, the document field will also be set * @param Audio $audio Optional. Message is an audio file, information about the file @@ -320,8 +376,9 @@ class Message extends MaybeInaccessibleMessage * @param Voice $voice Optional. Message is a voice message, information about the file * @param string $caption Optional. Caption for the animation, audio, document, paid media, photo, video or voice * @param MessageEntity[] $caption_entities Optional. For messages with a caption, special entities like usernames, URLs, bot commands, etc. that appear in the caption - * @param bool $show_caption_above_media Optional. True, if the caption must be shown above the message media + * @param bool $show_caption_above_media Optional. True, if the caption must be shown above the message media * @param bool $has_media_spoiler Optional. True, if the message media is covered by a spoiler animation + * @param Checklist $checklist Optional. Message is a checklist * @param Contact $contact Optional. Message is a shared contact, information about the contact * @param Dice $dice Optional. Message is a dice with random value * @param Game $game Optional. Message is a game, information about the game. More about games » @@ -339,18 +396,23 @@ class Message extends MaybeInaccessibleMessage * @param MessageAutoDeleteTimerChanged $message_auto_delete_timer_changed Optional. Service message: auto-delete timer settings changed in the chat * @param int $migrate_to_chat_id Optional. The group has been migrated to a supergroup with the specified identifier. 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 int $migrate_from_chat_id Optional. The supergroup has been migrated from a group with the specified identifier. 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 MaybeInaccessibleMessage $pinned_message Optional. Specified message was pinned. Note that the Message object in this field will not contain further reply_to_message fields even if it itself is a reply. + * @param MaybeInaccessibleMessage $pinned_message Optional. Specified message was pinned. Note that the Message object in this field will not contain further reply_to_message fields even if it itself is a reply. * @param Invoice $invoice Optional. Message is an invoice for a payment, information about the invoice. More about payments » * @param SuccessfulPayment $successful_payment Optional. Message is a service message about a successful payment, information about the payment. More about payments » * @param RefundedPayment $refunded_payment Optional. Message is a service message about a refunded payment, information about the payment. More about payments » * @param UsersShared $users_shared Optional. Service message: users were shared with the bot * @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 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 * @param ProximityAlertTriggered $proximity_alert_triggered Optional. Service message. A user in the chat triggered another user's proximity alert while sharing Live Location. * @param ChatBoostAdded $boost_added Optional. Service message: user boosted the chat * @param ChatBackground $chat_background_set Optional. Service message: chat background set + * @param ChecklistTasksDone $checklist_tasks_done Optional. Service message: some tasks in a checklist were marked as done or not done + * @param ChecklistTasksAdded $checklist_tasks_added Optional. Service message: tasks were added to a checklist + * @param DirectMessagePriceChanged $direct_message_price_changed Optional. Service message: the price for paid messages in the corresponding direct messages chat of a channel has changed * @param ForumTopicCreated $forum_topic_created Optional. Service message: forum topic created * @param ForumTopicEdited $forum_topic_edited Optional. Service message: forum topic edited * @param ForumTopicClosed $forum_topic_closed Optional. Service message: forum topic closed @@ -361,6 +423,12 @@ class Message extends MaybeInaccessibleMessage * @param Giveaway $giveaway Optional. The message is a scheduled giveaway message * @param GiveawayWinners $giveaway_winners Optional. A giveaway with public winners was completed * @param GiveawayCompleted $giveaway_completed Optional. Service message: a giveaway without public winners was completed + * @param PaidMessagePriceChanged $paid_message_price_changed Optional. Service message: the price for paid messages has changed in the chat + * @param SuggestedPostApproved $suggested_post_approved Optional. Service message: a suggested post was approved + * @param SuggestedPostApprovalFailed $suggested_post_approval_failed Optional. Service message: approval of a suggested post has failed + * @param SuggestedPostDeclined $suggested_post_declined Optional. Service message: a suggested post was declined + * @param SuggestedPostPaid $suggested_post_paid Optional. Service message: payment for a suggested post was received + * @param SuggestedPostRefunded $suggested_post_refunded Optional. Service message: payment for a suggested post was refunded * @param VideoChatScheduled $video_chat_scheduled Optional. Service message: video chat scheduled * @param VideoChatStarted $video_chat_started Optional. Service message: video chat started * @param VideoChatEnded $video_chat_ended Optional. Service message: video chat ended @@ -373,6 +441,7 @@ public static function make( int $date, Chat $chat, ?int $message_thread_id = null, + ?DirectMessagesTopic $direct_messages_topic = null, ?User $from = null, ?Chat $sender_chat = null, ?int $sender_boost_count = null, @@ -385,15 +454,19 @@ public static function make( ?ExternalReplyInfo $external_reply = null, ?TextQuote $quote = null, ?Story $reply_to_story = null, + ?int $reply_to_checklist_task_id = null, ?User $via_bot = null, ?int $edit_date = null, ?bool $has_protected_content = null, ?bool $is_from_offline = null, + ?bool $is_paid_post = null, ?string $media_group_id = null, ?string $author_signature = null, + ?int $paid_star_count = null, ?string $text = null, ?array $entities = null, ?LinkPreviewOptions $link_preview_options = null, + ?SuggestedPostInfo $suggested_post_info = null, ?string $effect_id = null, ?Animation $animation = null, ?Audio $audio = null, @@ -409,6 +482,7 @@ public static function make( ?array $caption_entities = null, ?bool $show_caption_above_media = null, ?bool $has_media_spoiler = null, + ?Checklist $checklist = null, ?Contact $contact = null, ?Dice $dice = null, ?Game $game = null, @@ -432,12 +506,17 @@ public static function make( ?RefundedPayment $refunded_payment = null, ?UsersShared $users_shared = null, ?ChatShared $chat_shared = null, + ?GiftInfo $gift = null, + ?UniqueGiftInfo $unique_gift = null, ?string $connected_website = null, ?WriteAccessAllowed $write_access_allowed = null, ?PassportData $passport_data = null, ?ProximityAlertTriggered $proximity_alert_triggered = null, ?ChatBoostAdded $boost_added = null, ?ChatBackground $chat_background_set = null, + ?ChecklistTasksDone $checklist_tasks_done = null, + ?ChecklistTasksAdded $checklist_tasks_added = null, + ?DirectMessagePriceChanged $direct_message_price_changed = null, ?ForumTopicCreated $forum_topic_created = null, ?ForumTopicEdited $forum_topic_edited = null, ?ForumTopicClosed $forum_topic_closed = null, @@ -448,6 +527,12 @@ public static function make( ?Giveaway $giveaway = null, ?GiveawayWinners $giveaway_winners = null, ?GiveawayCompleted $giveaway_completed = null, + ?PaidMessagePriceChanged $paid_message_price_changed = null, + ?SuggestedPostApproved $suggested_post_approved = null, + ?SuggestedPostApprovalFailed $suggested_post_approval_failed = null, + ?SuggestedPostDeclined $suggested_post_declined = null, + ?SuggestedPostPaid $suggested_post_paid = null, + ?SuggestedPostRefunded $suggested_post_refunded = null, ?VideoChatScheduled $video_chat_scheduled = null, ?VideoChatStarted $video_chat_started = null, ?VideoChatEnded $video_chat_ended = null, @@ -460,6 +545,7 @@ public static function make( 'date' => $date, 'chat' => $chat, 'message_thread_id' => $message_thread_id, + 'direct_messages_topic' => $direct_messages_topic, 'from' => $from, 'sender_chat' => $sender_chat, 'sender_boost_count' => $sender_boost_count, @@ -472,15 +558,19 @@ public static function make( 'external_reply' => $external_reply, 'quote' => $quote, 'reply_to_story' => $reply_to_story, + 'reply_to_checklist_task_id' => $reply_to_checklist_task_id, 'via_bot' => $via_bot, 'edit_date' => $edit_date, 'has_protected_content' => $has_protected_content, 'is_from_offline' => $is_from_offline, + 'is_paid_post' => $is_paid_post, 'media_group_id' => $media_group_id, 'author_signature' => $author_signature, + 'paid_star_count' => $paid_star_count, 'text' => $text, 'entities' => $entities, 'link_preview_options' => $link_preview_options, + 'suggested_post_info' => $suggested_post_info, 'effect_id' => $effect_id, 'animation' => $animation, 'audio' => $audio, @@ -496,6 +586,7 @@ public static function make( 'caption_entities' => $caption_entities, 'show_caption_above_media' => $show_caption_above_media, 'has_media_spoiler' => $has_media_spoiler, + 'checklist' => $checklist, 'contact' => $contact, 'dice' => $dice, 'game' => $game, @@ -519,12 +610,17 @@ public static function make( 'refunded_payment' => $refunded_payment, 'users_shared' => $users_shared, 'chat_shared' => $chat_shared, + 'gift' => $gift, + 'unique_gift' => $unique_gift, 'connected_website' => $connected_website, 'write_access_allowed' => $write_access_allowed, 'passport_data' => $passport_data, 'proximity_alert_triggered' => $proximity_alert_triggered, 'boost_added' => $boost_added, 'chat_background_set' => $chat_background_set, + 'checklist_tasks_done' => $checklist_tasks_done, + 'checklist_tasks_added' => $checklist_tasks_added, + 'direct_message_price_changed' => $direct_message_price_changed, 'forum_topic_created' => $forum_topic_created, 'forum_topic_edited' => $forum_topic_edited, 'forum_topic_closed' => $forum_topic_closed, @@ -535,6 +631,12 @@ public static function make( 'giveaway' => $giveaway, 'giveaway_winners' => $giveaway_winners, 'giveaway_completed' => $giveaway_completed, + 'paid_message_price_changed' => $paid_message_price_changed, + 'suggested_post_approved' => $suggested_post_approved, + 'suggested_post_approval_failed' => $suggested_post_approval_failed, + 'suggested_post_declined' => $suggested_post_declined, + 'suggested_post_paid' => $suggested_post_paid, + 'suggested_post_refunded' => $suggested_post_refunded, 'video_chat_scheduled' => $video_chat_scheduled, 'video_chat_started' => $video_chat_started, 'video_chat_ended' => $video_chat_ended, diff --git a/src/Telegram/OwnedGift.php b/src/Telegram/OwnedGift.php new file mode 100644 index 0000000..62a80d5 --- /dev/null +++ b/src/Telegram/OwnedGift.php @@ -0,0 +1,43 @@ +Optional. Unique identifier of the gift for the bot; for gifts received on behalf of business accounts only */ + public ?string $owned_gift_id = null; + + /** Optional. Sender of the gift if it is a known user */ + public ?User $sender_user = null; + + /** Optional. True, if the gift is displayed on the account's profile page; for gifts received on behalf of business accounts only */ + public ?bool $is_saved = null; + + public static function factory(array $data, ?Bot $bot = null): self + { + return match ($data['type']) { + 'regular' => new OwnedGiftRegular($data, $bot), + 'unique' => new OwnedGiftUnique($data, $bot), + }; + } +} diff --git a/src/Telegram/OwnedGiftRegular.php b/src/Telegram/OwnedGiftRegular.php new file mode 100644 index 0000000..831447a --- /dev/null +++ b/src/Telegram/OwnedGiftRegular.php @@ -0,0 +1,88 @@ +Optional. Text of the message that was added to the gift */ + public ?string $text = null; + + /** + * Optional. Special entities that appear in the text + * + * @var MessageEntity[] + */ + public ?array $entities = null; + + /** 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. True, if the gift is displayed on the account's profile page; for gifts received on behalf of business accounts only */ + public ?bool $is_saved = null; + + /** Optional. True, if the gift can be upgraded to a unique gift; for gifts received on behalf of business accounts only */ + public ?bool $can_be_upgraded = null; + + /** 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 */ + public ?int $convert_star_count = null; + + /** Optional. Number of Telegram Stars that were paid by the sender for the ability to upgrade the gift */ + public ?int $prepaid_upgrade_star_count = null; + + /** + * @param Gift $gift Information about the regular gift + * @param int $send_date Date the gift was sent in Unix time + * @param string $owned_gift_id Optional. Unique identifier of the gift for the bot; for gifts received on behalf of business accounts only + * @param User $sender_user Optional. Sender of the gift if it is a known user + * @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 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 + */ + public static function make( + Gift $gift, + int $send_date, + ?string $owned_gift_id = null, + ?User $sender_user = null, + ?string $text = null, + ?array $entities = null, + ?bool $is_private = null, + ?bool $is_saved = null, + ?bool $can_be_upgraded = null, + ?bool $was_refunded = null, + ?int $convert_star_count = null, + ?int $prepaid_upgrade_star_count = null, + ): static { + return new static([ + 'gift' => $gift, + 'send_date' => $send_date, + 'owned_gift_id' => $owned_gift_id, + 'sender_user' => $sender_user, + 'text' => $text, + 'entities' => $entities, + 'is_private' => $is_private, + 'is_saved' => $is_saved, + 'can_be_upgraded' => $can_be_upgraded, + 'was_refunded' => $was_refunded, + 'convert_star_count' => $convert_star_count, + 'prepaid_upgrade_star_count' => $prepaid_upgrade_star_count, + ]); + } +} diff --git a/src/Telegram/OwnedGiftUnique.php b/src/Telegram/OwnedGiftUnique.php new file mode 100644 index 0000000..6879f4b --- /dev/null +++ b/src/Telegram/OwnedGiftUnique.php @@ -0,0 +1,60 @@ +Optional. True, if the gift is displayed on the account's profile page; for gifts received on behalf of business accounts only */ + public ?bool $is_saved = null; + + /** Optional. True, if the gift can be transferred to another owner; for gifts received on behalf of business accounts only */ + public ?bool $can_be_transferred = null; + + /** Optional. Number of Telegram Stars that must be paid to transfer the gift; omitted if the bot cannot transfer the gift */ + public ?int $transfer_star_count = null; + + /** 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 */ + public ?int $next_transfer_date = null; + + /** + * @param UniqueGift $gift Information about the unique gift + * @param int $send_date Date the gift was sent in Unix time + * @param string $owned_gift_id Optional. Unique identifier of the received gift for the bot; for gifts received on behalf of business accounts only + * @param User $sender_user Optional. Sender of the gift if it is a known user + * @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_transferred Optional. True, if the gift can be transferred to another owner; for gifts received on behalf of business accounts only + * @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 + */ + public static function make( + UniqueGift $gift, + int $send_date, + ?string $owned_gift_id = null, + ?User $sender_user = null, + ?bool $is_saved = null, + ?bool $can_be_transferred = null, + ?int $transfer_star_count = null, + ?int $next_transfer_date = null, + ): static { + return new static([ + 'gift' => $gift, + 'send_date' => $send_date, + 'owned_gift_id' => $owned_gift_id, + 'sender_user' => $sender_user, + 'is_saved' => $is_saved, + 'can_be_transferred' => $can_be_transferred, + 'transfer_star_count' => $transfer_star_count, + 'next_transfer_date' => $next_transfer_date, + ]); + } +} diff --git a/src/Telegram/OwnedGifts.php b/src/Telegram/OwnedGifts.php new file mode 100644 index 0000000..b942929 --- /dev/null +++ b/src/Telegram/OwnedGifts.php @@ -0,0 +1,42 @@ +Optional. Offset for the next request. If empty, then there are no more results */ + public ?string $next_offset = null; + + /** + * @param int $total_count The total number of gifts owned by the user or the chat + * @param OwnedGift[] $gifts The list of gifts + * @param string $next_offset Optional. Offset for the next request. If empty, then there are no more results + */ + public static function make(int $total_count, array $gifts, ?string $next_offset = null): static + { + return new static([ + 'total_count' => $total_count, + 'gifts' => $gifts, + 'next_offset' => $next_offset, + ]); + } +} diff --git a/src/Telegram/PaidMessagePriceChanged.php b/src/Telegram/PaidMessagePriceChanged.php new file mode 100644 index 0000000..cadb764 --- /dev/null +++ b/src/Telegram/PaidMessagePriceChanged.php @@ -0,0 +1,28 @@ + $paid_message_star_count, + ]); + } +} diff --git a/src/Telegram/ReactionTypeEmoji.php b/src/Telegram/ReactionTypeEmoji.php index aa95ad4..4c72c0e 100644 --- a/src/Telegram/ReactionTypeEmoji.php +++ b/src/Telegram/ReactionTypeEmoji.php @@ -14,11 +14,11 @@ class ReactionTypeEmoji extends ReactionType /** Type of the reaction, always “emoji” */ public string $type = 'emoji'; - /** Reaction emoji. Currently, it can be one of "👍", "👎", "❤", "🔥", "🥰", "👏", "😁", "🤔", "🤯", "😱", "🤬", "😢", "🎉", "🤩", "🤮", "💩", "🙏", "👌", "🕊", "🤡", "🥱", "🥴", "😍", "🐳", "❤‍🔥", "🌚", "🌭", "💯", "🤣", "⚡", "🍌", "🏆", "💔", "🤨", "😐", "🍓", "🍾", "💋", "🖕", "😈", "😴", "😭", "🤓", "👻", "👨‍💻", "👀", "🎃", "🙈", "😇", "😨", "🤝", "✍", "🤗", "🫡", "🎅", "🎄", "☃", "💅", "🤪", "🗿", "🆒", "💘", "🙉", "🦄", "😘", "💊", "🙊", "😎", "👾", "🤷‍♂", "🤷", "🤷‍♀", "😡" */ + /** Reaction emoji. Currently, it can be one of "❤", "👍", "👎", "🔥", "🥰", "👏", "😁", "🤔", "🤯", "😱", "🤬", "😢", "🎉", "🤩", "🤮", "💩", "🙏", "👌", "🕊", "🤡", "🥱", "🥴", "😍", "🐳", "❤‍🔥", "🌚", "🌭", "💯", "🤣", "⚡", "🍌", "🏆", "💔", "🤨", "😐", "🍓", "🍾", "💋", "🖕", "😈", "😴", "😭", "🤓", "👻", "👨‍💻", "👀", "🎃", "🙈", "😇", "😨", "🤝", "✍", "🤗", "🫡", "🎅", "🎄", "☃", "💅", "🤪", "🗿", "🆒", "💘", "🙉", "🦄", "😘", "💊", "🙊", "😎", "👾", "🤷‍♂", "🤷", "🤷‍♀", "😡" */ public string $emoji; /** - * @param string $emoji Reaction emoji. Currently, it can be one of "👍", "👎", "❤", "🔥", "🥰", "👏", "😁", "🤔", "🤯", "😱", "🤬", "😢", "🎉", "🤩", "🤮", "💩", "🙏", "👌", "🕊", "🤡", "🥱", "🥴", "😍", "🐳", "❤‍🔥", "🌚", "🌭", "💯", "🤣", "⚡", "🍌", "🏆", "💔", "🤨", "😐", "🍓", "🍾", "💋", "🖕", "😈", "😴", "😭", "🤓", "👻", "👨‍💻", "👀", "🎃", "🙈", "😇", "😨", "🤝", "✍", "🤗", "🫡", "🎅", "🎄", "☃", "💅", "🤪", "🗿", "🆒", "💘", "🙉", "🦄", "😘", "💊", "🙊", "😎", "👾", "🤷‍♂", "🤷", "🤷‍♀", "😡" + * @param string $emoji Reaction emoji. Currently, it can be one of "❤", "👍", "👎", "🔥", "🥰", "👏", "😁", "🤔", "🤯", "😱", "🤬", "😢", "🎉", "🤩", "🤮", "💩", "🙏", "👌", "🕊", "🤡", "🥱", "🥴", "😍", "🐳", "❤‍🔥", "🌚", "🌭", "💯", "🤣", "⚡", "🍌", "🏆", "💔", "🤨", "😐", "🍓", "🍾", "💋", "🖕", "😈", "😴", "😭", "🤓", "👻", "👨‍💻", "👀", "🎃", "🙈", "😇", "😨", "🤝", "✍", "🤗", "🫡", "🎅", "🎄", "☃", "💅", "🤪", "🗿", "🆒", "💘", "🙉", "🦄", "😘", "💊", "🙊", "😎", "👾", "🤷‍♂", "🤷", "🤷‍♀", "😡" */ public static function make(string $emoji): static { diff --git a/src/Telegram/ReplyParameters.php b/src/Telegram/ReplyParameters.php index 7a232af..5e32e44 100644 --- a/src/Telegram/ReplyParameters.php +++ b/src/Telegram/ReplyParameters.php @@ -16,7 +16,7 @@ class ReplyParameters extends Type /** Identifier of the message that will be replied to in the current chat, or in the chat chat_id if it is specified */ public int $message_id; - /** Optional. If the message to be replied to is from a different chat, unique identifier for the chat or username of the channel (in the format @channelusername). Not supported for messages sent on behalf of a business account. */ + /** Optional. If the message to be replied to is from a different chat, unique identifier for the chat or username of the channel (in the format @channelusername). Not supported for messages sent on behalf of a business account and messages from channel direct messages chats. */ public int|string|null $chat_id = null; /** Optional. Pass True if the message should be sent even if the specified message to be replied to is not found. Always False for replies in another chat or forum topic. Always True for messages sent on behalf of a business account. */ @@ -38,14 +38,18 @@ class ReplyParameters extends Type /** Optional. Position of the quote in the original message in UTF-16 code units */ public ?int $quote_position = null; + /** Optional. Identifier of the specific checklist task to be replied to */ + public ?int $checklist_task_id = null; + /** * @param int $message_id Identifier of the message that will be replied to in the current chat, or in the chat chat_id if it is specified - * @param int|string $chat_id Optional. If the message to be replied to is from a different chat, unique identifier for the chat or username of the channel (in the format @channelusername). Not supported for messages sent on behalf of a business account. + * @param int|string $chat_id Optional. If the message to be replied to is from a different chat, unique identifier for the chat or username of the channel (in the format @channelusername). Not supported for messages sent on behalf of a business account and messages from channel direct messages chats. * @param bool $allow_sending_without_reply Optional. Pass True if the message should be sent even if the specified message to be replied to is not found. Always False for replies in another chat or forum topic. Always True for messages sent on behalf of a business account. * @param string $quote Optional. Quoted part of the message to be replied to; 0-1024 characters after entities parsing. The quote must be an exact substring of the message to be replied to, including bold, italic, underline, strikethrough, spoiler, and custom_emoji entities. The message will fail to send if the quote isn't found in the original message. * @param string $quote_parse_mode Optional. Mode for parsing entities in the quote. See formatting options for more details. * @param MessageEntity[] $quote_entities Optional. A JSON-serialized list of special entities that appear in the quote. It can be specified instead of quote_parse_mode. * @param int $quote_position Optional. Position of the quote in the original message in UTF-16 code units + * @param int $checklist_task_id Optional. Identifier of the specific checklist task to be replied to */ public static function make( int $message_id, @@ -55,6 +59,7 @@ public static function make( ?string $quote_parse_mode = null, ?array $quote_entities = null, ?int $quote_position = null, + ?int $checklist_task_id = null, ): static { return new static([ 'message_id' => $message_id, @@ -64,6 +69,7 @@ public static function make( 'quote_parse_mode' => $quote_parse_mode, 'quote_entities' => $quote_entities, 'quote_position' => $quote_position, + 'checklist_task_id' => $checklist_task_id, ]); } } diff --git a/src/Telegram/StarAmount.php b/src/Telegram/StarAmount.php new file mode 100644 index 0000000..a29c039 --- /dev/null +++ b/src/Telegram/StarAmount.php @@ -0,0 +1,33 @@ +Optional. The number of 1/1000000000 shares of Telegram Stars; from -999999999 to 999999999; can be negative if and only if amount is non-positive */ + public ?int $nanostar_amount = null; + + /** + * @param int $amount Integer amount of Telegram Stars, rounded to 0; can be negative + * @param int $nanostar_amount Optional. The number of 1/1000000000 shares of Telegram Stars; from -999999999 to 999999999; can be negative if and only if amount is non-positive + */ + public static function make(int $amount, ?int $nanostar_amount = null): static + { + return new static([ + 'amount' => $amount, + 'nanostar_amount' => $nanostar_amount, + ]); + } +} diff --git a/src/Telegram/StoryArea.php b/src/Telegram/StoryArea.php new file mode 100644 index 0000000..1b72f76 --- /dev/null +++ b/src/Telegram/StoryArea.php @@ -0,0 +1,33 @@ + $position, + 'type' => $type, + ]); + } +} diff --git a/src/Telegram/StoryAreaPosition.php b/src/Telegram/StoryAreaPosition.php new file mode 100644 index 0000000..5c76ed7 --- /dev/null +++ b/src/Telegram/StoryAreaPosition.php @@ -0,0 +1,59 @@ + $x_percentage, + 'y_percentage' => $y_percentage, + 'width_percentage' => $width_percentage, + 'height_percentage' => $height_percentage, + 'rotation_angle' => $rotation_angle, + 'corner_radius_percentage' => $corner_radius_percentage, + ]); + } +} diff --git a/src/Telegram/StoryAreaType.php b/src/Telegram/StoryAreaType.php new file mode 100644 index 0000000..bf81721 --- /dev/null +++ b/src/Telegram/StoryAreaType.php @@ -0,0 +1,31 @@ + new StoryAreaTypeLocation($data, $bot), + 'suggested_reaction' => new StoryAreaTypeSuggestedReaction($data, $bot), + 'link' => new StoryAreaTypeLink($data, $bot), + 'weather' => new StoryAreaTypeWeather($data, $bot), + 'unique_gift' => new StoryAreaTypeUniqueGift($data, $bot), + }; + } +} diff --git a/src/Telegram/StoryAreaTypeLink.php b/src/Telegram/StoryAreaTypeLink.php new file mode 100644 index 0000000..5e1c1b0 --- /dev/null +++ b/src/Telegram/StoryAreaTypeLink.php @@ -0,0 +1,29 @@ + $url, + ]); + } +} diff --git a/src/Telegram/StoryAreaTypeLocation.php b/src/Telegram/StoryAreaTypeLocation.php new file mode 100644 index 0000000..5105fd5 --- /dev/null +++ b/src/Telegram/StoryAreaTypeLocation.php @@ -0,0 +1,39 @@ +Optional. Address of the location */ + public ?LocationAddress $address = null; + + /** + * @param float $latitude Location latitude in degrees + * @param float $longitude Location longitude in degrees + * @param LocationAddress $address Optional. Address of the location + */ + public static function make(float $latitude, float $longitude, ?LocationAddress $address = null): static + { + return new static([ + 'latitude' => $latitude, + 'longitude' => $longitude, + 'address' => $address, + ]); + } +} diff --git a/src/Telegram/StoryAreaTypeSuggestedReaction.php b/src/Telegram/StoryAreaTypeSuggestedReaction.php new file mode 100644 index 0000000..2d4a087 --- /dev/null +++ b/src/Telegram/StoryAreaTypeSuggestedReaction.php @@ -0,0 +1,39 @@ +Optional. Pass True if the reaction area has a dark background */ + public ?bool $is_dark = null; + + /** Optional. Pass True if reaction area corner is flipped */ + public ?bool $is_flipped = null; + + /** + * @param ReactionType $reaction_type Type of the reaction + * @param bool $is_dark Optional. Pass True if the reaction area has a dark background + * @param bool $is_flipped Optional. Pass True if reaction area corner is flipped + */ + public static function make(ReactionType $reaction_type, ?bool $is_dark = null, ?bool $is_flipped = null): static + { + return new static([ + 'reaction_type' => $reaction_type, + 'is_dark' => $is_dark, + 'is_flipped' => $is_flipped, + ]); + } +} diff --git a/src/Telegram/StoryAreaTypeUniqueGift.php b/src/Telegram/StoryAreaTypeUniqueGift.php new file mode 100644 index 0000000..49bee1f --- /dev/null +++ b/src/Telegram/StoryAreaTypeUniqueGift.php @@ -0,0 +1,29 @@ + $name, + ]); + } +} diff --git a/src/Telegram/StoryAreaTypeWeather.php b/src/Telegram/StoryAreaTypeWeather.php new file mode 100644 index 0000000..cfca80a --- /dev/null +++ b/src/Telegram/StoryAreaTypeWeather.php @@ -0,0 +1,39 @@ + $temperature, + 'emoji' => $emoji, + 'background_color' => $background_color, + ]); + } +} diff --git a/src/Telegram/SuccessfulPayment.php b/src/Telegram/SuccessfulPayment.php index b31fb49..c4ce144 100644 --- a/src/Telegram/SuccessfulPayment.php +++ b/src/Telegram/SuccessfulPayment.php @@ -31,10 +31,10 @@ class SuccessfulPayment extends Type /** Optional. Expiration date of the subscription, in Unix time; for recurring payments only */ public ?int $subscription_expiration_date = null; - /** Optional. True, if the payment is a recurring payment for a subscription */ + /** Optional. True, if the payment is a recurring payment for a subscription */ public ?bool $is_recurring = null; - /** Optional. True, if the payment is the first payment for a subscription */ + /** Optional. True, if the payment is the first payment for a subscription */ public ?bool $is_first_recurring = null; /** Optional. Identifier of the shipping option chosen by the user */ @@ -50,8 +50,8 @@ class SuccessfulPayment extends Type * @param string $telegram_payment_charge_id Telegram payment identifier * @param string $provider_payment_charge_id Provider payment identifier * @param int $subscription_expiration_date Optional. Expiration date of the subscription, in Unix time; for recurring payments only - * @param bool $is_recurring Optional. True, if the payment is a recurring payment for a subscription - * @param bool $is_first_recurring Optional. True, if the payment is the first payment for a subscription + * @param bool $is_recurring Optional. True, if the payment is a recurring payment for a subscription + * @param bool $is_first_recurring Optional. True, if the payment is the first payment for a subscription * @param string $shipping_option_id Optional. Identifier of the shipping option chosen by the user * @param OrderInfo $order_info Optional. Order information provided by the user */ diff --git a/src/Telegram/SuggestedPostApprovalFailed.php b/src/Telegram/SuggestedPostApprovalFailed.php new file mode 100644 index 0000000..6babe53 --- /dev/null +++ b/src/Telegram/SuggestedPostApprovalFailed.php @@ -0,0 +1,33 @@ +Optional. Message containing the suggested post whose approval has failed. Note that the Message object in this field will not contain the reply_to_message field even if it itself is a reply. */ + public ?Message $suggested_post_message = null; + + /** + * @param SuggestedPostPrice $price Expected price of the post + * @param Message $suggested_post_message Optional. Message containing the suggested post whose approval has failed. Note that the Message object in this field will not contain the reply_to_message field even if it itself is a reply. + */ + public static function make(SuggestedPostPrice $price, ?Message $suggested_post_message = null): static + { + return new static([ + 'price' => $price, + 'suggested_post_message' => $suggested_post_message, + ]); + } +} diff --git a/src/Telegram/SuggestedPostApproved.php b/src/Telegram/SuggestedPostApproved.php new file mode 100644 index 0000000..607fe92 --- /dev/null +++ b/src/Telegram/SuggestedPostApproved.php @@ -0,0 +1,41 @@ +Optional. Message containing the suggested post. Note that the Message object in this field will not contain the reply_to_message field even if it itself is a reply. */ + public ?Message $suggested_post_message = null; + + /** Optional. Amount paid for the post */ + public ?SuggestedPostPrice $price = null; + + /** + * @param int $send_date Date when the post will be published + * @param Message $suggested_post_message Optional. Message containing the suggested post. Note that the Message object in this field will not contain the reply_to_message field even if it itself is a reply. + * @param SuggestedPostPrice $price Optional. Amount paid for the post + */ + public static function make( + int $send_date, + ?Message $suggested_post_message = null, + ?SuggestedPostPrice $price = null, + ): static { + return new static([ + 'send_date' => $send_date, + 'suggested_post_message' => $suggested_post_message, + 'price' => $price, + ]); + } +} diff --git a/src/Telegram/SuggestedPostDeclined.php b/src/Telegram/SuggestedPostDeclined.php new file mode 100644 index 0000000..df062eb --- /dev/null +++ b/src/Telegram/SuggestedPostDeclined.php @@ -0,0 +1,33 @@ +Optional. Message containing the suggested post. Note that the Message object in this field will not contain the reply_to_message field even if it itself is a reply. */ + public ?Message $suggested_post_message = null; + + /** Optional. Comment with which the post was declined */ + public ?string $comment = null; + + /** + * @param Message $suggested_post_message Optional. Message containing the suggested post. Note that the Message object in this field will not contain the reply_to_message field even if it itself is a reply. + * @param string $comment Optional. Comment with which the post was declined + */ + public static function make(?Message $suggested_post_message = null, ?string $comment = null): static + { + return new static([ + 'suggested_post_message' => $suggested_post_message, + 'comment' => $comment, + ]); + } +} diff --git a/src/Telegram/SuggestedPostInfo.php b/src/Telegram/SuggestedPostInfo.php new file mode 100644 index 0000000..69058d5 --- /dev/null +++ b/src/Telegram/SuggestedPostInfo.php @@ -0,0 +1,38 @@ +Optional. Proposed price of the post. If the field is omitted, then the post is unpaid. */ + public ?SuggestedPostPrice $price = null; + + /** Optional. Proposed send date of the post. If the field is omitted, then the post can be published at any time within 30 days at the sole discretion of the user or administrator who approves it. */ + public ?int $send_date = null; + + /** + * @param string $state State of the suggested post. Currently, it can be one of “pending”, “approved”, “declined”. + * @param SuggestedPostPrice $price Optional. Proposed price of the post. If the field is omitted, then the post is unpaid. + * @param int $send_date Optional. Proposed send date of the post. If the field is omitted, then the post can be published at any time within 30 days at the sole discretion of the user or administrator who approves it. + */ + public static function make(string $state, ?SuggestedPostPrice $price = null, ?int $send_date = null): static + { + return new static([ + 'state' => $state, + 'price' => $price, + 'send_date' => $send_date, + ]); + } +} diff --git a/src/Telegram/SuggestedPostPaid.php b/src/Telegram/SuggestedPostPaid.php new file mode 100644 index 0000000..cea4a68 --- /dev/null +++ b/src/Telegram/SuggestedPostPaid.php @@ -0,0 +1,47 @@ +Optional. Message containing the suggested post. Note that the Message object in this field will not contain the reply_to_message field even if it itself is a reply. */ + public ?Message $suggested_post_message = null; + + /** Optional. The amount of the currency that was received by the channel in nanotoncoins; for payments in toncoins only */ + public ?int $amount = null; + + /** Optional. The amount of Telegram Stars that was received by the channel; for payments in Telegram Stars only */ + public ?StarAmount $star_amount = null; + + /** + * @param string $currency Currency in which the payment was made. Currently, one of “XTR” for Telegram Stars or “TON” for toncoins + * @param Message $suggested_post_message Optional. Message containing the suggested post. Note that the Message object in this field will not contain the reply_to_message field even if it itself is a reply. + * @param int $amount Optional. The amount of the currency that was received by the channel in nanotoncoins; for payments in toncoins only + * @param StarAmount $star_amount Optional. The amount of Telegram Stars that was received by the channel; for payments in Telegram Stars only + */ + public static function make( + string $currency, + ?Message $suggested_post_message = null, + ?int $amount = null, + ?StarAmount $star_amount = null, + ): static { + return new static([ + 'currency' => $currency, + 'suggested_post_message' => $suggested_post_message, + 'amount' => $amount, + 'star_amount' => $star_amount, + ]); + } +} diff --git a/src/Telegram/SuggestedPostParameters.php b/src/Telegram/SuggestedPostParameters.php new file mode 100644 index 0000000..80a3d1f --- /dev/null +++ b/src/Telegram/SuggestedPostParameters.php @@ -0,0 +1,33 @@ +Optional. Proposed price for the post. If the field is omitted, then the post is unpaid. */ + public ?SuggestedPostPrice $price = null; + + /** Optional. Proposed send date of the post. If specified, then the date must be between 300 second and 2678400 seconds (30 days) in the future. If the field is omitted, then the post can be published at any time within 30 days at the sole discretion of the user who approves it. */ + public ?int $send_date = null; + + /** + * @param SuggestedPostPrice $price Optional. Proposed price for the post. If the field is omitted, then the post is unpaid. + * @param int $send_date Optional. Proposed send date of the post. If specified, then the date must be between 300 second and 2678400 seconds (30 days) in the future. If the field is omitted, then the post can be published at any time within 30 days at the sole discretion of the user who approves it. + */ + public static function make(?SuggestedPostPrice $price = null, ?int $send_date = null): static + { + return new static([ + 'price' => $price, + 'send_date' => $send_date, + ]); + } +} diff --git a/src/Telegram/SuggestedPostPrice.php b/src/Telegram/SuggestedPostPrice.php new file mode 100644 index 0000000..1aca8f0 --- /dev/null +++ b/src/Telegram/SuggestedPostPrice.php @@ -0,0 +1,33 @@ +smallest units of the currency, i.e. Telegram Stars or nanotoncoins. Currently, price in Telegram Stars must be between 5 and 100000, and price in nanotoncoins must be between 10000000 and 10000000000000. */ + public int $amount; + + /** + * @param string $currency Currency in which the post will be paid. Currently, must be one of “XTR” for Telegram Stars or “TON” for toncoins + * @param int $amount The amount of the currency that will be paid for the post in the smallest units of the currency, i.e. Telegram Stars or nanotoncoins. Currently, price in Telegram Stars must be between 5 and 100000, and price in nanotoncoins must be between 10000000 and 10000000000000. + */ + public static function make(string $currency, int $amount): static + { + return new static([ + 'currency' => $currency, + 'amount' => $amount, + ]); + } +} diff --git a/src/Telegram/SuggestedPostRefunded.php b/src/Telegram/SuggestedPostRefunded.php new file mode 100644 index 0000000..8e5a1cb --- /dev/null +++ b/src/Telegram/SuggestedPostRefunded.php @@ -0,0 +1,33 @@ +Optional. Message containing the suggested post. Note that the Message object in this field will not contain the reply_to_message field even if it itself is a reply. */ + public ?Message $suggested_post_message = null; + + /** + * @param string $reason Reason for the refund. Currently, one of “post_deleted” if the post was deleted within 24 hours of being posted or removed from scheduled messages without being posted, or “payment_refunded” if the payer refunded their payment. + * @param Message $suggested_post_message Optional. Message containing the suggested post. Note that the Message object in this field will not contain the reply_to_message field even if it itself is a reply. + */ + public static function make(string $reason, ?Message $suggested_post_message = null): static + { + return new static([ + 'reason' => $reason, + 'suggested_post_message' => $suggested_post_message, + ]); + } +} diff --git a/src/Telegram/SwitchInlineQueryChosenChat.php b/src/Telegram/SwitchInlineQueryChosenChat.php index ba842c7..fec2211 100644 --- a/src/Telegram/SwitchInlineQueryChosenChat.php +++ b/src/Telegram/SwitchInlineQueryChosenChat.php @@ -16,24 +16,24 @@ class SwitchInlineQueryChosenChat extends Type /** Optional. The default inline query to be inserted in the input field. If left empty, only the bot's username will be inserted */ public ?string $query = null; - /** Optional. True, if private chats with users can be chosen */ + /** Optional. True, if private chats with users can be chosen */ public ?bool $allow_user_chats = null; - /** Optional. True, if private chats with bots can be chosen */ + /** Optional. True, if private chats with bots can be chosen */ public ?bool $allow_bot_chats = null; - /** Optional. True, if group and supergroup chats can be chosen */ + /** Optional. True, if group and supergroup chats can be chosen */ public ?bool $allow_group_chats = null; - /** Optional. True, if channel chats can be chosen */ + /** Optional. True, if channel chats can be chosen */ public ?bool $allow_channel_chats = null; /** * @param string $query Optional. The default inline query to be inserted in the input field. If left empty, only the bot's username will be inserted - * @param bool $allow_user_chats Optional. True, if private chats with users can be chosen - * @param bool $allow_bot_chats Optional. True, if private chats with bots can be chosen - * @param bool $allow_group_chats Optional. True, if group and supergroup chats can be chosen - * @param bool $allow_channel_chats Optional. True, if channel chats can be chosen + * @param bool $allow_user_chats Optional. True, if private chats with users can be chosen + * @param bool $allow_bot_chats Optional. True, if private chats with bots can be chosen + * @param bool $allow_group_chats Optional. True, if group and supergroup chats can be chosen + * @param bool $allow_channel_chats Optional. True, if channel chats can be chosen */ public static function make( ?string $query = null, diff --git a/src/Telegram/TextQuote.php b/src/Telegram/TextQuote.php index bb51d14..3f1f509 100644 --- a/src/Telegram/TextQuote.php +++ b/src/Telegram/TextQuote.php @@ -26,14 +26,14 @@ class TextQuote extends Type */ public ?array $entities = null; - /** Optional. True, if the quote was chosen manually by the message sender. Otherwise, the quote was added automatically by the server. */ + /** Optional. True, if the quote was chosen manually by the message sender. Otherwise, the quote was added automatically by the server. */ public ?bool $is_manual = null; /** * @param string $text Text of the quoted part of a message that is replied to by the given message * @param int $position Approximate quote position in the original message in UTF-16 code units as specified by the sender * @param MessageEntity[] $entities Optional. Special entities that appear in the quote. Currently, only bold, italic, underline, strikethrough, spoiler, and custom_emoji entities are kept in quotes. - * @param bool $is_manual Optional. True, if the quote was chosen manually by the message sender. Otherwise, the quote was added automatically by the server. + * @param bool $is_manual Optional. True, if the quote was chosen manually by the message sender. Otherwise, the quote was added automatically by the server. */ public static function make(string $text, int $position, ?array $entities = null, ?bool $is_manual = null): static { diff --git a/src/Telegram/TransactionPartnerUser.php b/src/Telegram/TransactionPartnerUser.php index f22656d..392527d 100644 --- a/src/Telegram/TransactionPartnerUser.php +++ b/src/Telegram/TransactionPartnerUser.php @@ -14,41 +14,50 @@ class TransactionPartnerUser extends TransactionPartner /** Type of the transaction partner, always “user” */ public string $type = 'user'; + /** Type of the transaction, currently one of “invoice_payment” for payments via invoices, “paid_media_payment” for payments for paid media, “gift_purchase” for gifts sent by the bot, “premium_purchase” for Telegram Premium subscriptions gifted by the bot, “business_account_transfer” for direct transfers from managed business accounts */ + public string $transaction_type; + /** Information about the user */ public User $user; - /** Optional. Information about the affiliate that received a commission via this transaction */ + /** Optional. Information about the affiliate that received a commission via this transaction. Can be available only for “invoice_payment” and “paid_media_payment” transactions. */ public ?AffiliateInfo $affiliate = null; - /** Optional. Bot-specified invoice payload */ + /** Optional. Bot-specified invoice payload. Can be available only for “invoice_payment” transactions. */ public ?string $invoice_payload = null; - /** Optional. The duration of the paid subscription */ + /** Optional. The duration of the paid subscription. Can be available only for “invoice_payment” transactions. */ public ?int $subscription_period = null; /** - * Optional. Information about the paid media bought by the user + * Optional. Information about the paid media bought by the user; for “paid_media_payment” transactions only * * @var PaidMedia[] */ public ?array $paid_media = null; - /** Optional. Bot-specified paid media payload */ + /** Optional. Bot-specified paid media payload. Can be available only for “paid_media_payment” transactions. */ public ?string $paid_media_payload = null; - /** Optional. The gift sent to the user by the bot */ + /** Optional. The gift sent to the user by the bot; for “gift_purchase” transactions only */ public ?Gift $gift = null; + /** Optional. Number of months the gifted Telegram Premium subscription will be active for; for “premium_purchase” transactions only */ + public ?int $premium_subscription_duration = null; + /** + * @param string $transaction_type Type of the transaction, currently one of “invoice_payment” for payments via invoices, “paid_media_payment” for payments for paid media, “gift_purchase” for gifts sent by the bot, “premium_purchase” for Telegram Premium subscriptions gifted by the bot, “business_account_transfer” for direct transfers from managed business accounts * @param User $user Information about the user - * @param AffiliateInfo $affiliate Optional. Information about the affiliate that received a commission via this transaction - * @param string $invoice_payload Optional. Bot-specified invoice payload - * @param int $subscription_period Optional. The duration of the paid subscription - * @param PaidMedia[] $paid_media Optional. Information about the paid media bought by the user - * @param string $paid_media_payload Optional. Bot-specified paid media payload - * @param Gift $gift Optional. The gift sent to the user by the bot + * @param AffiliateInfo $affiliate Optional. Information about the affiliate that received a commission via this transaction. Can be available only for “invoice_payment” and “paid_media_payment” transactions. + * @param string $invoice_payload Optional. Bot-specified invoice payload. Can be available only for “invoice_payment” transactions. + * @param int $subscription_period Optional. The duration of the paid subscription. Can be available only for “invoice_payment” transactions. + * @param PaidMedia[] $paid_media Optional. Information about the paid media bought by the user; for “paid_media_payment” transactions only + * @param string $paid_media_payload Optional. Bot-specified paid media payload. Can be available only for “paid_media_payment” transactions. + * @param Gift $gift Optional. The gift sent to the user by the bot; for “gift_purchase” transactions only + * @param int $premium_subscription_duration Optional. Number of months the gifted Telegram Premium subscription will be active for; for “premium_purchase” transactions only */ public static function make( + string $transaction_type, User $user, ?AffiliateInfo $affiliate = null, ?string $invoice_payload = null, @@ -56,8 +65,10 @@ public static function make( ?array $paid_media = null, ?string $paid_media_payload = null, ?Gift $gift = null, + ?int $premium_subscription_duration = null, ): static { return new static([ + 'transaction_type' => $transaction_type, 'user' => $user, 'affiliate' => $affiliate, 'invoice_payload' => $invoice_payload, @@ -65,6 +76,7 @@ public static function make( 'paid_media' => $paid_media, 'paid_media_payload' => $paid_media_payload, 'gift' => $gift, + 'premium_subscription_duration' => $premium_subscription_duration, ]); } } diff --git a/src/Telegram/UniqueGift.php b/src/Telegram/UniqueGift.php new file mode 100644 index 0000000..df2683a --- /dev/null +++ b/src/Telegram/UniqueGift.php @@ -0,0 +1,65 @@ +Optional. Information about the chat that published the gift */ + public ?Chat $publisher_chat = null; + + /** + * @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 Chat $publisher_chat Optional. Information about the chat that published the gift + */ + public static function make( + string $base_name, + string $name, + int $number, + UniqueGiftModel $model, + UniqueGiftSymbol $symbol, + UniqueGiftBackdrop $backdrop, + ?Chat $publisher_chat = null, + ): static { + return new static([ + 'base_name' => $base_name, + 'name' => $name, + 'number' => $number, + 'model' => $model, + 'symbol' => $symbol, + 'backdrop' => $backdrop, + 'publisher_chat' => $publisher_chat, + ]); + } +} diff --git a/src/Telegram/UniqueGiftBackdrop.php b/src/Telegram/UniqueGiftBackdrop.php new file mode 100644 index 0000000..b82b008 --- /dev/null +++ b/src/Telegram/UniqueGiftBackdrop.php @@ -0,0 +1,38 @@ + $name, + 'colors' => $colors, + 'rarity_per_mille' => $rarity_per_mille, + ]); + } +} diff --git a/src/Telegram/UniqueGiftBackdropColors.php b/src/Telegram/UniqueGiftBackdropColors.php new file mode 100644 index 0000000..bbab56f --- /dev/null +++ b/src/Telegram/UniqueGiftBackdropColors.php @@ -0,0 +1,43 @@ + $center_color, + 'edge_color' => $edge_color, + 'symbol_color' => $symbol_color, + 'text_color' => $text_color, + ]); + } +} diff --git a/src/Telegram/UniqueGiftInfo.php b/src/Telegram/UniqueGiftInfo.php new file mode 100644 index 0000000..d9ae51a --- /dev/null +++ b/src/Telegram/UniqueGiftInfo.php @@ -0,0 +1,59 @@ +Optional. For gifts bought from other users, the price paid for the gift */ + public ?int $last_resale_star_count = 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; + + /** Optional. Number of Telegram Stars that must be paid to transfer the gift; omitted if the bot cannot transfer the gift */ + public ?int $transfer_star_count = null; + + /** 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 */ + public ?int $next_transfer_date = null; + + /** + * @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 $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 + */ + public static function make( + UniqueGift $gift, + string $origin, + ?int $last_resale_star_count = null, + ?string $owned_gift_id = null, + ?int $transfer_star_count = null, + ?int $next_transfer_date = null, + ): static { + return new static([ + 'gift' => $gift, + 'origin' => $origin, + 'last_resale_star_count' => $last_resale_star_count, + 'owned_gift_id' => $owned_gift_id, + 'transfer_star_count' => $transfer_star_count, + 'next_transfer_date' => $next_transfer_date, + ]); + } +} diff --git a/src/Telegram/UniqueGiftModel.php b/src/Telegram/UniqueGiftModel.php new file mode 100644 index 0000000..ec9267a --- /dev/null +++ b/src/Telegram/UniqueGiftModel.php @@ -0,0 +1,38 @@ + $name, + 'sticker' => $sticker, + 'rarity_per_mille' => $rarity_per_mille, + ]); + } +} diff --git a/src/Telegram/UniqueGiftSymbol.php b/src/Telegram/UniqueGiftSymbol.php new file mode 100644 index 0000000..3411e0e --- /dev/null +++ b/src/Telegram/UniqueGiftSymbol.php @@ -0,0 +1,38 @@ + $name, + 'sticker' => $sticker, + 'rarity_per_mille' => $rarity_per_mille, + ]); + } +} diff --git a/src/Telegram/WriteAccessAllowed.php b/src/Telegram/WriteAccessAllowed.php index 4573ee4..b4b425b 100644 --- a/src/Telegram/WriteAccessAllowed.php +++ b/src/Telegram/WriteAccessAllowed.php @@ -13,19 +13,19 @@ */ class WriteAccessAllowed extends Type { - /** Optional. True, if the access was granted after the user accepted an explicit request from a Web App sent by the method requestWriteAccess */ + /** Optional. True, if the access was granted after the user accepted an explicit request from a Web App sent by the method requestWriteAccess */ public ?bool $from_request = null; /** Optional. Name of the Web App, if the access was granted when the Web App was launched from a link */ public ?string $web_app_name = null; - /** Optional. True, if the access was granted when the bot was added to the attachment or side menu */ + /** Optional. True, if the access was granted when the bot was added to the attachment or side menu */ public ?bool $from_attachment_menu = null; /** - * @param bool $from_request Optional. True, if the access was granted after the user accepted an explicit request from a Web App sent by the method requestWriteAccess + * @param bool $from_request Optional. True, if the access was granted after the user accepted an explicit request from a Web App sent by the method requestWriteAccess * @param string $web_app_name Optional. Name of the Web App, if the access was granted when the Web App was launched from a link - * @param bool $from_attachment_menu Optional. True, if the access was granted when the bot was added to the attachment or side menu + * @param bool $from_attachment_menu Optional. True, if the access was granted when the bot was added to the attachment or side menu */ public static function make( ?bool $from_request = null, diff --git a/src/Types/Extensions/RepliesToMessage.php b/src/Types/Extensions/RepliesToMessage.php index 1804b41..e1dd76c 100644 --- a/src/Types/Extensions/RepliesToMessage.php +++ b/src/Types/Extensions/RepliesToMessage.php @@ -14,12 +14,14 @@ use Telepath\Telegram\ReplyKeyboardMarkup; use Telepath\Telegram\ReplyKeyboardRemove; use Telepath\Telegram\ReplyParameters; +use Telepath\Telegram\SuggestedPostParameters; 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 $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. * @param MessageEntity[] $entities A JSON-serialized list of special entities that appear in message text, which can be specified instead of parse_mode @@ -28,12 +30,14 @@ trait RepliesToMessage * @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; for private chats only + * @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 */ public function replyToUser( ?string $business_connection_id, ?int $message_thread_id, + ?int $direct_messages_topic_id, string $text, ParseMode|string|null $parse_mode = null, ?array $entities = null, @@ -42,6 +46,7 @@ public function replyToUser( ?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, ): \Telepath\Telegram\Message { @@ -49,6 +54,7 @@ public function replyToUser( chat_id: $this->user()->id, business_connection_id: $business_connection_id, message_thread_id: $message_thread_id, + direct_messages_topic_id: $direct_messages_topic_id, text: $text, parse_mode: $parse_mode, entities: $entities, @@ -57,6 +63,7 @@ public function replyToUser( protect_content: $protect_content, allow_paid_broadcast: $allow_paid_broadcast, message_effect_id: $message_effect_id, + suggested_post_parameters: $suggested_post_parameters, reply_parameters: $reply_parameters, reply_markup: $reply_markup, );