Lazarus

Announcements => Third party => Topic started by: Renat.Su on November 15, 2017, 11:32:10 am

Title: Telegram bots API Wrapper
Post by: Renat.Su on November 15, 2017, 11:32:10 am
I'm writing a class to work with telegram API as plugin to BrookFramework (https://github.com/silvioprog/brookframework).
https://github.com/Al-Muhandis/brook-telegram
There is also depends from library fp-telegram (https://github.com/Al-Muhandis/fp-telegram) that I am also actively developing now. The library functionality is still small, but it is working. In the examples (https://github.com/Al-Muhandis/brook-telegram/tree/master/example) folder you can find a working example of a Fast-cgi application HelloWorld. For those who have any online service or website, developed on the Brookframework then can add telegram bot TBrookAction to your website.
Please write if you find bugs, tips or want to join the development
Title: Re: Telegram plugin to brookframwork
Post by: Renat.Su on December 12, 2017, 12:56:30 pm
fp-telegram: Added Long Polling to receive updates in addition to Webhook that I already use. Not much testing, because for me it is more convenient only webhook.
But for those who do not want to bother with writing web applications a good option is writing a desktop [or console or service] application to work with the Telegram Bot API. In this case, you can get updates with long polling (even short polling for testing). [Personally, I do not like this method, the only useful application when you do not want or can not install a webhook]
/ EXAMPLES /: Added simple ready-made examples for showing how longpolling works. A multithreaded version and example quite simple without threads (see getMe) https://github.com/Al-Muhandis/fp-telegram/tree/master/examples
brook-telegram: adapted the library to work with brookframework 3.9.9 ...
Also I hope that someone will join the project;)
Title: Re: Telegram bots API Wrapper
Post by: Renat.Su on February 27, 2018, 11:35:32 am
Work on the library continues.
Recent changes: inline mode

Done:
    Todo:I need recommendations and advice from more experienced programmers on the hierarchy of classes, adding methods for interfaces to work through other libraries, examples of implementing webhooks, for example, through built-in FCL classes for web servers (for brookframework already exist, as well as adaptation to BF4).
Title: Re: Telegram bots API Wrapper
Post by: bonmario on June 29, 2018, 07:30:40 pm
Hi, referring to this thread http://forum.lazarus.freepascal.org/index.php/topic,41716.0/topicseen.html i am the author of the last post in the italian forum.
What's wrong in my code?

Thanks in advance, Mario
Title: Re: Telegram bots API Wrapper
Post by: Renat.Su on June 30, 2018, 08:24:42 pm
Hi.
So
To begin with, I will describe what the code you provided does. Performs a getMe request to the telegram server. As a result, we get some data on the bot (for example, its name). Further, in the case of a positive response, the program in the long polling mode waits for any event (getUpdates). This can be a message sent to the bot by the user or any other event that can be sent by the telegram server to the bot. The bot waits for an update depending on the TimeOut parameter in the procedure. If the update comes, then apparently You do not have processing. Just move on to the next operation. As in case it doesn't wait.
Then the bot sends the message "/start". Why and who? Instead, commands are sent by users to the bot, not the other way around. The CurrentChatID property is useful inside event processing, for example, as a response to a user's message (for example, the same command) and this property will store the ChatID In which the message was sent to the bot. It is logical that the bot will send a response in the same chat to the user.
Perhaps, if there was some update of the bot in the form of a message from the user, the program will send a message to this user, although there is a lot depends on other factors.
In General, the behavior of the algorithm is difficult to predict. So if you formulate Your task, what you want to do I would suggest you the options of using this bot
Title: Re: Telegram bots API Wrapper
Post by: bonmario on July 01, 2018, 07:58:10 am
Hello,
I subscribed the bot to a group.
I just want to make sure that when I send a message to the bot from my program, the same message is sent to the group.

