Skip to content

Commit

Permalink
Merge branch 'release/3.5.3'
Browse files Browse the repository at this point in the history
  • Loading branch information
rareMaxim committed May 11, 2018
2 parents d2bcfe2 + bbbb552 commit a328644
Show file tree
Hide file tree
Showing 42 changed files with 4,081 additions and 1,705 deletions.
3 changes: 3 additions & 0 deletions .gitmodules
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
[submodule "Source/CrossUrl"]
path = Source/CrossUrl
url = https://github.com/ms301/CrossUrl.git
10 changes: 5 additions & 5 deletions Delphinus.Info.json
Original file line number Diff line number Diff line change
Expand Up @@ -5,14 +5,14 @@
"license_type": "Modified MIT License (MIT), GNU GPL v2",
"license_file": "LICENSE.txt",
"package_compiler_max": "0",
"package_compiler_min": "29",
"compiler_min": "29",
"package_compiler_min": "27",
"compiler_min": "27",
"compiler_max": "0",
"platforms": "Win32;Win64;OSX32",
"platforms": "Win32;Win64;OSX32;Android;IOSDevice32;IOSDevice64;Linux64",
"dependencies": [],
"author": "M.E.Sysoev",
"author": "Maxim Sysoev",
"description": "Telegram Bot API for Delphi",
"version": "3.5.1",
"version": "3.5.3",
"first_version": "2.3.1",
"project_url": "https://github.com/ms301/TelegAPI",
"homepage_url": "https://t.me/telegaPiBotTest",
Expand Down
2 changes: 1 addition & 1 deletion Delphinus.Install.json
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
[
{
"pathes": "Source",
"platforms": "Win32;Win64;OSX32"
"platforms": "Win32;Win64;OSX32;Android;IOSDevice32;IOSDevice64;Linux64"
}
],

Expand Down
57 changes: 40 additions & 17 deletions Demo/Console/ConsoleBot.dpr
Original file line number Diff line number Diff line change
@@ -1,26 +1,49 @@
program ConsoleBot;
program ConsoleBot;

{$APPTYPE CONSOLE}
{$R *.res}

{/$DEFINE USE_INDY_CORE}
uses
TelegAPI.Bot,
{$IFDEF USE_INDY_CORE}
//Indy Http Core
CrossUrl.Indy.HttpClient,
{$ELSE}
// System.Net HTTP Core
CrossUrl.SystemNet.HttpClient,
{$ENDIF}

Rest.Json,
TelegAPI.Receiver.Console,
System.SysUtils,
TelegAPI.Receiver.Console,
TelegAPI.Bot,
TelegAPI.Types,
TelegaPi.Exceptions,
TelegaPi.Factory;
TelegAPI.Bot.Impl,
TelegAPI.Exceptions;

procedure SMG(ABot: ITelegramBot; AMessage: ITgMessage);
var
Test: TtgInputMediaPhoto;
begin
Test := TtgInputMediaPhoto.Create(TtgFileToSend.FromFile('D:\Repositories\Мои проекты\ms301-TelegAPI\Install\pJNqeRflXYU.png'),
'Test');
ABot.sendMediaGroup(AMessage.Chat.ID, [Test, Test])
end;

procedure Main;
var
LBot: ITelegramBot;
LRecesiver: TtgReceiverConsole;
LReceiver: TtgReceiverConsole;
LExcp: TtgExceptionManagerConsole;
LStop: string;
begin
LBot := TtgFactory.CreateTelegram('283107814:AAGOGxUCwTC2bOs2krUSuEtqZd2UnA8NZ2g');
LRecesiver := TtgReceiverConsole.Create(LBot);
LBot := TTelegramBot.Create('YOUR_TOKEN',
{$IFDEF USE_INDY_CORE}
TcuHttpClientIndy.Create(nil)
{$ELSE}
TcuHttpClientSysNet.Create(nil)
{$ENDIF});
LReceiver := TtgReceiverConsole.Create(LBot);
try
LExcp := LBot.ExceptionManager as TtgExceptionManagerConsole;
LExcp.OnApiException :=
Expand All @@ -33,35 +56,35 @@ begin
begin
Writeln(AExp.ToString);
end;
LRecesiver.OnStart :=
LReceiver.OnStart :=
procedure
begin
Writeln('started');
end;
LRecesiver.OnStop :=
LReceiver.OnStop :=
procedure
begin
Writeln('stoped');
end;

LRecesiver.OnMessage :=
LReceiver.OnMessage :=
procedure(AMessage: ITgMessage)
begin
Writeln(AMessage.From.ID, ': ', AMessage.Text);
LBot.SendMessage(AMessage.From.ID, AMessage.Text);
// LBot.SendMessage(AMessage.From.ID, AMessage.Text);
SMG(LBot, AMessage);
end;
Writeln('Bot nick: ', LBot.GetMe.Username);
LRecesiver.IsActive := True;
LReceiver.IsActive := True;
while LStop.ToLower.Trim <> 'exit' do
begin
Readln(LStop);
if LStop.ToLower.Trim = 'stop' then
LRecesiver.IsActive := False
LReceiver.IsActive := False
else if LStop.ToLower.Trim = 'start' then
LRecesiver.IsActive := True;
LReceiver.IsActive := True;
end;
finally
LRecesiver.Free;
LReceiver.Free;
end;
end;

Expand Down
Loading

0 comments on commit a328644

Please sign in to comment.