From 9a1247832acc441869cc57d3b895e3e070a9c4d6 Mon Sep 17 00:00:00 2001 From: Renat Suleymanov Date: Wed, 29 Apr 2020 18:50:47 +0400 Subject: [PATCH] Forward fields for message telegram object --- examples/LongPollingDesktop/LongPollingDesktop.lpi | 6 ++++++ fp-telegram.json | 14 +++++++------- fptelegram.lpk | 2 +- tgsendertypes.pas | 4 ++-- tgtypes.pas | 9 +++++++++ 5 files changed, 25 insertions(+), 10 deletions(-) diff --git a/examples/LongPollingDesktop/LongPollingDesktop.lpi b/examples/LongPollingDesktop/LongPollingDesktop.lpi index 32fac0d..3e68c0c 100644 --- a/examples/LongPollingDesktop/LongPollingDesktop.lpi +++ b/examples/LongPollingDesktop/LongPollingDesktop.lpi @@ -84,6 +84,9 @@ + + + @@ -141,6 +144,9 @@ + + + diff --git a/fp-telegram.json b/fp-telegram.json index 295dde9..9438dbf 100644 --- a/fp-telegram.json +++ b/fp-telegram.json @@ -5,9 +5,9 @@ "Category" : "Networking, Other", "CommunityDescription" : "Telegram bots API wrapper for freepascal", "RepositoryFileName" : "fp-telegram.zip", - "RepositoryFileSize" : 436906, - "RepositoryFileHash" : "54f1fe3f9e151dd3721d2442bb3a460a", - "RepositoryDate" : 4.3874736219849539E+004, + "RepositoryFileSize" : 507146, + "RepositoryFileHash" : "884b5957ace91ded16b5a90a84cebc09", + "RepositoryDate" : 4.3950783826064813E+004, "PackageBaseDir" : "fp-telegram\\/", "HomePageURL" : "https://github.com/Al-Muhandis/fp-telegram", "DownloadURL" : "https://raw.githubusercontent.com/Al-Muhandis/fp-telegram/master/update_FpTelegram.json", @@ -20,10 +20,10 @@ "Author" : "Al-muhandis (Renat Suleymanov)", "License" : "MIT License", "RelativeFilePath" : "", - "VersionAsString" : "0.0.0.18", - "LazCompatibility" : "1.8.5, 2.0.0, 2.0.2, 2.0.4, 2.0.6, Trunk", - "FPCCompatibility" : "3.0.0, 3.0.2, 3.0.4, 3.2.0, Trunk", - "SupportedWidgetSet" : "gtk2, win32/win64", + "VersionAsString" : "0.0.0.21", + "LazCompatibility" : "1.6, 1.8, 2.0, Trunk", + "FPCCompatibility" : "2.6.4, 3.0.0, 3.0.2, 3.0.4", + "SupportedWidgetSet" : "win32/64, gtk2, carbon", "PackageType" : 3, "DependenciesAsString" : "FCL" } diff --git a/fptelegram.lpk b/fptelegram.lpk index 7fa7257..eb6dd85 100644 --- a/fptelegram.lpk +++ b/fptelegram.lpk @@ -24,7 +24,7 @@ - + diff --git a/tgsendertypes.pas b/tgsendertypes.pas index 4c2b4db..fb8a4a5 100644 --- a/tgsendertypes.pas +++ b/tgsendertypes.pas @@ -1981,11 +1981,11 @@ procedure TTelegramSender.DoReceiveUpdate(AnUpdate: TTelegramUpdateObj); case AnUpdate.UpdateType of utMessage: DoReceiveMessageUpdate(AnUpdate.Message); utEditedMessage: DoReceiveEditedMessage(AnUpdate.EditedMessage); - utCallbackQuery: DoReceiveCallbackQuery(AnUpdate.CallbackQuery); utChannelPost: DoReceiveChannelPost(AnUpdate.ChannelPost); utEditedChannelPost: DoReceiveEditedChannelPost(AnUpdate.EditedChannelPost); - utInlineQuery: DoReceiveInlineQuery(AnUpdate.InlineQuery); + utInlineQuery: DoReceiveInlineQuery(AnUpdate.InlineQuery); utChosenInlineResult: DoReceiveChosenInlineResult(AnUpdate.ChosenInlineResult); + utCallbackQuery: DoReceiveCallbackQuery(AnUpdate.CallbackQuery); utPreCheckoutQuery: DoReceivePreCheckoutQuery(AnUpdate.PreCheckoutQuery); end; if Assigned(FUpdateLogger) then diff --git a/tgtypes.pas b/tgtypes.pas index ed3bb39..c51c7b9 100644 --- a/tgtypes.pas +++ b/tgtypes.pas @@ -88,6 +88,9 @@ TTelegramMessageObj = class(TTelegramObj) FCaption: String; FChat: TTelegramChatObj; FDocument: TTelegramDocument; + FForwardFrom: TTelegramUserObj; + FForwardFromChat: TTelegramChatObj; + FForwardFromMessageID: LongInt; FFrom: TTelegramUserObj; FLocation: TTelegramLocation; fMessageId: Integer; @@ -944,6 +947,10 @@ constructor TTelegramMessageObj.Create(JSONObject: TJSONObject); FAudio := TTelegramAudio.CreateFromJSONObject(fJSON.Find('audio', jtObject) as TJSONObject) as TTelegramAudio; FVoice := TTelegramVoice.CreateFromJSONObject(fJSON.Find('voice', jtObject) as TJSONObject) as TTelegramVoice; + FForwardFrom:=TTelegramUserObj.CreateFromJSONObject(fJSON.Find('forward_from', jtObject) as TJSONObject) as TTelegramUserObj; + FForwardFromChat:=TTelegramChatObj.CreateFromJSONObject(fJSON.Find('forward_from_chat', jtObject) as TJSONObject) as TTelegramChatObj; + FForwardFromMessageID:=fJSON.Integers['forward_from_message_id']; + FLocation:=TTelegramLocation.CreateFromJSONObject(fJSON.Find('location', jtObject) as TJSONObject) as TTelegramLocation; FReplyToMessage:= @@ -968,6 +975,8 @@ constructor TTelegramMessageObj.Create(JSONObject: TJSONObject); destructor TTelegramMessageObj.Destroy; begin + FForwardFrom.Free; + FForwardFromChat.Free; FSuccessfulPayment.Free; FFrom.Free; FLocation.Free;