Hi Mario
Title: Re: Telegram bots API Wrapper
Post by: Renat.Su on July 01, 2018, 08:10:15 pm
If I understand you correctly, it's just an example with getMe. In fact, you need to send (redirect) messages to a group on behalf of the bot.
For this, for example, we could use the OnReceiveMessage event. Regardless of how we will use the getting update mode: webhook or long polling.
Code: Pascal  [Select][+][-]
  1. procedure TYourBot.BotReceiveMessage(ASender: TObject; AMessage: TTelegramMessageObj);
  2. var
  3.   AGroupChatID: Int64;
  4. begin
  5.   AGroupChatID := xxxxxxxx; // Your group chat ID
  6. { It must to include the sender's userID checks. On good to override function IsSimpleUser or simply to check if CurrentChatID = xxxx where xxxx is your userID }
  7.   if AMessage.Text<>EmptyStr then
  8.     sendMessage(AGroupChatID, AMessage.Text);
  9. end;
The rest of the code depends on which method of obtaining the update you selected.
If Webhook, then you need to teach the program how the server to receive and process the request from the telegram. As an example, you can see the implementation of the bot as part of the brook-framework (you can use other libraries or the native fcl-web)
If long polling, then you can see an example implementation of LongPollingDesktop.
I hope I missed important moments. If something does not work or it is not clear, write again
Title: Re: Telegram bots API Wrapper
Post by: bonmario on July 03, 2018, 04:29:40 pm
Ok.
Thanks, Mario
Title: Re: Telegram bots API Wrapper
Post by: bonmario on July 04, 2018, 11:45:17 am
Hello,
I did a bit of testing, but I still could not make a working program.

Is it possible to have a source such as sending only a message to the bot?

Thanks in advance, Mario
Title: Re: Telegram bots API Wrapper
Post by: Renat.Su on July 05, 2018, 03:39:13 pm
Hello,
I did a bit of testing, but I still could not make a working program.

Is it possible to have a source such as sending only a message to the bot?

Thanks in advance, Mario
In the previous code is sending only a message, just this is done in the onreceivemessage method. I can show a more extensive piece of code, if you explain what exactly you need and I can put in the examples folder in lib
Title: Re: Telegram bots API Wrapper
Post by: bonmario on July 06, 2018, 07:48:36 am
Hello, I would need only a sample program that sends a message to the bot. I tried to use the code you posted, but I probably did not understand how to use it, since it does not work.

Thanks, Mario
Title: Re: Telegram bots API Wrapper
Post by: Renat.Su on July 06, 2018, 05:49:34 pm
Ok. I'll try to do a sample code/program the other day.
Title: Re: Telegram bots API Wrapper
Post by: bonmario on July 06, 2018, 07:27:47 pm
Thanks
Title: Re: Telegram bots API Wrapper
Post by: Renat.Su on July 11, 2018, 12:59:56 pm
Added an example of the simplest console application (https://github.com/Al-Muhandis/fp-telegram/tree/master/examples/SimpleSendMessage) that only sends a message from the bot. The program does not have the functionality to receive updates
Title: Re: Telegram bots API Wrapper
Post by: Renat.Su on July 11, 2018, 01:03:01 pm
Please note, the bot cannot send a message to users who have not sent the /start command before. This is a limitation of the Telegram itself. However, a bot can send messages to a group if it is a member
Title: Re: Telegram bots API Wrapper
Post by: bonmario on July 11, 2018, 05:14:57 pm
Ok, thanks, Mario
Title: Re: Telegram bots API Wrapper
Post by: Renat.Su on July 11, 2018, 08:37:00 pm
I hope I understood you correctly and that's what you needed
Title: Re: Telegram bots API Wrapper
Post by: bonmario on July 12, 2018, 08:59:11 am
Yes, thank you, I will do some tests in the next days.

Thanks, Mario
Title: Re: Telegram bots API Wrapper
Post by: Renat.Su on December 08, 2018, 03:50:09 pm
Added some tests (https://github.com/Al-Muhandis/fp-telegram/tree/master/test).
Added a simple procedural type to send a message via the bot (without creating a class).
 
Code: Pascal  [Select][+][-]
  1. { Procedure style method to send message from Bot to chat/user }
  2. function TgBotSendMessage(const AToken: String; chat_id: Int64; const AMessage: String;
  3.   out AReply: String;
  4.   ParseMode: TParseMode = pmDefault; DisableWebPagePreview: Boolean=False;
  5.   AReplyMarkup: TReplyMarkup = nil; ReplyToMessageID: Integer = 0): Boolean;
Brook-telegram added functions for calculating statistics for the day (events and unique users)
Title: Re: Telegram bots API Wrapper
Post by: Renat.Su on December 15, 2018, 09:16:09 am
SSH emulator via telegram
Anyone interested to manage a remote computer (a web server, a regular computer with access to the Internet) via telegrams, made a working example of the program source code https://github.com/Al-Muhandis/ShellRemoteBot
Actively tested on Linux (Debian), but should work on Windows. Instead of webhooks, longpolling is used to get updates from server telegrams, respectively, the program can work not only on a web server, but also on any home computer.
It is convenient to manage a web server via telegram in the phone.
The program can run as a console program that runs manually and as a service/daemon
Title: Re: Telegram bots API Wrapper
Post by: Renat.Su on December 15, 2018, 09:17:21 am
Visually it looks like this
Title: Re: Telegram bots API Wrapper
Post by: Renat.Su on March 18, 2019, 07:46:41 pm
1. Refactoring LongPollingDesktop example (https://github.com/Al-Muhandis/fp-telegram/tree/master/examples/LongPollingDesktop) & other examples restructuring
2. Added some procedures for API
3. Payments API methods and implementations
4. Other fixes and improvements
Title: Re: Telegram bots API Wrapper
Post by: bonmario on March 19, 2019, 08:01:48 am
Great job.

Thanks, Mario
Title: Re: Telegram bots API Wrapper
Post by: bonmario on August 08, 2019, 02:29:22 pm
Hi,
cause of the problem reported here: https://forum.lazarus.freepascal.org/index.php/topic,39206.msg318360.html#msg318360 this component had problems on my Ubuntu 19.04.

I have solved with some simple modify on "tgsendertypes":
added at uses
Code: Pascal  [Select][+][-]
  1. sslsockets, fpopenssl, ssockets

Modified "HTTPPostJSON":
Code: Pascal  [Select][+][-]
  1. function TTelegramSender.HTTPPostJSON(const Method: String): Boolean;
  2. var
  3.   HTTP: TFPHTTPClient;
  4. begin
  5.   HTTP:=TFPHTTPClient.Create(nil);
  6.   try
  7.     HTTP.RequestBody:=TStringStream.Create(FRequestBody);
  8.     try
  9.       HTTP.AddHeader('Content-Type','application/json');
  10.       HTTP.OnGetSocketHandler:=@HttpClientGetSocketHandler;    <<<<<< added this line
  11.       FResponse:=HTTP.Post(FAPIEndPoint+FToken+'/'+Method);
  12.     finally
  13.       HTTP.RequestBody.Free;
  14.     end;
  15.     Result:=True;
  16.     DebugMessage('Response: '+FResponse);
  17.   except
  18.     Result:=False;
  19.     ErrorMessage('It is not succesful request to API! Request body: '+FRequestBody);
  20.   end;
  21.   HTTP.Free;
  22. end;
  23.  


Added the procedure:
Code: Pascal  [Select][+][-]
  1. procedure TTelegramSender.HttpClientGetSocketHandler(Sender: TObject;
  2.   const UseSSL: Boolean; out AHandler: TSocketHandler);
  3. begin
  4.   {$IFDEF LINUX}
  5.     if UseSSL then begin
  6.       AHandler:=TSSLSocketHandler.Create;
  7.       TSSLSocketHandler(AHandler).SSLType:=stTLSv1_1;  // <--
  8.     end;
  9.   {$ENDIF}
  10. end;
  11.  

With these modifies, all works fine again.

Can you made these modifies on your beautiful component?

Thanks in advance, Mario
Title: Re: Telegram bots API Wrapper
Post by: Renat.Su on August 09, 2019, 10:39:14 am
Thank You very much! I will. Or You can (if You exists on github) to make pull request to lib and could accept this
Title: Re: Telegram bots API Wrapper
Post by: bonmario on August 09, 2019, 12:21:19 pm
Sorry, i haven't an account on github

Hi, Mario
Title: Re: Telegram bots API Wrapper
Post by: Renat.Su on August 09, 2019, 02:20:14 pm
Done! Thanks for the commit
Title: Re: Telegram bots API Wrapper
Post by: bonmario on August 09, 2019, 05:42:42 pm
Thanks !
Title: Re: Telegram bots API Wrapper
Post by: jdp on August 25, 2019, 10:26:28 pm
Hi. The package does not compile on Raspberry Pi.

I get this error.

tgsendertypes.pas(1746,45) Error: Identifier not found "stTLSv1_1"

Regards
Title: Re: Telegram bots API Wrapper
Post by: bonmario on August 27, 2019, 09:23:29 am
tgsendertypes.pas(1746,45) Error: Identifier not found "stTLSv1_1"

Wich version of FPC?
On fpc 3.0.4, stTLSv1_1 is declared in "....... / fpc / 3.0.4 / source / packages / openssl / src / fpopenssl.pp"


Hi, Mario
Title: Re: Telegram bots API Wrapper
Post by: Renat.Su on August 28, 2019, 08:56:36 am


Quote
Hi, If I comment it out it compiles and runs but when it runs I get SSL errors.

I tried the project on Windows and there it works 100%. I then tried it on The Raspbarian Desktop in a virtual machine. There I get the same error that the variable does not exist.

I then tried it on Debian Desktop. There it compiles but I get SSL error also.

On Raspberry Pi I use it on Raspbian Buster (Debian 10) and FPC is 3.3.1 and Lazarus is 2.0.1
Can You help us?
Title: Re: Telegram bots API Wrapper
Post by: Renat.Su on August 28, 2019, 09:53:01 am
I think that last commit (with OpenSSL in uses clause) is invalid for trunk FPC. Unit fpopenssl has many changes in trunk version of freepascal
Title: Re: Telegram bots API Wrapper
Post by: Thaddy on August 28, 2019, 10:58:54 am
I think that last commit (with OpenSSL in uses clause) is invalid for trunk FPC. Unit fpopenssl has many changes in trunk version of freepascal
Well not too many: the only thing that is  affected is the protocol defaults. Must be tls 1.1 or higher.
I suppose telegram adheres to this too.
Title: Re: Telegram bots API Wrapper
Post by: Renat.Su on August 28, 2019, 01:09:37 pm
I think that last commit (with OpenSSL in uses clause) is invalid for trunk FPC. Unit fpopenssl has many changes in trunk version of freepascal
Well not too many: the only thing that is  affected is the protocol defaults. Must be tls 1.1 or higher.
I suppose telegram adheres to this too.
Earlier it works without explicitly specifying of SSL type, and did not even need to specify fpopenssl unit in the uses block. As I understand works without this and OS itself defines that use. Maybe I'm wrong. Then one of the users of the library reported that the new Ubuntu 1.9 did not works with lib (SSL problem) and offered a commit https://github.com/Al-Muhandis/fp-telegram/commit/fafbe6dc7fd86756208ee17f1c87567da9a90165 with an explicit specifying of a secure connection
Title: Re: Telegram bots API Wrapper
Post by: Renat.Su on February 06, 2020, 02:53:31 pm
Very important and very small commit: change TLS version (https://github.com/Al-Muhandis/fp-telegram/commit/f3cc8bdd4c40d146f7d43483f79d088bcc047586) for HTTPS request to telegram endpoint. TLSv1_1 is not supported now by telegram server.
Other news: I want to abstract HTTP client lib from the fp-telegram library so that you can connect different HTTP libraries in addition to native ones (Synapse, indy etc)
Title: Re: Telegram bots API Wrapper
Post by: Thaddy on February 06, 2020, 03:26:24 pm
regarding flqueue (and possibly other places):

You can do this and remove all ifdef's regarding the 32/64 cpu tests.
Code: Pascal  [Select][+][-]
  1. {$mode objfpc}
  2. {$macro on}{$if defined(CPU64)}
  3. {$define interlockedCompareExchange:=interlockedCompareExchange64}
  4. {$define interlockedIncrement:=interlockedIncrement64}
  5. {$ifend}

That is, unless you want to keep Delphi compatibility of course, but your code is mode objpas and not mode delphi anyway.
Title: Re: Telegram bots API Wrapper
Post by: Renat.Su on February 06, 2020, 05:18:27 pm
regarding flqueue (and possibly other places):

You can do this and remove all ifdef's regarding the 32/64 cpu tests.
Code: Pascal  [Select][+][-]
  1. {$mode objfpc}
  2. {$macro on}{$if defined(CPU64)}
  3. {$define interlockedCompareExchange:=interlockedCompareExchange64}
  4. {$define interlockedIncrement:=interlockedIncrement64}
  5. {$ifend}

That is, unless you want to keep Delphi compatibility of course, but your code is mode objpas and not mode delphi anyway.
THanks, But flqueue unit is not used anywhere in the library now. It remained because of backward compatibility. I will probably delete this unit in the following commits
Title: Re: Telegram bots API Wrapper
Post by: bonmario on February 06, 2020, 07:41:08 pm
Very important and very small commit: change TLS version (https://github.com/Al-Muhandis/fp-telegram/commit/f3cc8bdd4c40d146f7d43483f79d088bcc047586) for HTTPS request to telegram endpoint. TLSv1_1 is not supported now by telegram server.
Other news: I want to abstract HTTP client lib from the fp-telegram library so that you can connect different HTTP libraries in addition to native ones (Synapse, indy etc)

Thanks !!!

Hi, Mario
Title: Re: Telegram bots API Wrapper
Post by: Renat.Su on February 13, 2020, 08:12:09 am
So, I separated the HTTP client implementation from the lib. By default, the native FPHTTPClient broker will also be used, but it is a good idea to specify the broker explicitly:
Code: Pascal  [Select][+][-]
  1. Uses ... tgfclhttpcientbroker... ;
Additionally, there is a broker for the synapse library. In this case, instead of tgfclhttpclientbroker, you should add tgsynapseclientbroker to the uses block and of course add laz_synapse to the project dependencies (for example, from the Online Package Manager).
An important consequence and the main reason why I introduced the HTTP client broker system is that it is now possible to use an HTTPS proxy (the native client, unfortunately, does not support) with synapse client broker.
For these purposes, properties have been added to the TTelegramSender:
Code: Pascal  [Select][+][-]
  1.     property HTTPProxyUser: String read FHTTPProxyUser write FHTTPProxyUser;
  2.     property HTTPProxyPassword: String read FHTTPProxyPassword write FHTTPProxyPassword;
  3.     property HTTPProxyHost: String read FHTTPProxyHost write FHTTPProxyHost;
  4.     property HTTProxyPort: Word read FHTTProxyPort write FHTTProxyPort;  

Next, another very important note. There is a bug in laz_synapse that causes the https proxy not works in Linux OS. It is solved by a small hack in the synapse library https://forum.lazarus.freepascal.org/index.php/topic,43574.msg349074.html#msg349074
Title: Re: Telegram bots API Wrapper
Post by: Thaddy on February 13, 2020, 09:04:53 am
use an HTTPS proxy (the native client, unfortunately, does not support)
The trunk version does support it. It does not use new compiler features, so you may simply check out and use with 3.0.4.
Title: Re: Telegram bots API Wrapper
Post by: Renat.Su on February 13, 2020, 09:36:13 am
use an HTTPS proxy (the native client, unfortunately, does not support)
The trunk version does support it. It does not use new compiler features, so you may simply check out and use with 3.0.4.
Thanks, I'll recheck it
Title: Re: Telegram bots API Wrapper
Post by: Renat.Su on February 13, 2020, 01:49:18 pm
use an HTTPS proxy (the native client, unfortunately, does not support)
The trunk version does support it. It does not use new compiler features, so you may simply check out and use with 3.0.4.
No, FPHTTPClient with HTTP proxy to HTTPS url is not works, even in trunk version! You can check any case.
Please note, I meant HTTPS URL via HTTP proxy! This is the combination that doesn't work. Without HTTPS works (but almost all API endpoints and all sites are HTTPS only) or with HTTPS URL but without a proxy works (it was necessary to support HTTP proxy)
Title: Re: Telegram bots API Wrapper
Post by: bonmario on July 11, 2020, 06:44:51 pm
Hi,
today i have updated FPC to 3.2.0, on my Ubuntu 64 bit.

Compiling, i have this error:
Code: Pascal  [Select][+][-]
  1. fgl.pp(1152,5) Note: Call to subroutine "function TFPGObjectList<tgtypes.TTelegramPhotoSize>.Add(const Item:TTelegramPhotoSize):LongInt;" marked as inline is not inlined
  2. fgl.pp(1152,18) Note: Call to subroutine "function TFPGObjectList<tgtypes.TTelegramPhotoSize>.Get(Index:LongInt):TTelegramPhotoSize;" marked as inline is not inlined
  3. tgtypes.pas(571,19) Note: Call to subroutine "operator :=(const source:Variant):AnsiString;" marked as inline is not inlined
  4. tgtypes.pas(1036,7) Note: Call to subroutine "function TFPGObjectList<tgtypes.TTelegramMessageEntityObj>.Add(const Item:TTelegramMessageEntityObj):LongInt;" marked as inline is not inlined
  5. tgtypes.pas(1041,7) Note: Call to subroutine "function TFPGObjectList<tgtypes.TTelegramPhotoSize>.Add(const Item:TTelegramPhotoSize):LongInt;" marked as inline is not inlined
  6. tgfclhttpclientbroker.pas(79,44) Error: Identifier not found "stTLSv1_2"
  7.  

Source tgfclhttpclientbroker:
Code: Pascal  [Select][+][-]
  1. TSSLSocketHandler(AHandler).SSLType:=stTLSv1_2;  // <--

It'ìs a bug?

Thanks in advance, Mario


P.S. Seems that adding uses of "sslbase" solve the problem
Title: Re: Telegram bots API Wrapper
Post by: Renat.Su on July 11, 2020, 08:30:21 pm
I compile it in the trunk version and in 2.0.8.

I will check in 2.0.10 soon
Title: Re: Telegram bots API Wrapper
Post by: Renat.Su on July 12, 2020, 12:06:00 am
Hi,
today i have updated FPC to 3.2.0, on my Ubuntu 64 bit.

Compiling, i have this error:
Code: Pascal  [Select][+][-]
  1. fgl.pp(1152,5) Note: Call to subroutine "function TFPGObjectList<tgtypes.TTelegramPhotoSize>.Add(const Item:TTelegramPhotoSize):LongInt;" marked as inline is not inlined
  2. fgl.pp(1152,18) Note: Call to subroutine "function TFPGObjectList<tgtypes.TTelegramPhotoSize>.Get(Index:LongInt):TTelegramPhotoSize;" marked as inline is not inlined
  3. tgtypes.pas(571,19) Note: Call to subroutine "operator :=(const source:Variant):AnsiString;" marked as inline is not inlined
  4. tgtypes.pas(1036,7) Note: Call to subroutine "function TFPGObjectList<tgtypes.TTelegramMessageEntityObj>.Add(const Item:TTelegramMessageEntityObj):LongInt;" marked as inline is not inlined
  5. tgtypes.pas(1041,7) Note: Call to subroutine "function TFPGObjectList<tgtypes.TTelegramPhotoSize>.Add(const Item:TTelegramPhotoSize):LongInt;" marked as inline is not inlined
  6. tgfclhttpclientbroker.pas(79,44) Error: Identifier not found "stTLSv1_2"
  7.  

Source tgfclhttpclientbroker:
Code: Pascal  [Select][+][-]
  1. TSSLSocketHandler(AHandler).SSLType:=stTLSv1_2;  // <--

It'ìs a bug?

Thanks in advance, Mario


P.S. Seems that adding uses of "sslbase" solve the problem
Try last commit https://github.com/Al-Muhandis/fp-telegram
Title: Re: Telegram bots API Wrapper
Post by: bonmario on July 12, 2020, 08:08:01 am
Thank you !!!
Now the source is compiled, as soon as I have the case, I will try to see if the sending of the messages still works correctly.

Hi Mario
Title: Re: Telegram bots API Wrapper
Post by: Renat.Su on October 18, 2021, 10:18:06 pm
Added the library to OPM,
added methods sendVideoStream, sendPhotoStream, sendMediaGroup by FileNames and other improvements.
You can download the finished release in https://github.com/Al-Muhandis/fp-telegram/releases/tag/v0.0.2.5
Added a unit tgBot.pas for the extended functionality of the bot
Title: Re: Telegram bots API Wrapper
Post by: bonmario on October 19, 2021, 08:22:01 am
Thanks for your job.

Hi, Mario
Title: Re: Telegram bots API Wrapper
Post by: Renat.Su on October 19, 2021, 11:47:40 am
Thanks for your job.

Hi, Mario
Thanks!
Title: Re: Telegram bots API Wrapper
Post by: ELCouz on December 30, 2021, 07:09:03 pm
Thank you all for that sweet library. I was reinventing the wheel with Telegram. Your solution is much cleaner than mine :)
Title: Re: Telegram bots API Wrapper
Post by: Renat.Su on December 31, 2021, 07:43:21 pm
Thanks. Contact me if you have any questions
Title: Re: Telegram bots API Wrapper
Post by: Renat.Su on March 09, 2022, 03:02:37 pm
Minor fixes:
Title: Re: Telegram bots API Wrapper
Post by: Renat.Su on December 09, 2023, 05:18:43 pm
So, I made a design-time component.

DTLongPollBot is ready-made longpolling bot which you can use for the rapid developments of longpolling telegram bots. Look about longpolling here (https://github.com/Al-Muhandis/fp-telegram/wiki/How-to-step-by-step.-Creation-telegram-bot-in-Lazarus-(longpolling (https://github.com/Al-Muhandis/fp-telegram/wiki/How-to-step-by-step.-Creation-telegram-bot-in-Lazarus-(longpolling))). This component ca be used in GUI and non-GUI applications, daemons and services and even in web-server.

 In the DTLongPolBot component, thread control takes place inside the component and you do not have to worry about it: it will be enough to activate the receiver of this component.

Simple example: https://github.com/Al-Muhandis/fp-telegram/tree/master/examples/DesignTime (https://github.com/Al-Muhandis/fp-telegram/tree/master/examples/DesignTime)
TinyPortal © 2005-2018