diff --git a/src/Client.php b/src/Client.php index 3984b5a..82c63d0 100644 --- a/src/Client.php +++ b/src/Client.php @@ -226,6 +226,9 @@ public function close( * @param string $text * Text of the message to be sent, 1-4096 characters after entities parsing * + * @param int|null $messageThreadId + * Unique identifier for the target message thread (topic) of the forum; for forum supergroups only + * * @param string|null $parseMode * Mode for parsing entities in the message text. See formatting options for more details. * @@ -257,6 +260,7 @@ public function close( public function sendMessage( $chatId, string $text, + int $messageThreadId = null, string $parseMode = null, array $entities = null, bool $disableWebPagePreview = null, @@ -269,6 +273,7 @@ public function sendMessage( { $requestParameters = [ 'chat_id' => $chatId, + 'message_thread_id' => $messageThreadId, 'text' => $text, 'parse_mode' => $parseMode, 'entities' => $entities, @@ -298,6 +303,9 @@ public function sendMessage( * @param int $messageId * Message identifier in the chat specified in from_chat_id * + * @param int|null $messageThreadId + * Unique identifier for the target message thread (topic) of the forum; for forum supergroups only + * * @param bool|null $disableNotification * Sends the message silently. Users will receive a notification with no sound. * @@ -310,12 +318,14 @@ public function forwardMessage( $chatId, $fromChatId, int $messageId, + int $messageThreadId = null, bool $disableNotification = null, bool $protectContent = null ) { $requestParameters = [ 'chat_id' => $chatId, + 'message_thread_id' => $messageThreadId, 'from_chat_id' => $fromChatId, 'disable_notification' => $disableNotification, 'protect_content' => $protectContent, @@ -342,6 +352,9 @@ public function forwardMessage( * @param int $messageId * Message identifier in the chat specified in from_chat_id * + * @param int|null $messageThreadId + * Unique identifier for the target message thread (topic) of the forum; for forum supergroups only + * * @param string|null $caption * New caption for media, 0-1024 characters after entities parsing. If not specified, the original caption is * kept @@ -375,6 +388,7 @@ public function copyMessage( $chatId, $fromChatId, int $messageId, + int $messageThreadId = null, string $caption = null, string $parseMode = null, array $captionEntities = null, @@ -387,6 +401,7 @@ public function copyMessage( { $requestParameters = [ 'chat_id' => $chatId, + 'message_thread_id' => $messageThreadId, 'from_chat_id' => $fromChatId, 'message_id' => $messageId, 'caption' => $caption, @@ -416,6 +431,9 @@ public function copyMessage( * 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 int|null $messageThreadId + * Unique identifier for the target message thread (topic) of the forum; for forum supergroups only + * * @param string|null $caption * Photo caption (may also be used when resending photos by file_id), 0-1024 characters after entities parsing * @@ -447,6 +465,7 @@ public function copyMessage( public function sendPhoto( $chatId, $photo, + int $messageThreadId = null, string $caption = null, string $parseMode = null, array $captionEntities = null, @@ -459,6 +478,7 @@ public function sendPhoto( { $requestParameters = [ 'chat_id' => $chatId, + 'message_thread_id' => $messageThreadId, 'photo' => $photo, 'caption' => $caption, 'parse_mode' => $parseMode, @@ -488,6 +508,9 @@ public function sendPhoto( * (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 int|null $messageThreadId + * Unique identifier for the target message thread (topic) of the forum; for forum supergroups only + * * @param string|null $caption * Audio caption, 0-1024 characters after entities parsing * @@ -535,6 +558,7 @@ public function sendPhoto( public function sendAudio( $chatId, $audio, + int $messageThreadId = null, string $caption = null, string $parseMode = null, array $captionEntities = null, @@ -551,6 +575,7 @@ public function sendAudio( { $requestParameters = [ 'chat_id' => $chatId, + 'message_thread_id' => $messageThreadId, 'audio' => $audio, 'caption' => $caption, 'parse_mode' => $parseMode, @@ -583,6 +608,9 @@ public function sendAudio( * 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 int|null $messageThreadId + * Unique identifier for the target message thread (topic) of the forum; for forum supergroups only + * * @param Type\InputFile|string|null $thumb * 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. @@ -625,6 +653,7 @@ public function sendAudio( public function sendDocument( $chatId, $document, + int $messageThreadId = null, $thumb = null, string $caption = null, string $parseMode = null, @@ -639,6 +668,7 @@ public function sendDocument( { $requestParameters = [ 'chat_id' => $chatId, + 'message_thread_id' => $messageThreadId, 'document' => $document, 'thumb' => $thumb, 'caption' => $caption, @@ -669,6 +699,9 @@ public function sendDocument( * 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 int|null $messageThreadId + * Unique identifier for the target message thread (topic) of the forum; for forum supergroups only + * * @param int|null $duration * Duration of sent video in seconds * @@ -719,6 +752,7 @@ public function sendDocument( public function sendVideo( $chatId, $video, + int $messageThreadId = null, int $duration = null, int $width = null, int $height = null, @@ -736,6 +770,7 @@ public function sendVideo( { $requestParameters = [ 'chat_id' => $chatId, + 'message_thread_id' => $messageThreadId, 'video' => $video, 'duration' => $duration, 'width' => $width, @@ -768,6 +803,9 @@ public function sendVideo( * (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 int|null $messageThreadId + * Unique identifier for the target message thread (topic) of the forum; for forum supergroups only + * * @param int|null $duration * Duration of sent animation in seconds * @@ -816,6 +854,7 @@ public function sendVideo( public function sendAnimation( $chatId, $animation, + int $messageThreadId = null, int $duration = null, int $width = null, int $height = null, @@ -832,6 +871,7 @@ public function sendAnimation( { $requestParameters = [ 'chat_id' => $chatId, + 'message_thread_id' => $messageThreadId, 'animation' => $animation, 'duration' => $duration, 'width' => $width, @@ -866,6 +906,9 @@ public function sendAnimation( * 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 int|null $messageThreadId + * Unique identifier for the target message thread (topic) of the forum; for forum supergroups only + * * @param string|null $caption * Voice message caption, 0-1024 characters after entities parsing * @@ -900,6 +943,7 @@ public function sendAnimation( public function sendVoice( $chatId, $voice, + int $messageThreadId = null, string $caption = null, string $parseMode = null, array $captionEntities = null, @@ -913,6 +957,7 @@ public function sendVoice( { $requestParameters = [ 'chat_id' => $chatId, + 'message_thread_id' => $messageThreadId, 'voice' => $voice, 'caption' => $caption, 'parse_mode' => $parseMode, @@ -942,6 +987,9 @@ public function sendVoice( * (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 int|null $messageThreadId + * Unique identifier for the target message thread (topic) of the forum; for forum supergroups only + * * @param int|null $duration * Duration of sent video in seconds * @@ -976,6 +1024,7 @@ public function sendVoice( public function sendVideoNote( $chatId, $videoNote, + int $messageThreadId = null, int $duration = null, int $length = null, $thumb = null, @@ -988,6 +1037,7 @@ public function sendVideoNote( { $requestParameters = [ 'chat_id' => $chatId, + 'message_thread_id' => $messageThreadId, 'video_note' => $videoNote, 'duration' => $duration, 'length' => $length, @@ -1015,6 +1065,9 @@ public function sendVideoNote( * @param Type\InputMediaAudio[]|Type\InputMediaDocument[]|Type\InputMediaPhoto[]|Type\InputMediaVideo[] $media * A JSON-serialized array describing messages to be sent, must include 2-10 items * + * @param int|null $messageThreadId + * Unique identifier for the target message thread (topic) of the forum; for forum supergroups only + * * @param bool|null $disableNotification * Sends messages silently. Users will receive a notification with no sound. * @@ -1032,6 +1085,7 @@ public function sendVideoNote( public function sendMediaGroup( $chatId, array $media, + int $messageThreadId = null, bool $disableNotification = null, bool $protectContent = null, int $replyToMessageId = null, @@ -1040,6 +1094,7 @@ public function sendMediaGroup( { $requestParameters = [ 'chat_id' => $chatId, + 'message_thread_id' => $messageThreadId, 'media' => $media, 'disable_notification' => $disableNotification, 'protect_content' => $protectContent, @@ -1064,6 +1119,9 @@ public function sendMediaGroup( * @param float $longitude * Longitude of the location * + * @param int|null $messageThreadId + * Unique identifier for the target message thread (topic) of the forum; for forum supergroups only + * * @param float|null $horizontalAccuracy * The radius of uncertainty for the location, measured in meters; 0-1500 * @@ -1099,6 +1157,7 @@ public function sendLocation( $chatId, float $latitude, float $longitude, + int $messageThreadId = null, float $horizontalAccuracy = null, int $livePeriod = null, int $heading = null, @@ -1112,6 +1171,7 @@ public function sendLocation( { $requestParameters = [ 'chat_id' => $chatId, + 'message_thread_id' => $messageThreadId, 'latitude' => $latitude, 'longitude' => $longitude, 'horizontal_accuracy' => $horizontalAccuracy, @@ -1254,6 +1314,9 @@ public function stopMessageLiveLocation( * @param string $address * Address of the venue * + * @param int|null $messageThreadId + * Unique identifier for the target message thread (topic) of the forum; for forum supergroups only + * * @param string|null $foursquareId * Foursquare identifier of the venue * @@ -1291,6 +1354,7 @@ public function sendVenue( float $longitude, string $title, string $address, + int $messageThreadId = null, string $foursquareId = null, string $foursquareType = null, string $googlePlaceId = null, @@ -1304,6 +1368,7 @@ public function sendVenue( { $requestParameters = [ 'chat_id' => $chatId, + 'message_thread_id' => $messageThreadId, 'latitude' => $latitude, 'longitude' => $longitude, 'title' => $title, @@ -1336,6 +1401,9 @@ public function sendVenue( * @param string $firstName * Contact's first name * + * @param int|null $messageThreadId + * Unique identifier for the target message thread (topic) of the forum; for forum supergroups only + * * @param string|null $lastName * Contact's last name * @@ -1356,7 +1424,7 @@ public function sendVenue( * * @param Type\InlineKeyboardMarkup|Type\ReplyKeyboardMarkup|Type\ReplyKeyboardRemove|Type\ForceReply|null $replyMarkup * Additional interface options. A JSON-serialized object for an inline keyboard, custom reply keyboard, - * instructions to remove keyboard or to force a reply from the user. + * instructions to remove reply keyboard or to force a reply from the user. * * @return mixed */ @@ -1364,6 +1432,7 @@ public function sendContact( $chatId, string $phoneNumber, string $firstName, + int $messageThreadId = null, string $lastName = null, string $vcard = null, bool $disableNotification = null, @@ -1375,6 +1444,7 @@ public function sendContact( { $requestParameters = [ 'chat_id' => $chatId, + 'message_thread_id' => $messageThreadId, 'phone_number' => $phoneNumber, 'first_name' => $firstName, 'last_name' => $lastName, @@ -1403,6 +1473,9 @@ public function sendContact( * @param string[] $options * A JSON-serialized list of answer options, 2-10 strings 1-100 characters each * + * @param int|null $openPeriod + * Amount of time in seconds the poll will be active after creation, 5-600. Can't be used together with close_date. + * * @param bool|null $allowSendingWithoutReply * Pass True if the message should be sent even if the specified replied-to message is not found * @@ -1422,15 +1495,15 @@ public function sendContact( * Point in time (Unix timestamp) when the poll will be automatically closed. Must be at least 5 and no more than 600 * seconds in the future. Can't be used together with open_period. * + * @param string|null $explanationParseMode + * Mode for parsing entities in the explanation. See formatting options for more details. + * * @param Type\MessageEntity[]|null $explanationEntities * A JSON-serialized list of special entities that appear in the poll explanation, which can be specified instead * of parse_mode * - * @param int|null $openPeriod - * Amount of time in seconds the poll will be active after creation, 5-600. Can't be used together with close_date. - * - * @param string|null $explanationParseMode - * Mode for parsing entities in the explanation. See formatting options for more details. + * @param int|null $messageThreadId + * Unique identifier for the target message thread (topic) of the forum; for forum supergroups only * * @param string|null $explanation * Text that is shown when a user chooses an incorrect answer or taps on the lamp icon in a quiz-style poll, 0-200 @@ -1458,15 +1531,16 @@ public function sendPoll( $chatId, string $question, array $options, + int $openPeriod = null, bool $allowSendingWithoutReply = null, int $replyToMessageId = null, bool $protectContent = null, bool $disableNotification = null, bool $isClosed = null, int $closeDate = null, - array $explanationEntities = null, - int $openPeriod = null, string $explanationParseMode = null, + array $explanationEntities = null, + int $messageThreadId = null, string $explanation = null, int $correctOptionId = null, bool $allowsMultipleAnswers = null, @@ -1477,6 +1551,7 @@ public function sendPoll( { $requestParameters = [ 'chat_id' => $chatId, + 'message_thread_id' => $messageThreadId, 'question' => $question, 'options' => $options, 'is_anonymous' => $isAnonymous, @@ -1507,6 +1582,9 @@ public function sendPoll( * @param int|string $chatId * Unique identifier for the target chat or username of the target channel (in the format @|channelusername) * + * @param int|null $messageThreadId + * Unique identifier for the target message thread (topic) of the forum; for forum supergroups only + * * @param string|null $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 @@ -1532,6 +1610,7 @@ public function sendPoll( */ public function sendDice( $chatId, + int $messageThreadId = null, string $emoji = null, bool $disableNotification = null, bool $protectContent = null, @@ -1542,6 +1621,7 @@ public function sendDice( { $requestParameters = [ 'chat_id' => $chatId, + 'message_thread_id' => $messageThreadId, 'emoji' => $emoji, 'disable_notification' => $disableNotification, 'protect_content' => $protectContent, @@ -1807,6 +1887,9 @@ public function restrictChatMember( * @param bool|null $canPinMessages * Pass True if the administrator can pin messages, supergroups only * + * @param bool|null $canManageTopics + * Pass True if the user is allowed to create, rename, close, and reopen forum topics, supergroups only + * * @return mixed */ public function promoteChatMember( @@ -1822,7 +1905,8 @@ public function promoteChatMember( bool $canPromoteMembers = null, bool $canChangeInfo = null, bool $canInviteUsers = null, - bool $canPinMessages = null + bool $canPinMessages = null, + bool $canManageTopics = null ) { $requestParameters = [ @@ -1839,6 +1923,7 @@ public function promoteChatMember( 'can_change_info' => $canChangeInfo, 'can_invite_users' => $canInviteUsers, 'can_pin_messages' => $canPinMessages, + 'can_manage_topics' => $canManageTopics, ]; return $this->_apiCall('promoteChatMember', $requestParameters); @@ -2218,7 +2303,7 @@ public function deleteChatPhoto( * Unique identifier for the target chat or username of the target channel (in the format @|channelusername) * * @param string $title - * New chat title, 1-255 characters + * New chat title, 1-128 characters * * @return mixed */ @@ -2520,11 +2605,226 @@ public function deleteChatStickerSet( return $this->_apiCall('deleteChatStickerSet', $requestParameters); } + /** + * https://core.telegram.org/bots/api#getforumtopiciconstickers + * + * Use this method to get custom emoji stickers, which can be used as a forum topic icon by any user. Requires no + * parameters. Returns an Array of Sticker objects. + * + * @return mixed + */ + public function getForumTopicIconStickers( + ) + { + $requestParameters = [ + ]; + + return $this->_apiCall('getForumTopicIconStickers', $requestParameters); + } + + /** + * https://core.telegram.org/bots/api#createforumtopic + * + * Use this method to create a topic in a forum supergroup chat. The bot must be an administrator in the chat for this to + * work and must have the can_manage_topics administrator rights. Returns information about the created topic + * as a ForumTopic object. + * + * @param int|string $chatId + * Unique identifier for the target chat or username of the target supergroup (in the format + * @|supergroupusername) + * + * @param string $name + * Topic name, 1-128 characters + * + * @param int|null $iconColor + * Color of the topic icon in RGB format. Currently, must be one of 0x6FB9F0, 0xFFD67E, 0xCB86DB, 0x8EEE98, + * 0xFF93B2, or 0xFB6F5F + * + * @param string|null $iconCustomEmojiId + * Unique identifier of the custom emoji shown as the topic icon. Use getForumTopicIconStickers to get all + * allowed custom emoji identifiers. + * + * @return mixed + */ + public function createForumTopic( + $chatId, + string $name, + int $iconColor = null, + string $iconCustomEmojiId = null + ) + { + $requestParameters = [ + 'chat_id' => $chatId, + 'name' => $name, + 'icon_color' => $iconColor, + 'icon_custom_emoji_id' => $iconCustomEmojiId, + ]; + + return $this->_apiCall('createForumTopic', $requestParameters); + } + + /** + * https://core.telegram.org/bots/api#editforumtopic + * + * Use this method to edit name and icon of a topic in a forum supergroup chat. The bot must be an administrator in the chat + * for this to work and must have can_manage_topics administrator rights, unless it is the creator of the topic. + * Returns True on success. + * + * @param int|string $chatId + * Unique identifier for the target chat or username of the target supergroup (in the format + * @|supergroupusername) + * + * @param int $messageThreadId + * Unique identifier for the target message thread of the forum topic + * + * @param string $name + * New topic name, 1-128 characters + * + * @param string $iconCustomEmojiId + * New unique identifier of the custom emoji shown as the topic icon. Use getForumTopicIconStickers to get all + * allowed custom emoji identifiers + * + * @return mixed + */ + public function editForumTopic( + $chatId, + int $messageThreadId, + string $name, + string $iconCustomEmojiId + ) + { + $requestParameters = [ + 'chat_id' => $chatId, + 'message_thread_id' => $messageThreadId, + 'name' => $name, + 'icon_custom_emoji_id' => $iconCustomEmojiId, + ]; + + return $this->_apiCall('editForumTopic', $requestParameters); + } + + /** + * https://core.telegram.org/bots/api#closeforumtopic + * + * Use this method to close an open topic in a forum supergroup chat. The bot must be an administrator in the chat for this + * to work and must have the can_manage_topics administrator rights, unless it is the creator of the topic. + * Returns True on success. + * + * @param int|string $chatId + * Unique identifier for the target chat or username of the target supergroup (in the format + * @|supergroupusername) + * + * @param int $messageThreadId + * Unique identifier for the target message thread of the forum topic + * + * @return mixed + */ + public function closeForumTopic( + $chatId, + int $messageThreadId + ) + { + $requestParameters = [ + 'chat_id' => $chatId, + 'message_thread_id' => $messageThreadId, + ]; + + return $this->_apiCall('closeForumTopic', $requestParameters); + } + + /** + * https://core.telegram.org/bots/api#reopenforumtopic + * + * Use this method to reopen a closed topic in a forum supergroup chat. The bot must be an administrator in the chat for + * this to work and must have the can_manage_topics administrator rights, unless it is the creator of the topic. + * Returns True on success. + * + * @param int|string $chatId + * Unique identifier for the target chat or username of the target supergroup (in the format + * @|supergroupusername) + * + * @param int $messageThreadId + * Unique identifier for the target message thread of the forum topic + * + * @return mixed + */ + public function reopenForumTopic( + $chatId, + int $messageThreadId + ) + { + $requestParameters = [ + 'chat_id' => $chatId, + 'message_thread_id' => $messageThreadId, + ]; + + return $this->_apiCall('reopenForumTopic', $requestParameters); + } + + /** + * https://core.telegram.org/bots/api#deleteforumtopic + * + * Use this method to delete a forum topic along with all its messages in a forum supergroup chat. The bot must be an + * administrator in the chat for this to work and must have the can_delete_messages administrator rights. Returns + * True on success. + * + * @param int|string $chatId + * Unique identifier for the target chat or username of the target supergroup (in the format + * @|supergroupusername) + * + * @param int $messageThreadId + * Unique identifier for the target message thread of the forum topic + * + * @return mixed + */ + public function deleteForumTopic( + $chatId, + int $messageThreadId + ) + { + $requestParameters = [ + 'chat_id' => $chatId, + 'message_thread_id' => $messageThreadId, + ]; + + return $this->_apiCall('deleteForumTopic', $requestParameters); + } + + /** + * https://core.telegram.org/bots/api#unpinallforumtopicmessages + * + * Use this method to clear the list of pinned messages in a forum topic. The bot must be an administrator in the chat for + * this to work and must have the can_pin_messages administrator right in the supergroup. Returns + * True on success. + * + * @param int|string $chatId + * Unique identifier for the target chat or username of the target supergroup (in the format + * @|supergroupusername) + * + * @param int $messageThreadId + * Unique identifier for the target message thread of the forum topic + * + * @return mixed + */ + public function unpinAllForumTopicMessages( + $chatId, + int $messageThreadId + ) + { + $requestParameters = [ + 'chat_id' => $chatId, + 'message_thread_id' => $messageThreadId, + ]; + + return $this->_apiCall('unpinAllForumTopicMessages', $requestParameters); + } + /** * https://core.telegram.org/bots/api#answercallbackquery * - * Use this method to send answers to callback queries sent from inline keyboards. The answer will be displayed to the user as a notification at the top of the chat screen or as an alert. - * On success, True is returned. + * Use this method to send answers to callback queries sent from inline + * keyboards. The answer will be displayed to the user as a notification at the top of the chat screen or as an alert. On success, + * True is returned. * * @param string $callbackQueryId * Unique identifier for the query to be answered @@ -2569,8 +2869,8 @@ public function answerCallbackQuery( /** * https://core.telegram.org/bots/api#setmycommands * - * Use this method to change the list of the bot's commands. See https://core.telegram.org/bots#commands for more - * details about bot commands. Returns True on success. + * Use this method to change the list of the bot's commands. See this manual + * for more details about bot commands. Returns True on success. * * @param Type\BotCommand[] $commands * A JSON-serialized list of bot commands to be set as the list of the bot's commands. At most 100 commands can be @@ -2989,12 +3289,12 @@ public function stopPoll( * https://core.telegram.org/bots/api#deletemessage * * 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.- 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. + * 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. * * @param int|string $chatId * Unique identifier for the target chat or username of the target channel (in the format @|channelusername) @@ -3032,6 +3332,9 @@ public function deleteMessage( * an HTTP URL as a String for Telegram to get a .WEBP file from the Internet, or upload a new one using * multipart/form-data. More information on Sending Files » * + * @param int|null $messageThreadId + * Unique identifier for the target message thread (topic) of the forum; for forum supergroups only + * * @param bool|null $disableNotification * Sends the message silently. Users will receive a notification with no sound. * @@ -3053,6 +3356,7 @@ public function deleteMessage( public function sendSticker( $chatId, $sticker, + int $messageThreadId = null, bool $disableNotification = null, bool $protectContent = null, int $replyToMessageId = null, @@ -3062,6 +3366,7 @@ public function sendSticker( { $requestParameters = [ 'chat_id' => $chatId, + 'message_thread_id' => $messageThreadId, 'sticker' => $sticker, 'disable_notification' => $disableNotification, 'protect_content' => $protectContent, @@ -3456,6 +3761,9 @@ public function answerWebAppQuery( * @param int|string $chatId * Unique identifier for the target chat or username of the target channel (in the format @|channelusername) * + * @param string $title + * Product name, 1-32 characters + * * @param string $description * Product description, 1-255 characters * @@ -3473,9 +3781,6 @@ public function answerWebAppQuery( * Price breakdown, a JSON-serialized list of components (e.g. product price, tax, discount, delivery cost, * delivery tax, bonus, etc.) * - * @param string $title - * Product name, 1-32 characters - * * @param bool|null $needEmail * Pass True if you require the user's email address to complete the order * @@ -3515,6 +3820,9 @@ public function answerWebAppQuery( * @param int|null $photoHeight * Photo height * + * @param int|null $messageThreadId + * Unique identifier for the target message thread (topic) of the forum; for forum supergroups only + * * @param int|null $photoSize * Photo size in bytes * @@ -3550,12 +3858,12 @@ public function answerWebAppQuery( */ public function sendInvoice( $chatId, + string $title, string $description, string $payload, string $providerToken, string $currency, array $prices, - string $title, bool $needEmail = null, bool $allowSendingWithoutReply = null, int $replyToMessageId = null, @@ -3569,6 +3877,7 @@ public function sendInvoice( bool $needPhoneNumber = null, bool $needName = null, int $photoHeight = null, + int $messageThreadId = null, int $photoSize = null, string $photoUrl = null, string $providerData = null, @@ -3580,6 +3889,7 @@ public function sendInvoice( { $requestParameters = [ 'chat_id' => $chatId, + 'message_thread_id' => $messageThreadId, 'title' => $title, 'description' => $description, 'payload' => $payload, @@ -3854,6 +4164,9 @@ public function setPassportDataErrors( * @param string $gameShortName * Short name of the game, serves as the unique identifier for the game. Set up your games via @|BotFather. * + * @param int|null $messageThreadId + * Unique identifier for the target message thread (topic) of the forum; for forum supergroups only + * * @param bool|null $disableNotification * Sends the message silently. Users will receive a notification with no sound. * @@ -3875,6 +4188,7 @@ public function setPassportDataErrors( public function sendGame( int $chatId, string $gameShortName, + int $messageThreadId = null, bool $disableNotification = null, bool $protectContent = null, int $replyToMessageId = null, @@ -3884,6 +4198,7 @@ public function sendGame( { $requestParameters = [ 'chat_id' => $chatId, + 'message_thread_id' => $messageThreadId, 'game_short_name' => $gameShortName, 'disable_notification' => $disableNotification, 'protect_content' => $protectContent, diff --git a/src/Type/Chat.php b/src/Type/Chat.php index 85426c9..94ed644 100644 --- a/src/Type/Chat.php +++ b/src/Type/Chat.php @@ -34,7 +34,10 @@ public static function _getPropertyNames(): array 'username', 'first_name', 'last_name', + 'is_forum', 'photo', + 'active_usernames', + 'emoji_status_custom_emoji_id', 'bio', 'has_private_forwards', 'has_restricted_voice_and_video_messages', @@ -68,7 +71,10 @@ public function _getData(): array 'username' => $this->getUsername(), 'first_name' => $this->getFirstName(), 'last_name' => $this->getLastName(), + 'is_forum' => $this->getIsForum(), 'photo' => $this->getPhoto(), + 'active_usernames' => $this->getActiveUsernames(), + 'emoji_status_custom_emoji_id' => $this->getEmojiStatusCustomEmojiId(), 'bio' => $this->getBio(), 'has_private_forwards' => $this->getHasPrivateForwards(), 'has_restricted_voice_and_video_messages' => $this->getHasRestrictedVoiceAndVideoMessages(), @@ -156,6 +162,17 @@ public function _getData(): array */ protected $lastName; + /** + * Optional. True, if the supergroup chat is a forum (has topics enabled) + * + * @var bool|null + * @SkipWhenEmpty + * @SerializedName("is_forum") + * @Accessor(getter="getIsForum", setter="setIsForum") + * @Type("bool") + */ + protected $isForum; + /** * Optional. Chat photo. Returned only in getChat. * @@ -167,6 +184,29 @@ public function _getData(): array */ protected $photo; + /** + * Optional. If non-empty, the list of all active chat usernames; for private chats, supergroups and channels. + * Returned only in getChat. + * + * @var string[]|null + * @SkipWhenEmpty + * @SerializedName("active_usernames") + * @Accessor(getter="getActiveUsernames", setter="setActiveUsernames") + * @Type("array") + */ + protected $activeUsernames; + + /** + * Optional. Custom emoji identifier of emoji status of the other party in a private chat. Returned only in getChat. + * + * @var string|null + * @SkipWhenEmpty + * @SerializedName("emoji_status_custom_emoji_id") + * @Accessor(getter="getEmojiStatusCustomEmojiId", setter="setEmojiStatusCustomEmojiId") + * @Type("string") + */ + protected $emojiStatusCustomEmojiId; + /** * Optional. Bio of the other party in a private chat. Returned only in getChat. * @@ -466,6 +506,25 @@ public function getLastName(): ?string return $this->lastName; } + /** + * @param bool $isForum + * @return static + */ + public function setIsForum(bool $isForum): self + { + $this->isForum = $isForum; + + return $this; + } + + /** + * @return bool|null + */ + public function getIsForum(): ?bool + { + return $this->isForum; + } + /** * @param ChatPhoto $photo * @return static @@ -485,6 +544,44 @@ public function getPhoto(): ?ChatPhoto return $this->photo; } + /** + * @param string[] $activeUsernames + * @return static + */ + public function setActiveUsernames(array $activeUsernames): self + { + $this->activeUsernames = $activeUsernames; + + return $this; + } + + /** + * @return string[]|null + */ + public function getActiveUsernames(): ?array + { + return $this->activeUsernames; + } + + /** + * @param string $emojiStatusCustomEmojiId + * @return static + */ + public function setEmojiStatusCustomEmojiId(string $emojiStatusCustomEmojiId): self + { + $this->emojiStatusCustomEmojiId = $emojiStatusCustomEmojiId; + + return $this; + } + + /** + * @return string|null + */ + public function getEmojiStatusCustomEmojiId(): ?string + { + return $this->emojiStatusCustomEmojiId; + } + /** * @param string $bio * @return static diff --git a/src/Type/ChatAdministratorRights.php b/src/Type/ChatAdministratorRights.php index 45be1b9..531e1c5 100644 --- a/src/Type/ChatAdministratorRights.php +++ b/src/Type/ChatAdministratorRights.php @@ -39,6 +39,7 @@ public static function _getPropertyNames(): array 'can_post_messages', 'can_edit_messages', 'can_pin_messages', + 'can_manage_topics', ]; } @@ -61,6 +62,7 @@ public function _getData(): array 'can_post_messages' => $this->getCanPostMessages(), 'can_edit_messages' => $this->getCanEditMessages(), 'can_pin_messages' => $this->getCanPinMessages(), + 'can_manage_topics' => $this->getCanManageTopics(), ]; return parent::normalizeData($result); @@ -182,6 +184,17 @@ public function _getData(): array */ protected $canPinMessages; + /** + * Optional. True, if the user is allowed to create, rename, close, and reopen forum topics; supergroups only + * + * @var bool|null + * @SkipWhenEmpty + * @SerializedName("can_manage_topics") + * @Accessor(getter="getCanManageTopics", setter="setCanManageTopics") + * @Type("bool") + */ + protected $canManageTopics; + /** * @param bool $isAnonymous @@ -392,4 +405,23 @@ public function getCanPinMessages(): ?bool return $this->canPinMessages; } + /** + * @param bool $canManageTopics + * @return static + */ + public function setCanManageTopics(bool $canManageTopics): self + { + $this->canManageTopics = $canManageTopics; + + return $this; + } + + /** + * @return bool|null + */ + public function getCanManageTopics(): ?bool + { + return $this->canManageTopics; + } + } \ No newline at end of file diff --git a/src/Type/ChatMemberAdministrator.php b/src/Type/ChatMemberAdministrator.php index a7c1fcf..f839fd4 100644 --- a/src/Type/ChatMemberAdministrator.php +++ b/src/Type/ChatMemberAdministrator.php @@ -42,6 +42,7 @@ public static function _getPropertyNames(): array 'can_post_messages', 'can_edit_messages', 'can_pin_messages', + 'can_manage_topics', 'custom_title', ]; } @@ -68,6 +69,7 @@ public function _getData(): array 'can_post_messages' => $this->getCanPostMessages(), 'can_edit_messages' => $this->getCanEditMessages(), 'can_pin_messages' => $this->getCanPinMessages(), + 'can_manage_topics' => $this->getCanManageTopics(), 'custom_title' => $this->getCustomTitle(), ]; @@ -220,6 +222,17 @@ public function _getData(): array */ protected $canPinMessages; + /** + * Optional. True, if the user is allowed to create, rename, close, and reopen forum topics; supergroups only + * + * @var bool|null + * @SkipWhenEmpty + * @SerializedName("can_manage_topics") + * @Accessor(getter="getCanManageTopics", setter="setCanManageTopics") + * @Type("bool") + */ + protected $canManageTopics; + /** * Optional. Custom title for this user * @@ -498,6 +511,25 @@ public function getCanPinMessages(): ?bool return $this->canPinMessages; } + /** + * @param bool $canManageTopics + * @return static + */ + public function setCanManageTopics(bool $canManageTopics): self + { + $this->canManageTopics = $canManageTopics; + + return $this; + } + + /** + * @return bool|null + */ + public function getCanManageTopics(): ?bool + { + return $this->canManageTopics; + } + /** * @param string $customTitle * @return static diff --git a/src/Type/ChatMemberRestricted.php b/src/Type/ChatMemberRestricted.php index 52a8375..76c962a 100644 --- a/src/Type/ChatMemberRestricted.php +++ b/src/Type/ChatMemberRestricted.php @@ -35,6 +35,7 @@ public static function _getPropertyNames(): array 'can_change_info', 'can_invite_users', 'can_pin_messages', + 'can_manage_topics', 'can_send_messages', 'can_send_media_messages', 'can_send_polls', @@ -58,6 +59,7 @@ public function _getData(): array 'can_change_info' => $this->getCanChangeInfo(), 'can_invite_users' => $this->getCanInviteUsers(), 'can_pin_messages' => $this->getCanPinMessages(), + 'can_manage_topics' => $this->getCanManageTopics(), 'can_send_messages' => $this->getCanSendMessages(), 'can_send_media_messages' => $this->getCanSendMediaMessages(), 'can_send_polls' => $this->getCanSendPolls(), @@ -129,6 +131,16 @@ public function _getData(): array */ protected $canPinMessages; + /** + * True, if the user is allowed to create forum topics + * + * @var bool + * @SerializedName("can_manage_topics") + * @Accessor(getter="getCanManageTopics", setter="setCanManageTopics") + * @Type("bool") + */ + protected $canManageTopics; + /** * True, if the user is allowed to send text messages, contacts, locations and venues * @@ -304,6 +316,25 @@ public function getCanPinMessages(): bool return $this->canPinMessages; } + /** + * @param bool $canManageTopics + * @return static + */ + public function setCanManageTopics(bool $canManageTopics): self + { + $this->canManageTopics = $canManageTopics; + + return $this; + } + + /** + * @return bool + */ + public function getCanManageTopics(): bool + { + return $this->canManageTopics; + } + /** * @param bool $canSendMessages * @return static diff --git a/src/Type/ChatPermissions.php b/src/Type/ChatPermissions.php index dfc3fd8..7fc54e5 100644 --- a/src/Type/ChatPermissions.php +++ b/src/Type/ChatPermissions.php @@ -36,6 +36,7 @@ public static function _getPropertyNames(): array 'can_change_info', 'can_invite_users', 'can_pin_messages', + 'can_manage_topics', ]; } @@ -55,6 +56,7 @@ public function _getData(): array 'can_change_info' => $this->getCanChangeInfo(), 'can_invite_users' => $this->getCanInviteUsers(), 'can_pin_messages' => $this->getCanPinMessages(), + 'can_manage_topics' => $this->getCanManageTopics(), ]; return parent::normalizeData($result); @@ -151,6 +153,17 @@ public function _getData(): array */ protected $canPinMessages; + /** + * Optional. True, if the user is allowed to create forum topics. If omitted defaults to the value of can_pin_messages + * + * @var bool|null + * @SkipWhenEmpty + * @SerializedName("can_manage_topics") + * @Accessor(getter="getCanManageTopics", setter="setCanManageTopics") + * @Type("bool") + */ + protected $canManageTopics; + /** * @param bool $canSendMessages @@ -304,4 +317,23 @@ public function getCanPinMessages(): ?bool return $this->canPinMessages; } + /** + * @param bool $canManageTopics + * @return static + */ + public function setCanManageTopics(bool $canManageTopics): self + { + $this->canManageTopics = $canManageTopics; + + return $this; + } + + /** + * @return bool|null + */ + public function getCanManageTopics(): ?bool + { + return $this->canManageTopics; + } + } \ No newline at end of file diff --git a/src/Type/EncryptedCredentials.php b/src/Type/EncryptedCredentials.php index 520a9fe..30ded64 100644 --- a/src/Type/EncryptedCredentials.php +++ b/src/Type/EncryptedCredentials.php @@ -12,8 +12,8 @@ /** * https://core.telegram.org/bots/api#encryptedcredentials * - * Describes data required for decrypting and authenticating EncryptedPassportElement. See the Telegram Passport - * Documentation for a complete description of the data decryption and authentication processes. + * Describes data required for decrypting and authenticating EncryptedPassportElement. See the Telegram Passport Documentation for a complete + * description of the data decryption and authentication processes. * * @ExclusionPolicy("none") * @AccessType("public_method") diff --git a/src/Type/ForumTopic.php b/src/Type/ForumTopic.php new file mode 100644 index 0000000..ef324fa --- /dev/null +++ b/src/Type/ForumTopic.php @@ -0,0 +1,173 @@ + $this->getMessageThreadId(), + 'name' => $this->getName(), + 'icon_color' => $this->getIconColor(), + 'icon_custom_emoji_id' => $this->getIconCustomEmojiId(), + ]; + + return parent::normalizeData($result); + } + + /** + * Unique identifier of the forum topic + * + * @var int + * @SerializedName("message_thread_id") + * @Accessor(getter="getMessageThreadId", setter="setMessageThreadId") + * @Type("int") + */ + protected $messageThreadId; + + /** + * Name of the topic + * + * @var string + * @SerializedName("name") + * @Accessor(getter="getName", setter="setName") + * @Type("string") + */ + protected $name; + + /** + * Color of the topic icon in RGB format + * + * @var int + * @SerializedName("icon_color") + * @Accessor(getter="getIconColor", setter="setIconColor") + * @Type("int") + */ + protected $iconColor; + + /** + * Optional. Unique identifier of the custom emoji shown as the topic icon + * + * @var string|null + * @SkipWhenEmpty + * @SerializedName("icon_custom_emoji_id") + * @Accessor(getter="getIconCustomEmojiId", setter="setIconCustomEmojiId") + * @Type("string") + */ + protected $iconCustomEmojiId; + + + /** + * @param int $messageThreadId + * @return static + */ + public function setMessageThreadId(int $messageThreadId): self + { + $this->messageThreadId = $messageThreadId; + + return $this; + } + + /** + * @return int + */ + public function getMessageThreadId(): int + { + return $this->messageThreadId; + } + + /** + * @param string $name + * @return static + */ + public function setName(string $name): self + { + $this->name = $name; + + return $this; + } + + /** + * @return string + */ + public function getName(): string + { + return $this->name; + } + + /** + * @param int $iconColor + * @return static + */ + public function setIconColor(int $iconColor): self + { + $this->iconColor = $iconColor; + + return $this; + } + + /** + * @return int + */ + public function getIconColor(): int + { + return $this->iconColor; + } + + /** + * @param string $iconCustomEmojiId + * @return static + */ + public function setIconCustomEmojiId(string $iconCustomEmojiId): self + { + $this->iconCustomEmojiId = $iconCustomEmojiId; + + return $this; + } + + /** + * @return string|null + */ + public function getIconCustomEmojiId(): ?string + { + return $this->iconCustomEmojiId; + } + +} \ No newline at end of file diff --git a/src/Type/ForumTopicClosed.php b/src/Type/ForumTopicClosed.php new file mode 100644 index 0000000..105cd95 --- /dev/null +++ b/src/Type/ForumTopicClosed.php @@ -0,0 +1,48 @@ + $this->getName(), + 'icon_color' => $this->getIconColor(), + 'icon_custom_emoji_id' => $this->getIconCustomEmojiId(), + ]; + + return parent::normalizeData($result); + } + + /** + * Name of the topic + * + * @var string + * @SerializedName("name") + * @Accessor(getter="getName", setter="setName") + * @Type("string") + */ + protected $name; + + /** + * Color of the topic icon in RGB format + * + * @var int + * @SerializedName("icon_color") + * @Accessor(getter="getIconColor", setter="setIconColor") + * @Type("int") + */ + protected $iconColor; + + /** + * Optional. Unique identifier of the custom emoji shown as the topic icon + * + * @var string|null + * @SkipWhenEmpty + * @SerializedName("icon_custom_emoji_id") + * @Accessor(getter="getIconCustomEmojiId", setter="setIconCustomEmojiId") + * @Type("string") + */ + protected $iconCustomEmojiId; + + + /** + * @param string $name + * @return static + */ + public function setName(string $name): self + { + $this->name = $name; + + return $this; + } + + /** + * @return string + */ + public function getName(): string + { + return $this->name; + } + + /** + * @param int $iconColor + * @return static + */ + public function setIconColor(int $iconColor): self + { + $this->iconColor = $iconColor; + + return $this; + } + + /** + * @return int + */ + public function getIconColor(): int + { + return $this->iconColor; + } + + /** + * @param string $iconCustomEmojiId + * @return static + */ + public function setIconCustomEmojiId(string $iconCustomEmojiId): self + { + $this->iconCustomEmojiId = $iconCustomEmojiId; + + return $this; + } + + /** + * @return string|null + */ + public function getIconCustomEmojiId(): ?string + { + return $this->iconCustomEmojiId; + } + +} \ No newline at end of file diff --git a/src/Type/ForumTopicReopened.php b/src/Type/ForumTopicReopened.php new file mode 100644 index 0000000..a7ffd6f --- /dev/null +++ b/src/Type/ForumTopicReopened.php @@ -0,0 +1,48 @@ + $this->getMessageId(), + 'message_thread_id' => $this->getMessageThreadId(), 'from' => $this->getFrom(), 'sender_chat' => $this->getSenderChat(), 'date' => $this->getDate(), @@ -109,6 +115,7 @@ public function _getData(): array 'forward_signature' => $this->getForwardSignature(), 'forward_sender_name' => $this->getForwardSenderName(), 'forward_date' => $this->getForwardDate(), + 'is_topic_message' => $this->getIsTopicMessage(), 'is_automatic_forward' => $this->getIsAutomaticForward(), 'reply_to_message' => $this->getReplyToMessage(), 'via_bot' => $this->getViaBot(), @@ -151,6 +158,9 @@ public function _getData(): array 'connected_website' => $this->getConnectedWebsite(), 'passport_data' => $this->getPassportData(), 'proximity_alert_triggered' => $this->getProximityAlertTriggered(), + 'forum_topic_created' => $this->getForumTopicCreated(), + 'forum_topic_closed' => $this->getForumTopicClosed(), + 'forum_topic_reopened' => $this->getForumTopicReopened(), 'video_chat_scheduled' => $this->getVideoChatScheduled(), 'video_chat_started' => $this->getVideoChatStarted(), 'video_chat_ended' => $this->getVideoChatEnded(), @@ -172,6 +182,17 @@ public function _getData(): array */ protected $messageId; + /** + * Optional. Unique identifier of a message thread to which the message belongs; for supergroups only + * + * @var int|null + * @SkipWhenEmpty + * @SerializedName("message_thread_id") + * @Accessor(getter="getMessageThreadId", setter="setMessageThreadId") + * @Type("int") + */ + protected $messageThreadId; + /** * Optional. Sender of the message; empty for messages sent to channels. For backward compatibility, the field * contains a fake sender user in non-channel chats, if the message was sent on behalf of a chat. @@ -287,6 +308,17 @@ public function _getData(): array */ protected $forwardDate; + /** + * Optional. True, if the message is sent to a forum topic + * + * @var bool|null + * @SkipWhenEmpty + * @SerializedName("is_topic_message") + * @Accessor(getter="getIsTopicMessage", setter="setIsTopicMessage") + * @Type("bool") + */ + protected $isTopicMessage; + /** * Optional. True, if the message is a channel post that was automatically forwarded to the connected discussion group * @@ -768,6 +800,39 @@ public function _getData(): array */ protected $proximityAlertTriggered; + /** + * Optional. Service message: forum topic created + * + * @var ForumTopicCreated|null + * @SkipWhenEmpty + * @SerializedName("forum_topic_created") + * @Accessor(getter="getForumTopicCreated", setter="setForumTopicCreated") + * @Type("MadmagesTelegram\Types\Type\ForumTopicCreated") + */ + protected $forumTopicCreated; + + /** + * Optional. Service message: forum topic closed + * + * @var ForumTopicClosed|null + * @SkipWhenEmpty + * @SerializedName("forum_topic_closed") + * @Accessor(getter="getForumTopicClosed", setter="setForumTopicClosed") + * @Type("MadmagesTelegram\Types\Type\ForumTopicClosed") + */ + protected $forumTopicClosed; + + /** + * Optional. Service message: forum topic reopened + * + * @var ForumTopicReopened|null + * @SkipWhenEmpty + * @SerializedName("forum_topic_reopened") + * @Accessor(getter="getForumTopicReopened", setter="setForumTopicReopened") + * @Type("MadmagesTelegram\Types\Type\ForumTopicReopened") + */ + protected $forumTopicReopened; + /** * Optional. Service message: video chat scheduled * @@ -854,6 +919,25 @@ public function getMessageId(): int return $this->messageId; } + /** + * @param int $messageThreadId + * @return static + */ + public function setMessageThreadId(int $messageThreadId): self + { + $this->messageThreadId = $messageThreadId; + + return $this; + } + + /** + * @return int|null + */ + public function getMessageThreadId(): ?int + { + return $this->messageThreadId; + } + /** * @param User $from * @return static @@ -1044,6 +1128,25 @@ public function getForwardDate(): ?int return $this->forwardDate; } + /** + * @param bool $isTopicMessage + * @return static + */ + public function setIsTopicMessage(bool $isTopicMessage): self + { + $this->isTopicMessage = $isTopicMessage; + + return $this; + } + + /** + * @return bool|null + */ + public function getIsTopicMessage(): ?bool + { + return $this->isTopicMessage; + } + /** * @param bool $isAutomaticForward * @return static @@ -1842,6 +1945,63 @@ public function getProximityAlertTriggered(): ?ProximityAlertTriggered return $this->proximityAlertTriggered; } + /** + * @param ForumTopicCreated $forumTopicCreated + * @return static + */ + public function setForumTopicCreated(ForumTopicCreated $forumTopicCreated): self + { + $this->forumTopicCreated = $forumTopicCreated; + + return $this; + } + + /** + * @return ForumTopicCreated|null + */ + public function getForumTopicCreated(): ?ForumTopicCreated + { + return $this->forumTopicCreated; + } + + /** + * @param ForumTopicClosed $forumTopicClosed + * @return static + */ + public function setForumTopicClosed(ForumTopicClosed $forumTopicClosed): self + { + $this->forumTopicClosed = $forumTopicClosed; + + return $this; + } + + /** + * @return ForumTopicClosed|null + */ + public function getForumTopicClosed(): ?ForumTopicClosed + { + return $this->forumTopicClosed; + } + + /** + * @param ForumTopicReopened $forumTopicReopened + * @return static + */ + public function setForumTopicReopened(ForumTopicReopened $forumTopicReopened): self + { + $this->forumTopicReopened = $forumTopicReopened; + + return $this; + } + + /** + * @return ForumTopicReopened|null + */ + public function getForumTopicReopened(): ?ForumTopicReopened + { + return $this->forumTopicReopened; + } + /** * @param VideoChatScheduled $videoChatScheduled * @return static diff --git a/src/Type/ReplyKeyboardMarkup.php b/src/Type/ReplyKeyboardMarkup.php index 24f8df7..ea9224f 100644 --- a/src/Type/ReplyKeyboardMarkup.php +++ b/src/Type/ReplyKeyboardMarkup.php @@ -12,8 +12,7 @@ /** * https://core.telegram.org/bots/api#replykeyboardmarkup * - * This object represents a custom keyboard with reply - * options (see Introduction to bots for details and examples). + * This object represents a custom keyboard with reply options (see Introduction to bots for details and examples). * * @ExclusionPolicy("none") * @AccessType("public_method") diff --git a/src/TypedClient.php b/src/TypedClient.php index 5fe3e96..b27d699 100644 --- a/src/TypedClient.php +++ b/src/TypedClient.php @@ -328,6 +328,9 @@ public function close( * @param string $text * Text of the message to be sent, 1-4096 characters after entities parsing * + * @param int|null $messageThreadId + * Unique identifier for the target message thread (topic) of the forum; for forum supergroups only + * * @param string|null $parseMode * Mode for parsing entities in the message text. See formatting options for more details. * @@ -360,6 +363,7 @@ public function close( public function sendMessage( $chatId, string $text, + int $messageThreadId = null, string $parseMode = null, array $entities = null, bool $disableWebPagePreview = null, @@ -372,6 +376,7 @@ public function sendMessage( { $requestParameters = [ 'chat_id' => $chatId, + 'message_thread_id' => $messageThreadId, 'text' => $text, 'parse_mode' => $parseMode, 'entities' => $entities, @@ -405,6 +410,9 @@ public function sendMessage( * @param int $messageId * Message identifier in the chat specified in from_chat_id * + * @param int|null $messageThreadId + * Unique identifier for the target message thread (topic) of the forum; for forum supergroups only + * * @param bool|null $disableNotification * Sends the message silently. Users will receive a notification with no sound. * @@ -418,12 +426,14 @@ public function forwardMessage( $chatId, $fromChatId, int $messageId, + int $messageThreadId = null, bool $disableNotification = null, bool $protectContent = null ): Type\Message { $requestParameters = [ 'chat_id' => $chatId, + 'message_thread_id' => $messageThreadId, 'from_chat_id' => $fromChatId, 'disable_notification' => $disableNotification, 'protect_content' => $protectContent, @@ -454,6 +464,9 @@ public function forwardMessage( * @param int $messageId * Message identifier in the chat specified in from_chat_id * + * @param int|null $messageThreadId + * Unique identifier for the target message thread (topic) of the forum; for forum supergroups only + * * @param string|null $caption * New caption for media, 0-1024 characters after entities parsing. If not specified, the original caption is * kept @@ -488,6 +501,7 @@ public function copyMessage( $chatId, $fromChatId, int $messageId, + int $messageThreadId = null, string $caption = null, string $parseMode = null, array $captionEntities = null, @@ -500,6 +514,7 @@ public function copyMessage( { $requestParameters = [ 'chat_id' => $chatId, + 'message_thread_id' => $messageThreadId, 'from_chat_id' => $fromChatId, 'message_id' => $messageId, 'caption' => $caption, @@ -533,6 +548,9 @@ public function copyMessage( * 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 int|null $messageThreadId + * Unique identifier for the target message thread (topic) of the forum; for forum supergroups only + * * @param string|null $caption * Photo caption (may also be used when resending photos by file_id), 0-1024 characters after entities parsing * @@ -565,6 +583,7 @@ public function copyMessage( public function sendPhoto( $chatId, $photo, + int $messageThreadId = null, string $caption = null, string $parseMode = null, array $captionEntities = null, @@ -577,6 +596,7 @@ public function sendPhoto( { $requestParameters = [ 'chat_id' => $chatId, + 'message_thread_id' => $messageThreadId, 'photo' => $photo, 'caption' => $caption, 'parse_mode' => $parseMode, @@ -610,6 +630,9 @@ public function sendPhoto( * (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 int|null $messageThreadId + * Unique identifier for the target message thread (topic) of the forum; for forum supergroups only + * * @param string|null $caption * Audio caption, 0-1024 characters after entities parsing * @@ -658,6 +681,7 @@ public function sendPhoto( public function sendAudio( $chatId, $audio, + int $messageThreadId = null, string $caption = null, string $parseMode = null, array $captionEntities = null, @@ -674,6 +698,7 @@ public function sendAudio( { $requestParameters = [ 'chat_id' => $chatId, + 'message_thread_id' => $messageThreadId, 'audio' => $audio, 'caption' => $caption, 'parse_mode' => $parseMode, @@ -710,6 +735,9 @@ public function sendAudio( * 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 int|null $messageThreadId + * Unique identifier for the target message thread (topic) of the forum; for forum supergroups only + * * @param Type\InputFile|string|null $thumb * 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. @@ -753,6 +781,7 @@ public function sendAudio( public function sendDocument( $chatId, $document, + int $messageThreadId = null, $thumb = null, string $caption = null, string $parseMode = null, @@ -767,6 +796,7 @@ public function sendDocument( { $requestParameters = [ 'chat_id' => $chatId, + 'message_thread_id' => $messageThreadId, 'document' => $document, 'thumb' => $thumb, 'caption' => $caption, @@ -801,6 +831,9 @@ public function sendDocument( * 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 int|null $messageThreadId + * Unique identifier for the target message thread (topic) of the forum; for forum supergroups only + * * @param int|null $duration * Duration of sent video in seconds * @@ -852,6 +885,7 @@ public function sendDocument( public function sendVideo( $chatId, $video, + int $messageThreadId = null, int $duration = null, int $width = null, int $height = null, @@ -869,6 +903,7 @@ public function sendVideo( { $requestParameters = [ 'chat_id' => $chatId, + 'message_thread_id' => $messageThreadId, 'video' => $video, 'duration' => $duration, 'width' => $width, @@ -905,6 +940,9 @@ public function sendVideo( * (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 int|null $messageThreadId + * Unique identifier for the target message thread (topic) of the forum; for forum supergroups only + * * @param int|null $duration * Duration of sent animation in seconds * @@ -954,6 +992,7 @@ public function sendVideo( public function sendAnimation( $chatId, $animation, + int $messageThreadId = null, int $duration = null, int $width = null, int $height = null, @@ -970,6 +1009,7 @@ public function sendAnimation( { $requestParameters = [ 'chat_id' => $chatId, + 'message_thread_id' => $messageThreadId, 'animation' => $animation, 'duration' => $duration, 'width' => $width, @@ -1008,6 +1048,9 @@ public function sendAnimation( * 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 int|null $messageThreadId + * Unique identifier for the target message thread (topic) of the forum; for forum supergroups only + * * @param string|null $caption * Voice message caption, 0-1024 characters after entities parsing * @@ -1043,6 +1086,7 @@ public function sendAnimation( public function sendVoice( $chatId, $voice, + int $messageThreadId = null, string $caption = null, string $parseMode = null, array $captionEntities = null, @@ -1056,6 +1100,7 @@ public function sendVoice( { $requestParameters = [ 'chat_id' => $chatId, + 'message_thread_id' => $messageThreadId, 'voice' => $voice, 'caption' => $caption, 'parse_mode' => $parseMode, @@ -1089,6 +1134,9 @@ public function sendVoice( * (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 int|null $messageThreadId + * Unique identifier for the target message thread (topic) of the forum; for forum supergroups only + * * @param int|null $duration * Duration of sent video in seconds * @@ -1124,6 +1172,7 @@ public function sendVoice( public function sendVideoNote( $chatId, $videoNote, + int $messageThreadId = null, int $duration = null, int $length = null, $thumb = null, @@ -1136,6 +1185,7 @@ public function sendVideoNote( { $requestParameters = [ 'chat_id' => $chatId, + 'message_thread_id' => $messageThreadId, 'video_note' => $videoNote, 'duration' => $duration, 'length' => $length, @@ -1167,6 +1217,9 @@ public function sendVideoNote( * @param Type\InputMediaAudio[]|Type\InputMediaDocument[]|Type\InputMediaPhoto[]|Type\InputMediaVideo[] $media * A JSON-serialized array describing messages to be sent, must include 2-10 items * + * @param int|null $messageThreadId + * Unique identifier for the target message thread (topic) of the forum; for forum supergroups only + * * @param bool|null $disableNotification * Sends messages silently. Users will receive a notification with no sound. * @@ -1185,6 +1238,7 @@ public function sendVideoNote( public function sendMediaGroup( $chatId, array $media, + int $messageThreadId = null, bool $disableNotification = null, bool $protectContent = null, int $replyToMessageId = null, @@ -1193,6 +1247,7 @@ public function sendMediaGroup( { $requestParameters = [ 'chat_id' => $chatId, + 'message_thread_id' => $messageThreadId, 'media' => $media, 'disable_notification' => $disableNotification, 'protect_content' => $protectContent, @@ -1221,6 +1276,9 @@ public function sendMediaGroup( * @param float $longitude * Longitude of the location * + * @param int|null $messageThreadId + * Unique identifier for the target message thread (topic) of the forum; for forum supergroups only + * * @param float|null $horizontalAccuracy * The radius of uncertainty for the location, measured in meters; 0-1500 * @@ -1257,6 +1315,7 @@ public function sendLocation( $chatId, float $latitude, float $longitude, + int $messageThreadId = null, float $horizontalAccuracy = null, int $livePeriod = null, int $heading = null, @@ -1270,6 +1329,7 @@ public function sendLocation( { $requestParameters = [ 'chat_id' => $chatId, + 'message_thread_id' => $messageThreadId, 'latitude' => $latitude, 'longitude' => $longitude, 'horizontal_accuracy' => $horizontalAccuracy, @@ -1428,6 +1488,9 @@ public function stopMessageLiveLocation( * @param string $address * Address of the venue * + * @param int|null $messageThreadId + * Unique identifier for the target message thread (topic) of the forum; for forum supergroups only + * * @param string|null $foursquareId * Foursquare identifier of the venue * @@ -1466,6 +1529,7 @@ public function sendVenue( float $longitude, string $title, string $address, + int $messageThreadId = null, string $foursquareId = null, string $foursquareType = null, string $googlePlaceId = null, @@ -1479,6 +1543,7 @@ public function sendVenue( { $requestParameters = [ 'chat_id' => $chatId, + 'message_thread_id' => $messageThreadId, 'latitude' => $latitude, 'longitude' => $longitude, 'title' => $title, @@ -1515,6 +1580,9 @@ public function sendVenue( * @param string $firstName * Contact's first name * + * @param int|null $messageThreadId + * Unique identifier for the target message thread (topic) of the forum; for forum supergroups only + * * @param string|null $lastName * Contact's last name * @@ -1535,7 +1603,7 @@ public function sendVenue( * * @param Type\InlineKeyboardMarkup|Type\ReplyKeyboardMarkup|Type\ReplyKeyboardRemove|Type\ForceReply|null $replyMarkup * Additional interface options. A JSON-serialized object for an inline keyboard, custom reply keyboard, - * instructions to remove keyboard or to force a reply from the user. + * instructions to remove reply keyboard or to force a reply from the user. * * @return Type\Message * @throws TelegramException @@ -1544,6 +1612,7 @@ public function sendContact( $chatId, string $phoneNumber, string $firstName, + int $messageThreadId = null, string $lastName = null, string $vcard = null, bool $disableNotification = null, @@ -1555,6 +1624,7 @@ public function sendContact( { $requestParameters = [ 'chat_id' => $chatId, + 'message_thread_id' => $messageThreadId, 'phone_number' => $phoneNumber, 'first_name' => $firstName, 'last_name' => $lastName, @@ -1587,6 +1657,9 @@ public function sendContact( * @param string[] $options * A JSON-serialized list of answer options, 2-10 strings 1-100 characters each * + * @param int|null $openPeriod + * Amount of time in seconds the poll will be active after creation, 5-600. Can't be used together with close_date. + * * @param bool|null $allowSendingWithoutReply * Pass True if the message should be sent even if the specified replied-to message is not found * @@ -1606,15 +1679,15 @@ public function sendContact( * Point in time (Unix timestamp) when the poll will be automatically closed. Must be at least 5 and no more than 600 * seconds in the future. Can't be used together with open_period. * + * @param string|null $explanationParseMode + * Mode for parsing entities in the explanation. See formatting options for more details. + * * @param Type\MessageEntity[]|null $explanationEntities * A JSON-serialized list of special entities that appear in the poll explanation, which can be specified instead * of parse_mode * - * @param int|null $openPeriod - * Amount of time in seconds the poll will be active after creation, 5-600. Can't be used together with close_date. - * - * @param string|null $explanationParseMode - * Mode for parsing entities in the explanation. See formatting options for more details. + * @param int|null $messageThreadId + * Unique identifier for the target message thread (topic) of the forum; for forum supergroups only * * @param string|null $explanation * Text that is shown when a user chooses an incorrect answer or taps on the lamp icon in a quiz-style poll, 0-200 @@ -1643,15 +1716,16 @@ public function sendPoll( $chatId, string $question, array $options, + int $openPeriod = null, bool $allowSendingWithoutReply = null, int $replyToMessageId = null, bool $protectContent = null, bool $disableNotification = null, bool $isClosed = null, int $closeDate = null, - array $explanationEntities = null, - int $openPeriod = null, string $explanationParseMode = null, + array $explanationEntities = null, + int $messageThreadId = null, string $explanation = null, int $correctOptionId = null, bool $allowsMultipleAnswers = null, @@ -1662,6 +1736,7 @@ public function sendPoll( { $requestParameters = [ 'chat_id' => $chatId, + 'message_thread_id' => $messageThreadId, 'question' => $question, 'options' => $options, 'is_anonymous' => $isAnonymous, @@ -1696,6 +1771,9 @@ public function sendPoll( * @param int|string $chatId * Unique identifier for the target chat or username of the target channel (in the format @|channelusername) * + * @param int|null $messageThreadId + * Unique identifier for the target message thread (topic) of the forum; for forum supergroups only + * * @param string|null $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 @@ -1722,6 +1800,7 @@ public function sendPoll( */ public function sendDice( $chatId, + int $messageThreadId = null, string $emoji = null, bool $disableNotification = null, bool $protectContent = null, @@ -1732,6 +1811,7 @@ public function sendDice( { $requestParameters = [ 'chat_id' => $chatId, + 'message_thread_id' => $messageThreadId, 'emoji' => $emoji, 'disable_notification' => $disableNotification, 'protect_content' => $protectContent, @@ -2031,6 +2111,9 @@ public function restrictChatMember( * @param bool|null $canPinMessages * Pass True if the administrator can pin messages, supergroups only * + * @param bool|null $canManageTopics + * Pass True if the user is allowed to create, rename, close, and reopen forum topics, supergroups only + * * @return bool * @throws TelegramException */ @@ -2047,7 +2130,8 @@ public function promoteChatMember( bool $canPromoteMembers = null, bool $canChangeInfo = null, bool $canInviteUsers = null, - bool $canPinMessages = null + bool $canPinMessages = null, + bool $canManageTopics = null ): bool { $requestParameters = [ @@ -2064,6 +2148,7 @@ public function promoteChatMember( 'can_change_info' => $canChangeInfo, 'can_invite_users' => $canInviteUsers, 'can_pin_messages' => $canPinMessages, + 'can_manage_topics' => $canManageTopics, ]; $returnType = [ @@ -2507,7 +2592,7 @@ public function deleteChatPhoto( * Unique identifier for the target chat or username of the target channel (in the format @|channelusername) * * @param string $title - * New chat title, 1-255 characters + * New chat title, 1-128 characters * * @return bool * @throws TelegramException @@ -2869,11 +2954,261 @@ public function deleteChatStickerSet( return $this->_requestWithMap('deleteChatStickerSet', $requestParameters, $returnType); } + /** + * https://core.telegram.org/bots/api#getforumtopiciconstickers + * + * Use this method to get custom emoji stickers, which can be used as a forum topic icon by any user. Requires no + * parameters. Returns an Array of Sticker objects. + * + * @return Type\Sticker[] + * @throws TelegramException + */ + public function getForumTopicIconStickers( + ): array + { + $requestParameters = [ + ]; + + $returnType = [ + 'array<' . Type\Sticker::class . '>', + ]; + + return $this->_requestWithMap('getForumTopicIconStickers', $requestParameters, $returnType); + } + + /** + * https://core.telegram.org/bots/api#createforumtopic + * + * Use this method to create a topic in a forum supergroup chat. The bot must be an administrator in the chat for this to + * work and must have the can_manage_topics administrator rights. Returns information about the created topic + * as a ForumTopic object. + * + * @param int|string $chatId + * Unique identifier for the target chat or username of the target supergroup (in the format + * @|supergroupusername) + * + * @param string $name + * Topic name, 1-128 characters + * + * @param int|null $iconColor + * Color of the topic icon in RGB format. Currently, must be one of 0x6FB9F0, 0xFFD67E, 0xCB86DB, 0x8EEE98, + * 0xFF93B2, or 0xFB6F5F + * + * @param string|null $iconCustomEmojiId + * Unique identifier of the custom emoji shown as the topic icon. Use getForumTopicIconStickers to get all + * allowed custom emoji identifiers. + * + * @return Type\ForumTopic + * @throws TelegramException + */ + public function createForumTopic( + $chatId, + string $name, + int $iconColor = null, + string $iconCustomEmojiId = null + ): Type\ForumTopic + { + $requestParameters = [ + 'chat_id' => $chatId, + 'name' => $name, + 'icon_color' => $iconColor, + 'icon_custom_emoji_id' => $iconCustomEmojiId, + ]; + + $returnType = [ + Type\ForumTopic::class, + ]; + + return $this->_requestWithMap('createForumTopic', $requestParameters, $returnType); + } + + /** + * https://core.telegram.org/bots/api#editforumtopic + * + * Use this method to edit name and icon of a topic in a forum supergroup chat. The bot must be an administrator in the chat + * for this to work and must have can_manage_topics administrator rights, unless it is the creator of the topic. + * Returns True on success. + * + * @param int|string $chatId + * Unique identifier for the target chat or username of the target supergroup (in the format + * @|supergroupusername) + * + * @param int $messageThreadId + * Unique identifier for the target message thread of the forum topic + * + * @param string $name + * New topic name, 1-128 characters + * + * @param string $iconCustomEmojiId + * New unique identifier of the custom emoji shown as the topic icon. Use getForumTopicIconStickers to get all + * allowed custom emoji identifiers + * + * @return bool + * @throws TelegramException + */ + public function editForumTopic( + $chatId, + int $messageThreadId, + string $name, + string $iconCustomEmojiId + ): bool + { + $requestParameters = [ + 'chat_id' => $chatId, + 'message_thread_id' => $messageThreadId, + 'name' => $name, + 'icon_custom_emoji_id' => $iconCustomEmojiId, + ]; + + $returnType = [ + 'bool', + ]; + + return $this->_requestWithMap('editForumTopic', $requestParameters, $returnType); + } + + /** + * https://core.telegram.org/bots/api#closeforumtopic + * + * Use this method to close an open topic in a forum supergroup chat. The bot must be an administrator in the chat for this + * to work and must have the can_manage_topics administrator rights, unless it is the creator of the topic. + * Returns True on success. + * + * @param int|string $chatId + * Unique identifier for the target chat or username of the target supergroup (in the format + * @|supergroupusername) + * + * @param int $messageThreadId + * Unique identifier for the target message thread of the forum topic + * + * @return bool + * @throws TelegramException + */ + public function closeForumTopic( + $chatId, + int $messageThreadId + ): bool + { + $requestParameters = [ + 'chat_id' => $chatId, + 'message_thread_id' => $messageThreadId, + ]; + + $returnType = [ + 'bool', + ]; + + return $this->_requestWithMap('closeForumTopic', $requestParameters, $returnType); + } + + /** + * https://core.telegram.org/bots/api#reopenforumtopic + * + * Use this method to reopen a closed topic in a forum supergroup chat. The bot must be an administrator in the chat for + * this to work and must have the can_manage_topics administrator rights, unless it is the creator of the topic. + * Returns True on success. + * + * @param int|string $chatId + * Unique identifier for the target chat or username of the target supergroup (in the format + * @|supergroupusername) + * + * @param int $messageThreadId + * Unique identifier for the target message thread of the forum topic + * + * @return bool + * @throws TelegramException + */ + public function reopenForumTopic( + $chatId, + int $messageThreadId + ): bool + { + $requestParameters = [ + 'chat_id' => $chatId, + 'message_thread_id' => $messageThreadId, + ]; + + $returnType = [ + 'bool', + ]; + + return $this->_requestWithMap('reopenForumTopic', $requestParameters, $returnType); + } + + /** + * https://core.telegram.org/bots/api#deleteforumtopic + * + * Use this method to delete a forum topic along with all its messages in a forum supergroup chat. The bot must be an + * administrator in the chat for this to work and must have the can_delete_messages administrator rights. Returns + * True on success. + * + * @param int|string $chatId + * Unique identifier for the target chat or username of the target supergroup (in the format + * @|supergroupusername) + * + * @param int $messageThreadId + * Unique identifier for the target message thread of the forum topic + * + * @return bool + * @throws TelegramException + */ + public function deleteForumTopic( + $chatId, + int $messageThreadId + ): bool + { + $requestParameters = [ + 'chat_id' => $chatId, + 'message_thread_id' => $messageThreadId, + ]; + + $returnType = [ + 'bool', + ]; + + return $this->_requestWithMap('deleteForumTopic', $requestParameters, $returnType); + } + + /** + * https://core.telegram.org/bots/api#unpinallforumtopicmessages + * + * Use this method to clear the list of pinned messages in a forum topic. The bot must be an administrator in the chat for + * this to work and must have the can_pin_messages administrator right in the supergroup. Returns + * True on success. + * + * @param int|string $chatId + * Unique identifier for the target chat or username of the target supergroup (in the format + * @|supergroupusername) + * + * @param int $messageThreadId + * Unique identifier for the target message thread of the forum topic + * + * @return bool + * @throws TelegramException + */ + public function unpinAllForumTopicMessages( + $chatId, + int $messageThreadId + ): bool + { + $requestParameters = [ + 'chat_id' => $chatId, + 'message_thread_id' => $messageThreadId, + ]; + + $returnType = [ + 'bool', + ]; + + return $this->_requestWithMap('unpinAllForumTopicMessages', $requestParameters, $returnType); + } + /** * https://core.telegram.org/bots/api#answercallbackquery * - * Use this method to send answers to callback queries sent from inline keyboards. The answer will be displayed to the user as a notification at the top of the chat screen or as an alert. - * On success, True is returned. + * Use this method to send answers to callback queries sent from inline + * keyboards. The answer will be displayed to the user as a notification at the top of the chat screen or as an alert. On success, + * True is returned. * * @param string $callbackQueryId * Unique identifier for the query to be answered @@ -2923,8 +3258,8 @@ public function answerCallbackQuery( /** * https://core.telegram.org/bots/api#setmycommands * - * Use this method to change the list of the bot's commands. See https://core.telegram.org/bots#commands for more - * details about bot commands. Returns True on success. + * Use this method to change the list of the bot's commands. See this manual + * for more details about bot commands. Returns True on success. * * @param Type\BotCommand[] $commands * A JSON-serialized list of bot commands to be set as the list of the bot's commands. At most 100 commands can be @@ -3407,12 +3742,12 @@ public function stopPoll( * https://core.telegram.org/bots/api#deletemessage * * 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.- 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. + * 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. * * @param int|string $chatId * Unique identifier for the target chat or username of the target channel (in the format @|channelusername) @@ -3455,6 +3790,9 @@ public function deleteMessage( * an HTTP URL as a String for Telegram to get a .WEBP file from the Internet, or upload a new one using * multipart/form-data. More information on Sending Files » * + * @param int|null $messageThreadId + * Unique identifier for the target message thread (topic) of the forum; for forum supergroups only + * * @param bool|null $disableNotification * Sends the message silently. Users will receive a notification with no sound. * @@ -3477,6 +3815,7 @@ public function deleteMessage( public function sendSticker( $chatId, $sticker, + int $messageThreadId = null, bool $disableNotification = null, bool $protectContent = null, int $replyToMessageId = null, @@ -3486,6 +3825,7 @@ public function sendSticker( { $requestParameters = [ 'chat_id' => $chatId, + 'message_thread_id' => $messageThreadId, 'sticker' => $sticker, 'disable_notification' => $disableNotification, 'protect_content' => $protectContent, @@ -3934,6 +4274,9 @@ public function answerWebAppQuery( * @param int|string $chatId * Unique identifier for the target chat or username of the target channel (in the format @|channelusername) * + * @param string $title + * Product name, 1-32 characters + * * @param string $description * Product description, 1-255 characters * @@ -3951,9 +4294,6 @@ public function answerWebAppQuery( * Price breakdown, a JSON-serialized list of components (e.g. product price, tax, discount, delivery cost, * delivery tax, bonus, etc.) * - * @param string $title - * Product name, 1-32 characters - * * @param bool|null $needEmail * Pass True if you require the user's email address to complete the order * @@ -3993,6 +4333,9 @@ public function answerWebAppQuery( * @param int|null $photoHeight * Photo height * + * @param int|null $messageThreadId + * Unique identifier for the target message thread (topic) of the forum; for forum supergroups only + * * @param int|null $photoSize * Photo size in bytes * @@ -4029,12 +4372,12 @@ public function answerWebAppQuery( */ public function sendInvoice( $chatId, + string $title, string $description, string $payload, string $providerToken, string $currency, array $prices, - string $title, bool $needEmail = null, bool $allowSendingWithoutReply = null, int $replyToMessageId = null, @@ -4048,6 +4391,7 @@ public function sendInvoice( bool $needPhoneNumber = null, bool $needName = null, int $photoHeight = null, + int $messageThreadId = null, int $photoSize = null, string $photoUrl = null, string $providerData = null, @@ -4059,6 +4403,7 @@ public function sendInvoice( { $requestParameters = [ 'chat_id' => $chatId, + 'message_thread_id' => $messageThreadId, 'title' => $title, 'description' => $description, 'payload' => $payload, @@ -4357,6 +4702,9 @@ public function setPassportDataErrors( * @param string $gameShortName * Short name of the game, serves as the unique identifier for the game. Set up your games via @|BotFather. * + * @param int|null $messageThreadId + * Unique identifier for the target message thread (topic) of the forum; for forum supergroups only + * * @param bool|null $disableNotification * Sends the message silently. Users will receive a notification with no sound. * @@ -4379,6 +4727,7 @@ public function setPassportDataErrors( public function sendGame( int $chatId, string $gameShortName, + int $messageThreadId = null, bool $disableNotification = null, bool $protectContent = null, int $replyToMessageId = null, @@ -4388,6 +4737,7 @@ public function sendGame( { $requestParameters = [ 'chat_id' => $chatId, + 'message_thread_id' => $messageThreadId, 'game_short_name' => $gameShortName, 'disable_notification' => $disableNotification, 'protect_content' => $protectContent,