diff --git a/src/Layers/Generated.php b/src/Layers/Generated.php index aebaeb3..b65b6f5 100644 --- a/src/Layers/Generated.php +++ b/src/Layers/Generated.php @@ -39,6 +39,7 @@ use Telepath\Telegram\InputProfilePhoto; use Telepath\Telegram\InputSticker; use Telepath\Telegram\InputStoryContent; +use Telepath\Telegram\KeyboardButton; use Telepath\Telegram\LabeledPrice; use Telepath\Telegram\LinkPreviewOptions; use Telepath\Telegram\MaskPosition; @@ -50,6 +51,7 @@ use Telepath\Telegram\PassportElementError; use Telepath\Telegram\Poll; use Telepath\Telegram\PreparedInlineMessage; +use Telepath\Telegram\PreparedKeyboardButton; use Telepath\Telegram\ReactionType; use Telepath\Telegram\ReplyKeyboardMarkup; use Telepath\Telegram\ReplyKeyboardRemove; @@ -66,6 +68,7 @@ use Telepath\Telegram\Update; use Telepath\Telegram\User; use Telepath\Telegram\UserChatBoosts; +use Telepath\Telegram\UserProfileAudios; use Telepath\Telegram\UserProfilePhotos; use Telepath\Telegram\WebhookInfo; use Telepath\Types\Enums\ChatActionType; @@ -898,14 +901,21 @@ public function sendContact( * @param MessageEntity[] $question_entities A JSON-serialized list of special entities that appear in the poll question. It can be specified instead of question_parse_mode * @param bool $is_anonymous True, if the poll needs to be anonymous, defaults to True * @param string $type Poll type, “quiz” or “regular”, defaults to “regular” - * @param bool $allows_multiple_answers True, if the poll allows multiple answers, ignored for polls in quiz mode, defaults to False - * @param int $correct_option_id 0-based identifier of the correct answer option, required for polls in quiz mode + * @param bool $allows_multiple_answers Pass True, if the poll allows multiple answers, defaults to False + * @param bool $allows_revoting Pass True, if the poll allows to change chosen answer options, defaults to False for quizzes and to True for regular polls + * @param bool $shuffle_options Pass True, if the poll options must be shown in random order + * @param bool $allow_adding_options Pass True, if answer options can be added to the poll after creation; not supported for anonymous polls and quizzes + * @param bool $hide_results_until_closes Pass True, if poll results must be shown only after the poll closes + * @param int[] $correct_option_ids A JSON-serialized list of monotonically increasing 0-based identifiers of the correct answer options, required for polls in quiz mode * @param string $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 characters with at most 2 line feeds after entities parsing * @param string $explanation_parse_mode Mode for parsing entities in the explanation. See formatting options for more details. * @param MessageEntity[] $explanation_entities A JSON-serialized list of special entities that appear in the poll explanation. It can be specified instead of explanation_parse_mode - * @param int $open_period Amount of time in seconds the poll will be active after creation, 5-600. Can't be used together with close_date. - * @param int $close_date 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 int $open_period Amount of time in seconds the poll will be active after creation, 5-2628000. Can't be used together with close_date. + * @param int $close_date Point in time (Unix timestamp) when the poll will be automatically closed. Must be at least 5 and no more than 2628000 seconds in the future. Can't be used together with open_period. * @param bool $is_closed Pass True if the poll needs to be immediately closed. This can be useful for poll preview. + * @param string $description Description of the poll to be sent, 0-1024 characters after entities parsing + * @param string $description_parse_mode Mode for parsing entities in the poll description. See formatting options for more details. + * @param MessageEntity[] $description_entities A JSON-serialized list of special entities that appear in the poll description, which can be specified instead of description_parse_mode * @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 @@ -926,13 +936,20 @@ public function sendPoll( ?bool $is_anonymous = null, ?string $type = null, ?bool $allows_multiple_answers = null, - ?int $correct_option_id = null, + ?bool $allows_revoting = null, + ?bool $shuffle_options = null, + ?bool $allow_adding_options = null, + ?bool $hide_results_until_closes = null, + ?array $correct_option_ids = null, ?string $explanation = null, ?string $explanation_parse_mode = null, ?array $explanation_entities = null, ?int $open_period = null, ?int $close_date = null, ?bool $is_closed = null, + ?string $description = null, + ?string $description_parse_mode = null, + ?array $description_entities = null, ?bool $disable_notification = null, ?bool $protect_content = null, ?bool $allow_paid_broadcast = null, @@ -953,7 +970,7 @@ public function sendPoll( * @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 + * @param InlineKeyboardMarkup $reply_markup A JSON-serialized object for an inline keyboard * * @throws TelegramException */ @@ -1006,7 +1023,7 @@ public function sendDice( } /** - * Use this method to stream a partial message to a user while the message is being generated; supported only for bots with forum topic mode enabled. Returns True on success. + * Use this method to stream a partial message to a user while the message is being generated. Returns True on success. * * @param int $chat_id Unique identifier for the target private chat * @param int $draft_id Unique identifier of the message draft; must be non-zero. Changes of drafts with the same identifier are animated @@ -1080,6 +1097,20 @@ public function getUserProfilePhotos(int $user_id, ?int $offset = null, ?int $li return $this->raw('getUserProfilePhotos', func_get_args()); } + /** + * Use this method to get a list of profile audios for a user. Returns a UserProfileAudios object. + * + * @param int $user_id Unique identifier of the target user + * @param int $offset Sequential number of the first audio to be returned. By default, all audios are returned. + * @param int $limit Limits the number of audios to be retrieved. Values between 1-100 are accepted. Defaults to 100. + * + * @throws TelegramException + */ + public function getUserProfileAudios(int $user_id, ?int $offset = null, ?int $limit = null): UserProfileAudios + { + return $this->raw('getUserProfileAudios', func_get_args()); + } + /** * Changes the emoji status for a given user that previously allowed the bot to manage their emoji status via the Mini App method requestEmojiStatusAccess. Returns True on success. * @@ -1184,6 +1215,7 @@ public function restrictChatMember( * @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 + * @param bool $can_manage_tags Pass True if the administrator can edit the tags of regular members; for groups and supergroups only * * @throws TelegramException */ @@ -1206,6 +1238,7 @@ public function promoteChatMember( ?bool $can_pin_messages = null, ?bool $can_manage_topics = null, ?bool $can_manage_direct_messages = null, + ?bool $can_manage_tags = null, ): bool { return $this->raw('promoteChatMember', func_get_args()); } @@ -1224,6 +1257,20 @@ public function setChatAdministratorCustomTitle(int|string $chat_id, int $user_i return $this->raw('setChatAdministratorCustomTitle', func_get_args()); } + /** + * Use this method to set a tag for a regular member in a group or a supergroup. The bot must be an administrator in the chat for this to work and must have the can_manage_tags administrator right. Returns True on success. + * + * @param int|string $chat_id Unique identifier for the target chat or username of the target supergroup (in the format @supergroupusername) + * @param int $user_id Unique identifier of the target user + * @param string $tag New tag for the member; 0-16 characters, emoji are not allowed + * + * @throws TelegramException + */ + public function setChatMemberTag(int|string $chat_id, int $user_id, ?string $tag = null): bool + { + return $this->raw('setChatMemberTag', func_get_args()); + } + /** * Use this method to ban a channel chat in a supergroup or a channel. Until the chat is unbanned, the owner of the banned chat won't be able to send messages on behalf of any of their channels. The bot must be an administrator in the supergroup or channel for this to work and must have the appropriate administrator rights. Returns True on success. * @@ -1597,7 +1644,7 @@ public function getForumTopicIconStickers(): array } /** - * 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. + * Use this method to create a topic in a forum supergroup chat or a private chat with a user. In the case of a supergroup chat the bot must be an administrator in the chat for this to work and must have the can_manage_topics administrator right. Returns information about the created topic as a ForumTopic object. * * @param int|string $chat_id Unique identifier for the target chat or username of the target supergroup (in the format @supergroupusername) * @param string $name Topic name, 1-128 characters @@ -1805,6 +1852,30 @@ public function getBusinessConnection(string $business_connection_id): BusinessC return $this->raw('getBusinessConnection', func_get_args()); } + /** + * Use this method to get the token of a managed bot. Returns the token as String on success. + * + * @param int $user_id User identifier of the managed bot whose token will be returned + * + * @throws TelegramException + */ + public function getManagedBotToken(int $user_id): string + { + return $this->raw('getManagedBotToken', func_get_args()); + } + + /** + * Use this method to revoke the current token of a managed bot and generate a new one. Returns the new token as String on success. + * + * @param int $user_id User identifier of the managed bot whose token will be replaced + * + * @throws TelegramException + */ + public function replaceManagedBotToken(int $user_id): string + { + return $this->raw('replaceManagedBotToken', func_get_args()); + } + /** * 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. * @@ -1924,6 +1995,18 @@ public function getMyShortDescription(?string $language_code = null): BotShortDe return $this->raw('getMyShortDescription', func_get_args()); } + /** + * Changes the profile photo of the bot. Returns True on success. + * + * @param InputProfilePhoto $photo The new profile photo to set + * + * @throws TelegramException + */ + public function setMyProfilePhoto(InputProfilePhoto $photo): bool + { + return $this->raw('setMyProfilePhoto', func_get_args()); + } + /** * Use this method to change the bot's menu button in a private chat, or the default menu button. Returns True on success. * @@ -1984,8 +2067,8 @@ public function getMyDefaultAdministratorRights(?bool $for_channels = null): Cha * @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. + * @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”, “custom_emoji”, and “date_time” 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”, “custom_emoji”, and “date_time” are ignored. * * @throws TelegramException */ @@ -2008,8 +2091,8 @@ public function sendGift( * @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. + * @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”, “custom_emoji”, and “date_time” 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”, “custom_emoji”, and “date_time” are ignored. * * @throws TelegramException */ @@ -2452,6 +2535,55 @@ public function deleteStory(string $business_connection_id, int $story_id): bool return $this->raw('deleteStory', func_get_args()); } + /** + * Use this method to set the result of an interaction with a Web App and send a corresponding message on behalf of the user to the chat from which the query originated. On success, a SentWebAppMessage object is returned. + * + * @param string $web_app_query_id Unique identifier for the query to be answered + * @param InlineQueryResult $result A JSON-serialized object describing the message to be sent + * + * @throws TelegramException + */ + public function answerWebAppQuery(string $web_app_query_id, InlineQueryResult $result): SentWebAppMessage + { + return $this->raw('answerWebAppQuery', func_get_args()); + } + + /** + * Stores a message that can be sent by a user of a Mini App. Returns a PreparedInlineMessage object. + * + * @param int $user_id Unique identifier of the target user that can use the prepared message + * @param InlineQueryResult $result A JSON-serialized object describing the message to be sent + * @param bool $allow_user_chats Pass True if the message can be sent to private chats with users + * @param bool $allow_bot_chats Pass True if the message can be sent to private chats with bots + * @param bool $allow_group_chats Pass True if the message can be sent to group and supergroup chats + * @param bool $allow_channel_chats Pass True if the message can be sent to channel chats + * + * @throws TelegramException + */ + public function savePreparedInlineMessage( + int $user_id, + InlineQueryResult $result, + ?bool $allow_user_chats = null, + ?bool $allow_bot_chats = null, + ?bool $allow_group_chats = null, + ?bool $allow_channel_chats = null, + ): PreparedInlineMessage { + return $this->raw('savePreparedInlineMessage', func_get_args()); + } + + /** + * Stores a keyboard button that can be used by a user within a Mini App. Returns a PreparedKeyboardButton object. + * + * @param int $user_id Unique identifier of the target user that can use the button + * @param KeyboardButton $button A JSON-serialized object describing the button to be saved. The button must be of the type request_users, request_chat, or request_managed_bot + * + * @throws TelegramException + */ + public function savePreparedKeyboardButton(int $user_id, KeyboardButton $button): PreparedKeyboardButton + { + return $this->raw('savePreparedKeyboardButton', 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. * @@ -2594,7 +2726,7 @@ public function stopMessageLiveLocation( * @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 + * @param InlineKeyboardMarkup $reply_markup A JSON-serialized object for the new inline keyboard for the message * * @throws TelegramException */ @@ -2974,42 +3106,6 @@ public function answerInlineQuery( return $this->raw('answerInlineQuery', func_get_args()); } - /** - * Use this method to set the result of an interaction with a Web App and send a corresponding message on behalf of the user to the chat from which the query originated. On success, a SentWebAppMessage object is returned. - * - * @param string $web_app_query_id Unique identifier for the query to be answered - * @param InlineQueryResult $result A JSON-serialized object describing the message to be sent - * - * @throws TelegramException - */ - public function answerWebAppQuery(string $web_app_query_id, InlineQueryResult $result): SentWebAppMessage - { - return $this->raw('answerWebAppQuery', func_get_args()); - } - - /** - * Stores a message that can be sent by a user of a Mini App. Returns a PreparedInlineMessage object. - * - * @param int $user_id Unique identifier of the target user that can use the prepared message - * @param InlineQueryResult $result A JSON-serialized object describing the message to be sent - * @param bool $allow_user_chats Pass True if the message can be sent to private chats with users - * @param bool $allow_bot_chats Pass True if the message can be sent to private chats with bots - * @param bool $allow_group_chats Pass True if the message can be sent to group and supergroup chats - * @param bool $allow_channel_chats Pass True if the message can be sent to channel chats - * - * @throws TelegramException - */ - public function savePreparedInlineMessage( - int $user_id, - InlineQueryResult $result, - ?bool $allow_user_chats = null, - ?bool $allow_bot_chats = null, - ?bool $allow_group_chats = null, - ?bool $allow_channel_chats = null, - ): PreparedInlineMessage { - return $this->raw('savePreparedInlineMessage', func_get_args()); - } - /** * Use this method to send invoices. On success, the sent Message is returned. * diff --git a/src/Telegram/ChatAdministratorRights.php b/src/Telegram/ChatAdministratorRights.php index 301f67c..81be26f 100644 --- a/src/Telegram/ChatAdministratorRights.php +++ b/src/Telegram/ChatAdministratorRights.php @@ -61,6 +61,9 @@ class ChatAdministratorRights extends Type /** 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. True, if the administrator can edit the tags of regular members; for groups and supergroups only. If omitted defaults to the value of can_pin_messages. */ + public ?bool $can_manage_tags = 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, ignore slow mode, and send messages to the chat without paying Telegram Stars. Implied by any other administrator privilege. @@ -78,6 +81,7 @@ class ChatAdministratorRights extends Type * @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 bool $can_manage_tags Optional. True, if the administrator can edit the tags of regular members; for groups and supergroups only. If omitted defaults to the value of can_pin_messages. */ public static function make( bool $is_anonymous, @@ -96,6 +100,7 @@ public static function make( ?bool $can_pin_messages = null, ?bool $can_manage_topics = null, ?bool $can_manage_direct_messages = null, + ?bool $can_manage_tags = null, ): static { return new static([ 'is_anonymous' => $is_anonymous, @@ -114,6 +119,7 @@ public static function make( 'can_pin_messages' => $can_pin_messages, 'can_manage_topics' => $can_manage_topics, 'can_manage_direct_messages' => $can_manage_direct_messages, + 'can_manage_tags' => $can_manage_tags, ]); } } diff --git a/src/Telegram/ChatFullInfo.php b/src/Telegram/ChatFullInfo.php index 2c092b6..a49f494 100644 --- a/src/Telegram/ChatFullInfo.php +++ b/src/Telegram/ChatFullInfo.php @@ -165,6 +165,9 @@ class ChatFullInfo extends Type /** Optional. For private chats, the rating of the user if any */ public ?UserRating $rating = null; + /** Optional. For private chats, the first audio added to the profile of the user */ + public ?Audio $first_profile_audio = null; + /** Optional. The color scheme based on a unique gift that must be used for the chat's name, message replies and link previews */ public ?UniqueGiftColors $unique_gift_colors = null; @@ -220,6 +223,7 @@ class ChatFullInfo extends Type * @param int $linked_chat_id Optional. Unique identifier for the linked chat, i.e. the discussion group identifier for a channel and vice versa; for supergroups and channel chats. This identifier may be greater than 32 bits and some programming languages may have difficulty/silent defects in interpreting it. But it is smaller than 52 bits, so a signed 64 bit integer or double-precision float type are safe for storing this identifier. * @param ChatLocation $location Optional. For supergroups, the location to which the supergroup is connected * @param UserRating $rating Optional. For private chats, the rating of the user if any + * @param Audio $first_profile_audio Optional. For private chats, the first audio added to the profile of the user * @param UniqueGiftColors $unique_gift_colors Optional. The color scheme based on a unique gift that must be used for the chat's name, message replies and link previews * @param int $paid_message_star_count Optional. The number of Telegram Stars a general user have to pay to send a message to the chat */ @@ -272,6 +276,7 @@ public static function make( ?int $linked_chat_id = null, ?ChatLocation $location = null, ?UserRating $rating = null, + ?Audio $first_profile_audio = null, ?UniqueGiftColors $unique_gift_colors = null, ?int $paid_message_star_count = null, ): static { @@ -324,6 +329,7 @@ public static function make( 'linked_chat_id' => $linked_chat_id, 'location' => $location, 'rating' => $rating, + 'first_profile_audio' => $first_profile_audio, 'unique_gift_colors' => $unique_gift_colors, 'paid_message_star_count' => $paid_message_star_count, ]); diff --git a/src/Telegram/ChatMemberAdministrator.php b/src/Telegram/ChatMemberAdministrator.php index a471fc9..925b380 100644 --- a/src/Telegram/ChatMemberAdministrator.php +++ b/src/Telegram/ChatMemberAdministrator.php @@ -65,6 +65,9 @@ class ChatMemberAdministrator extends ChatMember /** 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. True, if the administrator can edit the tags of regular members; for groups and supergroups only. If omitted defaults to the value of can_pin_messages. */ + public ?bool $can_manage_tags = null; + /** Optional. Custom title for this user */ public ?string $custom_title = null; @@ -87,6 +90,7 @@ class ChatMemberAdministrator extends ChatMember * @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 bool $can_manage_tags Optional. True, if the administrator can edit the tags of regular members; for groups and supergroups only. If omitted defaults to the value of can_pin_messages. * @param string $custom_title Optional. Custom title for this user */ public static function make( @@ -108,6 +112,7 @@ public static function make( ?bool $can_pin_messages = null, ?bool $can_manage_topics = null, ?bool $can_manage_direct_messages = null, + ?bool $can_manage_tags = null, ?string $custom_title = null, ): static { return new static([ @@ -129,6 +134,7 @@ public static function make( 'can_pin_messages' => $can_pin_messages, 'can_manage_topics' => $can_manage_topics, 'can_manage_direct_messages' => $can_manage_direct_messages, + 'can_manage_tags' => $can_manage_tags, 'custom_title' => $custom_title, ]); } diff --git a/src/Telegram/ChatMemberMember.php b/src/Telegram/ChatMemberMember.php index 8e147cf..19b1fa7 100644 --- a/src/Telegram/ChatMemberMember.php +++ b/src/Telegram/ChatMemberMember.php @@ -14,17 +14,22 @@ class ChatMemberMember extends ChatMember /** The member's status in the chat, always “member” */ public string $status = 'member'; + /** Optional. Tag of the member */ + public ?string $tag = null; + /** Optional. Date when the user's subscription will expire; Unix time */ public ?int $until_date = null; /** * @param User $user Information about the user + * @param string $tag Optional. Tag of the member * @param int $until_date Optional. Date when the user's subscription will expire; Unix time */ - public static function make(User $user, ?int $until_date = null): static + public static function make(User $user, ?string $tag = null, ?int $until_date = null): static { return new static([ 'user' => $user, + 'tag' => $tag, 'until_date' => $until_date, ]); } diff --git a/src/Telegram/ChatMemberRestricted.php b/src/Telegram/ChatMemberRestricted.php index d8cfece..4fcc19e 100644 --- a/src/Telegram/ChatMemberRestricted.php +++ b/src/Telegram/ChatMemberRestricted.php @@ -47,6 +47,9 @@ class ChatMemberRestricted extends ChatMember /** True, if the user is allowed to add web page previews to their messages */ public bool $can_add_web_page_previews; + /** True, if the user is allowed to edit their own tag */ + public bool $can_edit_tag; + /** True, if the user is allowed to change the chat title, photo and other settings */ public bool $can_change_info; @@ -62,6 +65,9 @@ class ChatMemberRestricted extends ChatMember /** Date when restrictions will be lifted for this user; Unix time. If 0, then the user is restricted forever */ public int $until_date; + /** Optional. Tag of the member */ + public ?string $tag = null; + /** * @param User $user Information about the user * @param bool $is_member True, if the user is a member of the chat at the moment of the request @@ -75,11 +81,13 @@ class ChatMemberRestricted extends ChatMember * @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_edit_tag True, if the user is allowed to edit their own tag * @param bool $can_change_info True, if the user is allowed to change the chat title, photo and other settings * @param bool $can_invite_users True, if the user is allowed to invite new users to the chat * @param bool $can_pin_messages True, if the user is allowed to pin messages * @param bool $can_manage_topics True, if the user is allowed to create forum topics * @param int $until_date Date when restrictions will be lifted for this user; Unix time. If 0, then the user is restricted forever + * @param string $tag Optional. Tag of the member */ public static function make( User $user, @@ -94,11 +102,13 @@ public static function make( bool $can_send_polls, bool $can_send_other_messages, bool $can_add_web_page_previews, + bool $can_edit_tag, bool $can_change_info, bool $can_invite_users, bool $can_pin_messages, bool $can_manage_topics, int $until_date, + ?string $tag = null, ): static { return new static([ 'user' => $user, @@ -113,11 +123,13 @@ public static function make( 'can_send_polls' => $can_send_polls, 'can_send_other_messages' => $can_send_other_messages, 'can_add_web_page_previews' => $can_add_web_page_previews, + 'can_edit_tag' => $can_edit_tag, 'can_change_info' => $can_change_info, 'can_invite_users' => $can_invite_users, 'can_pin_messages' => $can_pin_messages, 'can_manage_topics' => $can_manage_topics, 'until_date' => $until_date, + 'tag' => $tag, ]); } } diff --git a/src/Telegram/ChatOwnerChanged.php b/src/Telegram/ChatOwnerChanged.php new file mode 100644 index 0000000..5d858b2 --- /dev/null +++ b/src/Telegram/ChatOwnerChanged.php @@ -0,0 +1,28 @@ + $new_owner, + ]); + } +} diff --git a/src/Telegram/ChatOwnerLeft.php b/src/Telegram/ChatOwnerLeft.php new file mode 100644 index 0000000..5dd421f --- /dev/null +++ b/src/Telegram/ChatOwnerLeft.php @@ -0,0 +1,28 @@ +Optional. The user which will be the new owner of the chat if the previous owner does not return to the chat */ + public ?User $new_owner = null; + + /** + * @param User $new_owner Optional. The user which will be the new owner of the chat if the previous owner does not return to the chat + */ + public static function make(?User $new_owner = null): static + { + return new static([ + 'new_owner' => $new_owner, + ]); + } +} diff --git a/src/Telegram/ChatPermissions.php b/src/Telegram/ChatPermissions.php index 06147aa..bca401a 100644 --- a/src/Telegram/ChatPermissions.php +++ b/src/Telegram/ChatPermissions.php @@ -43,6 +43,9 @@ class ChatPermissions extends Type /** Optional. True, if the user is allowed to add web page previews to their messages */ public ?bool $can_add_web_page_previews = null; + /** Optional. True, if the user is allowed to edit their own tag */ + public ?bool $can_edit_tag = null; + /** Optional. True, if the user is allowed to change the chat title, photo and other settings. Ignored in public supergroups */ public ?bool $can_change_info = null; @@ -66,6 +69,7 @@ class ChatPermissions extends Type * @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_edit_tag Optional. True, if the user is allowed to edit their own tag * @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 * @param bool $can_invite_users Optional. True, if the user is allowed to invite new users to the chat * @param bool $can_pin_messages Optional. True, if the user is allowed to pin messages. Ignored in public supergroups @@ -82,6 +86,7 @@ public static function make( ?bool $can_send_polls = null, ?bool $can_send_other_messages = null, ?bool $can_add_web_page_previews = null, + ?bool $can_edit_tag = null, ?bool $can_change_info = null, ?bool $can_invite_users = null, ?bool $can_pin_messages = null, @@ -98,6 +103,7 @@ public static function make( 'can_send_polls' => $can_send_polls, 'can_send_other_messages' => $can_send_other_messages, 'can_add_web_page_previews' => $can_add_web_page_previews, + 'can_edit_tag' => $can_edit_tag, 'can_change_info' => $can_change_info, 'can_invite_users' => $can_invite_users, 'can_pin_messages' => $can_pin_messages, diff --git a/src/Telegram/InlineKeyboardButton.php b/src/Telegram/InlineKeyboardButton.php index 9eb9f71..77dbf64 100644 --- a/src/Telegram/InlineKeyboardButton.php +++ b/src/Telegram/InlineKeyboardButton.php @@ -9,13 +9,19 @@ use Telepath\Types\Type; /** - * This object represents one button of an inline keyboard. Exactly one of the optional fields must be used to specify type of the button. + * This object represents one button of an inline keyboard. Exactly one of the fields other than text, icon_custom_emoji_id, and style must be used to specify the type of the button. */ class InlineKeyboardButton extends Type { /** Label text on the button */ public string $text; + /** Optional. Unique identifier of the custom emoji shown before the text of the button. Can only be used by bots that purchased additional usernames on Fragment or in the messages directly sent by the bot to private, group and supergroup chats if the owner of the bot has a Telegram Premium subscription. */ + public ?string $icon_custom_emoji_id = null; + + /** Optional. Style of the button. Must be one of “danger” (red), “success” (green) or “primary” (blue). If omitted, then an app-specific style is used. */ + public ?string $style = null; + /** Optional. HTTP or tg:// URL to be opened when the button is pressed. Links tg://user?id= can be used to mention a user by their identifier without using a username, if this is allowed by their privacy settings. */ public ?string $url = null; @@ -48,6 +54,8 @@ class InlineKeyboardButton extends Type /** * @param string $text Label text on the button + * @param string $icon_custom_emoji_id Optional. Unique identifier of the custom emoji shown before the text of the button. Can only be used by bots that purchased additional usernames on Fragment or in the messages directly sent by the bot to private, group and supergroup chats if the owner of the bot has a Telegram Premium subscription. + * @param string $style Optional. Style of the button. Must be one of “danger” (red), “success” (green) or “primary” (blue). If omitted, then an app-specific style is used. * @param string $url Optional. HTTP or tg:// URL to be opened when the button is pressed. Links tg://user?id= can be used to mention a user by their identifier without using a username, if this is allowed by their privacy settings. * @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. @@ -61,6 +69,8 @@ class InlineKeyboardButton extends Type */ public static function make( string $text, + ?string $icon_custom_emoji_id = null, + ?string $style = null, ?string $url = null, ?string $callback_data = null, ?WebAppInfo $web_app = null, @@ -74,6 +84,8 @@ public static function make( ): static { return new static([ 'text' => $text, + 'icon_custom_emoji_id' => $icon_custom_emoji_id, + 'style' => $style, 'url' => $url, 'callback_data' => $callback_data, 'web_app' => $web_app, diff --git a/src/Telegram/InlineQueryResultDocument.php b/src/Telegram/InlineQueryResultDocument.php index e1b9c88..a5bc0c6 100644 --- a/src/Telegram/InlineQueryResultDocument.php +++ b/src/Telegram/InlineQueryResultDocument.php @@ -60,7 +60,7 @@ class InlineQueryResultDocument extends InlineQueryResult * @param string $parse_mode Optional. Mode for parsing entities in the document caption. See formatting options for more details. * @param MessageEntity[] $caption_entities Optional. List of special entities that appear in the caption, which can be specified instead of parse_mode * @param string $description Optional. Short description of the result - * @param InlineKeyboardMarkup $reply_markup Optional. Inline keyboard attached to the message + * @param InlineKeyboardMarkup $reply_markup Optional. Inline keyboard attached to the message * @param InputMessageContent $input_message_content Optional. Content of the message to be sent instead of the file * @param string $thumbnail_url Optional. URL of the thumbnail (JPEG only) for the file * @param int $thumbnail_width Optional. Thumbnail width diff --git a/src/Telegram/InputChecklist.php b/src/Telegram/InputChecklist.php index d7bab4a..dc5eecf 100644 --- a/src/Telegram/InputChecklist.php +++ b/src/Telegram/InputChecklist.php @@ -27,7 +27,7 @@ class InputChecklist extends Type 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. + * 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, custom_emoji, and date_time entities are allowed. * * @var MessageEntity[] */ @@ -43,7 +43,7 @@ class InputChecklist extends Type * @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 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, custom_emoji, and date_time 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 */ diff --git a/src/Telegram/InputChecklistTask.php b/src/Telegram/InputChecklistTask.php index 48e81b3..2c76d4a 100644 --- a/src/Telegram/InputChecklistTask.php +++ b/src/Telegram/InputChecklistTask.php @@ -23,7 +23,7 @@ class InputChecklistTask extends Type 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. + * 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, custom_emoji, and date_time entities are allowed. * * @var MessageEntity[] */ @@ -33,7 +33,7 @@ class InputChecklistTask extends Type * @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. + * @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, custom_emoji, and date_time entities are allowed. */ public static function make( int $id, diff --git a/src/Telegram/KeyboardButton.php b/src/Telegram/KeyboardButton.php index 7d6e3e7..9e4ff74 100644 --- a/src/Telegram/KeyboardButton.php +++ b/src/Telegram/KeyboardButton.php @@ -9,19 +9,28 @@ use Telepath\Types\Type; /** - * This object represents one button of the reply keyboard. At most one of the optional fields must be used to specify type of the button. For simple text buttons, String can be used instead of this object to specify the button text. + * This object represents one button of the reply keyboard. At most one of the fields other than text, icon_custom_emoji_id, and style must be used to specify the type of the button. For simple text buttons, String can be used instead of this object to specify the button text. */ 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 */ + /** Text of the button. If none of the fields other than text, icon_custom_emoji_id, and style are used, it will be sent as a message when the button is pressed */ public string $text; + /** Optional. Unique identifier of the custom emoji shown before the text of the button. Can only be used by bots that purchased additional usernames on Fragment or in the messages directly sent by the bot to private, group and supergroup chats if the owner of the bot has a Telegram Premium subscription. */ + public ?string $icon_custom_emoji_id = null; + + /** Optional. Style of the button. Must be one of “danger” (red), “success” (green) or “primary” (blue). If omitted, then an app-specific style is used. */ + public ?string $style = null; + /** 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. */ public ?KeyboardButtonRequestChat $request_chat = null; + /** Optional. If specified, pressing the button will ask the user to create and share a bot that will be managed by the current bot. Available for bots that enabled management of other bots in the @BotFather Mini App. Available in private chats only. */ + public ?KeyboardButtonRequestManagedBot $request_managed_bot = 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. */ public ?bool $request_contact = null; @@ -35,9 +44,12 @@ class KeyboardButton extends Type public ?WebAppInfo $web_app = null; /** - * @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 string $text Text of the button. If none of the fields other than text, icon_custom_emoji_id, and style are used, it will be sent as a message when the button is pressed + * @param string $icon_custom_emoji_id Optional. Unique identifier of the custom emoji shown before the text of the button. Can only be used by bots that purchased additional usernames on Fragment or in the messages directly sent by the bot to private, group and supergroup chats if the owner of the bot has a Telegram Premium subscription. + * @param string $style Optional. Style of the button. Must be one of “danger” (red), “success” (green) or “primary” (blue). If omitted, then an app-specific style is used. * @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 KeyboardButtonRequestManagedBot $request_managed_bot Optional. If specified, pressing the button will ask the user to create and share a bot that will be managed by the current bot. Available for bots that enabled management of other bots in the @BotFather Mini App. 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. @@ -45,8 +57,11 @@ class KeyboardButton extends Type */ public static function make( string $text, + ?string $icon_custom_emoji_id = null, + ?string $style = null, ?KeyboardButtonRequestUsers $request_users = null, ?KeyboardButtonRequestChat $request_chat = null, + ?KeyboardButtonRequestManagedBot $request_managed_bot = null, ?bool $request_contact = null, ?bool $request_location = null, ?KeyboardButtonPollType $request_poll = null, @@ -54,8 +69,11 @@ public static function make( ): static { return new static([ 'text' => $text, + 'icon_custom_emoji_id' => $icon_custom_emoji_id, + 'style' => $style, 'request_users' => $request_users, 'request_chat' => $request_chat, + 'request_managed_bot' => $request_managed_bot, 'request_contact' => $request_contact, 'request_location' => $request_location, 'request_poll' => $request_poll, diff --git a/src/Telegram/KeyboardButtonRequestManagedBot.php b/src/Telegram/KeyboardButtonRequestManagedBot.php new file mode 100644 index 0000000..2aa695a --- /dev/null +++ b/src/Telegram/KeyboardButtonRequestManagedBot.php @@ -0,0 +1,41 @@ +managed_bot and a Message with the field managed_bot_created. + */ +class KeyboardButtonRequestManagedBot extends Type +{ + /** Signed 32-bit identifier of the request. Must be unique within the message */ + public int $request_id; + + /** Optional. Suggested name for the bot */ + public ?string $suggested_name = null; + + /** Optional. Suggested username for the bot */ + public ?string $suggested_username = null; + + /** + * @param int $request_id Signed 32-bit identifier of the request. Must be unique within the message + * @param string $suggested_name Optional. Suggested name for the bot + * @param string $suggested_username Optional. Suggested username for the bot + */ + public static function make( + int $request_id, + ?string $suggested_name = null, + ?string $suggested_username = null, + ): static { + return new static([ + 'request_id' => $request_id, + 'suggested_name' => $suggested_name, + 'suggested_username' => $suggested_username, + ]); + } +} diff --git a/src/Telegram/ManagedBotCreated.php b/src/Telegram/ManagedBotCreated.php new file mode 100644 index 0000000..c77959d --- /dev/null +++ b/src/Telegram/ManagedBotCreated.php @@ -0,0 +1,28 @@ +getManagedBotToken. */ + public User $bot; + + /** + * @param User $bot Information about the bot. The bot's token can be fetched using the method getManagedBotToken. + */ + public static function make(User $bot): static + { + return new static([ + 'bot' => $bot, + ]); + } +} diff --git a/src/Telegram/ManagedBotUpdated.php b/src/Telegram/ManagedBotUpdated.php new file mode 100644 index 0000000..8449b34 --- /dev/null +++ b/src/Telegram/ManagedBotUpdated.php @@ -0,0 +1,33 @@ +getManagedBotToken. */ + public User $bot; + + /** + * @param User $user User that created the bot + * @param User $bot Information about the bot. Token of the bot can be fetched using the method getManagedBotToken. + */ + public static function make(User $user, User $bot): static + { + return new static([ + 'user' => $user, + 'bot' => $bot, + ]); + } +} diff --git a/src/Telegram/Message.php b/src/Telegram/Message.php index 251723e..30acb4e 100644 --- a/src/Telegram/Message.php +++ b/src/Telegram/Message.php @@ -33,6 +33,9 @@ class Message extends MaybeInaccessibleMessage /** Optional. The bot that actually sent the message on behalf of the business account. Available only for outgoing messages sent on behalf of the connected business account. */ public ?User $sender_business_bot = null; + /** Optional. Tag or custom title of the sender of the message; for supergroups only */ + public ?string $sender_tag = null; + /** Optional. Unique identifier of the business connection from which the message was received. If non-empty, the message belongs to a chat of the corresponding business account that is independent from any potential bot chat which might share the same identifier. */ public ?string $business_connection_id = null; @@ -60,6 +63,9 @@ class Message extends MaybeInaccessibleMessage /** Optional. Identifier of the specific checklist task that is being replied to */ public ?int $reply_to_checklist_task_id = null; + /** Optional. Persistent identifier of the specific poll option that is being replied to */ + public ?string $reply_to_poll_option_id = null; + /** Optional. Bot through which the message was sent */ public ?User $via_bot = null; @@ -75,7 +81,7 @@ class Message extends MaybeInaccessibleMessage /** 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 */ + /** Optional. The unique identifier inside this chat 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 */ @@ -184,6 +190,12 @@ class Message extends MaybeInaccessibleMessage /** Optional. A member was removed from the group, information about them (this member may be the bot itself) */ public ?User $left_chat_member = null; + /** Optional. Service message: chat owner has left */ + public ?ChatOwnerLeft $chat_owner_left = null; + + /** Optional. Service message: chat owner has changed */ + public ?ChatOwnerChanged $chat_owner_changed = null; + /** Optional. A chat title was changed to this value */ public ?string $new_chat_title = null; @@ -299,9 +311,18 @@ class Message extends MaybeInaccessibleMessage /** Optional. Service message: a giveaway without public winners was completed */ public ?GiveawayCompleted $giveaway_completed = null; + /** Optional. Service message: user created a bot that will be managed by the current bot */ + public ?ManagedBotCreated $managed_bot_created = null; + /** Optional. Service message: the price for paid messages has changed in the chat */ public ?PaidMessagePriceChanged $paid_message_price_changed = null; + /** Optional. Service message: answer option was added to a poll */ + public ?PollOptionAdded $poll_option_added = null; + + /** Optional. Service message: answer option was deleted from a poll */ + public ?PollOptionDeleted $poll_option_deleted = null; + /** Optional. Service message: a suggested post was approved */ public ?SuggestedPostApproved $suggested_post_approved = null; @@ -332,7 +353,7 @@ class Message extends MaybeInaccessibleMessage /** Optional. Service message: data sent by a Web App */ public ?WebAppData $web_app_data = null; - /** Optional. Inline keyboard attached to the message. login_url buttons are represented as ordinary url buttons. */ + /** Optional. Inline keyboard attached to the message. login_url buttons are represented as ordinary url buttons. */ public ?InlineKeyboardMarkup $reply_markup = null; /** @@ -345,6 +366,7 @@ class Message extends MaybeInaccessibleMessage * @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 * @param User $sender_business_bot Optional. The bot that actually sent the message on behalf of the business account. Available only for outgoing messages sent on behalf of the connected business account. + * @param string $sender_tag Optional. Tag or custom title of the sender of the message; for supergroups only * @param string $business_connection_id Optional. Unique identifier of the business connection from which the message was received. If non-empty, the message belongs to a chat of the corresponding business account that is independent from any potential bot chat which might share the same identifier. * @param MessageOrigin $forward_origin Optional. Information about the original message for forwarded messages * @param bool $is_topic_message Optional. True, if the message is sent to a topic in a forum supergroup or a private chat with the bot @@ -354,12 +376,13 @@ class Message extends MaybeInaccessibleMessage * @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 string $reply_to_poll_option_id Optional. Persistent identifier of the specific poll option 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_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 $media_group_id Optional. The unique identifier inside this chat 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 @@ -390,6 +413,8 @@ class Message extends MaybeInaccessibleMessage * @param Location $location Optional. Message is a shared location, information about the location * @param User[] $new_chat_members Optional. New members that were added to the group or supergroup and information about them (the bot itself may be one of these members) * @param User $left_chat_member Optional. A member was removed from the group, information about them (this member may be the bot itself) + * @param ChatOwnerLeft $chat_owner_left Optional. Service message: chat owner has left + * @param ChatOwnerChanged $chat_owner_changed Optional. Service message: chat owner has changed * @param string $new_chat_title Optional. A chat title was changed to this value * @param PhotoSize[] $new_chat_photo Optional. A chat photo was change to this value * @param bool $delete_chat_photo Optional. Service message: the chat photo was deleted @@ -427,7 +452,10 @@ 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 ManagedBotCreated $managed_bot_created Optional. Service message: user created a bot that will be managed by the current bot * @param PaidMessagePriceChanged $paid_message_price_changed Optional. Service message: the price for paid messages has changed in the chat + * @param PollOptionAdded $poll_option_added Optional. Service message: answer option was added to a poll + * @param PollOptionDeleted $poll_option_deleted Optional. Service message: answer option was deleted from a poll * @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 @@ -438,7 +466,7 @@ class Message extends MaybeInaccessibleMessage * @param VideoChatEnded $video_chat_ended Optional. Service message: video chat ended * @param VideoChatParticipantsInvited $video_chat_participants_invited Optional. Service message: new participants invited to a video chat * @param WebAppData $web_app_data Optional. Service message: data sent by a Web App - * @param InlineKeyboardMarkup $reply_markup Optional. Inline keyboard attached to the message. login_url buttons are represented as ordinary url buttons. + * @param InlineKeyboardMarkup $reply_markup Optional. Inline keyboard attached to the message. login_url buttons are represented as ordinary url buttons. */ public static function make( int $message_id, @@ -450,6 +478,7 @@ public static function make( ?Chat $sender_chat = null, ?int $sender_boost_count = null, ?User $sender_business_bot = null, + ?string $sender_tag = null, ?string $business_connection_id = null, ?MessageOrigin $forward_origin = null, ?bool $is_topic_message = null, @@ -459,6 +488,7 @@ public static function make( ?TextQuote $quote = null, ?Story $reply_to_story = null, ?int $reply_to_checklist_task_id = null, + ?string $reply_to_poll_option_id = null, ?User $via_bot = null, ?int $edit_date = null, ?bool $has_protected_content = null, @@ -495,6 +525,8 @@ public static function make( ?Location $location = null, ?array $new_chat_members = null, ?User $left_chat_member = null, + ?ChatOwnerLeft $chat_owner_left = null, + ?ChatOwnerChanged $chat_owner_changed = null, ?string $new_chat_title = null, ?array $new_chat_photo = null, ?bool $delete_chat_photo = null, @@ -532,7 +564,10 @@ public static function make( ?Giveaway $giveaway = null, ?GiveawayWinners $giveaway_winners = null, ?GiveawayCompleted $giveaway_completed = null, + ?ManagedBotCreated $managed_bot_created = null, ?PaidMessagePriceChanged $paid_message_price_changed = null, + ?PollOptionAdded $poll_option_added = null, + ?PollOptionDeleted $poll_option_deleted = null, ?SuggestedPostApproved $suggested_post_approved = null, ?SuggestedPostApprovalFailed $suggested_post_approval_failed = null, ?SuggestedPostDeclined $suggested_post_declined = null, @@ -555,6 +590,7 @@ public static function make( 'sender_chat' => $sender_chat, 'sender_boost_count' => $sender_boost_count, 'sender_business_bot' => $sender_business_bot, + 'sender_tag' => $sender_tag, 'business_connection_id' => $business_connection_id, 'forward_origin' => $forward_origin, 'is_topic_message' => $is_topic_message, @@ -564,6 +600,7 @@ public static function make( 'quote' => $quote, 'reply_to_story' => $reply_to_story, 'reply_to_checklist_task_id' => $reply_to_checklist_task_id, + 'reply_to_poll_option_id' => $reply_to_poll_option_id, 'via_bot' => $via_bot, 'edit_date' => $edit_date, 'has_protected_content' => $has_protected_content, @@ -600,6 +637,8 @@ public static function make( 'location' => $location, 'new_chat_members' => $new_chat_members, 'left_chat_member' => $left_chat_member, + 'chat_owner_left' => $chat_owner_left, + 'chat_owner_changed' => $chat_owner_changed, 'new_chat_title' => $new_chat_title, 'new_chat_photo' => $new_chat_photo, 'delete_chat_photo' => $delete_chat_photo, @@ -637,7 +676,10 @@ public static function make( 'giveaway' => $giveaway, 'giveaway_winners' => $giveaway_winners, 'giveaway_completed' => $giveaway_completed, + 'managed_bot_created' => $managed_bot_created, 'paid_message_price_changed' => $paid_message_price_changed, + 'poll_option_added' => $poll_option_added, + 'poll_option_deleted' => $poll_option_deleted, 'suggested_post_approved' => $suggested_post_approved, 'suggested_post_approval_failed' => $suggested_post_approval_failed, 'suggested_post_declined' => $suggested_post_declined, diff --git a/src/Telegram/MessageEntity.php b/src/Telegram/MessageEntity.php index 48162f8..9f55dd6 100644 --- a/src/Telegram/MessageEntity.php +++ b/src/Telegram/MessageEntity.php @@ -13,7 +13,7 @@ */ class MessageEntity extends Type { - /** Type of the entity. Currently, can be “mention” (@username), “hashtag” (#hashtag or #hashtag@chatusername), “cashtag” ($USD or $USD@chatusername), “bot_command” (/start@jobs_bot), “url” (https://telegram.org), “email” (do-not-reply@telegram.org), “phone_number” (+1-212-555-0123), “bold” (bold text), “italic” (italic text), “underline” (underlined text), “strikethrough” (strikethrough text), “spoiler” (spoiler message), “blockquote” (block quotation), “expandable_blockquote” (collapsed-by-default block quotation), “code” (monowidth string), “pre” (monowidth block), “text_link” (for clickable text URLs), “text_mention” (for users without usernames), “custom_emoji” (for inline custom emoji stickers) */ + /** Type of the entity. Currently, can be “mention” (@username), “hashtag” (#hashtag or #hashtag@chatusername), “cashtag” ($USD or $USD@chatusername), “bot_command” (/start@jobs_bot), “url” (https://telegram.org), “email” (do-not-reply@telegram.org), “phone_number” (+1-212-555-0123), “bold” (bold text), “italic” (italic text), “underline” (underlined text), “strikethrough” (strikethrough text), “spoiler” (spoiler message), “blockquote” (block quotation), “expandable_blockquote” (collapsed-by-default block quotation), “code” (monowidth string), “pre” (monowidth block), “text_link” (for clickable text URLs), “text_mention” (for users without usernames), “custom_emoji” (for inline custom emoji stickers), or “date_time” (for formatted date and time) */ public string $type; /** Offset in UTF-16 code units to the start of the entity */ @@ -34,14 +34,22 @@ class MessageEntity extends Type /** Optional. For “custom_emoji” only, unique identifier of the custom emoji. Use getCustomEmojiStickers to get full information about the sticker */ public ?string $custom_emoji_id = null; + /** Optional. For “date_time” only, the Unix time associated with the entity */ + public ?int $unix_time = null; + + /** Optional. For “date_time” only, the string that defines the formatting of the date and time. See date-time entity formatting for more details. */ + public ?string $date_time_format = null; + /** - * @param string $type Type of the entity. Currently, can be “mention” (@username), “hashtag” (#hashtag or #hashtag@chatusername), “cashtag” ($USD or $USD@chatusername), “bot_command” (/start@jobs_bot), “url” (https://telegram.org), “email” (do-not-reply@telegram.org), “phone_number” (+1-212-555-0123), “bold” (bold text), “italic” (italic text), “underline” (underlined text), “strikethrough” (strikethrough text), “spoiler” (spoiler message), “blockquote” (block quotation), “expandable_blockquote” (collapsed-by-default block quotation), “code” (monowidth string), “pre” (monowidth block), “text_link” (for clickable text URLs), “text_mention” (for users without usernames), “custom_emoji” (for inline custom emoji stickers) + * @param string $type Type of the entity. Currently, can be “mention” (@username), “hashtag” (#hashtag or #hashtag@chatusername), “cashtag” ($USD or $USD@chatusername), “bot_command” (/start@jobs_bot), “url” (https://telegram.org), “email” (do-not-reply@telegram.org), “phone_number” (+1-212-555-0123), “bold” (bold text), “italic” (italic text), “underline” (underlined text), “strikethrough” (strikethrough text), “spoiler” (spoiler message), “blockquote” (block quotation), “expandable_blockquote” (collapsed-by-default block quotation), “code” (monowidth string), “pre” (monowidth block), “text_link” (for clickable text URLs), “text_mention” (for users without usernames), “custom_emoji” (for inline custom emoji stickers), or “date_time” (for formatted date and time) * @param int $offset Offset in UTF-16 code units to the start of the entity * @param int $length Length of the entity in UTF-16 code units * @param string $url Optional. For “text_link” only, URL that will be opened after user taps on the text * @param User $user Optional. For “text_mention” only, the mentioned user * @param string $language Optional. For “pre” only, the programming language of the entity text * @param string $custom_emoji_id Optional. For “custom_emoji” only, unique identifier of the custom emoji. Use getCustomEmojiStickers to get full information about the sticker + * @param int $unix_time Optional. For “date_time” only, the Unix time associated with the entity + * @param string $date_time_format Optional. For “date_time” only, the string that defines the formatting of the date and time. See date-time entity formatting for more details. */ public static function make( string $type, @@ -51,6 +59,8 @@ public static function make( ?User $user = null, ?string $language = null, ?string $custom_emoji_id = null, + ?int $unix_time = null, + ?string $date_time_format = null, ): static { return new static([ 'type' => $type, @@ -60,6 +70,8 @@ public static function make( 'user' => $user, 'language' => $language, 'custom_emoji_id' => $custom_emoji_id, + 'unix_time' => $unix_time, + 'date_time_format' => $date_time_format, ]); } } diff --git a/src/Telegram/Poll.php b/src/Telegram/Poll.php index 8706d5f..cbd9da9 100644 --- a/src/Telegram/Poll.php +++ b/src/Telegram/Poll.php @@ -41,6 +41,9 @@ class Poll extends Type /** True, if the poll allows multiple answers */ public bool $allows_multiple_answers; + /** True, if the poll allows to change the chosen answer options */ + public bool $allows_revoting; + /** * Optional. Special entities that appear in the question. Currently, only custom emoji entities are allowed in poll questions * @@ -48,8 +51,12 @@ class Poll extends Type */ public ?array $question_entities = null; - /** Optional. 0-based identifier of the correct answer option. Available only for polls in the quiz mode, which are closed, or was sent (not forwarded) by the bot or to the private chat with the bot. */ - public ?int $correct_option_id = null; + /** + * Optional. Array of 0-based identifiers of the correct answer options. Available only for polls in quiz mode which are closed or were sent (not forwarded) by the bot or to the private chat with the bot. + * + * @var int[] + */ + public ?array $correct_option_ids = null; /** Optional. Text that is shown when a user chooses an incorrect answer or taps on the lamp icon in a quiz-style poll, 0-200 characters */ public ?string $explanation = null; @@ -67,6 +74,16 @@ class Poll extends Type /** Optional. Point in time (Unix timestamp) when the poll will be automatically closed */ public ?int $close_date = null; + /** Optional. Description of the poll; for polls inside the Message object only */ + public ?string $description = null; + + /** + * Optional. Special entities like usernames, URLs, bot commands, etc. that appear in the description + * + * @var MessageEntity[] + */ + public ?array $description_entities = null; + /** * @param string $id Unique poll identifier * @param string $question Poll question, 1-300 characters @@ -76,12 +93,15 @@ class Poll extends Type * @param bool $is_anonymous True, if the poll is anonymous * @param string $type Poll type, currently can be “regular” or “quiz” * @param bool $allows_multiple_answers True, if the poll allows multiple answers + * @param bool $allows_revoting True, if the poll allows to change the chosen answer options * @param MessageEntity[] $question_entities Optional. Special entities that appear in the question. Currently, only custom emoji entities are allowed in poll questions - * @param int $correct_option_id Optional. 0-based identifier of the correct answer option. Available only for polls in the quiz mode, which are closed, or was sent (not forwarded) by the bot or to the private chat with the bot. + * @param int[] $correct_option_ids Optional. Array of 0-based identifiers of the correct answer options. Available only for polls in quiz mode which are closed or were sent (not forwarded) by the bot or to the private chat with the bot. * @param string $explanation Optional. Text that is shown when a user chooses an incorrect answer or taps on the lamp icon in a quiz-style poll, 0-200 characters * @param MessageEntity[] $explanation_entities Optional. Special entities like usernames, URLs, bot commands, etc. that appear in the explanation * @param int $open_period Optional. Amount of time in seconds the poll will be active after creation * @param int $close_date Optional. Point in time (Unix timestamp) when the poll will be automatically closed + * @param string $description Optional. Description of the poll; for polls inside the Message object only + * @param MessageEntity[] $description_entities Optional. Special entities like usernames, URLs, bot commands, etc. that appear in the description */ public static function make( string $id, @@ -92,12 +112,15 @@ public static function make( bool $is_anonymous, string $type, bool $allows_multiple_answers, + bool $allows_revoting, ?array $question_entities = null, - ?int $correct_option_id = null, + ?array $correct_option_ids = null, ?string $explanation = null, ?array $explanation_entities = null, ?int $open_period = null, ?int $close_date = null, + ?string $description = null, + ?array $description_entities = null, ): static { return new static([ 'id' => $id, @@ -108,12 +131,15 @@ public static function make( 'is_anonymous' => $is_anonymous, 'type' => $type, 'allows_multiple_answers' => $allows_multiple_answers, + 'allows_revoting' => $allows_revoting, 'question_entities' => $question_entities, - 'correct_option_id' => $correct_option_id, + 'correct_option_ids' => $correct_option_ids, 'explanation' => $explanation, 'explanation_entities' => $explanation_entities, 'open_period' => $open_period, 'close_date' => $close_date, + 'description' => $description, + 'description_entities' => $description_entities, ]); } } diff --git a/src/Telegram/PollAnswer.php b/src/Telegram/PollAnswer.php index 863c7d7..a603736 100644 --- a/src/Telegram/PollAnswer.php +++ b/src/Telegram/PollAnswer.php @@ -23,6 +23,13 @@ class PollAnswer extends Type */ public array $option_ids; + /** + * Persistent identifiers of the chosen answer options. May be empty if the vote was retracted. + * + * @var string[] + */ + public array $option_persistent_ids; + /** Optional. The chat that changed the answer to the poll, if the voter is anonymous */ public ?Chat $voter_chat = null; @@ -32,18 +39,21 @@ class PollAnswer extends Type /** * @param string $poll_id Unique poll identifier * @param int[] $option_ids 0-based identifiers of chosen answer options. May be empty if the vote was retracted. + * @param string[] $option_persistent_ids Persistent identifiers of the chosen answer options. May be empty if the vote was retracted. * @param Chat $voter_chat Optional. The chat that changed the answer to the poll, if the voter is anonymous * @param User $user Optional. The user that changed the answer to the poll, if the voter isn't anonymous */ public static function make( string $poll_id, array $option_ids, + array $option_persistent_ids, ?Chat $voter_chat = null, ?User $user = null, ): static { return new static([ 'poll_id' => $poll_id, 'option_ids' => $option_ids, + 'option_persistent_ids' => $option_persistent_ids, 'voter_chat' => $voter_chat, 'user' => $user, ]); diff --git a/src/Telegram/PollOption.php b/src/Telegram/PollOption.php index 3f7c6a2..ccc9e84 100644 --- a/src/Telegram/PollOption.php +++ b/src/Telegram/PollOption.php @@ -13,10 +13,13 @@ */ class PollOption extends Type { + /** Unique identifier of the option, persistent on option addition and deletion */ + public string $persistent_id; + /** Option text, 1-100 characters */ public string $text; - /** Number of users that voted for this option */ + /** Number of users who voted for this option; may be 0 if unknown */ public int $voter_count; /** @@ -26,17 +29,41 @@ class PollOption extends Type */ public ?array $text_entities = null; + /** Optional. User who added the option; omitted if the option wasn't added by a user after poll creation */ + public ?User $added_by_user = null; + + /** Optional. Chat that added the option; omitted if the option wasn't added by a chat after poll creation */ + public ?Chat $added_by_chat = null; + + /** Optional. Point in time (Unix timestamp) when the option was added; omitted if the option existed in the original poll */ + public ?int $addition_date = null; + /** + * @param string $persistent_id Unique identifier of the option, persistent on option addition and deletion * @param string $text Option text, 1-100 characters - * @param int $voter_count Number of users that voted for this option + * @param int $voter_count Number of users who voted for this option; may be 0 if unknown * @param MessageEntity[] $text_entities Optional. Special entities that appear in the option text. Currently, only custom emoji entities are allowed in poll option texts + * @param User $added_by_user Optional. User who added the option; omitted if the option wasn't added by a user after poll creation + * @param Chat $added_by_chat Optional. Chat that added the option; omitted if the option wasn't added by a chat after poll creation + * @param int $addition_date Optional. Point in time (Unix timestamp) when the option was added; omitted if the option existed in the original poll */ - public static function make(string $text, int $voter_count, ?array $text_entities = null): static - { + public static function make( + string $persistent_id, + string $text, + int $voter_count, + ?array $text_entities = null, + ?User $added_by_user = null, + ?Chat $added_by_chat = null, + ?int $addition_date = null, + ): static { return new static([ + 'persistent_id' => $persistent_id, 'text' => $text, 'voter_count' => $voter_count, 'text_entities' => $text_entities, + 'added_by_user' => $added_by_user, + 'added_by_chat' => $added_by_chat, + 'addition_date' => $addition_date, ]); } } diff --git a/src/Telegram/PollOptionAdded.php b/src/Telegram/PollOptionAdded.php new file mode 100644 index 0000000..8d66b03 --- /dev/null +++ b/src/Telegram/PollOptionAdded.php @@ -0,0 +1,51 @@ +Optional. Message containing the poll to which the option was added, if known. Note that the Message object in this field will not contain the reply_to_message field even if it itself is a reply. */ + public ?MaybeInaccessibleMessage $poll_message = null; + + /** + * Optional. Special entities that appear in the option_text + * + * @var MessageEntity[] + */ + public ?array $option_text_entities = null; + + /** + * @param string $option_persistent_id Unique identifier of the added option + * @param string $option_text Option text + * @param MaybeInaccessibleMessage $poll_message Optional. Message containing the poll to which the option was added, if known. Note that the Message object in this field will not contain the reply_to_message field even if it itself is a reply. + * @param MessageEntity[] $option_text_entities Optional. Special entities that appear in the option_text + */ + public static function make( + string $option_persistent_id, + string $option_text, + ?MaybeInaccessibleMessage $poll_message = null, + ?array $option_text_entities = null, + ): static { + return new static([ + 'option_persistent_id' => $option_persistent_id, + 'option_text' => $option_text, + 'poll_message' => $poll_message, + 'option_text_entities' => $option_text_entities, + ]); + } +} diff --git a/src/Telegram/PollOptionDeleted.php b/src/Telegram/PollOptionDeleted.php new file mode 100644 index 0000000..1ea50e7 --- /dev/null +++ b/src/Telegram/PollOptionDeleted.php @@ -0,0 +1,51 @@ +Optional. Message containing the poll from which the option was deleted, if known. Note that the Message object in this field will not contain the reply_to_message field even if it itself is a reply. */ + public ?MaybeInaccessibleMessage $poll_message = null; + + /** + * Optional. Special entities that appear in the option_text + * + * @var MessageEntity[] + */ + public ?array $option_text_entities = null; + + /** + * @param string $option_persistent_id Unique identifier of the deleted option + * @param string $option_text Option text + * @param MaybeInaccessibleMessage $poll_message Optional. Message containing the poll from which the option was deleted, if known. Note that the Message object in this field will not contain the reply_to_message field even if it itself is a reply. + * @param MessageEntity[] $option_text_entities Optional. Special entities that appear in the option_text + */ + public static function make( + string $option_persistent_id, + string $option_text, + ?MaybeInaccessibleMessage $poll_message = null, + ?array $option_text_entities = null, + ): static { + return new static([ + 'option_persistent_id' => $option_persistent_id, + 'option_text' => $option_text, + 'poll_message' => $poll_message, + 'option_text_entities' => $option_text_entities, + ]); + } +} diff --git a/src/Telegram/PreparedKeyboardButton.php b/src/Telegram/PreparedKeyboardButton.php new file mode 100644 index 0000000..87c7228 --- /dev/null +++ b/src/Telegram/PreparedKeyboardButton.php @@ -0,0 +1,28 @@ + $id, + ]); + } +} diff --git a/src/Telegram/ReplyParameters.php b/src/Telegram/ReplyParameters.php index 5e32e44..2cd6b12 100644 --- a/src/Telegram/ReplyParameters.php +++ b/src/Telegram/ReplyParameters.php @@ -22,7 +22,7 @@ class ReplyParameters extends Type /** 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. */ public ?bool $allow_sending_without_reply = null; - /** 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. */ + /** 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, custom_emoji, and date_time entities. The message will fail to send if the quote isn't found in the original message. */ public ?string $quote = null; /** Optional. Mode for parsing entities in the quote. See formatting options for more details. */ @@ -41,15 +41,19 @@ class ReplyParameters extends Type /** Optional. Identifier of the specific checklist task to be replied to */ public ?int $checklist_task_id = null; + /** Optional. Persistent identifier of the specific poll option to be replied to */ + public ?string $poll_option_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 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 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, custom_emoji, and date_time 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 + * @param string $poll_option_id Optional. Persistent identifier of the specific poll option to be replied to */ public static function make( int $message_id, @@ -60,6 +64,7 @@ public static function make( ?array $quote_entities = null, ?int $quote_position = null, ?int $checklist_task_id = null, + ?string $poll_option_id = null, ): static { return new static([ 'message_id' => $message_id, @@ -70,6 +75,7 @@ public static function make( 'quote_entities' => $quote_entities, 'quote_position' => $quote_position, 'checklist_task_id' => $checklist_task_id, + 'poll_option_id' => $poll_option_id, ]); } } diff --git a/src/Telegram/TextQuote.php b/src/Telegram/TextQuote.php index 3f1f509..9a95cef 100644 --- a/src/Telegram/TextQuote.php +++ b/src/Telegram/TextQuote.php @@ -20,7 +20,7 @@ class TextQuote extends Type public int $position; /** - * Optional. Special entities that appear in the quote. Currently, only bold, italic, underline, strikethrough, spoiler, and custom_emoji entities are kept in quotes. + * Optional. Special entities that appear in the quote. Currently, only bold, italic, underline, strikethrough, spoiler, custom_emoji, and date_time entities are kept in quotes. * * @var MessageEntity[] */ @@ -32,7 +32,7 @@ class TextQuote extends Type /** * @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 MessageEntity[] $entities Optional. Special entities that appear in the quote. Currently, only bold, italic, underline, strikethrough, spoiler, custom_emoji, and date_time 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. */ public static function make(string $text, int $position, ?array $entities = null, ?bool $is_manual = null): static diff --git a/src/Telegram/UniqueGift.php b/src/Telegram/UniqueGift.php index b643b86..1c0e290 100644 --- a/src/Telegram/UniqueGift.php +++ b/src/Telegram/UniqueGift.php @@ -37,6 +37,9 @@ class UniqueGift extends Type /** Optional. True, if the original regular gift was exclusively purchaseable by Telegram Premium subscribers */ public ?bool $is_premium = null; + /** Optional. True, if the gift was used to craft another gift and isn't available anymore */ + public ?bool $is_burned = null; + /** Optional. True, if the gift is assigned from the TON blockchain and can't be resold or transferred in Telegram */ public ?bool $is_from_blockchain = null; @@ -55,6 +58,7 @@ class UniqueGift extends Type * @param UniqueGiftSymbol $symbol Symbol of the gift * @param UniqueGiftBackdrop $backdrop Backdrop of the gift * @param bool $is_premium Optional. True, if the original regular gift was exclusively purchaseable by Telegram Premium subscribers + * @param bool $is_burned Optional. True, if the gift was used to craft another gift and isn't available anymore * @param bool $is_from_blockchain Optional. True, if the gift is assigned from the TON blockchain and can't be resold or transferred in Telegram * @param UniqueGiftColors $colors Optional. The color scheme that can be used by the gift's owner for the chat's name, replies to messages and link previews; for business account gifts and gifts that are currently on sale only * @param Chat $publisher_chat Optional. Information about the chat that published the gift @@ -68,6 +72,7 @@ public static function make( UniqueGiftSymbol $symbol, UniqueGiftBackdrop $backdrop, ?bool $is_premium = null, + ?bool $is_burned = null, ?bool $is_from_blockchain = null, ?UniqueGiftColors $colors = null, ?Chat $publisher_chat = null, @@ -81,6 +86,7 @@ public static function make( 'symbol' => $symbol, 'backdrop' => $backdrop, 'is_premium' => $is_premium, + 'is_burned' => $is_burned, 'is_from_blockchain' => $is_from_blockchain, 'colors' => $colors, 'publisher_chat' => $publisher_chat, diff --git a/src/Telegram/UniqueGiftModel.php b/src/Telegram/UniqueGiftModel.php index ec9267a..e6a2bda 100644 --- a/src/Telegram/UniqueGiftModel.php +++ b/src/Telegram/UniqueGiftModel.php @@ -19,20 +19,25 @@ class UniqueGiftModel extends Type /** The sticker that represents the unique gift */ public Sticker $sticker; - /** The number of unique gifts that receive this model for every 1000 gifts upgraded */ - public int $rarity_per_mille; + /** The number of unique gifts that receive this model for every 1000 gift upgrades. Always 0 for crafted gifts. */ + public int $rarity_per_mille = 0; + + /** Optional. Rarity of the model if it is a crafted model. Currently, can be “uncommon”, “rare”, “epic”, or “legendary”. */ + public ?string $rarity = null; /** * @param string $name Name of the model * @param Sticker $sticker The sticker that represents the unique gift - * @param int $rarity_per_mille The number of unique gifts that receive this model for every 1000 gifts upgraded + * @param int $rarity_per_mille The number of unique gifts that receive this model for every 1000 gift upgrades. Always 0 for crafted gifts. + * @param string $rarity Optional. Rarity of the model if it is a crafted model. Currently, can be “uncommon”, “rare”, “epic”, or “legendary”. */ - public static function make(string $name, Sticker $sticker, int $rarity_per_mille): static + public static function make(string $name, Sticker $sticker, int $rarity_per_mille, ?string $rarity = null): static { return new static([ 'name' => $name, 'sticker' => $sticker, 'rarity_per_mille' => $rarity_per_mille, + 'rarity' => $rarity, ]); } } diff --git a/src/Telegram/Update.php b/src/Telegram/Update.php index 7d4e1d1..5d94e6a 100644 --- a/src/Telegram/Update.php +++ b/src/Telegram/Update.php @@ -88,6 +88,9 @@ class Update extends Type /** Optional. A boost was removed from a chat. The bot must be an administrator in the chat to receive these updates. */ public ?ChatBoostRemoved $removed_chat_boost = null; + /** Optional. A new bot was created to be managed by the bot or token of a bot was changed */ + public ?ManagedBotUpdated $managed_bot = null; + /** * @param int $update_id The update's unique identifier. Update identifiers start from a certain positive number and increase sequentially. This identifier becomes especially handy if you're using webhooks, since it allows you to ignore repeated updates or to restore the correct update sequence, should they get out of order. If there are no new updates for at least a week, then identifier of the next update will be chosen randomly instead of sequentially. * @param Message $message Optional. New incoming message of any kind - text, photo, sticker, etc. @@ -113,6 +116,7 @@ class Update extends Type * @param ChatJoinRequest $chat_join_request Optional. A request to join the chat has been sent. The bot must have the can_invite_users administrator right in the chat to receive these updates. * @param ChatBoostUpdated $chat_boost Optional. A chat boost was added or changed. The bot must be an administrator in the chat to receive these updates. * @param ChatBoostRemoved $removed_chat_boost Optional. A boost was removed from a chat. The bot must be an administrator in the chat to receive these updates. + * @param ManagedBotUpdated $managed_bot Optional. A new bot was created to be managed by the bot or token of a bot was changed */ public static function make( int $update_id, @@ -139,6 +143,7 @@ public static function make( ?ChatJoinRequest $chat_join_request = null, ?ChatBoostUpdated $chat_boost = null, ?ChatBoostRemoved $removed_chat_boost = null, + ?ManagedBotUpdated $managed_bot = null, ): static { return new static([ 'update_id' => $update_id, @@ -165,6 +170,7 @@ public static function make( 'chat_join_request' => $chat_join_request, 'chat_boost' => $chat_boost, 'removed_chat_boost' => $removed_chat_boost, + 'managed_bot' => $managed_bot, ]); } } diff --git a/src/Telegram/User.php b/src/Telegram/User.php index a570b87..10218b7 100644 --- a/src/Telegram/User.php +++ b/src/Telegram/User.php @@ -55,6 +55,12 @@ class User extends Type /** Optional. True, if the bot has forum topic mode enabled in private chats. Returned only in getMe. */ public ?bool $has_topics_enabled = null; + /** Optional. True, if the bot allows users to create and delete topics in private chats. Returned only in getMe. */ + public ?bool $allows_users_to_create_topics = null; + + /** Optional. True, if other bots can be created to be controlled by the bot. Returned only in getMe. */ + public ?bool $can_manage_bots = null; + /** * @param int $id Unique identifier for this user or bot. This number may have more than 32 significant bits and some programming languages may have difficulty/silent defects in interpreting it. But it has at most 52 significant bits, so a 64-bit integer or double-precision float type are safe for storing this identifier. * @param bool $is_bot True, if this user is a bot @@ -70,6 +76,8 @@ class User extends Type * @param bool $can_connect_to_business Optional. True, if the bot can be connected to a Telegram Business account to receive its messages. Returned only in getMe. * @param bool $has_main_web_app Optional. True, if the bot has a main Web App. Returned only in getMe. * @param bool $has_topics_enabled Optional. True, if the bot has forum topic mode enabled in private chats. Returned only in getMe. + * @param bool $allows_users_to_create_topics Optional. True, if the bot allows users to create and delete topics in private chats. Returned only in getMe. + * @param bool $can_manage_bots Optional. True, if other bots can be created to be controlled by the bot. Returned only in getMe. */ public static function make( int $id, @@ -86,6 +94,8 @@ public static function make( ?bool $can_connect_to_business = null, ?bool $has_main_web_app = null, ?bool $has_topics_enabled = null, + ?bool $allows_users_to_create_topics = null, + ?bool $can_manage_bots = null, ): static { return new static([ 'id' => $id, @@ -102,6 +112,8 @@ public static function make( 'can_connect_to_business' => $can_connect_to_business, 'has_main_web_app' => $has_main_web_app, 'has_topics_enabled' => $has_topics_enabled, + 'allows_users_to_create_topics' => $allows_users_to_create_topics, + 'can_manage_bots' => $can_manage_bots, ]); } } diff --git a/src/Telegram/UserProfileAudios.php b/src/Telegram/UserProfileAudios.php new file mode 100644 index 0000000..e939216 --- /dev/null +++ b/src/Telegram/UserProfileAudios.php @@ -0,0 +1,37 @@ + $total_count, + 'audios' => $audios, + ]); + } +} diff --git a/src/Telegram/Video.php b/src/Telegram/Video.php index b70f5b8..9fceccb 100644 --- a/src/Telegram/Video.php +++ b/src/Telegram/Video.php @@ -41,6 +41,13 @@ class Video extends Type /** Optional. Timestamp in seconds from which the video will play in the message */ public ?int $start_timestamp = null; + /** + * Optional. List of available qualities of the video + * + * @var VideoQuality[] + */ + public ?array $qualities = null; + /** Optional. Original filename as defined by the sender */ public ?string $file_name = null; @@ -59,6 +66,7 @@ class Video extends Type * @param PhotoSize $thumbnail Optional. Video thumbnail * @param PhotoSize[] $cover Optional. Available sizes of the cover of the video in the message * @param int $start_timestamp Optional. Timestamp in seconds from which the video will play in the message + * @param VideoQuality[] $qualities Optional. List of available qualities of the video * @param string $file_name Optional. Original filename as defined by the sender * @param string $mime_type Optional. MIME type of the file as defined by the sender * @param int $file_size Optional. File size in bytes. It can be bigger than 2^31 and some programming languages may have difficulty/silent defects in interpreting it. But it has at most 52 significant bits, so a signed 64-bit integer or double-precision float type are safe for storing this value. @@ -72,6 +80,7 @@ public static function make( ?PhotoSize $thumbnail = null, ?array $cover = null, ?int $start_timestamp = null, + ?array $qualities = null, ?string $file_name = null, ?string $mime_type = null, ?int $file_size = null, @@ -85,6 +94,7 @@ public static function make( 'thumbnail' => $thumbnail, 'cover' => $cover, 'start_timestamp' => $start_timestamp, + 'qualities' => $qualities, 'file_name' => $file_name, 'mime_type' => $mime_type, 'file_size' => $file_size, diff --git a/src/Telegram/VideoQuality.php b/src/Telegram/VideoQuality.php new file mode 100644 index 0000000..a352827 --- /dev/null +++ b/src/Telegram/VideoQuality.php @@ -0,0 +1,59 @@ +Optional. File size in bytes. It can be bigger than 2^31 and some programming languages may have difficulty/silent defects in interpreting it. But it has at most 52 significant bits, so a signed 64-bit integer or double-precision float type are safe for storing this value. */ + public ?int $file_size = null; + + /** + * @param string $file_id Identifier for this file, which can be used to download or reuse the file + * @param string $file_unique_id Unique identifier for this file, which is supposed to be the same over time and for different bots. Can't be used to download or reuse the file. + * @param int $width Video width + * @param int $height Video height + * @param string $codec Codec that was used to encode the video, for example, “h264”, “h265”, or “av01” + * @param int $file_size Optional. File size in bytes. It can be bigger than 2^31 and some programming languages may have difficulty/silent defects in interpreting it. But it has at most 52 significant bits, so a signed 64-bit integer or double-precision float type are safe for storing this value. + */ + public static function make( + string $file_id, + string $file_unique_id, + int $width, + int $height, + string $codec, + ?int $file_size = null, + ): static { + return new static([ + 'file_id' => $file_id, + 'file_unique_id' => $file_unique_id, + 'width' => $width, + 'height' => $height, + 'codec' => $codec, + 'file_size' => $file_size, + ]); + } +} diff --git a/src/Types/Enums/ChatActionType.php b/src/Types/Enums/ChatActionType.php index 37c36c7..670fa9d 100644 --- a/src/Types/Enums/ChatActionType.php +++ b/src/Types/Enums/ChatActionType.php @@ -14,16 +14,16 @@ enum ChatActionType: string /** for photos */ case UploadPhoto = 'upload_photo'; - /** for recording videos */ + /** for videos */ case RecordVideo = 'record_video'; - /** for uploading videos */ + /** for videos */ case UploadVideo = 'upload_video'; - /** for recording voice notes */ + /** for voice notes */ case RecordVoice = 'record_voice'; - /** for uploading voice notes */ + /** for voice notes */ case UploadVoice = 'upload_voice'; /** for general files */ @@ -35,9 +35,9 @@ enum ChatActionType: string /** for location data */ case FindLocation = 'find_location'; - /** for recording video notes */ + /** for video notes */ case RecordVideoNote = 'record_video_note'; - /** for uploading video notes */ + /** for video notes */ case UploadVideoNote = 'upload_video_note'; }