Skip to content

Commit a328644

Browse files
committed
Merge branch 'release/3.5.3'
2 parents d2bcfe2 + bbbb552 commit a328644

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

42 files changed

+4081
-1705
lines changed

.gitmodules

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
1+
[submodule "Source/CrossUrl"]
2+
path = Source/CrossUrl
3+
url = https://github.com/ms301/CrossUrl.git

Delphinus.Info.json

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -5,14 +5,14 @@
55
"license_type": "Modified MIT License (MIT), GNU GPL v2",
66
"license_file": "LICENSE.txt",
77
"package_compiler_max": "0",
8-
"package_compiler_min": "29",
9-
"compiler_min": "29",
8+
"package_compiler_min": "27",
9+
"compiler_min": "27",
1010
"compiler_max": "0",
11-
"platforms": "Win32;Win64;OSX32",
11+
"platforms": "Win32;Win64;OSX32;Android;IOSDevice32;IOSDevice64;Linux64",
1212
"dependencies": [],
13-
"author": "M.E.Sysoev",
13+
"author": "Maxim Sysoev",
1414
"description": "Telegram Bot API for Delphi",
15-
"version": "3.5.1",
15+
"version": "3.5.3",
1616
"first_version": "2.3.1",
1717
"project_url": "https://github.com/ms301/TelegAPI",
1818
"homepage_url": "https://t.me/telegaPiBotTest",

Delphinus.Install.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@
33
[
44
{
55
"pathes": "Source",
6-
"platforms": "Win32;Win64;OSX32"
6+
"platforms": "Win32;Win64;OSX32;Android;IOSDevice32;IOSDevice64;Linux64"
77
}
88
],
99

Demo/Console/ConsoleBot.dpr

Lines changed: 40 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -1,26 +1,49 @@
1-
program ConsoleBot;
1+
program ConsoleBot;
22

33
{$APPTYPE CONSOLE}
44
{$R *.res}
55

6+
{/$DEFINE USE_INDY_CORE}
67
uses
7-
TelegAPI.Bot,
8+
{$IFDEF USE_INDY_CORE}
9+
//Indy Http Core
10+
CrossUrl.Indy.HttpClient,
11+
{$ELSE}
12+
// System.Net HTTP Core
13+
CrossUrl.SystemNet.HttpClient,
14+
{$ENDIF}
15+
816
Rest.Json,
9-
TelegAPI.Receiver.Console,
1017
System.SysUtils,
18+
TelegAPI.Receiver.Console,
19+
TelegAPI.Bot,
1120
TelegAPI.Types,
12-
TelegaPi.Exceptions,
13-
TelegaPi.Factory;
21+
TelegAPI.Bot.Impl,
22+
TelegAPI.Exceptions;
23+
24+
procedure SMG(ABot: ITelegramBot; AMessage: ITgMessage);
25+
var
26+
Test: TtgInputMediaPhoto;
27+
begin
28+
Test := TtgInputMediaPhoto.Create(TtgFileToSend.FromFile('D:\Repositories\Мои проекты\ms301-TelegAPI\Install\pJNqeRflXYU.png'),
29+
'Test');
30+
ABot.sendMediaGroup(AMessage.Chat.ID, [Test, Test])
31+
end;
1432

1533
procedure Main;
1634
var
1735
LBot: ITelegramBot;
18-
LRecesiver: TtgReceiverConsole;
36+
LReceiver: TtgReceiverConsole;
1937
LExcp: TtgExceptionManagerConsole;
2038
LStop: string;
2139
begin
22-
LBot := TtgFactory.CreateTelegram('283107814:AAGOGxUCwTC2bOs2krUSuEtqZd2UnA8NZ2g');
23-
LRecesiver := TtgReceiverConsole.Create(LBot);
40+
LBot := TTelegramBot.Create('YOUR_TOKEN',
41+
{$IFDEF USE_INDY_CORE}
42+
TcuHttpClientIndy.Create(nil)
43+
{$ELSE}
44+
TcuHttpClientSysNet.Create(nil)
45+
{$ENDIF});
46+
LReceiver := TtgReceiverConsole.Create(LBot);
2447
try
2548
LExcp := LBot.ExceptionManager as TtgExceptionManagerConsole;
2649
LExcp.OnApiException :=
@@ -33,35 +56,35 @@ begin
3356
begin
3457
Writeln(AExp.ToString);
3558
end;
36-
LRecesiver.OnStart :=
59+
LReceiver.OnStart :=
3760
procedure
3861
begin
3962
Writeln('started');
4063
end;
41-
LRecesiver.OnStop :=
64+
LReceiver.OnStop :=
4265
procedure
4366
begin
4467
Writeln('stoped');
4568
end;
46-
47-
LRecesiver.OnMessage :=
69+
LReceiver.OnMessage :=
4870
procedure(AMessage: ITgMessage)
4971
begin
5072
Writeln(AMessage.From.ID, ': ', AMessage.Text);
51-
LBot.SendMessage(AMessage.From.ID, AMessage.Text);
73+
// LBot.SendMessage(AMessage.From.ID, AMessage.Text);
74+
SMG(LBot, AMessage);
5275
end;
5376
Writeln('Bot nick: ', LBot.GetMe.Username);
54-
LRecesiver.IsActive := True;
77+
LReceiver.IsActive := True;
5578
while LStop.ToLower.Trim <> 'exit' do
5679
begin
5780
Readln(LStop);
5881
if LStop.ToLower.Trim = 'stop' then
59-
LRecesiver.IsActive := False
82+
LReceiver.IsActive := False
6083
else if LStop.ToLower.Trim = 'start' then
61-
LRecesiver.IsActive := True;
84+
LReceiver.IsActive := True;
6285
end;
6386
finally
64-
LRecesiver.Free;
87+
LReceiver.Free;
6588
end;
6689
end;
6790

0 commit comments

Comments
 (0)