forked from ricardoelices/TGBotLazarus
-
Couldn't load subscription status.
- Fork 18
Home
Renat Suleymanov edited this page Mar 26, 2025
·
11 revisions
fp-telegram is a framework for creating Telegram bots using FreePascal/Lazarus. It provides a convenient API for working with the Telegram Bot API, allowing developers to create bots quickly and efficiently.
- Sending and receiving messages
- Handling commands and inline buttons
- Working with attachments (photos, videos, files)
- Support for both webhook and long polling
- Easy integration with other modules
See the Installation Guide.
A simple bot example:
program QuickStart;
{$mode objfpc}{$H+}
uses
{$IFDEF UNIX}
cthreads,
{$ENDIF}
Classes, fptelegram, SysUtils, tgsendertypes;
const
{ You will receive a token when you create your bot using @BotFather.
See the section: Creating a Telegram bot in Lazarus (Longpolling) (Guides & Tutorials)}
BOT_TOKEN = 'YOUR_TOKEN';
CHAT_ID = 123456789; // Replace it with the real recipient's chat_id
var
Reply: String;
begin
if TgBotSendMessage(BOT_TOKEN, CHAT_ID, 'Hello from fp-telegram!', Reply) then
WriteLn('Message sent successfully')
else
WriteLn('Error sending message: ', Reply);
end.