diff --git a/src/Client.php b/src/Client.php index ed215e7..96a2e6a 100644 --- a/src/Client.php +++ b/src/Client.php @@ -248,6 +248,10 @@ public function close( * @param bool|null $protectContent * Protects the contents of the sent message from forwarding and saving * + * @param bool|null $allowPaidBroadcast + * Pass True to allow up to 1000 messages per second, ignoring broadcasting limits for a fee of 0.1 Telegram Stars + * per message. The relevant Stars will be withdrawn from the bot's balance + * * @param string|null $messageEffectId * Unique identifier of the message effect to be added to the message; for private chats only * @@ -270,6 +274,7 @@ public function sendMessage( Type\LinkPreviewOptions $linkPreviewOptions = null, bool $disableNotification = null, bool $protectContent = null, + bool $allowPaidBroadcast = null, string $messageEffectId = null, Type\ReplyParameters $replyParameters = null, $replyMarkup = null @@ -285,6 +290,7 @@ public function sendMessage( 'link_preview_options' => $linkPreviewOptions, 'disable_notification' => $disableNotification, 'protect_content' => $protectContent, + 'allow_paid_broadcast' => $allowPaidBroadcast, 'message_effect_id' => $messageEffectId, 'reply_parameters' => $replyParameters, 'reply_markup' => $replyMarkup, @@ -431,6 +437,10 @@ public function forwardMessages( * @param bool|null $protectContent * Protects the contents of the sent message from forwarding and saving * + * @param bool|null $allowPaidBroadcast + * Pass True to allow up to 1000 messages per second, ignoring broadcasting limits for a fee of 0.1 Telegram Stars + * per message. The relevant Stars will be withdrawn from the bot's balance + * * @param Type\ReplyParameters|null $replyParameters * Description of the message to reply to * @@ -451,6 +461,7 @@ public function copyMessage( bool $showCaptionAboveMedia = null, bool $disableNotification = null, bool $protectContent = null, + bool $allowPaidBroadcast = null, Type\ReplyParameters $replyParameters = null, $replyMarkup = null ) @@ -466,6 +477,7 @@ public function copyMessage( 'show_caption_above_media' => $showCaptionAboveMedia, 'disable_notification' => $disableNotification, 'protect_content' => $protectContent, + 'allow_paid_broadcast' => $allowPaidBroadcast, 'reply_parameters' => $replyParameters, 'reply_markup' => $replyMarkup, ]; @@ -572,6 +584,10 @@ public function copyMessages( * @param bool|null $protectContent * Protects the contents of the sent message from forwarding and saving * + * @param bool|null $allowPaidBroadcast + * Pass True to allow up to 1000 messages per second, ignoring broadcasting limits for a fee of 0.1 Telegram Stars + * per message. The relevant Stars will be withdrawn from the bot's balance + * * @param string|null $messageEffectId * Unique identifier of the message effect to be added to the message; for private chats only * @@ -596,6 +612,7 @@ public function sendPhoto( bool $hasSpoiler = null, bool $disableNotification = null, bool $protectContent = null, + bool $allowPaidBroadcast = null, string $messageEffectId = null, Type\ReplyParameters $replyParameters = null, $replyMarkup = null @@ -613,6 +630,7 @@ public function sendPhoto( 'has_spoiler' => $hasSpoiler, 'disable_notification' => $disableNotification, 'protect_content' => $protectContent, + 'allow_paid_broadcast' => $allowPaidBroadcast, 'message_effect_id' => $messageEffectId, 'reply_parameters' => $replyParameters, 'reply_markup' => $replyMarkup, @@ -674,6 +692,10 @@ public function sendPhoto( * @param bool|null $protectContent * Protects the contents of the sent message from forwarding and saving * + * @param bool|null $allowPaidBroadcast + * Pass True to allow up to 1000 messages per second, ignoring broadcasting limits for a fee of 0.1 Telegram Stars + * per message. The relevant Stars will be withdrawn from the bot's balance + * * @param string|null $messageEffectId * Unique identifier of the message effect to be added to the message; for private chats only * @@ -700,6 +722,7 @@ public function sendAudio( $thumbnail = null, bool $disableNotification = null, bool $protectContent = null, + bool $allowPaidBroadcast = null, string $messageEffectId = null, Type\ReplyParameters $replyParameters = null, $replyMarkup = null @@ -719,6 +742,7 @@ public function sendAudio( 'thumbnail' => $thumbnail, 'disable_notification' => $disableNotification, 'protect_content' => $protectContent, + 'allow_paid_broadcast' => $allowPaidBroadcast, 'message_effect_id' => $messageEffectId, 'reply_parameters' => $replyParameters, 'reply_markup' => $replyMarkup, @@ -774,6 +798,10 @@ public function sendAudio( * @param bool|null $protectContent * Protects the contents of the sent message from forwarding and saving * + * @param bool|null $allowPaidBroadcast + * Pass True to allow up to 1000 messages per second, ignoring broadcasting limits for a fee of 0.1 Telegram Stars + * per message. The relevant Stars will be withdrawn from the bot's balance + * * @param string|null $messageEffectId * Unique identifier of the message effect to be added to the message; for private chats only * @@ -798,6 +826,7 @@ public function sendDocument( bool $disableContentTypeDetection = null, bool $disableNotification = null, bool $protectContent = null, + bool $allowPaidBroadcast = null, string $messageEffectId = null, Type\ReplyParameters $replyParameters = null, $replyMarkup = null @@ -815,6 +844,7 @@ public function sendDocument( 'disable_content_type_detection' => $disableContentTypeDetection, 'disable_notification' => $disableNotification, 'protect_content' => $protectContent, + 'allow_paid_broadcast' => $allowPaidBroadcast, 'message_effect_id' => $messageEffectId, 'reply_parameters' => $replyParameters, 'reply_markup' => $replyMarkup, @@ -884,6 +914,10 @@ public function sendDocument( * @param bool|null $protectContent * Protects the contents of the sent message from forwarding and saving * + * @param bool|null $allowPaidBroadcast + * Pass True to allow up to 1000 messages per second, ignoring broadcasting limits for a fee of 0.1 Telegram Stars + * per message. The relevant Stars will be withdrawn from the bot's balance + * * @param string|null $messageEffectId * Unique identifier of the message effect to be added to the message; for private chats only * @@ -913,6 +947,7 @@ public function sendVideo( bool $supportsStreaming = null, bool $disableNotification = null, bool $protectContent = null, + bool $allowPaidBroadcast = null, string $messageEffectId = null, Type\ReplyParameters $replyParameters = null, $replyMarkup = null @@ -935,6 +970,7 @@ public function sendVideo( 'supports_streaming' => $supportsStreaming, 'disable_notification' => $disableNotification, 'protect_content' => $protectContent, + 'allow_paid_broadcast' => $allowPaidBroadcast, 'message_effect_id' => $messageEffectId, 'reply_parameters' => $replyParameters, 'reply_markup' => $replyMarkup, @@ -1001,6 +1037,10 @@ public function sendVideo( * @param bool|null $protectContent * Protects the contents of the sent message from forwarding and saving * + * @param bool|null $allowPaidBroadcast + * Pass True to allow up to 1000 messages per second, ignoring broadcasting limits for a fee of 0.1 Telegram Stars + * per message. The relevant Stars will be withdrawn from the bot's balance + * * @param string|null $messageEffectId * Unique identifier of the message effect to be added to the message; for private chats only * @@ -1029,6 +1069,7 @@ public function sendAnimation( bool $hasSpoiler = null, bool $disableNotification = null, bool $protectContent = null, + bool $allowPaidBroadcast = null, string $messageEffectId = null, Type\ReplyParameters $replyParameters = null, $replyMarkup = null @@ -1050,6 +1091,7 @@ public function sendAnimation( 'has_spoiler' => $hasSpoiler, 'disable_notification' => $disableNotification, 'protect_content' => $protectContent, + 'allow_paid_broadcast' => $allowPaidBroadcast, 'message_effect_id' => $messageEffectId, 'reply_parameters' => $replyParameters, 'reply_markup' => $replyMarkup, @@ -1098,6 +1140,10 @@ public function sendAnimation( * @param bool|null $protectContent * Protects the contents of the sent message from forwarding and saving * + * @param bool|null $allowPaidBroadcast + * Pass True to allow up to 1000 messages per second, ignoring broadcasting limits for a fee of 0.1 Telegram Stars + * per message. The relevant Stars will be withdrawn from the bot's balance + * * @param string|null $messageEffectId * Unique identifier of the message effect to be added to the message; for private chats only * @@ -1121,6 +1167,7 @@ public function sendVoice( int $duration = null, bool $disableNotification = null, bool $protectContent = null, + bool $allowPaidBroadcast = null, string $messageEffectId = null, Type\ReplyParameters $replyParameters = null, $replyMarkup = null @@ -1137,6 +1184,7 @@ public function sendVoice( 'duration' => $duration, 'disable_notification' => $disableNotification, 'protect_content' => $protectContent, + 'allow_paid_broadcast' => $allowPaidBroadcast, 'message_effect_id' => $messageEffectId, 'reply_parameters' => $replyParameters, 'reply_markup' => $replyMarkup, @@ -1184,6 +1232,10 @@ public function sendVoice( * @param bool|null $protectContent * Protects the contents of the sent message from forwarding and saving * + * @param bool|null $allowPaidBroadcast + * Pass True to allow up to 1000 messages per second, ignoring broadcasting limits for a fee of 0.1 Telegram Stars + * per message. The relevant Stars will be withdrawn from the bot's balance + * * @param string|null $messageEffectId * Unique identifier of the message effect to be added to the message; for private chats only * @@ -1206,6 +1258,7 @@ public function sendVideoNote( $thumbnail = null, bool $disableNotification = null, bool $protectContent = null, + bool $allowPaidBroadcast = null, string $messageEffectId = null, Type\ReplyParameters $replyParameters = null, $replyMarkup = null @@ -1221,6 +1274,7 @@ public function sendVideoNote( 'thumbnail' => $thumbnail, 'disable_notification' => $disableNotification, 'protect_content' => $protectContent, + 'allow_paid_broadcast' => $allowPaidBroadcast, 'message_effect_id' => $messageEffectId, 'reply_parameters' => $replyParameters, 'reply_markup' => $replyMarkup, @@ -1232,18 +1286,26 @@ public function sendVideoNote( /** * https://core.telegram.org/bots/api#sendpaidmedia * - * Use this method to send paid media to channel chats. On success, the sent Message is - * returned. + * Use this method to send paid media. On success, the sent Message is returned. * * @param int|string $chatId - * Unique identifier for the target chat or username of the target channel (in the format @|channelusername) + * Unique identifier for the target chat or username of the target channel (in the format @|channelusername). If + * the chat is a channel, all Telegram Star proceeds from this media will be credited to the chat's balance. Otherwise, + * they will be credited to the bot's balance. * * @param int $starCount - * The number of Telegram Stars that must be paid to buy access to the media + * The number of Telegram Stars that must be paid to buy access to the media; 1-2500 * * @param Type\AbstractInputPaidMedia[] $media * A JSON-serialized array describing the media to be sent; up to 10 items * + * @param string|null $businessConnectionId + * Unique identifier of the business connection on behalf of which the message will be sent + * + * @param string|null $payload + * Bot-defined paid media payload, 0-128 bytes. This will not be displayed to the user, use it for your internal + * processes. + * * @param string|null $caption * Media caption, 0-1024 characters after entities parsing * @@ -1263,6 +1325,10 @@ public function sendVideoNote( * @param bool|null $protectContent * Protects the contents of the sent message from forwarding and saving * + * @param bool|null $allowPaidBroadcast + * Pass True to allow up to 1000 messages per second, ignoring broadcasting limits for a fee of 0.1 Telegram Stars + * per message. The relevant Stars will be withdrawn from the bot's balance + * * @param Type\ReplyParameters|null $replyParameters * Description of the message to reply to * @@ -1276,26 +1342,32 @@ public function sendPaidMedia( $chatId, int $starCount, array $media, + string $businessConnectionId = null, + string $payload = null, string $caption = null, string $parseMode = null, array $captionEntities = null, bool $showCaptionAboveMedia = null, bool $disableNotification = null, bool $protectContent = null, + bool $allowPaidBroadcast = null, Type\ReplyParameters $replyParameters = null, $replyMarkup = null ) { $requestParameters = [ + 'business_connection_id' => $businessConnectionId, 'chat_id' => $chatId, 'star_count' => $starCount, 'media' => $media, + 'payload' => $payload, 'caption' => $caption, 'parse_mode' => $parseMode, 'caption_entities' => $captionEntities, 'show_caption_above_media' => $showCaptionAboveMedia, 'disable_notification' => $disableNotification, 'protect_content' => $protectContent, + 'allow_paid_broadcast' => $allowPaidBroadcast, 'reply_parameters' => $replyParameters, 'reply_markup' => $replyMarkup, ]; @@ -1328,6 +1400,10 @@ public function sendPaidMedia( * @param bool|null $protectContent * Protects the contents of the sent messages from forwarding and saving * + * @param bool|null $allowPaidBroadcast + * Pass True to allow up to 1000 messages per second, ignoring broadcasting limits for a fee of 0.1 Telegram Stars + * per message. The relevant Stars will be withdrawn from the bot's balance + * * @param string|null $messageEffectId * Unique identifier of the message effect to be added to the message; for private chats only * @@ -1343,6 +1419,7 @@ public function sendMediaGroup( int $messageThreadId = null, bool $disableNotification = null, bool $protectContent = null, + bool $allowPaidBroadcast = null, string $messageEffectId = null, Type\ReplyParameters $replyParameters = null ) @@ -1354,6 +1431,7 @@ public function sendMediaGroup( 'media' => $media, 'disable_notification' => $disableNotification, 'protect_content' => $protectContent, + 'allow_paid_broadcast' => $allowPaidBroadcast, 'message_effect_id' => $messageEffectId, 'reply_parameters' => $replyParameters, ]; @@ -1401,6 +1479,10 @@ public function sendMediaGroup( * @param bool|null $protectContent * Protects the contents of the sent message from forwarding and saving * + * @param bool|null $allowPaidBroadcast + * Pass True to allow up to 1000 messages per second, ignoring broadcasting limits for a fee of 0.1 Telegram Stars + * per message. The relevant Stars will be withdrawn from the bot's balance + * * @param string|null $messageEffectId * Unique identifier of the message effect to be added to the message; for private chats only * @@ -1425,6 +1507,7 @@ public function sendLocation( int $proximityAlertRadius = null, bool $disableNotification = null, bool $protectContent = null, + bool $allowPaidBroadcast = null, string $messageEffectId = null, Type\ReplyParameters $replyParameters = null, $replyMarkup = null @@ -1442,6 +1525,7 @@ public function sendLocation( 'proximity_alert_radius' => $proximityAlertRadius, 'disable_notification' => $disableNotification, 'protect_content' => $protectContent, + 'allow_paid_broadcast' => $allowPaidBroadcast, 'message_effect_id' => $messageEffectId, 'reply_parameters' => $replyParameters, 'reply_markup' => $replyMarkup, @@ -1496,6 +1580,10 @@ public function sendLocation( * @param bool|null $protectContent * Protects the contents of the sent message from forwarding and saving * + * @param bool|null $allowPaidBroadcast + * Pass True to allow up to 1000 messages per second, ignoring broadcasting limits for a fee of 0.1 Telegram Stars + * per message. The relevant Stars will be withdrawn from the bot's balance + * * @param string|null $messageEffectId * Unique identifier of the message effect to be added to the message; for private chats only * @@ -1522,6 +1610,7 @@ public function sendVenue( string $googlePlaceType = null, bool $disableNotification = null, bool $protectContent = null, + bool $allowPaidBroadcast = null, string $messageEffectId = null, Type\ReplyParameters $replyParameters = null, $replyMarkup = null @@ -1541,6 +1630,7 @@ public function sendVenue( 'google_place_type' => $googlePlaceType, 'disable_notification' => $disableNotification, 'protect_content' => $protectContent, + 'allow_paid_broadcast' => $allowPaidBroadcast, 'message_effect_id' => $messageEffectId, 'reply_parameters' => $replyParameters, 'reply_markup' => $replyMarkup, @@ -1581,6 +1671,10 @@ public function sendVenue( * @param bool|null $protectContent * Protects the contents of the sent message from forwarding and saving * + * @param bool|null $allowPaidBroadcast + * Pass True to allow up to 1000 messages per second, ignoring broadcasting limits for a fee of 0.1 Telegram Stars + * per message. The relevant Stars will be withdrawn from the bot's balance + * * @param string|null $messageEffectId * Unique identifier of the message effect to be added to the message; for private chats only * @@ -1603,6 +1697,7 @@ public function sendContact( string $vcard = null, bool $disableNotification = null, bool $protectContent = null, + bool $allowPaidBroadcast = null, string $messageEffectId = null, Type\ReplyParameters $replyParameters = null, $replyMarkup = null @@ -1618,6 +1713,7 @@ public function sendContact( 'vcard' => $vcard, 'disable_notification' => $disableNotification, 'protect_content' => $protectContent, + 'allow_paid_broadcast' => $allowPaidBroadcast, 'message_effect_id' => $messageEffectId, 'reply_parameters' => $replyParameters, 'reply_markup' => $replyMarkup, @@ -1693,6 +1789,10 @@ public function sendContact( * @param bool|null $protectContent * Protects the contents of the sent message from forwarding and saving * + * @param bool|null $allowPaidBroadcast + * Pass True to allow up to 1000 messages per second, ignoring broadcasting limits for a fee of 0.1 Telegram Stars + * per message. The relevant Stars will be withdrawn from the bot's balance + * * @param string|null $messageEffectId * Unique identifier of the message effect to be added to the message; for private chats only * @@ -1725,6 +1825,7 @@ public function sendPoll( bool $isClosed = null, bool $disableNotification = null, bool $protectContent = null, + bool $allowPaidBroadcast = null, string $messageEffectId = null, Type\ReplyParameters $replyParameters = null, $replyMarkup = null @@ -1750,6 +1851,7 @@ public function sendPoll( 'is_closed' => $isClosed, 'disable_notification' => $disableNotification, 'protect_content' => $protectContent, + 'allow_paid_broadcast' => $allowPaidBroadcast, 'message_effect_id' => $messageEffectId, 'reply_parameters' => $replyParameters, 'reply_markup' => $replyMarkup, @@ -1783,6 +1885,10 @@ public function sendPoll( * @param bool|null $protectContent * Protects the contents of the sent message from forwarding * + * @param bool|null $allowPaidBroadcast + * Pass True to allow up to 1000 messages per second, ignoring broadcasting limits for a fee of 0.1 Telegram Stars + * per message. The relevant Stars will be withdrawn from the bot's balance + * * @param string|null $messageEffectId * Unique identifier of the message effect to be added to the message; for private chats only * @@ -1802,6 +1908,7 @@ public function sendDice( string $emoji = null, bool $disableNotification = null, bool $protectContent = null, + bool $allowPaidBroadcast = null, string $messageEffectId = null, Type\ReplyParameters $replyParameters = null, $replyMarkup = null @@ -1814,6 +1921,7 @@ public function sendDice( 'emoji' => $emoji, 'disable_notification' => $disableNotification, 'protect_content' => $protectContent, + 'allow_paid_broadcast' => $allowPaidBroadcast, 'message_effect_id' => $messageEffectId, 'reply_parameters' => $replyParameters, 'reply_markup' => $replyMarkup, @@ -1868,8 +1976,8 @@ public function sendChatAction( * https://core.telegram.org/bots/api#setmessagereaction * * Use this method to change the chosen reactions on a message. Service messages can't be reacted to. Automatically - * forwarded messages from a channel to its discussion group have the same available reactions as messages in the channel. - * Returns True on success. + * forwarded messages from a channel to its discussion group have the same available reactions as messages in the channel. Bots + * can't use paid reactions. Returns True on success. * * @param int|string $chatId * Unique identifier for the target chat or username of the target channel (in the format @|channelusername) @@ -1881,7 +1989,7 @@ public function sendChatAction( * @param Type\AbstractReactionType[]|null $reaction * A JSON-serialized list of reaction types to set on the message. Currently, as non-premium users, bots can set up * to one reaction per message. A custom emoji reaction can be used if it is either already present on the message or - * explicitly allowed by chat administrators. + * explicitly allowed by chat administrators. Paid reactions can't be used by bots. * * @param bool|null $isBig * Pass True to set the reaction with a big animation @@ -1936,6 +2044,39 @@ public function getUserProfilePhotos( return $this->_apiCall('getUserProfilePhotos', $requestParameters); } + /** + * https://core.telegram.org/bots/api#setuseremojistatus + * + * 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. + * + * @param int $userId + * Unique identifier of the target user + * + * @param string|null $emojiStatusCustomEmojiId + * Custom emoji identifier of the emoji status to set. Pass an empty string to remove the status. + * + * @param int|null $emojiStatusExpirationDate + * Expiration date of the emoji status, if any + * + * @return mixed + */ + public function setUserEmojiStatus( + int $userId, + string $emojiStatusCustomEmojiId = null, + int $emojiStatusExpirationDate = null + ) + { + $requestParameters = [ + 'user_id' => $userId, + 'emoji_status_custom_emoji_id' => $emojiStatusCustomEmojiId, + 'emoji_status_expiration_date' => $emojiStatusExpirationDate, + ]; + + return $this->_apiCall('setUserEmojiStatus', $requestParameters); + } + /** * https://core.telegram.org/bots/api#getfile * @@ -2434,6 +2575,80 @@ public function editChatInviteLink( return $this->_apiCall('editChatInviteLink', $requestParameters); } + /** + * https://core.telegram.org/bots/api#createchatsubscriptioninvitelink + * + * Use this method to create a subscription invite link for a channel chat. The bot must have the can_invite_users administrator rights. The + * link can be edited using the method editChatSubscriptionInviteLink or revoked using the method revokeChatInviteLink. Returns the new invite + * link as a ChatInviteLink object. + * + * @param int|string $chatId + * Unique identifier for the target channel chat or username of the target channel (in the format + * @|channelusername) + * + * @param int $subscriptionPeriod + * The number of seconds the subscription will be active for before the next payment. Currently, it must always be + * 2592000 (30 days). + * + * @param int $subscriptionPrice + * The amount of Telegram Stars a user must pay initially and after each subsequent subscription period to be a + * member of the chat; 1-2500 + * + * @param string|null $name + * Invite link name; 0-32 characters + * + * @return mixed + */ + public function createChatSubscriptionInviteLink( + $chatId, + int $subscriptionPeriod, + int $subscriptionPrice, + string $name = null + ) + { + $requestParameters = [ + 'chat_id' => $chatId, + 'name' => $name, + 'subscription_period' => $subscriptionPeriod, + 'subscription_price' => $subscriptionPrice, + ]; + + return $this->_apiCall('createChatSubscriptionInviteLink', $requestParameters); + } + + /** + * https://core.telegram.org/bots/api#editchatsubscriptioninvitelink + * + * Use this method to edit a subscription invite link created by the bot. The bot must have the + * can_invite_users administrator rights. Returns the edited invite link as a ChatInviteLink + * object. + * + * @param int|string $chatId + * Unique identifier for the target chat or username of the target channel (in the format @|channelusername) + * + * @param string $inviteLink + * The invite link to edit + * + * @param string|null $name + * Invite link name; 0-32 characters + * + * @return mixed + */ + public function editChatSubscriptionInviteLink( + $chatId, + string $inviteLink, + string $name = null + ) + { + $requestParameters = [ + 'chat_id' => $chatId, + 'invite_link' => $inviteLink, + 'name' => $name, + ]; + + return $this->_apiCall('editChatSubscriptionInviteLink', $requestParameters); + } + /** * https://core.telegram.org/bots/api#revokechatinvitelink * @@ -2632,6 +2847,9 @@ public function setChatDescription( * @param int $messageId * Identifier of a message to pin * + * @param string|null $businessConnectionId + * Unique identifier of the business connection on behalf of which the message will be pinned + * * @param bool|null $disableNotification * Pass True if it is not necessary to send a notification to all chat members about the new pinned message. * Notifications are always disabled in channels and private chats. @@ -2641,10 +2859,12 @@ public function setChatDescription( public function pinChatMessage( $chatId, int $messageId, + string $businessConnectionId = null, bool $disableNotification = null ) { $requestParameters = [ + 'business_connection_id' => $businessConnectionId, 'chat_id' => $chatId, 'message_id' => $messageId, 'disable_notification' => $disableNotification, @@ -2663,18 +2883,23 @@ public function pinChatMessage( * @param int|string $chatId * Unique identifier for the target chat or username of the target channel (in the format @|channelusername) * + * @param string|null $businessConnectionId + * Unique identifier of the business connection on behalf of which the message will be unpinned + * * @param int|null $messageId - * Identifier of a message to unpin. If not specified, the most recent pinned message (by sending date) will be - * unpinned. + * Identifier of the message to unpin. Required if business_connection_id is specified. If not specified, the + * most recent pinned message (by sending date) will be unpinned. * * @return mixed */ public function unpinChatMessage( $chatId, + string $businessConnectionId = null, int $messageId = null ) { $requestParameters = [ + 'business_connection_id' => $businessConnectionId, 'chat_id' => $chatId, 'message_id' => $messageId, ]; @@ -2938,8 +3163,8 @@ public function createForumTopic( * https://core.telegram.org/bots/api#editforumtopic * * Use this method to edit name and icon of a topic in a forum supergroup chat. The bot must be an administrator in the chat - * for this to work and must have can_manage_topics administrator rights, unless it is the creator of the topic. - * Returns True on success. + * for this to work and must have the can_manage_topics administrator rights, unless it is the creator of the + * topic. Returns True on success. * * @param int|string $chatId * Unique identifier for the target chat or username of the target supergroup (in the format @@ -3095,8 +3320,8 @@ public function unpinAllForumTopicMessages( * https://core.telegram.org/bots/api#editgeneralforumtopic * * Use this method to edit the name of the 'General' topic in a forum supergroup chat. The bot must be an administrator in - * the chat for this to work and must have can_manage_topics administrator rights. Returns True on - * success. + * the chat for this to work and must have the can_manage_topics administrator rights. Returns True + * on success. * * @param int|string $chatId * Unique identifier for the target chat or username of the target supergroup (in the format @@ -3809,12 +4034,11 @@ public function editMessageCaption( /** * https://core.telegram.org/bots/api#editmessagemedia * - * Use this method to edit animation, audio, document, photo, or video messages. If a message is part of a message album, - * then it can be edited only to an audio for audio albums, only to a document for document albums and to a photo or a video - * otherwise. When an inline message is edited, a new file can't be uploaded; use a previously uploaded file via its file_id or - * specify a URL. 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. + * Use this method to edit animation, audio, document, photo, or video messages, or to add media to text messages. If a + * message is part of a message album, then it can be edited only to an audio for audio albums, only to a document for document + * albums and to a photo or a video otherwise. When an inline message is edited, a new file can't be uploaded; use a previously + * uploaded file via its file_id or specify a URL. 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. * * @param Type\AbstractInputMedia $media * A JSON-serialized object for a new media content of the message @@ -4154,6 +4378,10 @@ public function deleteMessages( * @param bool|null $protectContent * Protects the contents of the sent message from forwarding and saving * + * @param bool|null $allowPaidBroadcast + * Pass True to allow up to 1000 messages per second, ignoring broadcasting limits for a fee of 0.1 Telegram Stars + * per message. The relevant Stars will be withdrawn from the bot's balance + * * @param string|null $messageEffectId * Unique identifier of the message effect to be added to the message; for private chats only * @@ -4174,6 +4402,7 @@ public function sendSticker( string $emoji = null, bool $disableNotification = null, bool $protectContent = null, + bool $allowPaidBroadcast = null, string $messageEffectId = null, Type\ReplyParameters $replyParameters = null, $replyMarkup = null @@ -4187,6 +4416,7 @@ public function sendSticker( 'emoji' => $emoji, 'disable_notification' => $disableNotification, 'protect_content' => $protectContent, + 'allow_paid_broadcast' => $allowPaidBroadcast, 'message_effect_id' => $messageEffectId, 'reply_parameters' => $replyParameters, 'reply_markup' => $replyMarkup, @@ -4565,8 +4795,8 @@ public function setStickerSetTitle( * @param Type\InputFile|string|null $thumbnail * A .WEBP or .PNG image with the thumbnail, must be up to 128 kilobytes in size and have a width and height of exactly * 100px, or a .TGS animation with a thumbnail up to 32 kilobytes in size (see - * https://core.telegram.org/stickers#animated-sticker-requirements for animated sticker technical requirements), or a WEBM video with the thumbnail up to 32 kilobytes in size; see - * https://core.telegram.org/stickers#video-sticker-requirements for video sticker technical requirements. Pass a file_id as a String to send a file that already exists on the + * https://core.telegram.org/stickers#animation-requirements for animated sticker technical requirements), or a WEBM video with the thumbnail up to 32 kilobytes in size; see + * https://core.telegram.org/stickers#video-requirements for video sticker technical requirements. Pass a file_id as a String to send a file that already exists on the * Telegram servers, pass an HTTP URL as a String for Telegram to get a file from the Internet, or upload a new one using * multipart/form-data. More information on Sending Files ». Animated and video sticker set thumbnails can't be uploaded via HTTP URL. * If omitted, then the thumbnail is dropped and the first sticker is used as the thumbnail. @@ -4620,9 +4850,7 @@ public function setCustomEmojiStickerSetThumbnail( /** * https://core.telegram.org/bots/api#deletestickerset * - * Use this method to delete a sticker set that was created by the bot. Returns True on success. To enable this - * option, send the /setinline command to @|BotFather and provide - * the placeholder text that the user will see in the input field after typing your bot's name. + * Use this method to delete a sticker set that was created by the bot. Returns True on success. * * @param string $name * Sticker set name @@ -4640,6 +4868,68 @@ public function deleteStickerSet( return $this->_apiCall('deleteStickerSet', $requestParameters); } + /** + * https://core.telegram.org/bots/api#getavailablegifts + * + * Returns the list of gifts that can be sent by the bot to users. Requires no parameters. Returns a Gifts object. + * + * @return mixed + */ + public function getAvailableGifts( + ) + { + $requestParameters = [ + ]; + + return $this->_apiCall('getAvailableGifts', $requestParameters); + } + + /** + * https://core.telegram.org/bots/api#sendgift + * + * Sends a gift to the given user. The gift can't be converted to Telegram Stars by the user. Returns True on + * success. To enable this option, send the /setinline command to @|BotFather and provide the placeholder text that the user will see in the input field after typing your bot's name. + * + * @param int $userId + * Unique identifier of the target user that will receive the gift + * + * @param string $giftId + * Identifier of the gift + * + * @param string|null $text + * Text that will be shown along with the gift; 0-255 characters + * + * @param string|null $textParseMode + * 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 Type\MessageEntity[]|null $textEntities + * 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. + * + * @return mixed + */ + public function sendGift( + int $userId, + string $giftId, + string $text = null, + string $textParseMode = null, + array $textEntities = null + ) + { + $requestParameters = [ + 'user_id' => $userId, + 'gift_id' => $giftId, + 'text' => $text, + 'text_parse_mode' => $textParseMode, + 'text_entities' => $textEntities, + ]; + + return $this->_apiCall('sendGift', $requestParameters); + } + /** * https://core.telegram.org/bots/api#answerinlinequery * @@ -4717,6 +5007,52 @@ public function answerWebAppQuery( return $this->_apiCall('answerWebAppQuery', $requestParameters); } + /** + * https://core.telegram.org/bots/api#savepreparedinlinemessage + * + * Stores a message that can be sent by a user of a Mini App. Returns a PreparedInlineMessage object. + * + * @param int $userId + * Unique identifier of the target user that can use the prepared message + * + * @param Type\AbstractInlineQueryResult $result + * A JSON-serialized object describing the message to be sent + * + * @param bool|null $allowUserChats + * Pass True if the message can be sent to private chats with users + * + * @param bool|null $allowBotChats + * Pass True if the message can be sent to private chats with bots + * + * @param bool|null $allowGroupChats + * Pass True if the message can be sent to group and supergroup chats + * + * @param bool|null $allowChannelChats + * Pass True if the message can be sent to channel chats + * + * @return mixed + */ + public function savePreparedInlineMessage( + int $userId, + Type\AbstractInlineQueryResult $result, + bool $allowUserChats = null, + bool $allowBotChats = null, + bool $allowGroupChats = null, + bool $allowChannelChats = null + ) + { + $requestParameters = [ + 'user_id' => $userId, + 'result' => $result, + 'allow_user_chats' => $allowUserChats, + 'allow_bot_chats' => $allowBotChats, + 'allow_group_chats' => $allowGroupChats, + 'allow_channel_chats' => $allowChannelChats, + ]; + + return $this->_apiCall('savePreparedInlineMessage', $requestParameters); + } + /** * https://core.telegram.org/bots/api#sendinvoice * @@ -4732,7 +5068,7 @@ public function answerWebAppQuery( * Product description, 1-255 characters * * @param string $payload - * Bot-defined invoice payload, 1-128 bytes. This will not be displayed to the user, use for your internal + * Bot-defined invoice payload, 1-128 bytes. This will not be displayed to the user, use it for your internal * processes. * * @param string $currency @@ -4810,6 +5146,10 @@ public function answerWebAppQuery( * @param bool|null $protectContent * Protects the contents of the sent message from forwarding and saving * + * @param bool|null $allowPaidBroadcast + * Pass True to allow up to 1000 messages per second, ignoring broadcasting limits for a fee of 0.1 Telegram Stars + * per message. The relevant Stars will be withdrawn from the bot's balance + * * @param string|null $messageEffectId * Unique identifier of the message effect to be added to the message; for private chats only * @@ -4848,6 +5188,7 @@ public function sendInvoice( bool $isFlexible = null, bool $disableNotification = null, bool $protectContent = null, + bool $allowPaidBroadcast = null, string $messageEffectId = null, Type\ReplyParameters $replyParameters = null, Type\InlineKeyboardMarkup $replyMarkup = null @@ -4879,6 +5220,7 @@ public function sendInvoice( 'is_flexible' => $isFlexible, 'disable_notification' => $disableNotification, 'protect_content' => $protectContent, + 'allow_paid_broadcast' => $allowPaidBroadcast, 'message_effect_id' => $messageEffectId, 'reply_parameters' => $replyParameters, 'reply_markup' => $replyMarkup, @@ -4899,7 +5241,7 @@ public function sendInvoice( * Product description, 1-255 characters * * @param string $payload - * Bot-defined invoice payload, 1-128 bytes. This will not be displayed to the user, use for your internal + * Bot-defined invoice payload, 1-128 bytes. This will not be displayed to the user, use it for your internal * processes. * * @param string $currency @@ -4909,9 +5251,19 @@ public function sendInvoice( * Price breakdown, a JSON-serialized list of components (e.g. product price, tax, discount, delivery cost, * delivery tax, bonus, etc.). Must contain exactly one item for payments in Telegram Stars. * + * @param string|null $businessConnectionId + * Unique identifier of the business connection on behalf of which the link will be created. For payments in + * Telegram Stars only. + * * @param string|null $providerToken * Payment provider token, obtained via @|BotFather. Pass an empty string for payments in Telegram Stars. * + * @param int|null $subscriptionPeriod + * The number of seconds the subscription will be active for before the next payment. The currency must be set to + * “XTR” (Telegram Stars) if the parameter is used. Currently, it must always be 2592000 (30 days) if specified. Any + * number of subscriptions can be active for a given bot at the same time, including multiple concurrent subscriptions + * from the same user. Subscription price must no exceed 2500 Telegram Stars. + * * @param int|null $maxTipAmount * The maximum accepted amount for tips in the smallest units of the currency (integer, not float/double). For * example, for a maximum tip of US$ 1.45 pass max_tip_amount = 145. See the exp parameter in currencies.json, it shows the @@ -4969,7 +5321,9 @@ public function createInvoiceLink( string $payload, string $currency, array $prices, + string $businessConnectionId = null, string $providerToken = null, + int $subscriptionPeriod = null, int $maxTipAmount = null, array $suggestedTipAmounts = null, string $providerData = null, @@ -4987,12 +5341,14 @@ public function createInvoiceLink( ) { $requestParameters = [ + 'business_connection_id' => $businessConnectionId, 'title' => $title, 'description' => $description, 'payload' => $payload, 'provider_token' => $providerToken, 'currency' => $currency, 'prices' => $prices, + 'subscription_period' => $subscriptionPeriod, 'max_tip_amount' => $maxTipAmount, 'suggested_tip_amounts' => $suggestedTipAmounts, 'provider_data' => $providerData, @@ -5144,6 +5500,40 @@ public function refundStarPayment( return $this->_apiCall('refundStarPayment', $requestParameters); } + /** + * https://core.telegram.org/bots/api#edituserstarsubscription + * + * Allows the bot to cancel or re-enable extension of a subscription paid in Telegram Stars. Returns True on + * success. + * + * @param int $userId + * Identifier of the user whose subscription will be edited + * + * @param string $telegramPaymentChargeId + * Telegram payment identifier for the subscription + * + * @param bool $isCanceled + * Pass True to cancel extension of the user subscription; the subscription must be active up to the end of the + * current subscription period. Pass False to allow the user to re-enable a subscription that was previously canceled by + * the bot. + * + * @return mixed + */ + public function editUserStarSubscription( + int $userId, + string $telegramPaymentChargeId, + bool $isCanceled + ) + { + $requestParameters = [ + 'user_id' => $userId, + 'telegram_payment_charge_id' => $telegramPaymentChargeId, + 'is_canceled' => $isCanceled, + ]; + + return $this->_apiCall('editUserStarSubscription', $requestParameters); + } + /** * https://core.telegram.org/bots/api#setpassportdataerrors * @@ -5197,6 +5587,10 @@ public function setPassportDataErrors( * @param bool|null $protectContent * Protects the contents of the sent message from forwarding and saving * + * @param bool|null $allowPaidBroadcast + * Pass True to allow up to 1000 messages per second, ignoring broadcasting limits for a fee of 0.1 Telegram Stars + * per message. The relevant Stars will be withdrawn from the bot's balance + * * @param string|null $messageEffectId * Unique identifier of the message effect to be added to the message; for private chats only * @@ -5216,6 +5610,7 @@ public function sendGame( int $messageThreadId = null, bool $disableNotification = null, bool $protectContent = null, + bool $allowPaidBroadcast = null, string $messageEffectId = null, Type\ReplyParameters $replyParameters = null, Type\InlineKeyboardMarkup $replyMarkup = null @@ -5228,6 +5623,7 @@ public function sendGame( 'game_short_name' => $gameShortName, 'disable_notification' => $disableNotification, 'protect_content' => $protectContent, + 'allow_paid_broadcast' => $allowPaidBroadcast, 'message_effect_id' => $messageEffectId, 'reply_parameters' => $replyParameters, 'reply_markup' => $replyMarkup, diff --git a/src/Type/AffiliateInfo.php b/src/Type/AffiliateInfo.php new file mode 100644 index 0000000..322ff81 --- /dev/null +++ b/src/Type/AffiliateInfo.php @@ -0,0 +1,209 @@ + $this->getAffiliateUser(), + 'affiliate_chat' => $this->getAffiliateChat(), + 'commission_per_mille' => $this->getCommissionPerMille(), + 'amount' => $this->getAmount(), + 'nanostar_amount' => $this->getNanostarAmount(), + ]; + + return parent::normalizeData($result); + } + + /** + * Optional. The bot or the user that received an affiliate commission if it was received by a bot or a user + * + * @var User|null + * @SkipWhenEmpty + * @SerializedName("affiliate_user") + * @Accessor(getter="getAffiliateUser", setter="setAffiliateUser") + * @Type("MadmagesTelegram\Types\Type\User") + */ + protected $affiliateUser; + + /** + * Optional. The chat that received an affiliate commission if it was received by a chat + * + * @var Chat|null + * @SkipWhenEmpty + * @SerializedName("affiliate_chat") + * @Accessor(getter="getAffiliateChat", setter="setAffiliateChat") + * @Type("MadmagesTelegram\Types\Type\Chat") + */ + protected $affiliateChat; + + /** + * The number of Telegram Stars received by the affiliate for each 1000 Telegram Stars received by the bot from referred + * users + * + * @var int + * @SerializedName("commission_per_mille") + * @Accessor(getter="getCommissionPerMille", setter="setCommissionPerMille") + * @Type("int") + */ + protected $commissionPerMille; + + /** + * Integer amount of Telegram Stars received by the affiliate from the transaction, rounded to 0; can be negative for + * refunds + * + * @var int + * @SerializedName("amount") + * @Accessor(getter="getAmount", setter="setAmount") + * @Type("int") + */ + protected $amount; + + /** + * Optional. The number of 1/1000000000 shares of Telegram Stars received by the affiliate; from -999999999 to + * 999999999; can be negative for refunds + * + * @var int|null + * @SkipWhenEmpty + * @SerializedName("nanostar_amount") + * @Accessor(getter="getNanostarAmount", setter="setNanostarAmount") + * @Type("int") + */ + protected $nanostarAmount; + + + /** + * @param User $affiliateUser + * @return static + */ + public function setAffiliateUser(User $affiliateUser): self + { + $this->affiliateUser = $affiliateUser; + + return $this; + } + + /** + * @return User|null + */ + public function getAffiliateUser(): ?User + { + return $this->affiliateUser; + } + + /** + * @param Chat $affiliateChat + * @return static + */ + public function setAffiliateChat(Chat $affiliateChat): self + { + $this->affiliateChat = $affiliateChat; + + return $this; + } + + /** + * @return Chat|null + */ + public function getAffiliateChat(): ?Chat + { + return $this->affiliateChat; + } + + /** + * @param int $commissionPerMille + * @return static + */ + public function setCommissionPerMille(int $commissionPerMille): self + { + $this->commissionPerMille = $commissionPerMille; + + return $this; + } + + /** + * @return int + */ + public function getCommissionPerMille(): int + { + return $this->commissionPerMille; + } + + /** + * @param int $amount + * @return static + */ + public function setAmount(int $amount): self + { + $this->amount = $amount; + + return $this; + } + + /** + * @return int + */ + public function getAmount(): int + { + return $this->amount; + } + + /** + * @param int $nanostarAmount + * @return static + */ + public function setNanostarAmount(int $nanostarAmount): self + { + $this->nanostarAmount = $nanostarAmount; + + return $this; + } + + /** + * @return int|null + */ + public function getNanostarAmount(): ?int + { + return $this->nanostarAmount; + } + +} \ No newline at end of file diff --git a/src/Type/ChatBoostSourceGiveaway.php b/src/Type/ChatBoostSourceGiveaway.php index 1059293..c80da76 100644 --- a/src/Type/ChatBoostSourceGiveaway.php +++ b/src/Type/ChatBoostSourceGiveaway.php @@ -12,8 +12,9 @@ /** * https://core.telegram.org/bots/api#chatboostsourcegiveaway * - * The boost was obtained by the creation of a Telegram Premium giveaway. This boosts the chat 4 times for the duration of - * the corresponding Telegram Premium subscription. + * The boost was obtained by the creation of a Telegram Premium or a Telegram Star giveaway. This boosts the chat 4 times + * for the duration of the corresponding Telegram Premium subscription for Telegram Premium giveaways and + * prize_star_count / 500 times for one year for Telegram Star giveaways. * * @ExclusionPolicy("none") * @AccessType("public_method") @@ -32,6 +33,7 @@ public static function _getPropertyNames(): array 'source', 'giveaway_message_id', 'user', + 'prize_star_count', 'is_unclaimed', ]; } @@ -47,6 +49,7 @@ public function _getData(): array 'source' => $this->getSource(), 'giveaway_message_id' => $this->getGiveawayMessageId(), 'user' => $this->getUser(), + 'prize_star_count' => $this->getPrizeStarCount(), 'is_unclaimed' => $this->getIsUnclaimed(), ]; @@ -75,7 +78,7 @@ public function _getData(): array protected $giveawayMessageId; /** - * Optional. User that won the prize in the giveaway if any + * Optional. User that won the prize in the giveaway if any; for Telegram Premium giveaways only * * @var User|null * @SkipWhenEmpty @@ -85,6 +88,17 @@ public function _getData(): array */ protected $user; + /** + * Optional. The number of Telegram Stars to be split between giveaway winners; for Telegram Star giveaways only + * + * @var int|null + * @SkipWhenEmpty + * @SerializedName("prize_star_count") + * @Accessor(getter="getPrizeStarCount", setter="setPrizeStarCount") + * @Type("int") + */ + protected $prizeStarCount; + /** * Optional. True, if the giveaway was completed, but there was no user to win the prize * @@ -154,6 +168,25 @@ public function getUser(): ?User return $this->user; } + /** + * @param int $prizeStarCount + * @return static + */ + public function setPrizeStarCount(int $prizeStarCount): self + { + $this->prizeStarCount = $prizeStarCount; + + return $this; + } + + /** + * @return int|null + */ + public function getPrizeStarCount(): ?int + { + return $this->prizeStarCount; + } + /** * @param bool $isUnclaimed * @return static diff --git a/src/Type/ChatInviteLink.php b/src/Type/ChatInviteLink.php index 95dd304..12b6172 100644 --- a/src/Type/ChatInviteLink.php +++ b/src/Type/ChatInviteLink.php @@ -37,6 +37,8 @@ public static function _getPropertyNames(): array 'expire_date', 'member_limit', 'pending_join_request_count', + 'subscription_period', + 'subscription_price', ]; } @@ -57,6 +59,8 @@ public function _getData(): array 'expire_date' => $this->getExpireDate(), 'member_limit' => $this->getMemberLimit(), 'pending_join_request_count' => $this->getPendingJoinRequestCount(), + 'subscription_period' => $this->getSubscriptionPeriod(), + 'subscription_price' => $this->getSubscriptionPrice(), ]; return parent::normalizeData($result); @@ -158,6 +162,29 @@ public function _getData(): array */ protected $pendingJoinRequestCount; + /** + * Optional. The number of seconds the subscription will be active for before the next payment + * + * @var int|null + * @SkipWhenEmpty + * @SerializedName("subscription_period") + * @Accessor(getter="getSubscriptionPeriod", setter="setSubscriptionPeriod") + * @Type("int") + */ + protected $subscriptionPeriod; + + /** + * Optional. The amount of Telegram Stars a user must pay initially and after each subsequent subscription period to be + * a member of the chat using the link + * + * @var int|null + * @SkipWhenEmpty + * @SerializedName("subscription_price") + * @Accessor(getter="getSubscriptionPrice", setter="setSubscriptionPrice") + * @Type("int") + */ + protected $subscriptionPrice; + /** * @param string $inviteLink @@ -330,4 +357,42 @@ public function getPendingJoinRequestCount(): ?int return $this->pendingJoinRequestCount; } + /** + * @param int $subscriptionPeriod + * @return static + */ + public function setSubscriptionPeriod(int $subscriptionPeriod): self + { + $this->subscriptionPeriod = $subscriptionPeriod; + + return $this; + } + + /** + * @return int|null + */ + public function getSubscriptionPeriod(): ?int + { + return $this->subscriptionPeriod; + } + + /** + * @param int $subscriptionPrice + * @return static + */ + public function setSubscriptionPrice(int $subscriptionPrice): self + { + $this->subscriptionPrice = $subscriptionPrice; + + return $this; + } + + /** + * @return int|null + */ + public function getSubscriptionPrice(): ?int + { + return $this->subscriptionPrice; + } + } \ No newline at end of file diff --git a/src/Type/ChatMemberMember.php b/src/Type/ChatMemberMember.php index efdb6d2..9b41a0b 100644 --- a/src/Type/ChatMemberMember.php +++ b/src/Type/ChatMemberMember.php @@ -30,6 +30,7 @@ public static function _getPropertyNames(): array return [ 'status', 'user', + 'until_date', ]; } @@ -43,6 +44,7 @@ public function _getData(): array $result = [ 'status' => $this->getStatus(), 'user' => $this->getUser(), + 'until_date' => $this->getUntilDate(), ]; return parent::normalizeData($result); @@ -68,6 +70,17 @@ public function _getData(): array */ protected $user; + /** + * Optional. Date when the user's subscription will expire; Unix time + * + * @var int|null + * @SkipWhenEmpty + * @SerializedName("until_date") + * @Accessor(getter="getUntilDate", setter="setUntilDate") + * @Type("int") + */ + protected $untilDate; + /** * @param string $status @@ -107,4 +120,23 @@ public function getUser(): User return $this->user; } + /** + * @param int $untilDate + * @return static + */ + public function setUntilDate(int $untilDate): self + { + $this->untilDate = $untilDate; + + return $this; + } + + /** + * @return int|null + */ + public function getUntilDate(): ?int + { + return $this->untilDate; + } + } \ No newline at end of file diff --git a/src/Type/CopyTextButton.php b/src/Type/CopyTextButton.php new file mode 100644 index 0000000..f531321 --- /dev/null +++ b/src/Type/CopyTextButton.php @@ -0,0 +1,79 @@ + $this->getText(), + ]; + + return parent::normalizeData($result); + } + + /** + * The text to be copied to the clipboard; 1-256 characters + * + * @var string + * @SerializedName("text") + * @Accessor(getter="getText", setter="setText") + * @Type("string") + */ + protected $text; + + + /** + * @param string $text + * @return static + */ + public function setText(string $text): self + { + $this->text = $text; + + return $this; + } + + /** + * @return string + */ + public function getText(): string + { + return $this->text; + } + +} \ No newline at end of file diff --git a/src/Type/Gift.php b/src/Type/Gift.php new file mode 100644 index 0000000..4f4862a --- /dev/null +++ b/src/Type/Gift.php @@ -0,0 +1,205 @@ + $this->getId(), + 'sticker' => $this->getSticker(), + 'star_count' => $this->getStarCount(), + 'total_count' => $this->getTotalCount(), + 'remaining_count' => $this->getRemainingCount(), + ]; + + return parent::normalizeData($result); + } + + /** + * Unique identifier of the gift + * + * @var string + * @SerializedName("id") + * @Accessor(getter="getId", setter="setId") + * @Type("string") + */ + protected $id; + + /** + * The sticker that represents the gift + * + * @var Sticker + * @SerializedName("sticker") + * @Accessor(getter="getSticker", setter="setSticker") + * @Type("MadmagesTelegram\Types\Type\Sticker") + */ + protected $sticker; + + /** + * The number of Telegram Stars that must be paid to send the sticker + * + * @var int + * @SerializedName("star_count") + * @Accessor(getter="getStarCount", setter="setStarCount") + * @Type("int") + */ + protected $starCount; + + /** + * Optional. The total number of the gifts of this type that can be sent; for limited gifts only + * + * @var int|null + * @SkipWhenEmpty + * @SerializedName("total_count") + * @Accessor(getter="getTotalCount", setter="setTotalCount") + * @Type("int") + */ + protected $totalCount; + + /** + * Optional. The number of remaining gifts of this type that can be sent; for limited gifts only + * + * @var int|null + * @SkipWhenEmpty + * @SerializedName("remaining_count") + * @Accessor(getter="getRemainingCount", setter="setRemainingCount") + * @Type("int") + */ + protected $remainingCount; + + + /** + * @param string $id + * @return static + */ + public function setId(string $id): self + { + $this->id = $id; + + return $this; + } + + /** + * @return string + */ + public function getId(): string + { + return $this->id; + } + + /** + * @param Sticker $sticker + * @return static + */ + public function setSticker(Sticker $sticker): self + { + $this->sticker = $sticker; + + return $this; + } + + /** + * @return Sticker + */ + public function getSticker(): Sticker + { + return $this->sticker; + } + + /** + * @param int $starCount + * @return static + */ + public function setStarCount(int $starCount): self + { + $this->starCount = $starCount; + + return $this; + } + + /** + * @return int + */ + public function getStarCount(): int + { + return $this->starCount; + } + + /** + * @param int $totalCount + * @return static + */ + public function setTotalCount(int $totalCount): self + { + $this->totalCount = $totalCount; + + return $this; + } + + /** + * @return int|null + */ + public function getTotalCount(): ?int + { + return $this->totalCount; + } + + /** + * @param int $remainingCount + * @return static + */ + public function setRemainingCount(int $remainingCount): self + { + $this->remainingCount = $remainingCount; + + return $this; + } + + /** + * @return int|null + */ + public function getRemainingCount(): ?int + { + return $this->remainingCount; + } + +} \ No newline at end of file diff --git a/src/Type/Gifts.php b/src/Type/Gifts.php new file mode 100644 index 0000000..46d4ebf --- /dev/null +++ b/src/Type/Gifts.php @@ -0,0 +1,79 @@ + $this->getGifts(), + ]; + + return parent::normalizeData($result); + } + + /** + * The list of gifts + * + * @var Gift[] + * @SerializedName("gifts") + * @Accessor(getter="getGifts", setter="setGifts") + * @Type("array") + */ + protected $gifts; + + + /** + * @param Gift[] $gifts + * @return static + */ + public function setGifts(array $gifts): self + { + $this->gifts = $gifts; + + return $this; + } + + /** + * @return Gift[] + */ + public function getGifts(): array + { + return $this->gifts; + } + +} \ No newline at end of file diff --git a/src/Type/Giveaway.php b/src/Type/Giveaway.php index 0844390..47d6774 100644 --- a/src/Type/Giveaway.php +++ b/src/Type/Giveaway.php @@ -35,6 +35,7 @@ public static function _getPropertyNames(): array 'has_public_winners', 'prize_description', 'country_codes', + 'prize_star_count', 'premium_subscription_month_count', ]; } @@ -54,6 +55,7 @@ public function _getData(): array 'has_public_winners' => $this->getHasPublicWinners(), 'prize_description' => $this->getPrizeDescription(), 'country_codes' => $this->getCountryCodes(), + 'prize_star_count' => $this->getPrizeStarCount(), 'premium_subscription_month_count' => $this->getPremiumSubscriptionMonthCount(), ]; @@ -137,7 +139,19 @@ public function _getData(): array protected $countryCodes; /** - * Optional. The number of months the Telegram Premium subscription won from the giveaway will be active for + * Optional. The number of Telegram Stars to be split between giveaway winners; for Telegram Star giveaways only + * + * @var int|null + * @SkipWhenEmpty + * @SerializedName("prize_star_count") + * @Accessor(getter="getPrizeStarCount", setter="setPrizeStarCount") + * @Type("int") + */ + protected $prizeStarCount; + + /** + * Optional. The number of months the Telegram Premium subscription won from the giveaway will be active for; for + * Telegram Premium giveaways only * * @var int|null * @SkipWhenEmpty @@ -281,6 +295,25 @@ public function getCountryCodes(): ?array return $this->countryCodes; } + /** + * @param int $prizeStarCount + * @return static + */ + public function setPrizeStarCount(int $prizeStarCount): self + { + $this->prizeStarCount = $prizeStarCount; + + return $this; + } + + /** + * @return int|null + */ + public function getPrizeStarCount(): ?int + { + return $this->prizeStarCount; + } + /** * @param int $premiumSubscriptionMonthCount * @return static diff --git a/src/Type/GiveawayCompleted.php b/src/Type/GiveawayCompleted.php index 91ac3b9..e8bbb0b 100644 --- a/src/Type/GiveawayCompleted.php +++ b/src/Type/GiveawayCompleted.php @@ -31,6 +31,7 @@ public static function _getPropertyNames(): array 'winner_count', 'unclaimed_prize_count', 'giveaway_message', + 'is_star_giveaway', ]; } @@ -45,6 +46,7 @@ public function _getData(): array 'winner_count' => $this->getWinnerCount(), 'unclaimed_prize_count' => $this->getUnclaimedPrizeCount(), 'giveaway_message' => $this->getGiveawayMessage(), + 'is_star_giveaway' => $this->getIsStarGiveaway(), ]; return parent::normalizeData($result); @@ -82,6 +84,18 @@ public function _getData(): array */ protected $giveawayMessage; + /** + * Optional. True, if the giveaway is a Telegram Star giveaway. Otherwise, currently, the giveaway is a Telegram + * Premium giveaway. + * + * @var bool|null + * @SkipWhenEmpty + * @SerializedName("is_star_giveaway") + * @Accessor(getter="getIsStarGiveaway", setter="setIsStarGiveaway") + * @Type("bool") + */ + protected $isStarGiveaway; + /** * @param int $winnerCount @@ -140,4 +154,23 @@ public function getGiveawayMessage(): ?Message return $this->giveawayMessage; } + /** + * @param bool $isStarGiveaway + * @return static + */ + public function setIsStarGiveaway(bool $isStarGiveaway): self + { + $this->isStarGiveaway = $isStarGiveaway; + + return $this; + } + + /** + * @return bool|null + */ + public function getIsStarGiveaway(): ?bool + { + return $this->isStarGiveaway; + } + } \ No newline at end of file diff --git a/src/Type/GiveawayCreated.php b/src/Type/GiveawayCreated.php index 23c45cf..81cc54e 100644 --- a/src/Type/GiveawayCreated.php +++ b/src/Type/GiveawayCreated.php @@ -12,8 +12,7 @@ /** * https://core.telegram.org/bots/api#giveawaycreated * - * This object represents a service message about the creation of a scheduled giveaway. Currently holds no - * information. + * This object represents a service message about the creation of a scheduled giveaway. * * @ExclusionPolicy("none") * @AccessType("public_method") @@ -29,6 +28,7 @@ class GiveawayCreated extends AbstractType public static function _getPropertyNames(): array { return [ + 'prize_star_count', ]; } @@ -40,10 +40,41 @@ public static function _getPropertyNames(): array public function _getData(): array { $result = [ + 'prize_star_count' => $this->getPrizeStarCount(), ]; return parent::normalizeData($result); } + /** + * Optional. The number of Telegram Stars to be split between giveaway winners; for Telegram Star giveaways only + * + * @var int|null + * @SkipWhenEmpty + * @SerializedName("prize_star_count") + * @Accessor(getter="getPrizeStarCount", setter="setPrizeStarCount") + * @Type("int") + */ + protected $prizeStarCount; + + + /** + * @param int $prizeStarCount + * @return static + */ + public function setPrizeStarCount(int $prizeStarCount): self + { + $this->prizeStarCount = $prizeStarCount; + + return $this; + } + + /** + * @return int|null + */ + public function getPrizeStarCount(): ?int + { + return $this->prizeStarCount; + } } \ No newline at end of file diff --git a/src/Type/GiveawayWinners.php b/src/Type/GiveawayWinners.php index d57789f..8866643 100644 --- a/src/Type/GiveawayWinners.php +++ b/src/Type/GiveawayWinners.php @@ -34,6 +34,7 @@ public static function _getPropertyNames(): array 'winner_count', 'winners', 'additional_chat_count', + 'prize_star_count', 'premium_subscription_month_count', 'unclaimed_prize_count', 'only_new_members', @@ -56,6 +57,7 @@ public function _getData(): array 'winner_count' => $this->getWinnerCount(), 'winners' => $this->getWinners(), 'additional_chat_count' => $this->getAdditionalChatCount(), + 'prize_star_count' => $this->getPrizeStarCount(), 'premium_subscription_month_count' => $this->getPremiumSubscriptionMonthCount(), 'unclaimed_prize_count' => $this->getUnclaimedPrizeCount(), 'only_new_members' => $this->getOnlyNewMembers(), @@ -128,7 +130,19 @@ public function _getData(): array protected $additionalChatCount; /** - * Optional. The number of months the Telegram Premium subscription won from the giveaway will be active for + * Optional. The number of Telegram Stars that were split between giveaway winners; for Telegram Star giveaways only + * + * @var int|null + * @SkipWhenEmpty + * @SerializedName("prize_star_count") + * @Accessor(getter="getPrizeStarCount", setter="setPrizeStarCount") + * @Type("int") + */ + protected $prizeStarCount; + + /** + * Optional. The number of months the Telegram Premium subscription won from the giveaway will be active for; for + * Telegram Premium giveaways only * * @var int|null * @SkipWhenEmpty @@ -297,6 +311,25 @@ public function getAdditionalChatCount(): ?int return $this->additionalChatCount; } + /** + * @param int $prizeStarCount + * @return static + */ + public function setPrizeStarCount(int $prizeStarCount): self + { + $this->prizeStarCount = $prizeStarCount; + + return $this; + } + + /** + * @return int|null + */ + public function getPrizeStarCount(): ?int + { + return $this->prizeStarCount; + } + /** * @param int $premiumSubscriptionMonthCount * @return static diff --git a/src/Type/InlineKeyboardButton.php b/src/Type/InlineKeyboardButton.php index 2558791..db786d9 100644 --- a/src/Type/InlineKeyboardButton.php +++ b/src/Type/InlineKeyboardButton.php @@ -37,6 +37,7 @@ public static function _getPropertyNames(): array 'switch_inline_query', 'switch_inline_query_current_chat', 'switch_inline_query_chosen_chat', + 'copy_text', 'callback_game', 'pay', ]; @@ -58,6 +59,7 @@ public function _getData(): array 'switch_inline_query' => $this->getSwitchInlineQuery(), 'switch_inline_query_current_chat' => $this->getSwitchInlineQueryCurrentChat(), 'switch_inline_query_chosen_chat' => $this->getSwitchInlineQueryChosenChat(), + 'copy_text' => $this->getCopyText(), 'callback_game' => $this->getCallbackGame(), 'pay' => $this->getPay(), ]; @@ -163,6 +165,17 @@ public function _getData(): array */ protected $switchInlineQueryChosenChat; + /** + * Optional. Description of the button that copies the specified text to the clipboard. + * + * @var CopyTextButton|null + * @SkipWhenEmpty + * @SerializedName("copy_text") + * @Accessor(getter="getCopyText", setter="setCopyText") + * @Type("MadmagesTelegram\Types\Type\CopyTextButton") + */ + protected $copyText; + /** * Optional. Description of the game that will be launched when the user presses the button.NOTE: This type of button * must always be the first button in the first row. @@ -341,6 +354,25 @@ public function getSwitchInlineQueryChosenChat(): ?SwitchInlineQueryChosenChat return $this->switchInlineQueryChosenChat; } + /** + * @param CopyTextButton $copyText + * @return static + */ + public function setCopyText(CopyTextButton $copyText): self + { + $this->copyText = $copyText; + + return $this; + } + + /** + * @return CopyTextButton|null + */ + public function getCopyText(): ?CopyTextButton + { + return $this->copyText; + } + /** * @param array $callbackGame * @return static diff --git a/src/Type/InputInvoiceMessageContent.php b/src/Type/InputInvoiceMessageContent.php index 4ccaf36..0c49b98 100644 --- a/src/Type/InputInvoiceMessageContent.php +++ b/src/Type/InputInvoiceMessageContent.php @@ -106,7 +106,8 @@ public function _getData(): array protected $description; /** - * Bot-defined invoice payload, 1-128 bytes. This will not be displayed to the user, use for your internal processes. + * Bot-defined invoice payload, 1-128 bytes. This will not be displayed to the user, use it for your internal + * processes. * * @var string * @SerializedName("payload") diff --git a/src/Type/Message.php b/src/Type/Message.php index f569fb5..4749878 100644 --- a/src/Type/Message.php +++ b/src/Type/Message.php @@ -215,7 +215,9 @@ public function _getData(): array } /** - * Unique message identifier inside this chat + * Unique message identifier inside this chat. In specific instances (e.g., message containing a video sent to a big + * chat), the server might automatically schedule a message instead of sending it immediately. In such cases, this field will + * be 0 and the relevant message will be unusable until it is actually sent * * @var int * @SerializedName("message_id") @@ -236,8 +238,8 @@ public function _getData(): array protected $messageThreadId; /** - * Optional. Sender of the message; empty for messages sent to channels. For backward compatibility, the field - * contains a fake sender user in non-channel chats, if the message was sent on behalf of a chat. + * Optional. Sender of the message; may be empty for messages sent to channels. For backward compatibility, if the + * message was sent on behalf of a chat, the field contains a fake sender user in non-channel chats * * @var User|null * @SkipWhenEmpty @@ -248,10 +250,10 @@ public function _getData(): array protected $from; /** - * Optional. Sender of the message, sent on behalf of a chat. For example, the channel itself for channel posts, the - * supergroup itself for messages from anonymous group administrators, the linked channel for messages automatically - * forwarded to the discussion group. For backward compatibility, the field from contains a fake sender user in non-channel - * chats, if the message was sent on behalf of a 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. * * @var Chat|null * @SkipWhenEmpty diff --git a/src/Type/MessageEntity.php b/src/Type/MessageEntity.php index 0e868bd..93cbb59 100644 --- a/src/Type/MessageEntity.php +++ b/src/Type/MessageEntity.php @@ -59,13 +59,13 @@ public function _getData(): array } /** - * Type of the entity. Currently, can be “mention” (@|username), “hashtag” (#hashtag), “cashtag” - * ($USD), “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) * * @var string * @SerializedName("type") diff --git a/src/Type/MessageId.php b/src/Type/MessageId.php index 15eac96..ddd9cb4 100644 --- a/src/Type/MessageId.php +++ b/src/Type/MessageId.php @@ -47,7 +47,9 @@ public function _getData(): array } /** - * Unique message identifier + * Unique message identifier. In specific instances (e.g., message containing a video sent to a big chat), the server + * might automatically schedule a message instead of sending it immediately. In such cases, this field will be 0 and the + * relevant message will be unusable until it is actually sent * * @var int * @SerializedName("message_id") diff --git a/src/Type/PaidMediaPurchased.php b/src/Type/PaidMediaPurchased.php new file mode 100644 index 0000000..e66eeab --- /dev/null +++ b/src/Type/PaidMediaPurchased.php @@ -0,0 +1,110 @@ + $this->getFrom(), + 'paid_media_payload' => $this->getPaidMediaPayload(), + ]; + + return parent::normalizeData($result); + } + + /** + * User who purchased the media + * + * @var User + * @SerializedName("from") + * @Accessor(getter="getFrom", setter="setFrom") + * @Type("MadmagesTelegram\Types\Type\User") + */ + protected $from; + + /** + * Bot-specified paid media payload + * + * @var string + * @SerializedName("paid_media_payload") + * @Accessor(getter="getPaidMediaPayload", setter="setPaidMediaPayload") + * @Type("string") + */ + protected $paidMediaPayload; + + + /** + * @param User $from + * @return static + */ + public function setFrom(User $from): self + { + $this->from = $from; + + return $this; + } + + /** + * @return User + */ + public function getFrom(): User + { + return $this->from; + } + + /** + * @param string $paidMediaPayload + * @return static + */ + public function setPaidMediaPayload(string $paidMediaPayload): self + { + $this->paidMediaPayload = $paidMediaPayload; + + return $this; + } + + /** + * @return string + */ + public function getPaidMediaPayload(): string + { + return $this->paidMediaPayload; + } + +} \ No newline at end of file diff --git a/src/Type/PreparedInlineMessage.php b/src/Type/PreparedInlineMessage.php new file mode 100644 index 0000000..c4977c0 --- /dev/null +++ b/src/Type/PreparedInlineMessage.php @@ -0,0 +1,110 @@ + $this->getId(), + 'expiration_date' => $this->getExpirationDate(), + ]; + + return parent::normalizeData($result); + } + + /** + * Unique identifier of the prepared message + * + * @var string + * @SerializedName("id") + * @Accessor(getter="getId", setter="setId") + * @Type("string") + */ + protected $id; + + /** + * Expiration date of the prepared message, in Unix time. Expired prepared messages can no longer be used + * + * @var int + * @SerializedName("expiration_date") + * @Accessor(getter="getExpirationDate", setter="setExpirationDate") + * @Type("int") + */ + protected $expirationDate; + + + /** + * @param string $id + * @return static + */ + public function setId(string $id): self + { + $this->id = $id; + + return $this; + } + + /** + * @return string + */ + public function getId(): string + { + return $this->id; + } + + /** + * @param int $expirationDate + * @return static + */ + public function setExpirationDate(int $expirationDate): self + { + $this->expirationDate = $expirationDate; + + return $this; + } + + /** + * @return int + */ + public function getExpirationDate(): int + { + return $this->expirationDate; + } + +} \ No newline at end of file diff --git a/src/Type/ReactionTypePaid.php b/src/Type/ReactionTypePaid.php new file mode 100644 index 0000000..a679daa --- /dev/null +++ b/src/Type/ReactionTypePaid.php @@ -0,0 +1,79 @@ + $this->getType(), + ]; + + return parent::normalizeData($result); + } + + /** + * Type of the reaction, always “paid” + * + * @var string + * @SerializedName("type") + * @Accessor(getter="getType", setter="setType") + * @Type("string") + */ + protected $type; + + + /** + * @param string $type + * @return static + */ + public function setType(string $type): self + { + $this->type = $type; + + return $this; + } + + /** + * @return string + */ + public function getType(): string + { + return $this->type; + } + +} \ No newline at end of file diff --git a/src/Type/StarTransaction.php b/src/Type/StarTransaction.php index c828a5e..d32f2bf 100644 --- a/src/Type/StarTransaction.php +++ b/src/Type/StarTransaction.php @@ -30,6 +30,7 @@ public static function _getPropertyNames(): array return [ 'id', 'amount', + 'nanostar_amount', 'date', 'source', 'receiver', @@ -46,6 +47,7 @@ public function _getData(): array $result = [ 'id' => $this->getId(), 'amount' => $this->getAmount(), + 'nanostar_amount' => $this->getNanostarAmount(), 'date' => $this->getDate(), 'source' => $this->getSource(), 'receiver' => $this->getReceiver(), @@ -55,7 +57,7 @@ public function _getData(): array } /** - * Unique identifier of the transaction. Coincides with the identifer of the original transaction for refund + * Unique identifier of the transaction. Coincides with the identifier of the original transaction for refund * transactions. Coincides with SuccessfulPayment.telegram_payment_charge_id for successful incoming payments from users. * * @var string @@ -66,7 +68,7 @@ public function _getData(): array protected $id; /** - * Number of Telegram Stars transferred by the transaction + * Integer amount of Telegram Stars transferred by the transaction * * @var int * @SerializedName("amount") @@ -75,6 +77,17 @@ public function _getData(): array */ protected $amount; + /** + * Optional. The number of 1/1000000000 shares of Telegram Stars transferred by the transaction; from 0 to 999999999 + * + * @var int|null + * @SkipWhenEmpty + * @SerializedName("nanostar_amount") + * @Accessor(getter="getNanostarAmount", setter="setNanostarAmount") + * @Type("int") + */ + protected $nanostarAmount; + /** * Date the transaction was created in Unix time * @@ -148,6 +161,25 @@ public function getAmount(): int return $this->amount; } + /** + * @param int $nanostarAmount + * @return static + */ + public function setNanostarAmount(int $nanostarAmount): self + { + $this->nanostarAmount = $nanostarAmount; + + return $this; + } + + /** + * @return int|null + */ + public function getNanostarAmount(): ?int + { + return $this->nanostarAmount; + } + /** * @param int $date * @return static diff --git a/src/Type/SuccessfulPayment.php b/src/Type/SuccessfulPayment.php index 97d3a0a..31bb239 100644 --- a/src/Type/SuccessfulPayment.php +++ b/src/Type/SuccessfulPayment.php @@ -31,6 +31,9 @@ public static function _getPropertyNames(): array 'currency', 'total_amount', 'invoice_payload', + 'subscription_expiration_date', + 'is_recurring', + 'is_first_recurring', 'shipping_option_id', 'order_info', 'telegram_payment_charge_id', @@ -49,6 +52,9 @@ public function _getData(): array 'currency' => $this->getCurrency(), 'total_amount' => $this->getTotalAmount(), 'invoice_payload' => $this->getInvoicePayload(), + 'subscription_expiration_date' => $this->getSubscriptionExpirationDate(), + 'is_recurring' => $this->getIsRecurring(), + 'is_first_recurring' => $this->getIsFirstRecurring(), 'shipping_option_id' => $this->getShippingOptionId(), 'order_info' => $this->getOrderInfo(), 'telegram_payment_charge_id' => $this->getTelegramPaymentChargeId(), @@ -90,6 +96,39 @@ public function _getData(): array */ protected $invoicePayload; + /** + * Optional. Expiration date of the subscription, in Unix time; for recurring payments only + * + * @var int|null + * @SkipWhenEmpty + * @SerializedName("subscription_expiration_date") + * @Accessor(getter="getSubscriptionExpirationDate", setter="setSubscriptionExpirationDate") + * @Type("int") + */ + protected $subscriptionExpirationDate; + + /** + * Optional. True, if the payment is a recurring payment for a subscription + * + * @var bool|null + * @SkipWhenEmpty + * @SerializedName("is_recurring") + * @Accessor(getter="getIsRecurring", setter="setIsRecurring") + * @Type("bool") + */ + protected $isRecurring; + + /** + * Optional. True, if the payment is the first payment for a subscription + * + * @var bool|null + * @SkipWhenEmpty + * @SerializedName("is_first_recurring") + * @Accessor(getter="getIsFirstRecurring", setter="setIsFirstRecurring") + * @Type("bool") + */ + protected $isFirstRecurring; + /** * Optional. Identifier of the shipping option chosen by the user * @@ -190,6 +229,63 @@ public function getInvoicePayload(): string return $this->invoicePayload; } + /** + * @param int $subscriptionExpirationDate + * @return static + */ + public function setSubscriptionExpirationDate(int $subscriptionExpirationDate): self + { + $this->subscriptionExpirationDate = $subscriptionExpirationDate; + + return $this; + } + + /** + * @return int|null + */ + public function getSubscriptionExpirationDate(): ?int + { + return $this->subscriptionExpirationDate; + } + + /** + * @param bool $isRecurring + * @return static + */ + public function setIsRecurring(bool $isRecurring): self + { + $this->isRecurring = $isRecurring; + + return $this; + } + + /** + * @return bool|null + */ + public function getIsRecurring(): ?bool + { + return $this->isRecurring; + } + + /** + * @param bool $isFirstRecurring + * @return static + */ + public function setIsFirstRecurring(bool $isFirstRecurring): self + { + $this->isFirstRecurring = $isFirstRecurring; + + return $this; + } + + /** + * @return bool|null + */ + public function getIsFirstRecurring(): ?bool + { + return $this->isFirstRecurring; + } + /** * @param string $shippingOptionId * @return static diff --git a/src/Type/TransactionPartnerAffiliateProgram.php b/src/Type/TransactionPartnerAffiliateProgram.php new file mode 100644 index 0000000..2180396 --- /dev/null +++ b/src/Type/TransactionPartnerAffiliateProgram.php @@ -0,0 +1,143 @@ + $this->getType(), + 'sponsor_user' => $this->getSponsorUser(), + 'commission_per_mille' => $this->getCommissionPerMille(), + ]; + + return parent::normalizeData($result); + } + + /** + * Type of the transaction partner, always “affiliate_program” + * + * @var string + * @SerializedName("type") + * @Accessor(getter="getType", setter="setType") + * @Type("string") + */ + protected $type; + + /** + * Optional. Information about the bot that sponsored the affiliate program + * + * @var User|null + * @SkipWhenEmpty + * @SerializedName("sponsor_user") + * @Accessor(getter="getSponsorUser", setter="setSponsorUser") + * @Type("MadmagesTelegram\Types\Type\User") + */ + protected $sponsorUser; + + /** + * The number of Telegram Stars received by the bot for each 1000 Telegram Stars received by the affiliate program + * sponsor from referred users + * + * @var int + * @SerializedName("commission_per_mille") + * @Accessor(getter="getCommissionPerMille", setter="setCommissionPerMille") + * @Type("int") + */ + protected $commissionPerMille; + + + /** + * @param string $type + * @return static + */ + public function setType(string $type): self + { + $this->type = $type; + + return $this; + } + + /** + * @return string + */ + public function getType(): string + { + return $this->type; + } + + /** + * @param User $sponsorUser + * @return static + */ + public function setSponsorUser(User $sponsorUser): self + { + $this->sponsorUser = $sponsorUser; + + return $this; + } + + /** + * @return User|null + */ + public function getSponsorUser(): ?User + { + return $this->sponsorUser; + } + + /** + * @param int $commissionPerMille + * @return static + */ + public function setCommissionPerMille(int $commissionPerMille): self + { + $this->commissionPerMille = $commissionPerMille; + + return $this; + } + + /** + * @return int + */ + public function getCommissionPerMille(): int + { + return $this->commissionPerMille; + } + +} \ No newline at end of file diff --git a/src/Type/TransactionPartnerTelegramApi.php b/src/Type/TransactionPartnerTelegramApi.php new file mode 100644 index 0000000..ebc3dff --- /dev/null +++ b/src/Type/TransactionPartnerTelegramApi.php @@ -0,0 +1,110 @@ + $this->getType(), + 'request_count' => $this->getRequestCount(), + ]; + + return parent::normalizeData($result); + } + + /** + * Type of the transaction partner, always “telegram_api” + * + * @var string + * @SerializedName("type") + * @Accessor(getter="getType", setter="setType") + * @Type("string") + */ + protected $type; + + /** + * The number of successful requests that exceeded regular limits and were therefore billed + * + * @var int + * @SerializedName("request_count") + * @Accessor(getter="getRequestCount", setter="setRequestCount") + * @Type("int") + */ + protected $requestCount; + + + /** + * @param string $type + * @return static + */ + public function setType(string $type): self + { + $this->type = $type; + + return $this; + } + + /** + * @return string + */ + public function getType(): string + { + return $this->type; + } + + /** + * @param int $requestCount + * @return static + */ + public function setRequestCount(int $requestCount): self + { + $this->requestCount = $requestCount; + + return $this; + } + + /** + * @return int + */ + public function getRequestCount(): int + { + return $this->requestCount; + } + +} \ No newline at end of file diff --git a/src/Type/TransactionPartnerUser.php b/src/Type/TransactionPartnerUser.php index 888578e..11c9ea4 100644 --- a/src/Type/TransactionPartnerUser.php +++ b/src/Type/TransactionPartnerUser.php @@ -30,7 +30,12 @@ public static function _getPropertyNames(): array return [ 'type', 'user', + 'affiliate', 'invoice_payload', + 'subscription_period', + 'paid_media', + 'paid_media_payload', + 'gift', ]; } @@ -44,7 +49,12 @@ public function _getData(): array $result = [ 'type' => $this->getType(), 'user' => $this->getUser(), + 'affiliate' => $this->getAffiliate(), 'invoice_payload' => $this->getInvoicePayload(), + 'subscription_period' => $this->getSubscriptionPeriod(), + 'paid_media' => $this->getPaidMedia(), + 'paid_media_payload' => $this->getPaidMediaPayload(), + 'gift' => $this->getGift(), ]; return parent::normalizeData($result); @@ -70,6 +80,17 @@ public function _getData(): array */ protected $user; + /** + * Optional. Information about the affiliate that received a commission via this transaction + * + * @var AffiliateInfo|null + * @SkipWhenEmpty + * @SerializedName("affiliate") + * @Accessor(getter="getAffiliate", setter="setAffiliate") + * @Type("MadmagesTelegram\Types\Type\AffiliateInfo") + */ + protected $affiliate; + /** * Optional. Bot-specified invoice payload * @@ -81,6 +102,50 @@ public function _getData(): array */ protected $invoicePayload; + /** + * Optional. The duration of the paid subscription + * + * @var int|null + * @SkipWhenEmpty + * @SerializedName("subscription_period") + * @Accessor(getter="getSubscriptionPeriod", setter="setSubscriptionPeriod") + * @Type("int") + */ + protected $subscriptionPeriod; + + /** + * Optional. Information about the paid media bought by the user + * + * @var AbstractPaidMedia[]|null + * @SkipWhenEmpty + * @SerializedName("paid_media") + * @Accessor(getter="getPaidMedia", setter="setPaidMedia") + * @Type("array") + */ + protected $paidMedia; + + /** + * Optional. Bot-specified paid media payload + * + * @var string|null + * @SkipWhenEmpty + * @SerializedName("paid_media_payload") + * @Accessor(getter="getPaidMediaPayload", setter="setPaidMediaPayload") + * @Type("string") + */ + protected $paidMediaPayload; + + /** + * Optional. The gift sent to the user by the bot + * + * @var Gift|null + * @SkipWhenEmpty + * @SerializedName("gift") + * @Accessor(getter="getGift", setter="setGift") + * @Type("MadmagesTelegram\Types\Type\Gift") + */ + protected $gift; + /** * @param string $type @@ -120,6 +185,25 @@ public function getUser(): User return $this->user; } + /** + * @param AffiliateInfo $affiliate + * @return static + */ + public function setAffiliate(AffiliateInfo $affiliate): self + { + $this->affiliate = $affiliate; + + return $this; + } + + /** + * @return AffiliateInfo|null + */ + public function getAffiliate(): ?AffiliateInfo + { + return $this->affiliate; + } + /** * @param string $invoicePayload * @return static @@ -139,4 +223,80 @@ public function getInvoicePayload(): ?string return $this->invoicePayload; } + /** + * @param int $subscriptionPeriod + * @return static + */ + public function setSubscriptionPeriod(int $subscriptionPeriod): self + { + $this->subscriptionPeriod = $subscriptionPeriod; + + return $this; + } + + /** + * @return int|null + */ + public function getSubscriptionPeriod(): ?int + { + return $this->subscriptionPeriod; + } + + /** + * @param AbstractPaidMedia[] $paidMedia + * @return static + */ + public function setPaidMedia(array $paidMedia): self + { + $this->paidMedia = $paidMedia; + + return $this; + } + + /** + * @return AbstractPaidMedia[]|null + */ + public function getPaidMedia(): ?array + { + return $this->paidMedia; + } + + /** + * @param string $paidMediaPayload + * @return static + */ + public function setPaidMediaPayload(string $paidMediaPayload): self + { + $this->paidMediaPayload = $paidMediaPayload; + + return $this; + } + + /** + * @return string|null + */ + public function getPaidMediaPayload(): ?string + { + return $this->paidMediaPayload; + } + + /** + * @param Gift $gift + * @return static + */ + public function setGift(Gift $gift): self + { + $this->gift = $gift; + + return $this; + } + + /** + * @return Gift|null + */ + public function getGift(): ?Gift + { + return $this->gift; + } + } \ No newline at end of file diff --git a/src/Type/Update.php b/src/Type/Update.php index cff7cd7..74af0a2 100644 --- a/src/Type/Update.php +++ b/src/Type/Update.php @@ -45,6 +45,7 @@ public static function _getPropertyNames(): array 'callback_query', 'shipping_query', 'pre_checkout_query', + 'purchased_paid_media', 'poll', 'poll_answer', 'my_chat_member', @@ -79,6 +80,7 @@ public function _getData(): array 'callback_query' => $this->getCallbackQuery(), 'shipping_query' => $this->getShippingQuery(), 'pre_checkout_query' => $this->getPreCheckoutQuery(), + 'purchased_paid_media' => $this->getPurchasedPaidMedia(), 'poll' => $this->getPoll(), 'poll_answer' => $this->getPollAnswer(), 'my_chat_member' => $this->getMyChatMember(), @@ -277,6 +279,17 @@ public function _getData(): array */ protected $preCheckoutQuery; + /** + * Optional. A user purchased paid media with a non-empty payload sent by the bot in a non-channel chat + * + * @var PaidMediaPurchased|null + * @SkipWhenEmpty + * @SerializedName("purchased_paid_media") + * @Accessor(getter="getPurchasedPaidMedia", setter="setPurchasedPaidMedia") + * @Type("MadmagesTelegram\Types\Type\PaidMediaPurchased") + */ + protected $purchasedPaidMedia; + /** * Optional. New poll state. Bots receive only updates about manually stopped polls and polls, which are sent by the bot * @@ -663,6 +676,25 @@ public function getPreCheckoutQuery(): ?PreCheckoutQuery return $this->preCheckoutQuery; } + /** + * @param PaidMediaPurchased $purchasedPaidMedia + * @return static + */ + public function setPurchasedPaidMedia(PaidMediaPurchased $purchasedPaidMedia): self + { + $this->purchasedPaidMedia = $purchasedPaidMedia; + + return $this; + } + + /** + * @return PaidMediaPurchased|null + */ + public function getPurchasedPaidMedia(): ?PaidMediaPurchased + { + return $this->purchasedPaidMedia; + } + /** * @param Poll $poll * @return static diff --git a/src/Type/User.php b/src/Type/User.php index f42c203..a52a823 100644 --- a/src/Type/User.php +++ b/src/Type/User.php @@ -40,6 +40,7 @@ public static function _getPropertyNames(): array 'can_read_all_group_messages', 'supports_inline_queries', 'can_connect_to_business', + 'has_main_web_app', ]; } @@ -63,6 +64,7 @@ public function _getData(): array 'can_read_all_group_messages' => $this->getCanReadAllGroupMessages(), 'supports_inline_queries' => $this->getSupportsInlineQueries(), 'can_connect_to_business' => $this->getCanConnectToBusiness(), + 'has_main_web_app' => $this->getHasMainWebApp(), ]; return parent::normalizeData($result); @@ -200,6 +202,17 @@ public function _getData(): array */ protected $canConnectToBusiness; + /** + * Optional. True, if the bot has a main Web App. Returned only in getMe. + * + * @var bool|null + * @SkipWhenEmpty + * @SerializedName("has_main_web_app") + * @Accessor(getter="getHasMainWebApp", setter="setHasMainWebApp") + * @Type("bool") + */ + protected $hasMainWebApp; + /** * @param int $id @@ -429,4 +442,23 @@ public function getCanConnectToBusiness(): ?bool return $this->canConnectToBusiness; } + /** + * @param bool $hasMainWebApp + * @return static + */ + public function setHasMainWebApp(bool $hasMainWebApp): self + { + $this->hasMainWebApp = $hasMainWebApp; + + return $this; + } + + /** + * @return bool|null + */ + public function getHasMainWebApp(): ?bool + { + return $this->hasMainWebApp; + } + } \ No newline at end of file diff --git a/src/TypedClient.php b/src/TypedClient.php index a1aea37..62436be 100644 --- a/src/TypedClient.php +++ b/src/TypedClient.php @@ -350,6 +350,10 @@ public function close( * @param bool|null $protectContent * Protects the contents of the sent message from forwarding and saving * + * @param bool|null $allowPaidBroadcast + * Pass True to allow up to 1000 messages per second, ignoring broadcasting limits for a fee of 0.1 Telegram Stars + * per message. The relevant Stars will be withdrawn from the bot's balance + * * @param string|null $messageEffectId * Unique identifier of the message effect to be added to the message; for private chats only * @@ -373,6 +377,7 @@ public function sendMessage( Type\LinkPreviewOptions $linkPreviewOptions = null, bool $disableNotification = null, bool $protectContent = null, + bool $allowPaidBroadcast = null, string $messageEffectId = null, Type\ReplyParameters $replyParameters = null, $replyMarkup = null @@ -388,6 +393,7 @@ public function sendMessage( 'link_preview_options' => $linkPreviewOptions, 'disable_notification' => $disableNotification, 'protect_content' => $protectContent, + 'allow_paid_broadcast' => $allowPaidBroadcast, 'message_effect_id' => $messageEffectId, 'reply_parameters' => $replyParameters, 'reply_markup' => $replyMarkup, @@ -548,6 +554,10 @@ public function forwardMessages( * @param bool|null $protectContent * Protects the contents of the sent message from forwarding and saving * + * @param bool|null $allowPaidBroadcast + * Pass True to allow up to 1000 messages per second, ignoring broadcasting limits for a fee of 0.1 Telegram Stars + * per message. The relevant Stars will be withdrawn from the bot's balance + * * @param Type\ReplyParameters|null $replyParameters * Description of the message to reply to * @@ -569,6 +579,7 @@ public function copyMessage( bool $showCaptionAboveMedia = null, bool $disableNotification = null, bool $protectContent = null, + bool $allowPaidBroadcast = null, Type\ReplyParameters $replyParameters = null, $replyMarkup = null ): Type\MessageId @@ -584,6 +595,7 @@ public function copyMessage( 'show_caption_above_media' => $showCaptionAboveMedia, 'disable_notification' => $disableNotification, 'protect_content' => $protectContent, + 'allow_paid_broadcast' => $allowPaidBroadcast, 'reply_parameters' => $replyParameters, 'reply_markup' => $replyMarkup, ]; @@ -699,6 +711,10 @@ public function copyMessages( * @param bool|null $protectContent * Protects the contents of the sent message from forwarding and saving * + * @param bool|null $allowPaidBroadcast + * Pass True to allow up to 1000 messages per second, ignoring broadcasting limits for a fee of 0.1 Telegram Stars + * per message. The relevant Stars will be withdrawn from the bot's balance + * * @param string|null $messageEffectId * Unique identifier of the message effect to be added to the message; for private chats only * @@ -724,6 +740,7 @@ public function sendPhoto( bool $hasSpoiler = null, bool $disableNotification = null, bool $protectContent = null, + bool $allowPaidBroadcast = null, string $messageEffectId = null, Type\ReplyParameters $replyParameters = null, $replyMarkup = null @@ -741,6 +758,7 @@ public function sendPhoto( 'has_spoiler' => $hasSpoiler, 'disable_notification' => $disableNotification, 'protect_content' => $protectContent, + 'allow_paid_broadcast' => $allowPaidBroadcast, 'message_effect_id' => $messageEffectId, 'reply_parameters' => $replyParameters, 'reply_markup' => $replyMarkup, @@ -806,6 +824,10 @@ public function sendPhoto( * @param bool|null $protectContent * Protects the contents of the sent message from forwarding and saving * + * @param bool|null $allowPaidBroadcast + * Pass True to allow up to 1000 messages per second, ignoring broadcasting limits for a fee of 0.1 Telegram Stars + * per message. The relevant Stars will be withdrawn from the bot's balance + * * @param string|null $messageEffectId * Unique identifier of the message effect to be added to the message; for private chats only * @@ -833,6 +855,7 @@ public function sendAudio( $thumbnail = null, bool $disableNotification = null, bool $protectContent = null, + bool $allowPaidBroadcast = null, string $messageEffectId = null, Type\ReplyParameters $replyParameters = null, $replyMarkup = null @@ -852,6 +875,7 @@ public function sendAudio( 'thumbnail' => $thumbnail, 'disable_notification' => $disableNotification, 'protect_content' => $protectContent, + 'allow_paid_broadcast' => $allowPaidBroadcast, 'message_effect_id' => $messageEffectId, 'reply_parameters' => $replyParameters, 'reply_markup' => $replyMarkup, @@ -911,6 +935,10 @@ public function sendAudio( * @param bool|null $protectContent * Protects the contents of the sent message from forwarding and saving * + * @param bool|null $allowPaidBroadcast + * Pass True to allow up to 1000 messages per second, ignoring broadcasting limits for a fee of 0.1 Telegram Stars + * per message. The relevant Stars will be withdrawn from the bot's balance + * * @param string|null $messageEffectId * Unique identifier of the message effect to be added to the message; for private chats only * @@ -936,6 +964,7 @@ public function sendDocument( bool $disableContentTypeDetection = null, bool $disableNotification = null, bool $protectContent = null, + bool $allowPaidBroadcast = null, string $messageEffectId = null, Type\ReplyParameters $replyParameters = null, $replyMarkup = null @@ -953,6 +982,7 @@ public function sendDocument( 'disable_content_type_detection' => $disableContentTypeDetection, 'disable_notification' => $disableNotification, 'protect_content' => $protectContent, + 'allow_paid_broadcast' => $allowPaidBroadcast, 'message_effect_id' => $messageEffectId, 'reply_parameters' => $replyParameters, 'reply_markup' => $replyMarkup, @@ -1026,6 +1056,10 @@ public function sendDocument( * @param bool|null $protectContent * Protects the contents of the sent message from forwarding and saving * + * @param bool|null $allowPaidBroadcast + * Pass True to allow up to 1000 messages per second, ignoring broadcasting limits for a fee of 0.1 Telegram Stars + * per message. The relevant Stars will be withdrawn from the bot's balance + * * @param string|null $messageEffectId * Unique identifier of the message effect to be added to the message; for private chats only * @@ -1056,6 +1090,7 @@ public function sendVideo( bool $supportsStreaming = null, bool $disableNotification = null, bool $protectContent = null, + bool $allowPaidBroadcast = null, string $messageEffectId = null, Type\ReplyParameters $replyParameters = null, $replyMarkup = null @@ -1078,6 +1113,7 @@ public function sendVideo( 'supports_streaming' => $supportsStreaming, 'disable_notification' => $disableNotification, 'protect_content' => $protectContent, + 'allow_paid_broadcast' => $allowPaidBroadcast, 'message_effect_id' => $messageEffectId, 'reply_parameters' => $replyParameters, 'reply_markup' => $replyMarkup, @@ -1148,6 +1184,10 @@ public function sendVideo( * @param bool|null $protectContent * Protects the contents of the sent message from forwarding and saving * + * @param bool|null $allowPaidBroadcast + * Pass True to allow up to 1000 messages per second, ignoring broadcasting limits for a fee of 0.1 Telegram Stars + * per message. The relevant Stars will be withdrawn from the bot's balance + * * @param string|null $messageEffectId * Unique identifier of the message effect to be added to the message; for private chats only * @@ -1177,6 +1217,7 @@ public function sendAnimation( bool $hasSpoiler = null, bool $disableNotification = null, bool $protectContent = null, + bool $allowPaidBroadcast = null, string $messageEffectId = null, Type\ReplyParameters $replyParameters = null, $replyMarkup = null @@ -1198,6 +1239,7 @@ public function sendAnimation( 'has_spoiler' => $hasSpoiler, 'disable_notification' => $disableNotification, 'protect_content' => $protectContent, + 'allow_paid_broadcast' => $allowPaidBroadcast, 'message_effect_id' => $messageEffectId, 'reply_parameters' => $replyParameters, 'reply_markup' => $replyMarkup, @@ -1250,6 +1292,10 @@ public function sendAnimation( * @param bool|null $protectContent * Protects the contents of the sent message from forwarding and saving * + * @param bool|null $allowPaidBroadcast + * Pass True to allow up to 1000 messages per second, ignoring broadcasting limits for a fee of 0.1 Telegram Stars + * per message. The relevant Stars will be withdrawn from the bot's balance + * * @param string|null $messageEffectId * Unique identifier of the message effect to be added to the message; for private chats only * @@ -1274,6 +1320,7 @@ public function sendVoice( int $duration = null, bool $disableNotification = null, bool $protectContent = null, + bool $allowPaidBroadcast = null, string $messageEffectId = null, Type\ReplyParameters $replyParameters = null, $replyMarkup = null @@ -1290,6 +1337,7 @@ public function sendVoice( 'duration' => $duration, 'disable_notification' => $disableNotification, 'protect_content' => $protectContent, + 'allow_paid_broadcast' => $allowPaidBroadcast, 'message_effect_id' => $messageEffectId, 'reply_parameters' => $replyParameters, 'reply_markup' => $replyMarkup, @@ -1341,6 +1389,10 @@ public function sendVoice( * @param bool|null $protectContent * Protects the contents of the sent message from forwarding and saving * + * @param bool|null $allowPaidBroadcast + * Pass True to allow up to 1000 messages per second, ignoring broadcasting limits for a fee of 0.1 Telegram Stars + * per message. The relevant Stars will be withdrawn from the bot's balance + * * @param string|null $messageEffectId * Unique identifier of the message effect to be added to the message; for private chats only * @@ -1364,6 +1416,7 @@ public function sendVideoNote( $thumbnail = null, bool $disableNotification = null, bool $protectContent = null, + bool $allowPaidBroadcast = null, string $messageEffectId = null, Type\ReplyParameters $replyParameters = null, $replyMarkup = null @@ -1379,6 +1432,7 @@ public function sendVideoNote( 'thumbnail' => $thumbnail, 'disable_notification' => $disableNotification, 'protect_content' => $protectContent, + 'allow_paid_broadcast' => $allowPaidBroadcast, 'message_effect_id' => $messageEffectId, 'reply_parameters' => $replyParameters, 'reply_markup' => $replyMarkup, @@ -1394,18 +1448,26 @@ public function sendVideoNote( /** * https://core.telegram.org/bots/api#sendpaidmedia * - * Use this method to send paid media to channel chats. On success, the sent Message is - * returned. + * Use this method to send paid media. On success, the sent Message is returned. * * @param int|string $chatId - * Unique identifier for the target chat or username of the target channel (in the format @|channelusername) + * Unique identifier for the target chat or username of the target channel (in the format @|channelusername). If + * the chat is a channel, all Telegram Star proceeds from this media will be credited to the chat's balance. Otherwise, + * they will be credited to the bot's balance. * * @param int $starCount - * The number of Telegram Stars that must be paid to buy access to the media + * The number of Telegram Stars that must be paid to buy access to the media; 1-2500 * * @param Type\AbstractInputPaidMedia[] $media * A JSON-serialized array describing the media to be sent; up to 10 items * + * @param string|null $businessConnectionId + * Unique identifier of the business connection on behalf of which the message will be sent + * + * @param string|null $payload + * Bot-defined paid media payload, 0-128 bytes. This will not be displayed to the user, use it for your internal + * processes. + * * @param string|null $caption * Media caption, 0-1024 characters after entities parsing * @@ -1425,6 +1487,10 @@ public function sendVideoNote( * @param bool|null $protectContent * Protects the contents of the sent message from forwarding and saving * + * @param bool|null $allowPaidBroadcast + * Pass True to allow up to 1000 messages per second, ignoring broadcasting limits for a fee of 0.1 Telegram Stars + * per message. The relevant Stars will be withdrawn from the bot's balance + * * @param Type\ReplyParameters|null $replyParameters * Description of the message to reply to * @@ -1439,26 +1505,32 @@ public function sendPaidMedia( $chatId, int $starCount, array $media, + string $businessConnectionId = null, + string $payload = null, string $caption = null, string $parseMode = null, array $captionEntities = null, bool $showCaptionAboveMedia = null, bool $disableNotification = null, bool $protectContent = null, + bool $allowPaidBroadcast = null, Type\ReplyParameters $replyParameters = null, $replyMarkup = null ): Type\Message { $requestParameters = [ + 'business_connection_id' => $businessConnectionId, 'chat_id' => $chatId, 'star_count' => $starCount, 'media' => $media, + 'payload' => $payload, 'caption' => $caption, 'parse_mode' => $parseMode, 'caption_entities' => $captionEntities, 'show_caption_above_media' => $showCaptionAboveMedia, 'disable_notification' => $disableNotification, 'protect_content' => $protectContent, + 'allow_paid_broadcast' => $allowPaidBroadcast, 'reply_parameters' => $replyParameters, 'reply_markup' => $replyMarkup, ]; @@ -1495,6 +1567,10 @@ public function sendPaidMedia( * @param bool|null $protectContent * Protects the contents of the sent messages from forwarding and saving * + * @param bool|null $allowPaidBroadcast + * Pass True to allow up to 1000 messages per second, ignoring broadcasting limits for a fee of 0.1 Telegram Stars + * per message. The relevant Stars will be withdrawn from the bot's balance + * * @param string|null $messageEffectId * Unique identifier of the message effect to be added to the message; for private chats only * @@ -1511,6 +1587,7 @@ public function sendMediaGroup( int $messageThreadId = null, bool $disableNotification = null, bool $protectContent = null, + bool $allowPaidBroadcast = null, string $messageEffectId = null, Type\ReplyParameters $replyParameters = null ): array @@ -1522,6 +1599,7 @@ public function sendMediaGroup( 'media' => $media, 'disable_notification' => $disableNotification, 'protect_content' => $protectContent, + 'allow_paid_broadcast' => $allowPaidBroadcast, 'message_effect_id' => $messageEffectId, 'reply_parameters' => $replyParameters, ]; @@ -1573,6 +1651,10 @@ public function sendMediaGroup( * @param bool|null $protectContent * Protects the contents of the sent message from forwarding and saving * + * @param bool|null $allowPaidBroadcast + * Pass True to allow up to 1000 messages per second, ignoring broadcasting limits for a fee of 0.1 Telegram Stars + * per message. The relevant Stars will be withdrawn from the bot's balance + * * @param string|null $messageEffectId * Unique identifier of the message effect to be added to the message; for private chats only * @@ -1598,6 +1680,7 @@ public function sendLocation( int $proximityAlertRadius = null, bool $disableNotification = null, bool $protectContent = null, + bool $allowPaidBroadcast = null, string $messageEffectId = null, Type\ReplyParameters $replyParameters = null, $replyMarkup = null @@ -1615,6 +1698,7 @@ public function sendLocation( 'proximity_alert_radius' => $proximityAlertRadius, 'disable_notification' => $disableNotification, 'protect_content' => $protectContent, + 'allow_paid_broadcast' => $allowPaidBroadcast, 'message_effect_id' => $messageEffectId, 'reply_parameters' => $replyParameters, 'reply_markup' => $replyMarkup, @@ -1673,6 +1757,10 @@ public function sendLocation( * @param bool|null $protectContent * Protects the contents of the sent message from forwarding and saving * + * @param bool|null $allowPaidBroadcast + * Pass True to allow up to 1000 messages per second, ignoring broadcasting limits for a fee of 0.1 Telegram Stars + * per message. The relevant Stars will be withdrawn from the bot's balance + * * @param string|null $messageEffectId * Unique identifier of the message effect to be added to the message; for private chats only * @@ -1700,6 +1788,7 @@ public function sendVenue( string $googlePlaceType = null, bool $disableNotification = null, bool $protectContent = null, + bool $allowPaidBroadcast = null, string $messageEffectId = null, Type\ReplyParameters $replyParameters = null, $replyMarkup = null @@ -1719,6 +1808,7 @@ public function sendVenue( 'google_place_type' => $googlePlaceType, 'disable_notification' => $disableNotification, 'protect_content' => $protectContent, + 'allow_paid_broadcast' => $allowPaidBroadcast, 'message_effect_id' => $messageEffectId, 'reply_parameters' => $replyParameters, 'reply_markup' => $replyMarkup, @@ -1763,6 +1853,10 @@ public function sendVenue( * @param bool|null $protectContent * Protects the contents of the sent message from forwarding and saving * + * @param bool|null $allowPaidBroadcast + * Pass True to allow up to 1000 messages per second, ignoring broadcasting limits for a fee of 0.1 Telegram Stars + * per message. The relevant Stars will be withdrawn from the bot's balance + * * @param string|null $messageEffectId * Unique identifier of the message effect to be added to the message; for private chats only * @@ -1786,6 +1880,7 @@ public function sendContact( string $vcard = null, bool $disableNotification = null, bool $protectContent = null, + bool $allowPaidBroadcast = null, string $messageEffectId = null, Type\ReplyParameters $replyParameters = null, $replyMarkup = null @@ -1801,6 +1896,7 @@ public function sendContact( 'vcard' => $vcard, 'disable_notification' => $disableNotification, 'protect_content' => $protectContent, + 'allow_paid_broadcast' => $allowPaidBroadcast, 'message_effect_id' => $messageEffectId, 'reply_parameters' => $replyParameters, 'reply_markup' => $replyMarkup, @@ -1880,6 +1976,10 @@ public function sendContact( * @param bool|null $protectContent * Protects the contents of the sent message from forwarding and saving * + * @param bool|null $allowPaidBroadcast + * Pass True to allow up to 1000 messages per second, ignoring broadcasting limits for a fee of 0.1 Telegram Stars + * per message. The relevant Stars will be withdrawn from the bot's balance + * * @param string|null $messageEffectId * Unique identifier of the message effect to be added to the message; for private chats only * @@ -1913,6 +2013,7 @@ public function sendPoll( bool $isClosed = null, bool $disableNotification = null, bool $protectContent = null, + bool $allowPaidBroadcast = null, string $messageEffectId = null, Type\ReplyParameters $replyParameters = null, $replyMarkup = null @@ -1938,6 +2039,7 @@ public function sendPoll( 'is_closed' => $isClosed, 'disable_notification' => $disableNotification, 'protect_content' => $protectContent, + 'allow_paid_broadcast' => $allowPaidBroadcast, 'message_effect_id' => $messageEffectId, 'reply_parameters' => $replyParameters, 'reply_markup' => $replyMarkup, @@ -1975,6 +2077,10 @@ public function sendPoll( * @param bool|null $protectContent * Protects the contents of the sent message from forwarding * + * @param bool|null $allowPaidBroadcast + * Pass True to allow up to 1000 messages per second, ignoring broadcasting limits for a fee of 0.1 Telegram Stars + * per message. The relevant Stars will be withdrawn from the bot's balance + * * @param string|null $messageEffectId * Unique identifier of the message effect to be added to the message; for private chats only * @@ -1995,6 +2101,7 @@ public function sendDice( string $emoji = null, bool $disableNotification = null, bool $protectContent = null, + bool $allowPaidBroadcast = null, string $messageEffectId = null, Type\ReplyParameters $replyParameters = null, $replyMarkup = null @@ -2007,6 +2114,7 @@ public function sendDice( 'emoji' => $emoji, 'disable_notification' => $disableNotification, 'protect_content' => $protectContent, + 'allow_paid_broadcast' => $allowPaidBroadcast, 'message_effect_id' => $messageEffectId, 'reply_parameters' => $replyParameters, 'reply_markup' => $replyMarkup, @@ -2070,8 +2178,8 @@ public function sendChatAction( * https://core.telegram.org/bots/api#setmessagereaction * * Use this method to change the chosen reactions on a message. Service messages can't be reacted to. Automatically - * forwarded messages from a channel to its discussion group have the same available reactions as messages in the channel. - * Returns True on success. + * forwarded messages from a channel to its discussion group have the same available reactions as messages in the channel. Bots + * can't use paid reactions. Returns True on success. * * @param int|string $chatId * Unique identifier for the target chat or username of the target channel (in the format @|channelusername) @@ -2083,7 +2191,7 @@ public function sendChatAction( * @param Type\AbstractReactionType[]|null $reaction * A JSON-serialized list of reaction types to set on the message. Currently, as non-premium users, bots can set up * to one reaction per message. A custom emoji reaction can be used if it is either already present on the message or - * explicitly allowed by chat administrators. + * explicitly allowed by chat administrators. Paid reactions can't be used by bots. * * @param bool|null $isBig * Pass True to set the reaction with a big animation @@ -2148,6 +2256,44 @@ public function getUserProfilePhotos( return $this->_requestWithMap('getUserProfilePhotos', $requestParameters, $returnType); } + /** + * https://core.telegram.org/bots/api#setuseremojistatus + * + * 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. + * + * @param int $userId + * Unique identifier of the target user + * + * @param string|null $emojiStatusCustomEmojiId + * Custom emoji identifier of the emoji status to set. Pass an empty string to remove the status. + * + * @param int|null $emojiStatusExpirationDate + * Expiration date of the emoji status, if any + * + * @return bool + * @throws TelegramException + */ + public function setUserEmojiStatus( + int $userId, + string $emojiStatusCustomEmojiId = null, + int $emojiStatusExpirationDate = null + ): bool + { + $requestParameters = [ + 'user_id' => $userId, + 'emoji_status_custom_emoji_id' => $emojiStatusCustomEmojiId, + 'emoji_status_expiration_date' => $emojiStatusExpirationDate, + ]; + + $returnType = [ + 'bool', + ]; + + return $this->_requestWithMap('setUserEmojiStatus', $requestParameters, $returnType); + } + /** * https://core.telegram.org/bots/api#getfile * @@ -2706,6 +2852,90 @@ public function editChatInviteLink( return $this->_requestWithMap('editChatInviteLink', $requestParameters, $returnType); } + /** + * https://core.telegram.org/bots/api#createchatsubscriptioninvitelink + * + * Use this method to create a subscription invite link for a channel chat. The bot must have the can_invite_users administrator rights. The + * link can be edited using the method editChatSubscriptionInviteLink or revoked using the method revokeChatInviteLink. Returns the new invite + * link as a ChatInviteLink object. + * + * @param int|string $chatId + * Unique identifier for the target channel chat or username of the target channel (in the format + * @|channelusername) + * + * @param int $subscriptionPeriod + * The number of seconds the subscription will be active for before the next payment. Currently, it must always be + * 2592000 (30 days). + * + * @param int $subscriptionPrice + * The amount of Telegram Stars a user must pay initially and after each subsequent subscription period to be a + * member of the chat; 1-2500 + * + * @param string|null $name + * Invite link name; 0-32 characters + * + * @return Type\ChatInviteLink + * @throws TelegramException + */ + public function createChatSubscriptionInviteLink( + $chatId, + int $subscriptionPeriod, + int $subscriptionPrice, + string $name = null + ): Type\ChatInviteLink + { + $requestParameters = [ + 'chat_id' => $chatId, + 'name' => $name, + 'subscription_period' => $subscriptionPeriod, + 'subscription_price' => $subscriptionPrice, + ]; + + $returnType = [ + Type\ChatInviteLink::class, + ]; + + return $this->_requestWithMap('createChatSubscriptionInviteLink', $requestParameters, $returnType); + } + + /** + * https://core.telegram.org/bots/api#editchatsubscriptioninvitelink + * + * Use this method to edit a subscription invite link created by the bot. The bot must have the + * can_invite_users administrator rights. Returns the edited invite link as a ChatInviteLink + * object. + * + * @param int|string $chatId + * Unique identifier for the target chat or username of the target channel (in the format @|channelusername) + * + * @param string $inviteLink + * The invite link to edit + * + * @param string|null $name + * Invite link name; 0-32 characters + * + * @return Type\ChatInviteLink + * @throws TelegramException + */ + public function editChatSubscriptionInviteLink( + $chatId, + string $inviteLink, + string $name = null + ): Type\ChatInviteLink + { + $requestParameters = [ + 'chat_id' => $chatId, + 'invite_link' => $inviteLink, + 'name' => $name, + ]; + + $returnType = [ + Type\ChatInviteLink::class, + ]; + + return $this->_requestWithMap('editChatSubscriptionInviteLink', $requestParameters, $returnType); + } + /** * https://core.telegram.org/bots/api#revokechatinvitelink * @@ -2939,6 +3169,9 @@ public function setChatDescription( * @param int $messageId * Identifier of a message to pin * + * @param string|null $businessConnectionId + * Unique identifier of the business connection on behalf of which the message will be pinned + * * @param bool|null $disableNotification * Pass True if it is not necessary to send a notification to all chat members about the new pinned message. * Notifications are always disabled in channels and private chats. @@ -2949,10 +3182,12 @@ public function setChatDescription( public function pinChatMessage( $chatId, int $messageId, + string $businessConnectionId = null, bool $disableNotification = null ): bool { $requestParameters = [ + 'business_connection_id' => $businessConnectionId, 'chat_id' => $chatId, 'message_id' => $messageId, 'disable_notification' => $disableNotification, @@ -2975,19 +3210,24 @@ public function pinChatMessage( * @param int|string $chatId * Unique identifier for the target chat or username of the target channel (in the format @|channelusername) * + * @param string|null $businessConnectionId + * Unique identifier of the business connection on behalf of which the message will be unpinned + * * @param int|null $messageId - * Identifier of a message to unpin. If not specified, the most recent pinned message (by sending date) will be - * unpinned. + * Identifier of the message to unpin. Required if business_connection_id is specified. If not specified, the + * most recent pinned message (by sending date) will be unpinned. * * @return bool * @throws TelegramException */ public function unpinChatMessage( $chatId, + string $businessConnectionId = null, int $messageId = null ): bool { $requestParameters = [ + 'business_connection_id' => $businessConnectionId, 'chat_id' => $chatId, 'message_id' => $messageId, ]; @@ -3305,8 +3545,8 @@ public function createForumTopic( * https://core.telegram.org/bots/api#editforumtopic * * Use this method to edit name and icon of a topic in a forum supergroup chat. The bot must be an administrator in the chat - * for this to work and must have can_manage_topics administrator rights, unless it is the creator of the topic. - * Returns True on success. + * for this to work and must have the can_manage_topics administrator rights, unless it is the creator of the + * topic. Returns True on success. * * @param int|string $chatId * Unique identifier for the target chat or username of the target supergroup (in the format @@ -3487,8 +3727,8 @@ public function unpinAllForumTopicMessages( * https://core.telegram.org/bots/api#editgeneralforumtopic * * Use this method to edit the name of the 'General' topic in a forum supergroup chat. The bot must be an administrator in - * the chat for this to work and must have can_manage_topics administrator rights. Returns True on - * success. + * the chat for this to work and must have the can_manage_topics administrator rights. Returns True + * on success. * * @param int|string $chatId * Unique identifier for the target chat or username of the target supergroup (in the format @@ -4323,12 +4563,11 @@ public function editMessageCaption( /** * https://core.telegram.org/bots/api#editmessagemedia * - * Use this method to edit animation, audio, document, photo, or video messages. If a message is part of a message album, - * then it can be edited only to an audio for audio albums, only to a document for document albums and to a photo or a video - * otherwise. When an inline message is edited, a new file can't be uploaded; use a previously uploaded file via its file_id or - * specify a URL. 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. + * Use this method to edit animation, audio, document, photo, or video messages, or to add media to text messages. If a + * message is part of a message album, then it can be edited only to an audio for audio albums, only to a document for document + * albums and to a photo or a video otherwise. When an inline message is edited, a new file can't be uploaded; use a previously + * uploaded file via its file_id or specify a URL. 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. * * @param Type\AbstractInputMedia $media * A JSON-serialized object for a new media content of the message @@ -4707,6 +4946,10 @@ public function deleteMessages( * @param bool|null $protectContent * Protects the contents of the sent message from forwarding and saving * + * @param bool|null $allowPaidBroadcast + * Pass True to allow up to 1000 messages per second, ignoring broadcasting limits for a fee of 0.1 Telegram Stars + * per message. The relevant Stars will be withdrawn from the bot's balance + * * @param string|null $messageEffectId * Unique identifier of the message effect to be added to the message; for private chats only * @@ -4728,6 +4971,7 @@ public function sendSticker( string $emoji = null, bool $disableNotification = null, bool $protectContent = null, + bool $allowPaidBroadcast = null, string $messageEffectId = null, Type\ReplyParameters $replyParameters = null, $replyMarkup = null @@ -4741,6 +4985,7 @@ public function sendSticker( 'emoji' => $emoji, 'disable_notification' => $disableNotification, 'protect_content' => $protectContent, + 'allow_paid_broadcast' => $allowPaidBroadcast, 'message_effect_id' => $messageEffectId, 'reply_parameters' => $replyParameters, 'reply_markup' => $replyMarkup, @@ -5183,8 +5428,8 @@ public function setStickerSetTitle( * @param Type\InputFile|string|null $thumbnail * A .WEBP or .PNG image with the thumbnail, must be up to 128 kilobytes in size and have a width and height of exactly * 100px, or a .TGS animation with a thumbnail up to 32 kilobytes in size (see - * https://core.telegram.org/stickers#animated-sticker-requirements for animated sticker technical requirements), or a WEBM video with the thumbnail up to 32 kilobytes in size; see - * https://core.telegram.org/stickers#video-sticker-requirements for video sticker technical requirements. Pass a file_id as a String to send a file that already exists on the + * https://core.telegram.org/stickers#animation-requirements for animated sticker technical requirements), or a WEBM video with the thumbnail up to 32 kilobytes in size; see + * https://core.telegram.org/stickers#video-requirements for video sticker technical requirements. Pass a file_id as a String to send a file that already exists on the * Telegram servers, pass an HTTP URL as a String for Telegram to get a file from the Internet, or upload a new one using * multipart/form-data. More information on Sending Files ». Animated and video sticker set thumbnails can't be uploaded via HTTP URL. * If omitted, then the thumbnail is dropped and the first sticker is used as the thumbnail. @@ -5248,9 +5493,7 @@ public function setCustomEmojiStickerSetThumbnail( /** * https://core.telegram.org/bots/api#deletestickerset * - * Use this method to delete a sticker set that was created by the bot. Returns True on success. To enable this - * option, send the /setinline command to @|BotFather and provide - * the placeholder text that the user will see in the input field after typing your bot's name. + * Use this method to delete a sticker set that was created by the bot. Returns True on success. * * @param string $name * Sticker set name @@ -5273,6 +5516,78 @@ public function deleteStickerSet( return $this->_requestWithMap('deleteStickerSet', $requestParameters, $returnType); } + /** + * https://core.telegram.org/bots/api#getavailablegifts + * + * Returns the list of gifts that can be sent by the bot to users. Requires no parameters. Returns a Gifts object. + * + * @return Type\Gifts + * @throws TelegramException + */ + public function getAvailableGifts( + ): Type\Gifts + { + $requestParameters = [ + ]; + + $returnType = [ + Type\Gifts::class, + ]; + + return $this->_requestWithMap('getAvailableGifts', $requestParameters, $returnType); + } + + /** + * https://core.telegram.org/bots/api#sendgift + * + * Sends a gift to the given user. The gift can't be converted to Telegram Stars by the user. Returns True on + * success. To enable this option, send the /setinline command to @|BotFather and provide the placeholder text that the user will see in the input field after typing your bot's name. + * + * @param int $userId + * Unique identifier of the target user that will receive the gift + * + * @param string $giftId + * Identifier of the gift + * + * @param string|null $text + * Text that will be shown along with the gift; 0-255 characters + * + * @param string|null $textParseMode + * 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 Type\MessageEntity[]|null $textEntities + * 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. + * + * @return bool + * @throws TelegramException + */ + public function sendGift( + int $userId, + string $giftId, + string $text = null, + string $textParseMode = null, + array $textEntities = null + ): bool + { + $requestParameters = [ + 'user_id' => $userId, + 'gift_id' => $giftId, + 'text' => $text, + 'text_parse_mode' => $textParseMode, + 'text_entities' => $textEntities, + ]; + + $returnType = [ + 'bool', + ]; + + return $this->_requestWithMap('sendGift', $requestParameters, $returnType); + } + /** * https://core.telegram.org/bots/api#answerinlinequery * @@ -5360,6 +5675,57 @@ public function answerWebAppQuery( return $this->_requestWithMap('answerWebAppQuery', $requestParameters, $returnType); } + /** + * https://core.telegram.org/bots/api#savepreparedinlinemessage + * + * Stores a message that can be sent by a user of a Mini App. Returns a PreparedInlineMessage object. + * + * @param int $userId + * Unique identifier of the target user that can use the prepared message + * + * @param Type\AbstractInlineQueryResult $result + * A JSON-serialized object describing the message to be sent + * + * @param bool|null $allowUserChats + * Pass True if the message can be sent to private chats with users + * + * @param bool|null $allowBotChats + * Pass True if the message can be sent to private chats with bots + * + * @param bool|null $allowGroupChats + * Pass True if the message can be sent to group and supergroup chats + * + * @param bool|null $allowChannelChats + * Pass True if the message can be sent to channel chats + * + * @return Type\PreparedInlineMessage + * @throws TelegramException + */ + public function savePreparedInlineMessage( + int $userId, + Type\AbstractInlineQueryResult $result, + bool $allowUserChats = null, + bool $allowBotChats = null, + bool $allowGroupChats = null, + bool $allowChannelChats = null + ): Type\PreparedInlineMessage + { + $requestParameters = [ + 'user_id' => $userId, + 'result' => $result, + 'allow_user_chats' => $allowUserChats, + 'allow_bot_chats' => $allowBotChats, + 'allow_group_chats' => $allowGroupChats, + 'allow_channel_chats' => $allowChannelChats, + ]; + + $returnType = [ + Type\PreparedInlineMessage::class, + ]; + + return $this->_requestWithMap('savePreparedInlineMessage', $requestParameters, $returnType); + } + /** * https://core.telegram.org/bots/api#sendinvoice * @@ -5375,7 +5741,7 @@ public function answerWebAppQuery( * Product description, 1-255 characters * * @param string $payload - * Bot-defined invoice payload, 1-128 bytes. This will not be displayed to the user, use for your internal + * Bot-defined invoice payload, 1-128 bytes. This will not be displayed to the user, use it for your internal * processes. * * @param string $currency @@ -5453,6 +5819,10 @@ public function answerWebAppQuery( * @param bool|null $protectContent * Protects the contents of the sent message from forwarding and saving * + * @param bool|null $allowPaidBroadcast + * Pass True to allow up to 1000 messages per second, ignoring broadcasting limits for a fee of 0.1 Telegram Stars + * per message. The relevant Stars will be withdrawn from the bot's balance + * * @param string|null $messageEffectId * Unique identifier of the message effect to be added to the message; for private chats only * @@ -5492,6 +5862,7 @@ public function sendInvoice( bool $isFlexible = null, bool $disableNotification = null, bool $protectContent = null, + bool $allowPaidBroadcast = null, string $messageEffectId = null, Type\ReplyParameters $replyParameters = null, Type\InlineKeyboardMarkup $replyMarkup = null @@ -5523,6 +5894,7 @@ public function sendInvoice( 'is_flexible' => $isFlexible, 'disable_notification' => $disableNotification, 'protect_content' => $protectContent, + 'allow_paid_broadcast' => $allowPaidBroadcast, 'message_effect_id' => $messageEffectId, 'reply_parameters' => $replyParameters, 'reply_markup' => $replyMarkup, @@ -5547,7 +5919,7 @@ public function sendInvoice( * Product description, 1-255 characters * * @param string $payload - * Bot-defined invoice payload, 1-128 bytes. This will not be displayed to the user, use for your internal + * Bot-defined invoice payload, 1-128 bytes. This will not be displayed to the user, use it for your internal * processes. * * @param string $currency @@ -5557,9 +5929,19 @@ public function sendInvoice( * Price breakdown, a JSON-serialized list of components (e.g. product price, tax, discount, delivery cost, * delivery tax, bonus, etc.). Must contain exactly one item for payments in Telegram Stars. * + * @param string|null $businessConnectionId + * Unique identifier of the business connection on behalf of which the link will be created. For payments in + * Telegram Stars only. + * * @param string|null $providerToken * Payment provider token, obtained via @|BotFather. Pass an empty string for payments in Telegram Stars. * + * @param int|null $subscriptionPeriod + * The number of seconds the subscription will be active for before the next payment. The currency must be set to + * “XTR” (Telegram Stars) if the parameter is used. Currently, it must always be 2592000 (30 days) if specified. Any + * number of subscriptions can be active for a given bot at the same time, including multiple concurrent subscriptions + * from the same user. Subscription price must no exceed 2500 Telegram Stars. + * * @param int|null $maxTipAmount * The maximum accepted amount for tips in the smallest units of the currency (integer, not float/double). For * example, for a maximum tip of US$ 1.45 pass max_tip_amount = 145. See the exp parameter in currencies.json, it shows the @@ -5618,7 +6000,9 @@ public function createInvoiceLink( string $payload, string $currency, array $prices, + string $businessConnectionId = null, string $providerToken = null, + int $subscriptionPeriod = null, int $maxTipAmount = null, array $suggestedTipAmounts = null, string $providerData = null, @@ -5636,12 +6020,14 @@ public function createInvoiceLink( ): string { $requestParameters = [ + 'business_connection_id' => $businessConnectionId, 'title' => $title, 'description' => $description, 'payload' => $payload, 'provider_token' => $providerToken, 'currency' => $currency, 'prices' => $prices, + 'subscription_period' => $subscriptionPeriod, 'max_tip_amount' => $maxTipAmount, 'suggested_tip_amounts' => $suggestedTipAmounts, 'provider_data' => $providerData, @@ -5817,6 +6203,45 @@ public function refundStarPayment( return $this->_requestWithMap('refundStarPayment', $requestParameters, $returnType); } + /** + * https://core.telegram.org/bots/api#edituserstarsubscription + * + * Allows the bot to cancel or re-enable extension of a subscription paid in Telegram Stars. Returns True on + * success. + * + * @param int $userId + * Identifier of the user whose subscription will be edited + * + * @param string $telegramPaymentChargeId + * Telegram payment identifier for the subscription + * + * @param bool $isCanceled + * Pass True to cancel extension of the user subscription; the subscription must be active up to the end of the + * current subscription period. Pass False to allow the user to re-enable a subscription that was previously canceled by + * the bot. + * + * @return bool + * @throws TelegramException + */ + public function editUserStarSubscription( + int $userId, + string $telegramPaymentChargeId, + bool $isCanceled + ): bool + { + $requestParameters = [ + 'user_id' => $userId, + 'telegram_payment_charge_id' => $telegramPaymentChargeId, + 'is_canceled' => $isCanceled, + ]; + + $returnType = [ + 'bool', + ]; + + return $this->_requestWithMap('editUserStarSubscription', $requestParameters, $returnType); + } + /** * https://core.telegram.org/bots/api#setpassportdataerrors * @@ -5875,6 +6300,10 @@ public function setPassportDataErrors( * @param bool|null $protectContent * Protects the contents of the sent message from forwarding and saving * + * @param bool|null $allowPaidBroadcast + * Pass True to allow up to 1000 messages per second, ignoring broadcasting limits for a fee of 0.1 Telegram Stars + * per message. The relevant Stars will be withdrawn from the bot's balance + * * @param string|null $messageEffectId * Unique identifier of the message effect to be added to the message; for private chats only * @@ -5895,6 +6324,7 @@ public function sendGame( int $messageThreadId = null, bool $disableNotification = null, bool $protectContent = null, + bool $allowPaidBroadcast = null, string $messageEffectId = null, Type\ReplyParameters $replyParameters = null, Type\InlineKeyboardMarkup $replyMarkup = null @@ -5907,6 +6337,7 @@ public function sendGame( 'game_short_name' => $gameShortName, 'disable_notification' => $disableNotification, 'protect_content' => $protectContent, + 'allow_paid_broadcast' => $allowPaidBroadcast, 'message_effect_id' => $messageEffectId, 'reply_parameters' => $replyParameters, 'reply_markup' => $replyMarkup,