From 371ae5c9a08b9b5ffdb0841cbdac0ba906c0ae34 Mon Sep 17 00:00:00 2001 From: Nikolay Matyushin Date: Fri, 18 Oct 2024 16:56:27 +0400 Subject: [PATCH] Update Bot API to 7.10 --- README.md | 2 +- .../Methods/MethodsParser.fs | 1 + src/Funogram.Generator/out/methods.json | 128 +++++++++++-- src/Funogram.Generator/out/types.json | 168 +++++++++++++++++- src/Funogram.Telegram/Directory.Build.props | 2 +- src/Funogram.Telegram/RequestsTypes.fs | 78 ++++++-- src/Funogram.Telegram/Types.fs | 123 ++++++++++--- src/Funogram.Tests/Constants.fs | 2 +- 8 files changed, 445 insertions(+), 59 deletions(-) diff --git a/README.md b/README.md index 614bf0b..60b9735 100644 --- a/README.md +++ b/README.md @@ -1,7 +1,7 @@ ![.NET Core](https://github.com/Dolfik1/Funogram/workflows/.NET/badge.svg) [![NuGet](https://img.shields.io/nuget/v/Funogram.svg)](https://www.nuget.org/packages/Funogram/) [![NuGet](https://img.shields.io/nuget/v/Funogram.Telegram.svg)](https://www.nuget.org/packages/Funogram.Telegram/) -[![NuGet](https://img.shields.io/badge/Bot%20API-7.7-blue?logo=telegram)](https://www.nuget.org/packages/Funogram.Telegram/) +[![NuGet](https://img.shields.io/badge/Bot%20API-7.10-blue?logo=telegram)](https://www.nuget.org/packages/Funogram.Telegram/) Funogram Logo diff --git a/src/Funogram.Generator/Methods/MethodsParser.fs b/src/Funogram.Generator/Methods/MethodsParser.fs index b44fafc..06dd430 100644 --- a/src/Funogram.Generator/Methods/MethodsParser.fs +++ b/src/Funogram.Generator/Methods/MethodsParser.fs @@ -45,6 +45,7 @@ let loadRemapData remapPath config = let private returnTypeRegexes = [| // invite links + Regex("Returns the new invite link as a ([A|a]rray of \w+|\w+)\s") Regex("Returns the new invite link as ([A|a]rray of \w+|\w+)\s") Regex("Returns the edited invite link as a ([A|a]rray of \w+|\w+)\s") Regex("Returns the revoked invite link as ([A|a]rray of \w+|\w+)\s") diff --git a/src/Funogram.Generator/out/methods.json b/src/Funogram.Generator/out/methods.json index 2539b37..2bc9d06 100644 --- a/src/Funogram.Generator/out/methods.json +++ b/src/Funogram.Generator/out/methods.json @@ -1457,12 +1457,20 @@ { "OriginalName": "sendPaidMedia", "ConvertedName": "SendPaidMedia", - "Description": "Use this method to send paid media to channel chats. On success, the sent Message is returned.", + "Description": "Use this method to send paid media. On success, the sent Message is returned.", "Fields": [ + { + "OriginalName": "business_connection_id", + "ConvertedName": "BusinessConnectionId", + "Description": "Unique identifier of the business connection on behalf of which the message will be sent", + "OriginalFieldType": "String", + "ConvertedFieldType": "string", + "Optional": true + }, { "OriginalName": "chat_id", "ConvertedName": "ChatId", - "Description": "Unique identifier for the target chat or username of the target channel (in the format @channelusername)", + "Description": "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\u0027s balance. Otherwise, they will be credited to the bot\u0027s balance.", "OriginalFieldType": "Integer or String", "ConvertedFieldType": "ChatId", "Optional": false @@ -1470,7 +1478,7 @@ { "OriginalName": "star_count", "ConvertedName": "StarCount", - "Description": "The number of Telegram Stars that must be paid to buy access to the media", + "Description": "The number of Telegram Stars that must be paid to buy access to the media; 1-2500", "OriginalFieldType": "Integer", "ConvertedFieldType": "int64", "Optional": false @@ -1483,6 +1491,14 @@ "ConvertedFieldType": "InputPaidMedia[]", "Optional": false }, + { + "OriginalName": "payload", + "ConvertedName": "Payload", + "Description": "Bot-defined paid media payload, 0-128 bytes. This will not be displayed to the user, use it for your internal processes.", + "OriginalFieldType": "String", + "ConvertedFieldType": "string", + "Optional": true + }, { "OriginalName": "caption", "ConvertedName": "Caption", @@ -2297,7 +2313,7 @@ { "OriginalName": "setMessageReaction", "ConvertedName": "SetMessageReaction", - "Description": "Use this method to change the chosen reactions on a message. Service messages can\u0027t 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.", + "Description": "Use this method to change the chosen reactions on a message. Service messages can\u0027t be reacted to. Automatically forwarded messages from a channel to its discussion group have the same available reactions as messages in the channel. Bots can\u0027t use paid reactions. Returns True on success.", "Fields": [ { "OriginalName": "chat_id", @@ -2318,7 +2334,7 @@ { "OriginalName": "reaction", "ConvertedName": "Reaction", - "Description": "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.", + "Description": "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. Paid reactions can\u0027t be used by bots.", "OriginalFieldType": "Array of ReactionType", "ConvertedFieldType": "ReactionType[]", "Optional": true @@ -2892,6 +2908,80 @@ "OriginalReturnType": "ChatInviteLink", "ConvertedReturnType": "ChatInviteLink" }, + { + "OriginalName": "createChatSubscriptionInviteLink", + "ConvertedName": "CreateChatSubscriptionInviteLink", + "Description": "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.", + "Fields": [ + { + "OriginalName": "chat_id", + "ConvertedName": "ChatId", + "Description": "Unique identifier for the target channel chat or username of the target channel (in the format @channelusername)", + "OriginalFieldType": "Integer or String", + "ConvertedFieldType": "ChatId", + "Optional": false + }, + { + "OriginalName": "name", + "ConvertedName": "Name", + "Description": "Invite link name; 0-32 characters", + "OriginalFieldType": "String", + "ConvertedFieldType": "string", + "Optional": true + }, + { + "OriginalName": "subscription_period", + "ConvertedName": "SubscriptionPeriod", + "Description": "The number of seconds the subscription will be active for before the next payment. Currently, it must always be 2592000 (30 days).", + "OriginalFieldType": "Integer", + "ConvertedFieldType": "int64", + "Optional": false + }, + { + "OriginalName": "subscription_price", + "ConvertedName": "SubscriptionPrice", + "Description": "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", + "OriginalFieldType": "Integer", + "ConvertedFieldType": "int64", + "Optional": false + } + ], + "OriginalReturnType": "ChatInviteLink", + "ConvertedReturnType": "ChatInviteLink" + }, + { + "OriginalName": "editChatSubscriptionInviteLink", + "ConvertedName": "EditChatSubscriptionInviteLink", + "Description": "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.", + "Fields": [ + { + "OriginalName": "chat_id", + "ConvertedName": "ChatId", + "Description": "Unique identifier for the target chat or username of the target channel (in the format @channelusername)", + "OriginalFieldType": "Integer or String", + "ConvertedFieldType": "ChatId", + "Optional": false + }, + { + "OriginalName": "invite_link", + "ConvertedName": "InviteLink", + "Description": "The invite link to edit", + "OriginalFieldType": "String", + "ConvertedFieldType": "string", + "Optional": false + }, + { + "OriginalName": "name", + "ConvertedName": "Name", + "Description": "Invite link name; 0-32 characters", + "OriginalFieldType": "String", + "ConvertedFieldType": "string", + "Optional": true + } + ], + "OriginalReturnType": "ChatInviteLink", + "ConvertedReturnType": "ChatInviteLink" + }, { "OriginalName": "revokeChatInviteLink", "ConvertedName": "RevokeChatInviteLink", @@ -3064,6 +3154,14 @@ "ConvertedName": "PinChatMessage", "Description": "Use this method to add a message to the list of pinned messages in a chat. If the chat is not a private chat, the bot must be an administrator in the chat for this to work and must have the \u0027can_pin_messages\u0027 administrator right in a supergroup or \u0027can_edit_messages\u0027 administrator right in a channel. Returns True on success.", "Fields": [ + { + "OriginalName": "business_connection_id", + "ConvertedName": "BusinessConnectionId", + "Description": "Unique identifier of the business connection on behalf of which the message will be pinned", + "OriginalFieldType": "String", + "ConvertedFieldType": "string", + "Optional": true + }, { "OriginalName": "chat_id", "ConvertedName": "ChatId", @@ -3097,6 +3195,14 @@ "ConvertedName": "UnpinChatMessage", "Description": "Use this method to remove a message from the list of pinned messages in a chat. If the chat is not a private chat, the bot must be an administrator in the chat for this to work and must have the \u0027can_pin_messages\u0027 administrator right in a supergroup or \u0027can_edit_messages\u0027 administrator right in a channel. Returns True on success.", "Fields": [ + { + "OriginalName": "business_connection_id", + "ConvertedName": "BusinessConnectionId", + "Description": "Unique identifier of the business connection on behalf of which the message will be unpinned", + "OriginalFieldType": "String", + "ConvertedFieldType": "string", + "Optional": true + }, { "OriginalName": "chat_id", "ConvertedName": "ChatId", @@ -3108,7 +3214,7 @@ { "OriginalName": "message_id", "ConvertedName": "MessageId", - "Description": "Identifier of a message to unpin. If not specified, the most recent pinned message (by sending date) will be unpinned.", + "Description": "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.", "OriginalFieldType": "Integer", "ConvertedFieldType": "int64", "Optional": true @@ -3321,7 +3427,7 @@ { "OriginalName": "editForumTopic", "ConvertedName": "EditForumTopic", - "Description": "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.", + "Description": "Use this method to edit name and icon of a topic in a forum supergroup chat. The bot must be an administrator in the chat for this to work and must have the can_manage_topics administrator rights, unless it is the creator of the topic. Returns True on success.", "Fields": [ { "OriginalName": "chat_id", @@ -3462,7 +3568,7 @@ { "OriginalName": "editGeneralForumTopic", "ConvertedName": "EditGeneralForumTopic", - "Description": "Use this method to edit the name of the \u0027General\u0027 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.", + "Description": "Use this method to edit the name of the \u0027General\u0027 topic in a forum supergroup chat. The bot must be an administrator in the chat for this to work and must have the can_manage_topics administrator rights. Returns True on success.", "Fields": [ { "OriginalName": "chat_id", @@ -4911,7 +5017,7 @@ { "OriginalName": "thumbnail", "ConvertedName": "Thumbnail", - "Description": "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 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 \u00BB. Animated and video sticker set thumbnails can\u0027t be uploaded via HTTP URL. If omitted, then the thumbnail is dropped and the first sticker is used as the thumbnail.", + "Description": "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#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 \u00BB. Animated and video sticker set thumbnails can\u0027t be uploaded via HTTP URL. If omitted, then the thumbnail is dropped and the first sticker is used as the thumbnail.", "OriginalFieldType": "InputFile or String", "ConvertedFieldType": "InputFile", "Optional": true @@ -5092,7 +5198,7 @@ { "OriginalName": "payload", "ConvertedName": "Payload", - "Description": "Bot-defined invoice payload, 1-128 bytes. This will not be displayed to the user, use for your internal processes.", + "Description": "Bot-defined invoice payload, 1-128 bytes. This will not be displayed to the user, use it for your internal processes.", "OriginalFieldType": "String", "ConvertedFieldType": "string", "Optional": false @@ -5309,7 +5415,7 @@ { "OriginalName": "payload", "ConvertedName": "Payload", - "Description": "Bot-defined invoice payload, 1-128 bytes. This will not be displayed to the user, use for your internal processes.", + "Description": "Bot-defined invoice payload, 1-128 bytes. This will not be displayed to the user, use it for your internal processes.", "OriginalFieldType": "String", "ConvertedFieldType": "string", "Optional": false diff --git a/src/Funogram.Generator/out/types.json b/src/Funogram.Generator/out/types.json index 516b4be..b7544f4 100644 --- a/src/Funogram.Generator/out/types.json +++ b/src/Funogram.Generator/out/types.json @@ -134,6 +134,14 @@ "ConvertedFieldType": "PreCheckoutQuery", "Optional": true }, + { + "OriginalName": "purchased_paid_media", + "ConvertedName": "PurchasedPaidMedia", + "Description": "A user purchased paid media with a non-empty payload sent by the bot in a non-channel chat", + "OriginalFieldType": "PaidMediaPurchased", + "ConvertedFieldType": "PaidMediaPurchased", + "Optional": true + }, { "OriginalName": "poll", "ConvertedName": "Poll", @@ -379,6 +387,14 @@ "OriginalFieldType": "Boolean", "ConvertedFieldType": "bool", "Optional": true + }, + { + "OriginalName": "has_main_web_app", + "ConvertedName": "HasMainWebApp", + "Description": "True, if the bot has a main Web App. Returned only in getMe.", + "OriginalFieldType": "Boolean", + "ConvertedFieldType": "bool", + "Optional": true } ] ] @@ -840,7 +856,7 @@ { "OriginalName": "from", "ConvertedName": "From", - "Description": "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.", + "Description": "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", "OriginalFieldType": "User", "ConvertedFieldType": "User", "Optional": true @@ -848,7 +864,7 @@ { "OriginalName": "sender_chat", "ConvertedName": "SenderChat", - "Description": "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.", + "Description": "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\u0027s 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.", "OriginalFieldType": "Chat", "ConvertedFieldType": "Chat", "Optional": true @@ -3990,9 +4006,21 @@ }, { "Name": "GiveawayCreated", - "Description": "This object represents a service message about the creation of a scheduled giveaway. Currently holds no information.", + "Description": "This object represents a service message about the creation of a scheduled giveaway.", "Kind": { - "Case": "Stub" + "Case": "Fields", + "Fields": [ + [ + { + "OriginalName": "prize_star_count", + "ConvertedName": "PrizeStarCount", + "Description": "The number of Telegram Stars to be split between giveaway winners; for Telegram Star giveaways only", + "OriginalFieldType": "Integer", + "ConvertedFieldType": "int64", + "Optional": true + } + ] + ] } }, { @@ -4058,10 +4086,18 @@ "ConvertedFieldType": "string[]", "Optional": true }, + { + "OriginalName": "prize_star_count", + "ConvertedName": "PrizeStarCount", + "Description": "The number of Telegram Stars to be split between giveaway winners; for Telegram Star giveaways only", + "OriginalFieldType": "Integer", + "ConvertedFieldType": "int64", + "Optional": true + }, { "OriginalName": "premium_subscription_month_count", "ConvertedName": "PremiumSubscriptionMonthCount", - "Description": "The number of months the Telegram Premium subscription won from the giveaway will be active for", + "Description": "The number of months the Telegram Premium subscription won from the giveaway will be active for; for Telegram Premium giveaways only", "OriginalFieldType": "Integer", "ConvertedFieldType": "int64", "Optional": true @@ -4125,10 +4161,18 @@ "ConvertedFieldType": "int64", "Optional": true }, + { + "OriginalName": "prize_star_count", + "ConvertedName": "PrizeStarCount", + "Description": "The number of Telegram Stars that were split between giveaway winners; for Telegram Star giveaways only", + "OriginalFieldType": "Integer", + "ConvertedFieldType": "int64", + "Optional": true + }, { "OriginalName": "premium_subscription_month_count", "ConvertedName": "PremiumSubscriptionMonthCount", - "Description": "The number of months the Telegram Premium subscription won from the giveaway will be active for", + "Description": "The number of months the Telegram Premium subscription won from the giveaway will be active for; for Telegram Premium giveaways only", "OriginalFieldType": "Integer", "ConvertedFieldType": "int64", "Optional": true @@ -4199,6 +4243,14 @@ "OriginalFieldType": "Message", "ConvertedFieldType": "Message", "Optional": true + }, + { + "OriginalName": "is_star_giveaway", + "ConvertedName": "IsStarGiveaway", + "Description": "True, if the giveaway is a Telegram Star giveaway. Otherwise, currently, the giveaway is a Telegram Premium giveaway.", + "OriginalFieldType": "True", + "ConvertedFieldType": "bool", + "Optional": true } ] ] @@ -5109,6 +5161,22 @@ "OriginalFieldType": "Integer", "ConvertedFieldType": "int64", "Optional": true + }, + { + "OriginalName": "subscription_period", + "ConvertedName": "SubscriptionPeriod", + "Description": "The number of seconds the subscription will be active for before the next payment", + "OriginalFieldType": "Integer", + "ConvertedFieldType": "int64", + "Optional": true + }, + { + "OriginalName": "subscription_price", + "ConvertedName": "SubscriptionPrice", + "Description": "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", + "OriginalFieldType": "Integer", + "ConvertedFieldType": "int64", + "Optional": true } ] ] @@ -5599,6 +5667,14 @@ "OriginalFieldType": "User", "ConvertedFieldType": "User", "Optional": false + }, + { + "OriginalName": "until_date", + "ConvertedName": "UntilDate", + "Description": "Date when the user\u0027s subscription will expire; Unix time", + "OriginalFieldType": "Integer", + "ConvertedFieldType": "DateTime", + "Optional": true } ] ] @@ -6195,6 +6271,10 @@ { "Name": "CustomEmoji", "CaseType": "ReactionTypeCustomEmoji" + }, + { + "Name": "Paid", + "CaseType": "ReactionTypePaid" } ] ] @@ -6254,6 +6334,25 @@ ] } }, + { + "Name": "ReactionTypePaid", + "Description": "The reaction is paid.", + "Kind": { + "Case": "Fields", + "Fields": [ + [ + { + "OriginalName": "type", + "ConvertedName": "Type", + "Description": "Type of the reaction, always \u201Cpaid\u201D", + "OriginalFieldType": "String", + "ConvertedFieldType": "string", + "Optional": false + } + ] + ] + } + }, { "Name": "ReactionCount", "Description": "Represents a reaction added to a message along with the number of times it was added.", @@ -6897,7 +6996,7 @@ }, { "Name": "ChatBoostSourceGiveaway", - "Description": "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.", + "Description": "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.", "Kind": { "Case": "Fields", "Fields": [ @@ -6921,11 +7020,19 @@ { "OriginalName": "user", "ConvertedName": "User", - "Description": "User that won the prize in the giveaway if any", + "Description": "User that won the prize in the giveaway if any; for Telegram Premium giveaways only", "OriginalFieldType": "User", "ConvertedFieldType": "User", "Optional": true }, + { + "OriginalName": "prize_star_count", + "ConvertedName": "PrizeStarCount", + "Description": "The number of Telegram Stars to be split between giveaway winners; for Telegram Star giveaways only", + "OriginalFieldType": "Integer", + "ConvertedFieldType": "int64", + "Optional": true + }, { "OriginalName": "is_unclaimed", "ConvertedName": "IsUnclaimed", @@ -10515,7 +10622,7 @@ { "OriginalName": "payload", "ConvertedName": "Payload", - "Description": "Bot-defined invoice payload, 1-128 bytes. This will not be displayed to the user, use for your internal processes.", + "Description": "Bot-defined invoice payload, 1-128 bytes. This will not be displayed to the user, use it for your internal processes.", "OriginalFieldType": "String", "ConvertedFieldType": "string", "Optional": false @@ -11173,6 +11280,33 @@ ] } }, + { + "Name": "PaidMediaPurchased", + "Description": "This object contains information about a paid media purchase.", + "Kind": { + "Case": "Fields", + "Fields": [ + [ + { + "OriginalName": "from", + "ConvertedName": "From", + "Description": "User who purchased the media", + "OriginalFieldType": "User", + "ConvertedFieldType": "User", + "Optional": false + }, + { + "OriginalName": "paid_media_payload", + "ConvertedName": "PaidMediaPayload", + "Description": "Bot-specified paid media payload", + "OriginalFieldType": "String", + "ConvertedFieldType": "string", + "Optional": false + } + ] + ] + } + }, { "Name": "RevenueWithdrawalState", "Description": "This object describes the state of a revenue withdrawal operation. Currently, it can be one of", @@ -11326,6 +11460,22 @@ "OriginalFieldType": "String", "ConvertedFieldType": "string", "Optional": true + }, + { + "OriginalName": "paid_media", + "ConvertedName": "PaidMedia", + "Description": "Information about the paid media bought by the user", + "OriginalFieldType": "Array of PaidMedia", + "ConvertedFieldType": "PaidMedia[]", + "Optional": true + }, + { + "OriginalName": "paid_media_payload", + "ConvertedName": "PaidMediaPayload", + "Description": "Bot-specified paid media payload", + "OriginalFieldType": "String", + "ConvertedFieldType": "string", + "Optional": true } ] ] diff --git a/src/Funogram.Telegram/Directory.Build.props b/src/Funogram.Telegram/Directory.Build.props index 9acc287..0acf47b 100644 --- a/src/Funogram.Telegram/Directory.Build.props +++ b/src/Funogram.Telegram/Directory.Build.props @@ -1,7 +1,7 @@  - 7.7.0.0 + 7.10.0.0 Nikolay Matyushin Funogram.Telegram Funogram.Telegram diff --git a/src/Funogram.Telegram/RequestsTypes.fs b/src/Funogram.Telegram/RequestsTypes.fs index 0423cb9..c15ead2 100644 --- a/src/Funogram.Telegram/RequestsTypes.fs +++ b/src/Funogram.Telegram/RequestsTypes.fs @@ -532,9 +532,11 @@ type SendVideoNote = type SendPaidMedia = { + BusinessConnectionId: string option ChatId: ChatId StarCount: int64 Media: InputPaidMedia[] + Payload: string option Caption: string option ParseMode: ParseMode option CaptionEntities: MessageEntity[] option @@ -544,11 +546,13 @@ type SendPaidMedia = ReplyParameters: ReplyParameters option ReplyMarkup: Markup option } - static member Make(chatId: ChatId, starCount: int64, media: InputPaidMedia[], ?caption: string, ?parseMode: ParseMode, ?captionEntities: MessageEntity[], ?showCaptionAboveMedia: bool, ?disableNotification: bool, ?protectContent: bool, ?replyParameters: ReplyParameters, ?replyMarkup: Markup) = + static member Make(chatId: ChatId, starCount: int64, media: InputPaidMedia[], ?businessConnectionId: string, ?payload: string, ?caption: string, ?parseMode: ParseMode, ?captionEntities: MessageEntity[], ?showCaptionAboveMedia: bool, ?disableNotification: bool, ?protectContent: bool, ?replyParameters: ReplyParameters, ?replyMarkup: Markup) = { + BusinessConnectionId = businessConnectionId ChatId = chatId StarCount = starCount Media = media + Payload = payload Caption = caption ParseMode = parseMode CaptionEntities = captionEntities @@ -558,10 +562,10 @@ type SendPaidMedia = ReplyParameters = replyParameters ReplyMarkup = replyMarkup } - static member Make(chatId: int64, starCount: int64, media: InputPaidMedia[], ?caption: string, ?parseMode: ParseMode, ?captionEntities: MessageEntity[], ?showCaptionAboveMedia: bool, ?disableNotification: bool, ?protectContent: bool, ?replyParameters: ReplyParameters, ?replyMarkup: Markup) = - SendPaidMedia.Make(ChatId.Int chatId, starCount, media, ?caption = caption, ?parseMode = parseMode, ?captionEntities = captionEntities, ?showCaptionAboveMedia = showCaptionAboveMedia, ?disableNotification = disableNotification, ?protectContent = protectContent, ?replyParameters = replyParameters, ?replyMarkup = replyMarkup) - static member Make(chatId: string, starCount: int64, media: InputPaidMedia[], ?caption: string, ?parseMode: ParseMode, ?captionEntities: MessageEntity[], ?showCaptionAboveMedia: bool, ?disableNotification: bool, ?protectContent: bool, ?replyParameters: ReplyParameters, ?replyMarkup: Markup) = - SendPaidMedia.Make(ChatId.String chatId, starCount, media, ?caption = caption, ?parseMode = parseMode, ?captionEntities = captionEntities, ?showCaptionAboveMedia = showCaptionAboveMedia, ?disableNotification = disableNotification, ?protectContent = protectContent, ?replyParameters = replyParameters, ?replyMarkup = replyMarkup) + static member Make(chatId: int64, starCount: int64, media: InputPaidMedia[], ?businessConnectionId: string, ?payload: string, ?caption: string, ?parseMode: ParseMode, ?captionEntities: MessageEntity[], ?showCaptionAboveMedia: bool, ?disableNotification: bool, ?protectContent: bool, ?replyParameters: ReplyParameters, ?replyMarkup: Markup) = + SendPaidMedia.Make(ChatId.Int chatId, starCount, media, ?businessConnectionId = businessConnectionId, ?payload = payload, ?caption = caption, ?parseMode = parseMode, ?captionEntities = captionEntities, ?showCaptionAboveMedia = showCaptionAboveMedia, ?disableNotification = disableNotification, ?protectContent = protectContent, ?replyParameters = replyParameters, ?replyMarkup = replyMarkup) + static member Make(chatId: string, starCount: int64, media: InputPaidMedia[], ?businessConnectionId: string, ?payload: string, ?caption: string, ?parseMode: ParseMode, ?captionEntities: MessageEntity[], ?showCaptionAboveMedia: bool, ?disableNotification: bool, ?protectContent: bool, ?replyParameters: ReplyParameters, ?replyMarkup: Markup) = + SendPaidMedia.Make(ChatId.String chatId, starCount, media, ?businessConnectionId = businessConnectionId, ?payload = payload, ?caption = caption, ?parseMode = parseMode, ?captionEntities = captionEntities, ?showCaptionAboveMedia = showCaptionAboveMedia, ?disableNotification = disableNotification, ?protectContent = protectContent, ?replyParameters = replyParameters, ?replyMarkup = replyMarkup) interface IRequestBase with member _.MethodName = "sendPaidMedia" @@ -1118,6 +1122,46 @@ type EditChatInviteLink = interface IRequestBase with member _.MethodName = "editChatInviteLink" +type CreateChatSubscriptionInviteLink = + { + ChatId: ChatId + Name: string option + SubscriptionPeriod: int64 + SubscriptionPrice: int64 + } + static member Make(chatId: ChatId, subscriptionPeriod: int64, subscriptionPrice: int64, ?name: string) = + { + ChatId = chatId + Name = name + SubscriptionPeriod = subscriptionPeriod + SubscriptionPrice = subscriptionPrice + } + static member Make(chatId: int64, subscriptionPeriod: int64, subscriptionPrice: int64, ?name: string) = + CreateChatSubscriptionInviteLink.Make(ChatId.Int chatId, subscriptionPeriod, subscriptionPrice, ?name = name) + static member Make(chatId: string, subscriptionPeriod: int64, subscriptionPrice: int64, ?name: string) = + CreateChatSubscriptionInviteLink.Make(ChatId.String chatId, subscriptionPeriod, subscriptionPrice, ?name = name) + interface IRequestBase with + member _.MethodName = "createChatSubscriptionInviteLink" + +type EditChatSubscriptionInviteLink = + { + ChatId: ChatId + InviteLink: string + Name: string option + } + static member Make(chatId: ChatId, inviteLink: string, ?name: string) = + { + ChatId = chatId + InviteLink = inviteLink + Name = name + } + static member Make(chatId: int64, inviteLink: string, ?name: string) = + EditChatSubscriptionInviteLink.Make(ChatId.Int chatId, inviteLink, ?name = name) + static member Make(chatId: string, inviteLink: string, ?name: string) = + EditChatSubscriptionInviteLink.Make(ChatId.String chatId, inviteLink, ?name = name) + interface IRequestBase with + member _.MethodName = "editChatSubscriptionInviteLink" + type RevokeChatInviteLink = { ChatId: ChatId @@ -1237,37 +1281,41 @@ type SetChatDescription = type PinChatMessage = { + BusinessConnectionId: string option ChatId: ChatId MessageId: int64 DisableNotification: bool option } - static member Make(chatId: ChatId, messageId: int64, ?disableNotification: bool) = + static member Make(chatId: ChatId, messageId: int64, ?businessConnectionId: string, ?disableNotification: bool) = { + BusinessConnectionId = businessConnectionId ChatId = chatId MessageId = messageId DisableNotification = disableNotification } - static member Make(chatId: int64, messageId: int64, ?disableNotification: bool) = - PinChatMessage.Make(ChatId.Int chatId, messageId, ?disableNotification = disableNotification) - static member Make(chatId: string, messageId: int64, ?disableNotification: bool) = - PinChatMessage.Make(ChatId.String chatId, messageId, ?disableNotification = disableNotification) + static member Make(chatId: int64, messageId: int64, ?businessConnectionId: string, ?disableNotification: bool) = + PinChatMessage.Make(ChatId.Int chatId, messageId, ?businessConnectionId = businessConnectionId, ?disableNotification = disableNotification) + static member Make(chatId: string, messageId: int64, ?businessConnectionId: string, ?disableNotification: bool) = + PinChatMessage.Make(ChatId.String chatId, messageId, ?businessConnectionId = businessConnectionId, ?disableNotification = disableNotification) interface IRequestBase with member _.MethodName = "pinChatMessage" type UnpinChatMessage = { + BusinessConnectionId: string option ChatId: ChatId MessageId: int64 option } - static member Make(chatId: ChatId, ?messageId: int64) = + static member Make(chatId: ChatId, ?businessConnectionId: string, ?messageId: int64) = { + BusinessConnectionId = businessConnectionId ChatId = chatId MessageId = messageId } - static member Make(chatId: int64, ?messageId: int64) = - UnpinChatMessage.Make(ChatId.Int chatId, ?messageId = messageId) - static member Make(chatId: string, ?messageId: int64) = - UnpinChatMessage.Make(ChatId.String chatId, ?messageId = messageId) + static member Make(chatId: int64, ?businessConnectionId: string, ?messageId: int64) = + UnpinChatMessage.Make(ChatId.Int chatId, ?businessConnectionId = businessConnectionId, ?messageId = messageId) + static member Make(chatId: string, ?businessConnectionId: string, ?messageId: int64) = + UnpinChatMessage.Make(ChatId.String chatId, ?businessConnectionId = businessConnectionId, ?messageId = messageId) interface IRequestBase with member _.MethodName = "unpinChatMessage" diff --git a/src/Funogram.Telegram/Types.fs b/src/Funogram.Telegram/Types.fs index 40b8776..9d3f395 100644 --- a/src/Funogram.Telegram/Types.fs +++ b/src/Funogram.Telegram/Types.fs @@ -125,6 +125,9 @@ and [] Update = /// New incoming pre-checkout query. Contains full information about checkout [] PreCheckoutQuery: PreCheckoutQuery option + /// A user purchased paid media with a non-empty payload sent by the bot in a non-channel chat + [] + PurchasedPaidMedia: PaidMediaPurchased option /// New poll state. Bots receive only updates about manually stopped polls and polls, which are sent by the bot [] Poll: Poll option @@ -147,7 +150,7 @@ and [] Update = [] RemovedChatBoost: ChatBoostRemoved option } - static member Create(updateId: int64, ?chatJoinRequest: ChatJoinRequest, ?chatMember: ChatMemberUpdated, ?myChatMember: ChatMemberUpdated, ?pollAnswer: PollAnswer, ?poll: Poll, ?preCheckoutQuery: PreCheckoutQuery, ?shippingQuery: ShippingQuery, ?callbackQuery: CallbackQuery, ?chosenInlineResult: ChosenInlineResult, ?chatBoost: ChatBoostUpdated, ?inlineQuery: InlineQuery, ?messageReaction: MessageReactionUpdated, ?deletedBusinessMessages: BusinessMessagesDeleted, ?editedBusinessMessage: Message, ?businessMessage: Message, ?businessConnection: BusinessConnection, ?editedChannelPost: Message, ?channelPost: Message, ?editedMessage: Message, ?message: Message, ?messageReactionCount: MessageReactionCountUpdated, ?removedChatBoost: ChatBoostRemoved) = + static member Create(updateId: int64, ?chatJoinRequest: ChatJoinRequest, ?chatMember: ChatMemberUpdated, ?myChatMember: ChatMemberUpdated, ?pollAnswer: PollAnswer, ?poll: Poll, ?purchasedPaidMedia: PaidMediaPurchased, ?preCheckoutQuery: PreCheckoutQuery, ?shippingQuery: ShippingQuery, ?callbackQuery: CallbackQuery, ?chosenInlineResult: ChosenInlineResult, ?inlineQuery: InlineQuery, ?messageReactionCount: MessageReactionCountUpdated, ?messageReaction: MessageReactionUpdated, ?deletedBusinessMessages: BusinessMessagesDeleted, ?editedBusinessMessage: Message, ?businessMessage: Message, ?businessConnection: BusinessConnection, ?editedChannelPost: Message, ?channelPost: Message, ?editedMessage: Message, ?message: Message, ?chatBoost: ChatBoostUpdated, ?removedChatBoost: ChatBoostRemoved) = { UpdateId = updateId ChatJoinRequest = chatJoinRequest @@ -155,12 +158,13 @@ and [] Update = MyChatMember = myChatMember PollAnswer = pollAnswer Poll = poll + PurchasedPaidMedia = purchasedPaidMedia PreCheckoutQuery = preCheckoutQuery ShippingQuery = shippingQuery CallbackQuery = callbackQuery ChosenInlineResult = chosenInlineResult - ChatBoost = chatBoost InlineQuery = inlineQuery + MessageReactionCount = messageReactionCount MessageReaction = messageReaction DeletedBusinessMessages = deletedBusinessMessages EditedBusinessMessage = editedBusinessMessage @@ -170,7 +174,7 @@ and [] Update = ChannelPost = channelPost EditedMessage = editedMessage Message = message - MessageReactionCount = messageReactionCount + ChatBoost = chatBoost RemovedChatBoost = removedChatBoost } @@ -259,8 +263,11 @@ and [] User = /// True, if the bot can be connected to a Telegram Business account to receive its messages. Returned only in getMe. [] CanConnectToBusiness: bool option + /// True, if the bot has a main Web App. Returned only in getMe. + [] + HasMainWebApp: bool option } - static member Create(id: int64, isBot: bool, firstName: string, ?lastName: string, ?username: string, ?languageCode: string, ?isPremium: bool, ?addedToAttachmentMenu: bool, ?canJoinGroups: bool, ?canReadAllGroupMessages: bool, ?supportsInlineQueries: bool, ?canConnectToBusiness: bool) = + static member Create(id: int64, isBot: bool, firstName: string, ?lastName: string, ?username: string, ?languageCode: string, ?isPremium: bool, ?addedToAttachmentMenu: bool, ?canJoinGroups: bool, ?canReadAllGroupMessages: bool, ?supportsInlineQueries: bool, ?canConnectToBusiness: bool, ?hasMainWebApp: bool) = { Id = id IsBot = isBot @@ -274,6 +281,7 @@ and [] User = CanReadAllGroupMessages = canReadAllGroupMessages SupportsInlineQueries = supportsInlineQueries CanConnectToBusiness = canConnectToBusiness + HasMainWebApp = hasMainWebApp } /// This object represents a chat. @@ -505,10 +513,10 @@ and [] Message = /// Unique identifier of a message thread to which the message belongs; for supergroups only [] MessageThreadId: int64 option - /// 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. + /// 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 [] From: User option - /// 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. + /// 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. [] SenderChat: Chat option /// If the sender of the message boosted the chat, the number of boosts added by the user @@ -2199,9 +2207,17 @@ and [] VideoChatParticipantsInvited = Users = users } -/// This object represents a service message about the creation of a scheduled giveaway. Currently holds no information. -and GiveawayCreated = - new() = {} +/// This object represents a service message about the creation of a scheduled giveaway. +and [] GiveawayCreated = + { + /// The number of Telegram Stars to be split between giveaway winners; for Telegram Star giveaways only + [] + PrizeStarCount: int64 option + } + static member Create(?prizeStarCount: int64) = + { + PrizeStarCount = prizeStarCount + } /// This object represents a message about a scheduled giveaway. and [] Giveaway = @@ -2227,11 +2243,14 @@ and [] Giveaway = /// A list of two-letter ISO 3166-1 alpha-2 country codes indicating the countries from which eligible users for the giveaway must come. If empty, then all users can participate in the giveaway. Users with a phone number that was bought on Fragment can always participate in giveaways. [] CountryCodes: string[] option - /// The number of months the Telegram Premium subscription won from the giveaway will be active for + /// The number of Telegram Stars to be split between giveaway winners; for Telegram Star giveaways only + [] + PrizeStarCount: int64 option + /// The number of months the Telegram Premium subscription won from the giveaway will be active for; for Telegram Premium giveaways only [] PremiumSubscriptionMonthCount: int64 option } - static member Create(chats: Chat[], winnersSelectionDate: int64, winnerCount: int64, ?onlyNewMembers: bool, ?hasPublicWinners: bool, ?prizeDescription: string, ?countryCodes: string[], ?premiumSubscriptionMonthCount: int64) = + static member Create(chats: Chat[], winnersSelectionDate: int64, winnerCount: int64, ?onlyNewMembers: bool, ?hasPublicWinners: bool, ?prizeDescription: string, ?countryCodes: string[], ?prizeStarCount: int64, ?premiumSubscriptionMonthCount: int64) = { Chats = chats WinnersSelectionDate = winnersSelectionDate @@ -2240,6 +2259,7 @@ and [] Giveaway = HasPublicWinners = hasPublicWinners PrizeDescription = prizeDescription CountryCodes = countryCodes + PrizeStarCount = prizeStarCount PremiumSubscriptionMonthCount = premiumSubscriptionMonthCount } @@ -2264,7 +2284,10 @@ and [] GiveawayWinners = /// The number of other chats the user had to join in order to be eligible for the giveaway [] AdditionalChatCount: int64 option - /// The number of months the Telegram Premium subscription won from the giveaway will be active for + /// The number of Telegram Stars that were split between giveaway winners; for Telegram Star giveaways only + [] + PrizeStarCount: int64 option + /// The number of months the Telegram Premium subscription won from the giveaway will be active for; for Telegram Premium giveaways only [] PremiumSubscriptionMonthCount: int64 option /// Number of undistributed prizes @@ -2280,7 +2303,7 @@ and [] GiveawayWinners = [] PrizeDescription: string option } - static member Create(chat: Chat, giveawayMessageId: int64, winnersSelectionDate: int64, winnerCount: int64, winners: User[], ?additionalChatCount: int64, ?premiumSubscriptionMonthCount: int64, ?unclaimedPrizeCount: int64, ?onlyNewMembers: bool, ?wasRefunded: bool, ?prizeDescription: string) = + static member Create(chat: Chat, giveawayMessageId: int64, winnersSelectionDate: int64, winnerCount: int64, winners: User[], ?additionalChatCount: int64, ?prizeStarCount: int64, ?premiumSubscriptionMonthCount: int64, ?unclaimedPrizeCount: int64, ?onlyNewMembers: bool, ?wasRefunded: bool, ?prizeDescription: string) = { Chat = chat GiveawayMessageId = giveawayMessageId @@ -2288,6 +2311,7 @@ and [] GiveawayWinners = WinnerCount = winnerCount Winners = winners AdditionalChatCount = additionalChatCount + PrizeStarCount = prizeStarCount PremiumSubscriptionMonthCount = premiumSubscriptionMonthCount UnclaimedPrizeCount = unclaimedPrizeCount OnlyNewMembers = onlyNewMembers @@ -2307,12 +2331,16 @@ and [] GiveawayCompleted = /// Message with the giveaway that was completed, if it wasn't deleted [] GiveawayMessage: Message option + /// True, if the giveaway is a Telegram Star giveaway. Otherwise, currently, the giveaway is a Telegram Premium giveaway. + [] + IsStarGiveaway: bool option } - static member Create(winnerCount: int64, ?unclaimedPrizeCount: int64, ?giveawayMessage: Message) = + static member Create(winnerCount: int64, ?unclaimedPrizeCount: int64, ?giveawayMessage: Message, ?isStarGiveaway: bool) = { WinnerCount = winnerCount UnclaimedPrizeCount = unclaimedPrizeCount GiveawayMessage = giveawayMessage + IsStarGiveaway = isStarGiveaway } /// Describes the options used for link preview generation. @@ -2815,8 +2843,14 @@ and [] ChatInviteLink = /// Number of pending join requests created using this link [] PendingJoinRequestCount: int64 option + /// The number of seconds the subscription will be active for before the next payment + [] + SubscriptionPeriod: int64 option + /// 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 + [] + SubscriptionPrice: int64 option } - static member Create(inviteLink: string, creator: User, createsJoinRequest: bool, isPrimary: bool, isRevoked: bool, ?name: string, ?expireDate: int64, ?memberLimit: int64, ?pendingJoinRequestCount: int64) = + static member Create(inviteLink: string, creator: User, createsJoinRequest: bool, isPrimary: bool, isRevoked: bool, ?name: string, ?expireDate: int64, ?memberLimit: int64, ?pendingJoinRequestCount: int64, ?subscriptionPeriod: int64, ?subscriptionPrice: int64) = { InviteLink = inviteLink Creator = creator @@ -2827,6 +2861,8 @@ and [] ChatInviteLink = ExpireDate = expireDate MemberLimit = memberLimit PendingJoinRequestCount = pendingJoinRequestCount + SubscriptionPeriod = subscriptionPeriod + SubscriptionPrice = subscriptionPrice } /// Represents the rights of an administrator in a chat. @@ -3071,11 +3107,15 @@ and [] ChatMemberMember = /// Information about the user [] User: User + /// Date when the user's subscription will expire; Unix time + [] + UntilDate: DateTime option } - static member Create(status: string, user: User) = + static member Create(status: string, user: User, ?untilDate: DateTime) = { Status = status User = user + UntilDate = untilDate } /// Represents a chat member that is under certain restrictions in the chat. Supergroups only. @@ -3398,6 +3438,7 @@ and [] ChatLocation = and ReactionType = | Emoji of ReactionTypeEmoji | CustomEmoji of ReactionTypeCustomEmoji + | Paid of ReactionTypePaid /// The reaction is based on an emoji. and [] ReactionTypeEmoji = @@ -3431,6 +3472,18 @@ and [] ReactionTypeCustomEmoji = CustomEmojiId = customEmojiId } +/// The reaction is paid. +and [] ReactionTypePaid = + { + /// Type of the reaction, always “paid” + [] + Type: string + } + static member Create(``type``: string) = + { + Type = ``type`` + } + /// Represents a reaction added to a message along with the number of times it was added. and [] ReactionCount = { @@ -3782,7 +3835,7 @@ and [] ChatBoostSourceGiftCode = User = user } -/// 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. and [] ChatBoostSourceGiveaway = { /// Source of the boost, always “giveaway” @@ -3791,18 +3844,22 @@ and [] ChatBoostSourceGiveaway = /// Identifier of a message in the chat with the giveaway; the message could have been deleted already. May be 0 if the message isn't sent yet. [] GiveawayMessageId: int64 - /// User that won the prize in the giveaway if any + /// User that won the prize in the giveaway if any; for Telegram Premium giveaways only [] User: User option + /// The number of Telegram Stars to be split between giveaway winners; for Telegram Star giveaways only + [] + PrizeStarCount: int64 option /// True, if the giveaway was completed, but there was no user to win the prize [] IsUnclaimed: bool option } - static member Create(source: string, giveawayMessageId: int64, ?user: User, ?isUnclaimed: bool) = + static member Create(source: string, giveawayMessageId: int64, ?user: User, ?prizeStarCount: int64, ?isUnclaimed: bool) = { Source = source GiveawayMessageId = giveawayMessageId User = user + PrizeStarCount = prizeStarCount IsUnclaimed = isUnclaimed } @@ -5658,7 +5715,7 @@ and [] InputInvoiceMessageContent = /// Product description, 1-255 characters [] Description: string - /// 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. [] Payload: string /// Payment provider token, obtained via @BotFather. Pass an empty string for payments in Telegram Stars. @@ -6023,6 +6080,22 @@ and [] PreCheckoutQuery = OrderInfo = orderInfo } +/// This object contains information about a paid media purchase. +and [] PaidMediaPurchased = + { + /// User who purchased the media + [] + From: User + /// Bot-specified paid media payload + [] + PaidMediaPayload: string + } + static member Create(from: User, paidMediaPayload: string) = + { + From = from + PaidMediaPayload = paidMediaPayload + } + /// This object describes the state of a revenue withdrawal operation. Currently, it can be one of and RevenueWithdrawalState = | Pending of RevenueWithdrawalStatePending @@ -6092,12 +6165,20 @@ and [] TransactionPartnerUser = /// Bot-specified invoice payload [] InvoicePayload: string option + /// Information about the paid media bought by the user + [] + PaidMedia: PaidMedia[] option + /// Bot-specified paid media payload + [] + PaidMediaPayload: string option } - static member Create(``type``: string, user: User, ?invoicePayload: string) = + static member Create(``type``: string, user: User, ?invoicePayload: string, ?paidMedia: PaidMedia[], ?paidMediaPayload: string) = { Type = ``type`` User = user InvoicePayload = invoicePayload + PaidMedia = paidMedia + PaidMediaPayload = paidMediaPayload } /// Describes a withdrawal transaction with Fragment. diff --git a/src/Funogram.Tests/Constants.fs b/src/Funogram.Tests/Constants.fs index 5af26af..141dd81 100644 --- a/src/Funogram.Tests/Constants.fs +++ b/src/Funogram.Tests/Constants.fs @@ -22,7 +22,7 @@ module Constants = let jsonTestObjString = """{"type":"italic","offset":0,"length":100,"url":"http://github.com"}""" let jsonTestObjResultString = """{"ok":true,"result":{"type":"italic","offset":0,"length":100,"url":"http://github.com","user":null,"language":null} }""" - let jsonTestObjUser = { Id = 123456L; FirstName = "BotFather"; LastName = None; Username = (Some "BotFather"); LanguageCode = None; IsBot = false; CanJoinGroups = None; CanReadAllGroupMessages = None; SupportsInlineQueries = None; IsPremium = None; AddedToAttachmentMenu = None; CanConnectToBusiness = None } + let jsonTestObjUser = { Id = 123456L; FirstName = "BotFather"; LastName = None; Username = (Some "BotFather"); LanguageCode = None; IsBot = false; CanJoinGroups = None; CanReadAllGroupMessages = None; SupportsInlineQueries = None; IsPremium = None; AddedToAttachmentMenu = None; CanConnectToBusiness = None; HasMainWebApp = None } let jsonTestObjUserResultString = """{"ok":true,"result":{"id":123456,"first_name":"BotFather","username":"BotFather","language_code":null,"is_bot":false,"can_join_groups":null,"can_read_all_group_messages":null,"supports_inline_queries":null}}""" let jsonTestEditResult1 = EditMessageResult.Success(true)