From d5fb24ae233fadd02ce922e6c4a8fca957bd9f12 Mon Sep 17 00:00:00 2001 From: Nikolay Matyushin Date: Sun, 16 Feb 2025 11:02:40 +0400 Subject: [PATCH] Update Bot API to 8.3 --- README.md | 2 +- src/Funogram.Generator/out/methods.json | 52 ++++++++- src/Funogram.Generator/out/types.json | 115 ++++++++++++++++++-- src/Funogram.Telegram/Directory.Build.props | 2 +- src/Funogram.Telegram/RequestsTypes.fs | 44 +++++--- src/Funogram.Telegram/Types.fs | 85 ++++++++++++--- src/Funogram.Tests/Constants.fs | 1 + 7 files changed, 248 insertions(+), 53 deletions(-) diff --git a/README.md b/README.md index 492941c..819fbb1 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-8.2-blue?logo=telegram)](https://www.nuget.org/packages/Funogram.Telegram/) +[![NuGet](https://img.shields.io/badge/Bot%20API-8.3-blue?logo=telegram)](https://www.nuget.org/packages/Funogram.Telegram/) Funogram Logo diff --git a/src/Funogram.Generator/out/methods.json b/src/Funogram.Generator/out/methods.json index 38f9e09..20d32cd 100644 --- a/src/Funogram.Generator/out/methods.json +++ b/src/Funogram.Generator/out/methods.json @@ -296,6 +296,14 @@ "ConvertedFieldType": "ChatId", "Optional": false }, + { + "OriginalName": "video_start_timestamp", + "ConvertedName": "VideoStartTimestamp", + "Description": "New start timestamp for the forwarded video in the message", + "OriginalFieldType": "Integer", + "ConvertedFieldType": "int64", + "Optional": true + }, { "OriginalName": "disable_notification", "ConvertedName": "DisableNotification", @@ -418,6 +426,14 @@ "ConvertedFieldType": "int64", "Optional": false }, + { + "OriginalName": "video_start_timestamp", + "ConvertedName": "VideoStartTimestamp", + "Description": "New start timestamp for the copied video in the message", + "OriginalFieldType": "Integer", + "ConvertedFieldType": "int64", + "Optional": true + }, { "OriginalName": "caption", "ConvertedName": "Caption", @@ -1031,6 +1047,22 @@ "ConvertedFieldType": "InputFile", "Optional": true }, + { + "OriginalName": "cover", + "ConvertedName": "Cover", + "Description": "Cover for the video in the message. Pass a file_id to send a file that exists on the Telegram servers (recommended), pass an HTTP URL for Telegram to get a file from the Internet, or pass \u201Cattach://\u003Cfile_attach_name\u003E\u201D to upload a new one using multipart/form-data under \u003Cfile_attach_name\u003E name. More information on Sending Files \u00BB", + "OriginalFieldType": "InputFile or String", + "ConvertedFieldType": "InputFile", + "Optional": true + }, + { + "OriginalName": "start_timestamp", + "ConvertedName": "StartTimestamp", + "Description": "Start timestamp for the video in the message", + "OriginalFieldType": "Integer", + "ConvertedFieldType": "int64", + "Optional": true + }, { "OriginalName": "caption", "ConvertedName": "Caption", @@ -2441,7 +2473,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. Bots can\u0027t use paid reactions. Returns True on success.", + "Description": "Use this method to change the chosen reactions on a message. Service messages of some types 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", @@ -5248,7 +5280,7 @@ { "OriginalName": "getAvailableGifts", "ConvertedName": "GetAvailableGifts", - "Description": "Returns the list of gifts that can be sent by the bot to users. Requires no parameters. Returns a Gifts object.", + "Description": "Returns the list of gifts that can be sent by the bot to users and channel chats. Requires no parameters. Returns a Gifts object.", "Fields": [], "OriginalReturnType": "Gifts", "ConvertedReturnType": "Gifts" @@ -5256,15 +5288,23 @@ { "OriginalName": "sendGift", "ConvertedName": "SendGift", - "Description": "Sends a gift to the given user. The gift can\u0027t be converted to Telegram Stars by the user. Returns True on success.", + "Description": "Sends a gift to the given user or channel chat. The gift can\u0027t be converted to Telegram Stars by the receiver. Returns True on success.", "Fields": [ { "OriginalName": "user_id", "ConvertedName": "UserId", - "Description": "Unique identifier of the target user that will receive the gift", + "Description": "Required if chat_id is not specified. Unique identifier of the target user who will receive the gift.", "OriginalFieldType": "Integer", "ConvertedFieldType": "int64", - "Optional": false + "Optional": true + }, + { + "OriginalName": "chat_id", + "ConvertedName": "ChatId", + "Description": "Required if user_id is not specified. Unique identifier for the chat or username of the channel (in the format @channelusername) that will receive the gift.", + "OriginalFieldType": "Integer or String", + "ConvertedFieldType": "ChatId", + "Optional": true }, { "OriginalName": "gift_id", @@ -5285,7 +5325,7 @@ { "OriginalName": "text", "ConvertedName": "Text", - "Description": "Text that will be shown along with the gift; 0-255 characters", + "Description": "Text that will be shown along with the gift; 0-128 characters", "OriginalFieldType": "String", "ConvertedFieldType": "string", "Optional": true diff --git a/src/Funogram.Generator/out/types.json b/src/Funogram.Generator/out/types.json index 4683228..e1e7907 100644 --- a/src/Funogram.Generator/out/types.json +++ b/src/Funogram.Generator/out/types.json @@ -722,6 +722,14 @@ "ConvertedFieldType": "ChatPermissions", "Optional": true }, + { + "OriginalName": "can_send_gift", + "ConvertedName": "CanSendGift", + "Description": "True, if gifts can be sent to the chat", + "OriginalFieldType": "True", + "ConvertedFieldType": "bool", + "Optional": true + }, { "OriginalName": "can_send_paid_media", "ConvertedName": "CanSendPaidMedia", @@ -2523,6 +2531,22 @@ "ConvertedFieldType": "PhotoSize", "Optional": true }, + { + "OriginalName": "cover", + "ConvertedName": "Cover", + "Description": "Available sizes of the cover of the video in the message", + "OriginalFieldType": "Array of PhotoSize", + "ConvertedFieldType": "PhotoSize[]", + "Optional": true + }, + { + "OriginalName": "start_timestamp", + "ConvertedName": "StartTimestamp", + "Description": "Timestamp in seconds from which the video will play in the message", + "OriginalFieldType": "Integer", + "ConvertedFieldType": "int64", + "Optional": true + }, { "OriginalName": "file_name", "ConvertedName": "FileName", @@ -7450,8 +7474,24 @@ "OriginalName": "thumbnail", "ConvertedName": "Thumbnail", "Description": "Thumbnail of the file sent; can be ignored if thumbnail generation for the file is supported server-side. The thumbnail should be in JPEG format and less than 200 kB in size. A thumbnail\u0027s width and height should not exceed 320. Ignored if the file is not uploaded using multipart/form-data. Thumbnails can\u0027t be reused and can be only uploaded as a new file, so you can pass \u201Cattach://\u003Cfile_attach_name\u003E\u201D if the thumbnail was uploaded using multipart/form-data under \u003Cfile_attach_name\u003E. More information on Sending Files \u00BB", - "OriginalFieldType": "InputFile or String", - "ConvertedFieldType": "InputFile", + "OriginalFieldType": "String", + "ConvertedFieldType": "string", + "Optional": true + }, + { + "OriginalName": "cover", + "ConvertedName": "Cover", + "Description": "Cover for the video in the message. Pass a file_id to send a file that exists on the Telegram servers (recommended), pass an HTTP URL for Telegram to get a file from the Internet, or pass \u201Cattach://\u003Cfile_attach_name\u003E\u201D to upload a new one using multipart/form-data under \u003Cfile_attach_name\u003E name. More information on Sending Files \u00BB", + "OriginalFieldType": "String", + "ConvertedFieldType": "string", + "Optional": true + }, + { + "OriginalName": "start_timestamp", + "ConvertedName": "StartTimestamp", + "Description": "Start timestamp for the video in the message", + "OriginalFieldType": "Integer", + "ConvertedFieldType": "int64", "Optional": true }, { @@ -7557,8 +7597,8 @@ "OriginalName": "thumbnail", "ConvertedName": "Thumbnail", "Description": "Thumbnail of the file sent; can be ignored if thumbnail generation for the file is supported server-side. The thumbnail should be in JPEG format and less than 200 kB in size. A thumbnail\u0027s width and height should not exceed 320. Ignored if the file is not uploaded using multipart/form-data. Thumbnails can\u0027t be reused and can be only uploaded as a new file, so you can pass \u201Cattach://\u003Cfile_attach_name\u003E\u201D if the thumbnail was uploaded using multipart/form-data under \u003Cfile_attach_name\u003E. More information on Sending Files \u00BB", - "OriginalFieldType": "InputFile or String", - "ConvertedFieldType": "InputFile", + "OriginalFieldType": "String", + "ConvertedFieldType": "string", "Optional": true }, { @@ -7656,8 +7696,8 @@ "OriginalName": "thumbnail", "ConvertedName": "Thumbnail", "Description": "Thumbnail of the file sent; can be ignored if thumbnail generation for the file is supported server-side. The thumbnail should be in JPEG format and less than 200 kB in size. A thumbnail\u0027s width and height should not exceed 320. Ignored if the file is not uploaded using multipart/form-data. Thumbnails can\u0027t be reused and can be only uploaded as a new file, so you can pass \u201Cattach://\u003Cfile_attach_name\u003E\u201D if the thumbnail was uploaded using multipart/form-data under \u003Cfile_attach_name\u003E. More information on Sending Files \u00BB", - "OriginalFieldType": "InputFile or String", - "ConvertedFieldType": "InputFile", + "OriginalFieldType": "String", + "ConvertedFieldType": "string", "Optional": true }, { @@ -7739,8 +7779,8 @@ "OriginalName": "thumbnail", "ConvertedName": "Thumbnail", "Description": "Thumbnail of the file sent; can be ignored if thumbnail generation for the file is supported server-side. The thumbnail should be in JPEG format and less than 200 kB in size. A thumbnail\u0027s width and height should not exceed 320. Ignored if the file is not uploaded using multipart/form-data. Thumbnails can\u0027t be reused and can be only uploaded as a new file, so you can pass \u201Cattach://\u003Cfile_attach_name\u003E\u201D if the thumbnail was uploaded using multipart/form-data under \u003Cfile_attach_name\u003E. More information on Sending Files \u00BB", - "OriginalFieldType": "InputFile or String", - "ConvertedFieldType": "InputFile", + "OriginalFieldType": "String", + "ConvertedFieldType": "string", "Optional": true }, { @@ -7859,8 +7899,24 @@ "OriginalName": "thumbnail", "ConvertedName": "Thumbnail", "Description": "Thumbnail of the file sent; can be ignored if thumbnail generation for the file is supported server-side. The thumbnail should be in JPEG format and less than 200 kB in size. A thumbnail\u0027s width and height should not exceed 320. Ignored if the file is not uploaded using multipart/form-data. Thumbnails can\u0027t be reused and can be only uploaded as a new file, so you can pass \u201Cattach://\u003Cfile_attach_name\u003E\u201D if the thumbnail was uploaded using multipart/form-data under \u003Cfile_attach_name\u003E. More information on Sending Files \u00BB", - "OriginalFieldType": "InputFile or String", - "ConvertedFieldType": "InputFile", + "OriginalFieldType": "String", + "ConvertedFieldType": "string", + "Optional": true + }, + { + "OriginalName": "cover", + "ConvertedName": "Cover", + "Description": "Cover for the video in the message. Pass a file_id to send a file that exists on the Telegram servers (recommended), pass an HTTP URL for Telegram to get a file from the Internet, or pass \u201Cattach://\u003Cfile_attach_name\u003E\u201D to upload a new one using multipart/form-data under \u003Cfile_attach_name\u003E name. More information on Sending Files \u00BB", + "OriginalFieldType": "String", + "ConvertedFieldType": "string", + "Optional": true + }, + { + "OriginalName": "start_timestamp", + "ConvertedName": "StartTimestamp", + "Description": "Start timestamp for the video in the message", + "OriginalFieldType": "Integer", + "ConvertedFieldType": "int64", "Optional": true }, { @@ -11613,6 +11669,10 @@ "Name": "User", "CaseType": "TransactionPartnerUser" }, + { + "Name": "Chat", + "CaseType": "TransactionPartnerChat" + }, { "Name": "AffiliateProgram", "CaseType": "TransactionPartnerAffiliateProgram" @@ -11712,6 +11772,41 @@ ] } }, + { + "Name": "TransactionPartnerChat", + "Description": "Describes a transaction with a chat.", + "Kind": { + "Case": "Fields", + "Fields": [ + [ + { + "OriginalName": "type", + "ConvertedName": "Type", + "Description": "Type of the transaction partner, always \u201Cchat\u201D", + "OriginalFieldType": "String", + "ConvertedFieldType": "string", + "Optional": false + }, + { + "OriginalName": "chat", + "ConvertedName": "Chat", + "Description": "Information about the chat", + "OriginalFieldType": "Chat", + "ConvertedFieldType": "Chat", + "Optional": false + }, + { + "OriginalName": "gift", + "ConvertedName": "Gift", + "Description": "The gift sent to the chat by the bot", + "OriginalFieldType": "Gift", + "ConvertedFieldType": "Gift", + "Optional": true + } + ] + ] + } + }, { "Name": "TransactionPartnerAffiliateProgram", "Description": "Describes the affiliate program that issued the affiliate commission received via this transaction.", diff --git a/src/Funogram.Telegram/Directory.Build.props b/src/Funogram.Telegram/Directory.Build.props index a26aa14..449c97a 100644 --- a/src/Funogram.Telegram/Directory.Build.props +++ b/src/Funogram.Telegram/Directory.Build.props @@ -1,7 +1,7 @@  - 8.2.0.0 + 8.3.0.0 Nikolay Matyushin Funogram.Telegram Funogram.Telegram diff --git a/src/Funogram.Telegram/RequestsTypes.fs b/src/Funogram.Telegram/RequestsTypes.fs index 5f5bb8a..d844f18 100644 --- a/src/Funogram.Telegram/RequestsTypes.fs +++ b/src/Funogram.Telegram/RequestsTypes.fs @@ -120,23 +120,25 @@ type ForwardMessage = ChatId: ChatId MessageThreadId: int64 option FromChatId: ChatId + VideoStartTimestamp: int64 option DisableNotification: bool option ProtectContent: bool option MessageId: int64 } - static member Make(chatId: ChatId, fromChatId: ChatId, messageId: int64, ?messageThreadId: int64, ?disableNotification: bool, ?protectContent: bool) = + static member Make(chatId: ChatId, fromChatId: ChatId, messageId: int64, ?messageThreadId: int64, ?videoStartTimestamp: int64, ?disableNotification: bool, ?protectContent: bool) = { ChatId = chatId MessageThreadId = messageThreadId FromChatId = fromChatId + VideoStartTimestamp = videoStartTimestamp DisableNotification = disableNotification ProtectContent = protectContent MessageId = messageId } - static member Make(chatId: int64, fromChatId: int64, messageId: int64, ?messageThreadId: int64, ?disableNotification: bool, ?protectContent: bool) = - ForwardMessage.Make(ChatId.Int chatId, ChatId.Int fromChatId, messageId, ?messageThreadId = messageThreadId, ?disableNotification = disableNotification, ?protectContent = protectContent) - static member Make(chatId: string, fromChatId: string, messageId: int64, ?messageThreadId: int64, ?disableNotification: bool, ?protectContent: bool) = - ForwardMessage.Make(ChatId.String chatId, ChatId.String fromChatId, messageId, ?messageThreadId = messageThreadId, ?disableNotification = disableNotification, ?protectContent = protectContent) + static member Make(chatId: int64, fromChatId: int64, messageId: int64, ?messageThreadId: int64, ?videoStartTimestamp: int64, ?disableNotification: bool, ?protectContent: bool) = + ForwardMessage.Make(ChatId.Int chatId, ChatId.Int fromChatId, messageId, ?messageThreadId = messageThreadId, ?videoStartTimestamp = videoStartTimestamp, ?disableNotification = disableNotification, ?protectContent = protectContent) + static member Make(chatId: string, fromChatId: string, messageId: int64, ?messageThreadId: int64, ?videoStartTimestamp: int64, ?disableNotification: bool, ?protectContent: bool) = + ForwardMessage.Make(ChatId.String chatId, ChatId.String fromChatId, messageId, ?messageThreadId = messageThreadId, ?videoStartTimestamp = videoStartTimestamp, ?disableNotification = disableNotification, ?protectContent = protectContent) interface IRequestBase with member _.MethodName = "forwardMessage" @@ -171,6 +173,7 @@ type CopyMessage = MessageThreadId: int64 option FromChatId: ChatId MessageId: int64 + VideoStartTimestamp: int64 option Caption: string option ParseMode: ParseMode option CaptionEntities: MessageEntity[] option @@ -181,12 +184,13 @@ type CopyMessage = ReplyParameters: ReplyParameters option ReplyMarkup: Markup option } - static member Make(chatId: ChatId, fromChatId: ChatId, messageId: int64, ?messageThreadId: int64, ?caption: string, ?parseMode: ParseMode, ?captionEntities: MessageEntity[], ?showCaptionAboveMedia: bool, ?disableNotification: bool, ?protectContent: bool, ?allowPaidBroadcast: bool, ?replyParameters: ReplyParameters, ?replyMarkup: Markup) = + static member Make(chatId: ChatId, fromChatId: ChatId, messageId: int64, ?messageThreadId: int64, ?videoStartTimestamp: int64, ?caption: string, ?parseMode: ParseMode, ?captionEntities: MessageEntity[], ?showCaptionAboveMedia: bool, ?disableNotification: bool, ?protectContent: bool, ?allowPaidBroadcast: bool, ?replyParameters: ReplyParameters, ?replyMarkup: Markup) = { ChatId = chatId MessageThreadId = messageThreadId FromChatId = fromChatId MessageId = messageId + VideoStartTimestamp = videoStartTimestamp Caption = caption ParseMode = parseMode CaptionEntities = captionEntities @@ -197,10 +201,10 @@ type CopyMessage = ReplyParameters = replyParameters ReplyMarkup = replyMarkup } - static member Make(chatId: int64, fromChatId: int64, messageId: int64, ?messageThreadId: int64, ?caption: string, ?parseMode: ParseMode, ?captionEntities: MessageEntity[], ?showCaptionAboveMedia: bool, ?disableNotification: bool, ?protectContent: bool, ?allowPaidBroadcast: bool, ?replyParameters: ReplyParameters, ?replyMarkup: Markup) = - CopyMessage.Make(ChatId.Int chatId, ChatId.Int fromChatId, messageId, ?messageThreadId = messageThreadId, ?caption = caption, ?parseMode = parseMode, ?captionEntities = captionEntities, ?showCaptionAboveMedia = showCaptionAboveMedia, ?disableNotification = disableNotification, ?protectContent = protectContent, ?allowPaidBroadcast = allowPaidBroadcast, ?replyParameters = replyParameters, ?replyMarkup = replyMarkup) - static member Make(chatId: string, fromChatId: string, messageId: int64, ?messageThreadId: int64, ?caption: string, ?parseMode: ParseMode, ?captionEntities: MessageEntity[], ?showCaptionAboveMedia: bool, ?disableNotification: bool, ?protectContent: bool, ?allowPaidBroadcast: bool, ?replyParameters: ReplyParameters, ?replyMarkup: Markup) = - CopyMessage.Make(ChatId.String chatId, ChatId.String fromChatId, messageId, ?messageThreadId = messageThreadId, ?caption = caption, ?parseMode = parseMode, ?captionEntities = captionEntities, ?showCaptionAboveMedia = showCaptionAboveMedia, ?disableNotification = disableNotification, ?protectContent = protectContent, ?allowPaidBroadcast = allowPaidBroadcast, ?replyParameters = replyParameters, ?replyMarkup = replyMarkup) + static member Make(chatId: int64, fromChatId: int64, messageId: int64, ?messageThreadId: int64, ?videoStartTimestamp: int64, ?caption: string, ?parseMode: ParseMode, ?captionEntities: MessageEntity[], ?showCaptionAboveMedia: bool, ?disableNotification: bool, ?protectContent: bool, ?allowPaidBroadcast: bool, ?replyParameters: ReplyParameters, ?replyMarkup: Markup) = + CopyMessage.Make(ChatId.Int chatId, ChatId.Int fromChatId, messageId, ?messageThreadId = messageThreadId, ?videoStartTimestamp = videoStartTimestamp, ?caption = caption, ?parseMode = parseMode, ?captionEntities = captionEntities, ?showCaptionAboveMedia = showCaptionAboveMedia, ?disableNotification = disableNotification, ?protectContent = protectContent, ?allowPaidBroadcast = allowPaidBroadcast, ?replyParameters = replyParameters, ?replyMarkup = replyMarkup) + static member Make(chatId: string, fromChatId: string, messageId: int64, ?messageThreadId: int64, ?videoStartTimestamp: int64, ?caption: string, ?parseMode: ParseMode, ?captionEntities: MessageEntity[], ?showCaptionAboveMedia: bool, ?disableNotification: bool, ?protectContent: bool, ?allowPaidBroadcast: bool, ?replyParameters: ReplyParameters, ?replyMarkup: Markup) = + CopyMessage.Make(ChatId.String chatId, ChatId.String fromChatId, messageId, ?messageThreadId = messageThreadId, ?videoStartTimestamp = videoStartTimestamp, ?caption = caption, ?parseMode = parseMode, ?captionEntities = captionEntities, ?showCaptionAboveMedia = showCaptionAboveMedia, ?disableNotification = disableNotification, ?protectContent = protectContent, ?allowPaidBroadcast = allowPaidBroadcast, ?replyParameters = replyParameters, ?replyMarkup = replyMarkup) interface IRequestBase with member _.MethodName = "copyMessage" @@ -374,6 +378,8 @@ type SendVideo = Width: int64 option Height: int64 option Thumbnail: InputFile option + Cover: InputFile option + StartTimestamp: int64 option Caption: string option ParseMode: ParseMode option CaptionEntities: MessageEntity[] option @@ -387,7 +393,7 @@ type SendVideo = ReplyParameters: ReplyParameters option ReplyMarkup: Markup option } - static member Make(chatId: ChatId, video: InputFile, ?businessConnectionId: string, ?messageEffectId: string, ?allowPaidBroadcast: bool, ?protectContent: bool, ?disableNotification: bool, ?supportsStreaming: bool, ?hasSpoiler: bool, ?showCaptionAboveMedia: bool, ?parseMode: ParseMode, ?replyParameters: ReplyParameters, ?caption: string, ?thumbnail: InputFile, ?height: int64, ?width: int64, ?duration: int64, ?messageThreadId: int64, ?captionEntities: MessageEntity[], ?replyMarkup: Markup) = + static member Make(chatId: ChatId, video: InputFile, ?businessConnectionId: string, ?messageEffectId: string, ?allowPaidBroadcast: bool, ?protectContent: bool, ?disableNotification: bool, ?supportsStreaming: bool, ?hasSpoiler: bool, ?showCaptionAboveMedia: bool, ?captionEntities: MessageEntity[], ?caption: string, ?replyParameters: ReplyParameters, ?startTimestamp: int64, ?cover: InputFile, ?thumbnail: InputFile, ?height: int64, ?width: int64, ?duration: int64, ?messageThreadId: int64, ?parseMode: ParseMode, ?replyMarkup: Markup) = { BusinessConnectionId = businessConnectionId ChatId = chatId @@ -397,6 +403,8 @@ type SendVideo = Width = width Height = height Thumbnail = thumbnail + Cover = cover + StartTimestamp = startTimestamp Caption = caption ParseMode = parseMode CaptionEntities = captionEntities @@ -410,10 +418,10 @@ type SendVideo = ReplyParameters = replyParameters ReplyMarkup = replyMarkup } - static member Make(chatId: int64, video: InputFile, ?businessConnectionId: string, ?messageEffectId: string, ?allowPaidBroadcast: bool, ?protectContent: bool, ?disableNotification: bool, ?supportsStreaming: bool, ?hasSpoiler: bool, ?showCaptionAboveMedia: bool, ?parseMode: ParseMode, ?replyParameters: ReplyParameters, ?caption: string, ?thumbnail: InputFile, ?height: int64, ?width: int64, ?duration: int64, ?messageThreadId: int64, ?captionEntities: MessageEntity[], ?replyMarkup: Markup) = - SendVideo.Make(ChatId.Int chatId, video, ?businessConnectionId = businessConnectionId, ?messageEffectId = messageEffectId, ?allowPaidBroadcast = allowPaidBroadcast, ?protectContent = protectContent, ?disableNotification = disableNotification, ?supportsStreaming = supportsStreaming, ?hasSpoiler = hasSpoiler, ?showCaptionAboveMedia = showCaptionAboveMedia, ?parseMode = parseMode, ?replyParameters = replyParameters, ?caption = caption, ?thumbnail = thumbnail, ?height = height, ?width = width, ?duration = duration, ?messageThreadId = messageThreadId, ?captionEntities = captionEntities, ?replyMarkup = replyMarkup) - static member Make(chatId: string, video: InputFile, ?businessConnectionId: string, ?messageEffectId: string, ?allowPaidBroadcast: bool, ?protectContent: bool, ?disableNotification: bool, ?supportsStreaming: bool, ?hasSpoiler: bool, ?showCaptionAboveMedia: bool, ?parseMode: ParseMode, ?replyParameters: ReplyParameters, ?caption: string, ?thumbnail: InputFile, ?height: int64, ?width: int64, ?duration: int64, ?messageThreadId: int64, ?captionEntities: MessageEntity[], ?replyMarkup: Markup) = - SendVideo.Make(ChatId.String chatId, video, ?businessConnectionId = businessConnectionId, ?messageEffectId = messageEffectId, ?allowPaidBroadcast = allowPaidBroadcast, ?protectContent = protectContent, ?disableNotification = disableNotification, ?supportsStreaming = supportsStreaming, ?hasSpoiler = hasSpoiler, ?showCaptionAboveMedia = showCaptionAboveMedia, ?parseMode = parseMode, ?replyParameters = replyParameters, ?caption = caption, ?thumbnail = thumbnail, ?height = height, ?width = width, ?duration = duration, ?messageThreadId = messageThreadId, ?captionEntities = captionEntities, ?replyMarkup = replyMarkup) + static member Make(chatId: int64, video: InputFile, ?businessConnectionId: string, ?messageEffectId: string, ?allowPaidBroadcast: bool, ?protectContent: bool, ?disableNotification: bool, ?supportsStreaming: bool, ?hasSpoiler: bool, ?showCaptionAboveMedia: bool, ?captionEntities: MessageEntity[], ?caption: string, ?replyParameters: ReplyParameters, ?startTimestamp: int64, ?cover: InputFile, ?thumbnail: InputFile, ?height: int64, ?width: int64, ?duration: int64, ?messageThreadId: int64, ?parseMode: ParseMode, ?replyMarkup: Markup) = + SendVideo.Make(ChatId.Int chatId, video, ?businessConnectionId = businessConnectionId, ?messageEffectId = messageEffectId, ?allowPaidBroadcast = allowPaidBroadcast, ?protectContent = protectContent, ?disableNotification = disableNotification, ?supportsStreaming = supportsStreaming, ?hasSpoiler = hasSpoiler, ?showCaptionAboveMedia = showCaptionAboveMedia, ?captionEntities = captionEntities, ?caption = caption, ?replyParameters = replyParameters, ?startTimestamp = startTimestamp, ?cover = cover, ?thumbnail = thumbnail, ?height = height, ?width = width, ?duration = duration, ?messageThreadId = messageThreadId, ?parseMode = parseMode, ?replyMarkup = replyMarkup) + static member Make(chatId: string, video: InputFile, ?businessConnectionId: string, ?messageEffectId: string, ?allowPaidBroadcast: bool, ?protectContent: bool, ?disableNotification: bool, ?supportsStreaming: bool, ?hasSpoiler: bool, ?showCaptionAboveMedia: bool, ?captionEntities: MessageEntity[], ?caption: string, ?replyParameters: ReplyParameters, ?startTimestamp: int64, ?cover: InputFile, ?thumbnail: InputFile, ?height: int64, ?width: int64, ?duration: int64, ?messageThreadId: int64, ?parseMode: ParseMode, ?replyMarkup: Markup) = + SendVideo.Make(ChatId.String chatId, video, ?businessConnectionId = businessConnectionId, ?messageEffectId = messageEffectId, ?allowPaidBroadcast = allowPaidBroadcast, ?protectContent = protectContent, ?disableNotification = disableNotification, ?supportsStreaming = supportsStreaming, ?hasSpoiler = hasSpoiler, ?showCaptionAboveMedia = showCaptionAboveMedia, ?captionEntities = captionEntities, ?caption = caption, ?replyParameters = replyParameters, ?startTimestamp = startTimestamp, ?cover = cover, ?thumbnail = thumbnail, ?height = height, ?width = width, ?duration = duration, ?messageThreadId = messageThreadId, ?parseMode = parseMode, ?replyMarkup = replyMarkup) interface IRequestBase with member _.MethodName = "sendVideo" @@ -2353,16 +2361,18 @@ type GetAvailableGifts() = type SendGift = { - UserId: int64 + UserId: int64 option + ChatId: ChatId option GiftId: string PayForUpgrade: bool option Text: string option TextParseMode: string option TextEntities: MessageEntity[] option } - static member Make(userId: int64, giftId: string, ?payForUpgrade: bool, ?text: string, ?textParseMode: string, ?textEntities: MessageEntity[]) = + static member Make(giftId: string, ?userId: int64, ?chatId: ChatId, ?payForUpgrade: bool, ?text: string, ?textParseMode: string, ?textEntities: MessageEntity[]) = { UserId = userId + ChatId = chatId GiftId = giftId PayForUpgrade = payForUpgrade Text = text diff --git a/src/Funogram.Telegram/Types.fs b/src/Funogram.Telegram/Types.fs index d244cd7..57cade4 100644 --- a/src/Funogram.Telegram/Types.fs +++ b/src/Funogram.Telegram/Types.fs @@ -416,6 +416,9 @@ and [] ChatFullInfo = /// Default chat member permissions, for groups and supergroups [] Permissions: ChatPermissions option + /// True, if gifts can be sent to the chat + [] + CanSendGift: bool option /// True, if paid media messages can be sent or forwarded to the channel chat. The field is available only for channel chats. [] CanSendPaidMedia: bool option @@ -456,22 +459,22 @@ and [] ChatFullInfo = [] Location: ChatLocation option } - static member Create(id: int64, ``type``: string, accentColorId: int64, maxReactionCount: int64, ?joinToSendMessages: bool, ?joinByRequest: bool, ?description: string, ?inviteLink: string, ?pinnedMessage: Message, ?permissions: ChatPermissions, ?canSendPaidMedia: bool, ?slowModeDelay: int64, ?messageAutoDeleteTime: int64, ?hasRestrictedVoiceAndVideoMessages: bool, ?hasAggressiveAntiSpamEnabled: bool, ?hasHiddenMembers: bool, ?hasProtectedContent: bool, ?hasVisibleHistory: bool, ?stickerSetName: string, ?canSetStickerSet: bool, ?customEmojiStickerSetName: string, ?unrestrictBoostCount: int64, ?hasPrivateForwards: bool, ?emojiStatusExpirationDate: int64, ?linkedChatId: int64, ?title: string, ?username: string, ?firstName: string, ?lastName: string, ?isForum: bool, ?photo: ChatPhoto, ?activeUsernames: string[], ?birthdate: Birthdate, ?businessIntro: BusinessIntro, ?businessLocation: BusinessLocation, ?businessOpeningHours: BusinessOpeningHours, ?personalChat: Chat, ?availableReactions: ReactionType[], ?backgroundCustomEmojiId: string, ?profileAccentColorId: int64, ?profileBackgroundCustomEmojiId: string, ?emojiStatusCustomEmojiId: string, ?bio: string, ?location: ChatLocation) = + static member Create(id: int64, ``type``: string, accentColorId: int64, maxReactionCount: int64, ?joinByRequest: bool, ?description: string, ?inviteLink: string, ?pinnedMessage: Message, ?permissions: ChatPermissions, ?canSendGift: bool, ?canSendPaidMedia: bool, ?slowModeDelay: int64, ?messageAutoDeleteTime: int64, ?joinToSendMessages: bool, ?hasAggressiveAntiSpamEnabled: bool, ?hasHiddenMembers: bool, ?hasProtectedContent: bool, ?hasVisibleHistory: bool, ?stickerSetName: string, ?canSetStickerSet: bool, ?customEmojiStickerSetName: string, ?unrestrictBoostCount: int64, ?hasRestrictedVoiceAndVideoMessages: bool, ?bio: string, ?linkedChatId: int64, ?title: string, ?username: string, ?firstName: string, ?lastName: string, ?isForum: bool, ?photo: ChatPhoto, ?activeUsernames: string[], ?birthdate: Birthdate, ?hasPrivateForwards: bool, ?businessIntro: BusinessIntro, ?businessOpeningHours: BusinessOpeningHours, ?personalChat: Chat, ?availableReactions: ReactionType[], ?backgroundCustomEmojiId: string, ?profileAccentColorId: int64, ?profileBackgroundCustomEmojiId: string, ?emojiStatusCustomEmojiId: string, ?emojiStatusExpirationDate: int64, ?businessLocation: BusinessLocation, ?location: ChatLocation) = { Id = id Type = ``type`` AccentColorId = accentColorId MaxReactionCount = maxReactionCount - JoinToSendMessages = joinToSendMessages JoinByRequest = joinByRequest Description = description InviteLink = inviteLink PinnedMessage = pinnedMessage Permissions = permissions + CanSendGift = canSendGift CanSendPaidMedia = canSendPaidMedia SlowModeDelay = slowModeDelay MessageAutoDeleteTime = messageAutoDeleteTime - HasRestrictedVoiceAndVideoMessages = hasRestrictedVoiceAndVideoMessages + JoinToSendMessages = joinToSendMessages HasAggressiveAntiSpamEnabled = hasAggressiveAntiSpamEnabled HasHiddenMembers = hasHiddenMembers HasProtectedContent = hasProtectedContent @@ -480,8 +483,8 @@ and [] ChatFullInfo = CanSetStickerSet = canSetStickerSet CustomEmojiStickerSetName = customEmojiStickerSetName UnrestrictBoostCount = unrestrictBoostCount - HasPrivateForwards = hasPrivateForwards - EmojiStatusExpirationDate = emojiStatusExpirationDate + HasRestrictedVoiceAndVideoMessages = hasRestrictedVoiceAndVideoMessages + Bio = bio LinkedChatId = linkedChatId Title = title Username = username @@ -491,8 +494,8 @@ and [] ChatFullInfo = Photo = photo ActiveUsernames = activeUsernames Birthdate = birthdate + HasPrivateForwards = hasPrivateForwards BusinessIntro = businessIntro - BusinessLocation = businessLocation BusinessOpeningHours = businessOpeningHours PersonalChat = personalChat AvailableReactions = availableReactions @@ -500,7 +503,8 @@ and [] ChatFullInfo = ProfileAccentColorId = profileAccentColorId ProfileBackgroundCustomEmojiId = profileBackgroundCustomEmojiId EmojiStatusCustomEmojiId = emojiStatusCustomEmojiId - Bio = bio + EmojiStatusExpirationDate = emojiStatusExpirationDate + BusinessLocation = businessLocation Location = location } @@ -1373,6 +1377,12 @@ and [] Video = /// Video thumbnail [] Thumbnail: PhotoSize option + /// Available sizes of the cover of the video in the message + [] + Cover: PhotoSize[] option + /// Timestamp in seconds from which the video will play in the message + [] + StartTimestamp: int64 option /// Original filename as defined by the sender [] FileName: string option @@ -1383,7 +1393,7 @@ and [] Video = [] FileSize: int64 option } - static member Create(fileId: string, fileUniqueId: string, width: int64, height: int64, duration: int64, ?thumbnail: PhotoSize, ?fileName: string, ?mimeType: string, ?fileSize: int64) = + static member Create(fileId: string, fileUniqueId: string, width: int64, height: int64, duration: int64, ?thumbnail: PhotoSize, ?cover: PhotoSize[], ?startTimestamp: int64, ?fileName: string, ?mimeType: string, ?fileSize: int64) = { FileId = fileId FileUniqueId = fileUniqueId @@ -1391,6 +1401,8 @@ and [] Video = Height = height Duration = duration Thumbnail = thumbnail + Cover = cover + StartTimestamp = startTimestamp FileName = fileName MimeType = mimeType FileSize = fileSize @@ -4078,7 +4090,13 @@ and [] InputMediaVideo = Media: InputFile /// Thumbnail of the file sent; can be ignored if thumbnail generation for the file is supported server-side. The thumbnail should be in JPEG format and less than 200 kB in size. A thumbnail's width and height should not exceed 320. Ignored if the file is not uploaded using multipart/form-data. Thumbnails can't be reused and can be only uploaded as a new file, so you can pass “attach://” if the thumbnail was uploaded using multipart/form-data under . More information on Sending Files » [] - Thumbnail: InputFile option + Thumbnail: string option + /// Cover for the video in the message. Pass a file_id to send a file that exists on the Telegram servers (recommended), pass an HTTP URL for Telegram to get a file from the Internet, or pass “attach://” to upload a new one using multipart/form-data under name. More information on Sending Files » + [] + Cover: string option + /// Start timestamp for the video in the message + [] + StartTimestamp: int64 option /// Caption of the video to be sent, 0-1024 characters after entities parsing [] Caption: string option @@ -4107,11 +4125,13 @@ and [] InputMediaVideo = [] HasSpoiler: bool option } - static member Create(``type``: string, media: InputFile, ?thumbnail: InputFile, ?caption: string, ?parseMode: ParseMode, ?captionEntities: MessageEntity[], ?showCaptionAboveMedia: bool, ?width: int64, ?height: int64, ?duration: int64, ?supportsStreaming: bool, ?hasSpoiler: bool) = + static member Create(``type``: string, media: InputFile, ?thumbnail: string, ?cover: string, ?startTimestamp: int64, ?caption: string, ?parseMode: ParseMode, ?captionEntities: MessageEntity[], ?showCaptionAboveMedia: bool, ?width: int64, ?height: int64, ?duration: int64, ?supportsStreaming: bool, ?hasSpoiler: bool) = { Type = ``type`` Media = media Thumbnail = thumbnail + Cover = cover + StartTimestamp = startTimestamp Caption = caption ParseMode = parseMode CaptionEntities = captionEntities @@ -4134,7 +4154,7 @@ and [] InputMediaAnimation = Media: InputFile /// Thumbnail of the file sent; can be ignored if thumbnail generation for the file is supported server-side. The thumbnail should be in JPEG format and less than 200 kB in size. A thumbnail's width and height should not exceed 320. Ignored if the file is not uploaded using multipart/form-data. Thumbnails can't be reused and can be only uploaded as a new file, so you can pass “attach://” if the thumbnail was uploaded using multipart/form-data under . More information on Sending Files » [] - Thumbnail: InputFile option + Thumbnail: string option /// Caption of the animation to be sent, 0-1024 characters after entities parsing [] Caption: string option @@ -4160,7 +4180,7 @@ and [] InputMediaAnimation = [] HasSpoiler: bool option } - static member Create(``type``: string, media: InputFile, ?thumbnail: InputFile, ?caption: string, ?parseMode: ParseMode, ?captionEntities: MessageEntity[], ?showCaptionAboveMedia: bool, ?width: int64, ?height: int64, ?duration: int64, ?hasSpoiler: bool) = + static member Create(``type``: string, media: InputFile, ?thumbnail: string, ?caption: string, ?parseMode: ParseMode, ?captionEntities: MessageEntity[], ?showCaptionAboveMedia: bool, ?width: int64, ?height: int64, ?duration: int64, ?hasSpoiler: bool) = { Type = ``type`` Media = media @@ -4186,7 +4206,7 @@ and [] InputMediaAudio = Media: InputFile /// Thumbnail of the file sent; can be ignored if thumbnail generation for the file is supported server-side. The thumbnail should be in JPEG format and less than 200 kB in size. A thumbnail's width and height should not exceed 320. Ignored if the file is not uploaded using multipart/form-data. Thumbnails can't be reused and can be only uploaded as a new file, so you can pass “attach://” if the thumbnail was uploaded using multipart/form-data under . More information on Sending Files » [] - Thumbnail: InputFile option + Thumbnail: string option /// Caption of the audio to be sent, 0-1024 characters after entities parsing [] Caption: string option @@ -4206,7 +4226,7 @@ and [] InputMediaAudio = [] Title: string option } - static member Create(``type``: string, media: InputFile, ?thumbnail: InputFile, ?caption: string, ?parseMode: ParseMode, ?captionEntities: MessageEntity[], ?duration: int64, ?performer: string, ?title: string) = + static member Create(``type``: string, media: InputFile, ?thumbnail: string, ?caption: string, ?parseMode: ParseMode, ?captionEntities: MessageEntity[], ?duration: int64, ?performer: string, ?title: string) = { Type = ``type`` Media = media @@ -4230,7 +4250,7 @@ and [] InputMediaDocument = Media: InputFile /// Thumbnail of the file sent; can be ignored if thumbnail generation for the file is supported server-side. The thumbnail should be in JPEG format and less than 200 kB in size. A thumbnail's width and height should not exceed 320. Ignored if the file is not uploaded using multipart/form-data. Thumbnails can't be reused and can be only uploaded as a new file, so you can pass “attach://” if the thumbnail was uploaded using multipart/form-data under . More information on Sending Files » [] - Thumbnail: InputFile option + Thumbnail: string option /// Caption of the document to be sent, 0-1024 characters after entities parsing [] Caption: string option @@ -4244,7 +4264,7 @@ and [] InputMediaDocument = [] DisableContentTypeDetection: bool option } - static member Create(``type``: string, media: InputFile, ?thumbnail: InputFile, ?caption: string, ?parseMode: ParseMode, ?captionEntities: MessageEntity[], ?disableContentTypeDetection: bool) = + static member Create(``type``: string, media: InputFile, ?thumbnail: string, ?caption: string, ?parseMode: ParseMode, ?captionEntities: MessageEntity[], ?disableContentTypeDetection: bool) = { Type = ``type`` Media = media @@ -4287,7 +4307,13 @@ and [] InputPaidMediaVideo = Media: InputFile /// Thumbnail of the file sent; can be ignored if thumbnail generation for the file is supported server-side. The thumbnail should be in JPEG format and less than 200 kB in size. A thumbnail's width and height should not exceed 320. Ignored if the file is not uploaded using multipart/form-data. Thumbnails can't be reused and can be only uploaded as a new file, so you can pass “attach://” if the thumbnail was uploaded using multipart/form-data under . More information on Sending Files » [] - Thumbnail: InputFile option + Thumbnail: string option + /// Cover for the video in the message. Pass a file_id to send a file that exists on the Telegram servers (recommended), pass an HTTP URL for Telegram to get a file from the Internet, or pass “attach://” to upload a new one using multipart/form-data under name. More information on Sending Files » + [] + Cover: string option + /// Start timestamp for the video in the message + [] + StartTimestamp: int64 option /// Video width [] Width: int64 option @@ -4301,11 +4327,13 @@ and [] InputPaidMediaVideo = [] SupportsStreaming: bool option } - static member Create(``type``: string, media: InputFile, ?thumbnail: InputFile, ?width: int64, ?height: int64, ?duration: int64, ?supportsStreaming: bool) = + static member Create(``type``: string, media: InputFile, ?thumbnail: string, ?cover: string, ?startTimestamp: int64, ?width: int64, ?height: int64, ?duration: int64, ?supportsStreaming: bool) = { Type = ``type`` Media = media Thumbnail = thumbnail + Cover = cover + StartTimestamp = startTimestamp Width = width Height = height Duration = duration @@ -6261,6 +6289,7 @@ and [] AffiliateInfo = /// This object describes the source of a transaction, or its recipient for outgoing transactions. Currently, it can be one of and TransactionPartner = | User of TransactionPartnerUser + | Chat of TransactionPartnerChat | AffiliateProgram of TransactionPartnerAffiliateProgram | Fragment of TransactionPartnerFragment | TelegramAds of TransactionPartnerTelegramAds @@ -6307,6 +6336,26 @@ and [] TransactionPartnerUser = Gift = gift } +/// Describes a transaction with a chat. +and [] TransactionPartnerChat = + { + /// Type of the transaction partner, always “chat” + [] + Type: string + /// Information about the chat + [] + Chat: Chat + /// The gift sent to the chat by the bot + [] + Gift: Gift option + } + static member Create(``type``: string, chat: Chat, ?gift: Gift) = + { + Type = ``type`` + Chat = chat + Gift = gift + } + /// Describes the affiliate program that issued the affiliate commission received via this transaction. and [] TransactionPartnerAffiliateProgram = { diff --git a/src/Funogram.Tests/Constants.fs b/src/Funogram.Tests/Constants.fs index 141dd81..d5463b9 100644 --- a/src/Funogram.Tests/Constants.fs +++ b/src/Funogram.Tests/Constants.fs @@ -68,6 +68,7 @@ module Constants = MessageId = 10L DisableNotification = None ProtectContent = None + VideoStartTimestamp = None }: Req.ForwardMessage) :> IBotRequest let jsonForwardMessageReq = """{"chat_id":"Dolfik","from_chat_id":10,"message_id":10}"""