THTTPClient.DoValidateServerCertificate
limelect opened this issue · 5 comments
D10.2.3
I put my token and my id
on start i get Certificate exception server certificate invalid or not present
Can you also elaborate on the theory behind your software?
To elaborate in order not to install on create i did from the dfm
cuHttpClientSysNet1 := TcuHttpClientSysNet.Create(self);
InjectTelegram1 := TInjectTelegram.Create(self);
InjectTelegram1.Logger := InjectTelegramExceptionManagerUI1;
InjectTelegram1.HttpCore := cuHttpClientSysNet1;
InjectTelegramExceptionManagerUI1 :=
TInjectTelegramExceptionManagerUI.Create(Self);
InjectTelegramExceptionManagerUI1.OnLog :=
InjectTelegramExceptionManagerUI1Log;
InjectTelegramReceiverService1 := TInjectTelegramReceiverService.Create(self);
InjectTelegramReceiverService1.Bot := InjectTelegram1;
InjectTelegramReceiverService1.OnStart := InjectTelegramReceiverService1Start;
InjectTelegramReceiverService1.OnStop := InjectTelegramReceiverService1Stop;
InjectTelegramReceiverService1.OnMessage :=
InjectTelegramReceiverService1Message;
InjectTelegramReceiverService1.OnChosenInlineResult :=
InjectTelegramReceiverService1ChosenInlineResult;
InjectTelegramReceiverService1.OnCallbackQuery :=
InjectTelegramReceiverService1CallbackQuery;
This way you are passing the events to the component's methods will generate a circular error, as these methods are already linked to these events.
For this to work you must create new methods and assign them to the events;
As an example I will show below:
// Create the Objects
cuHttpClientSysNet1: = TcuHttpClientSysNet.Create (self);
InjectTelegramExceptionManagerUI1: =
TInjectTelegramExceptionManagerUI.Create (Self);
InjectTelegramReceiverService1: = TInjectTelegramReceiverService.Create (self);
InjectTelegram1: = TInjectTelegram.Create (self);
// Set the Properties
InjectTelegram1.Logger: = InjectTelegramExceptionManagerUI1;
InjectTelegram1.HttpCore: = cuHttpClientSysNet1;
InjectTelegramReceiverService1.Bot: = InjectTelegram1;
// Associate Events
InjectTelegramExceptionManagerUI1.OnLog: = MyOnLog;
InjectTelegramReceiverService1.OnStart: = MyOnStart;
InjectTelegramReceiverService1.OnStop: = MyOnStop;
InjectTelegramReceiverService1.OnMessage: = MyOnMessage;
InjectTelegramReceiverService1.OnChosenInlineResult: = MyOnChosenInlineResult;
InjectTelegramReceiverService1.OnCallbackQuery: = MyOnCallbackQuery;
Finally, you create your interaction within these new methods MyOnLog, MyOnStart, MyOnStop, MyOnMessage, MyOnChosenInlineResult and MyOnCallbackQuery.
these names are just to illustrate how you should proceed with logic for this application.
Hope this helps
for more information join our support group at Telegram: http://t.me/TinjectTelegram
Well your suggestion did not help since the Certificate exception server error is still there.
try this...
var
LBot : IInjectTelegramBot;
LReceiver : TInjectTelegramReceiverConsole;
LExcp : TInjectTelegramExceptionManagerConsole;
Begin
{$IFDEF USE_INDY_CORE}
LBot := TInjectTelegram.Create(TOKEN, TcuHttpClientIndy.Create(nil));
{$ELSE}
LBot := TInjectTelegram.Create(TOKEN, TcuHttpClientSysNet.Create(nil));
{$ENDIF}
LReceiver := TInjectTelegramReceiverConsole.Create(LBot);
LBot.Logger := TInjectTelegramExceptionManagerConsole.Create(Nil);
try
LExcp := LBot.Logger as TInjectTelegramExceptionManagerConsole;
// ON LOG
LExcp.OnLog := MyOnLog;
// ON START
LReceiver.OnStart := MyOnStart;
// ON STOP
LReceiver.OnStop := MyOnStop;
// ON INLINE INPUT CALLBACK
LReceiver.OnCallbackQuery := MyOnCallBackQuery;
// ON CHOSEN INLINE RESULT
LReceiver.OnChosenInlineResult := MyOnChosenInlineResult;
// ON INLINE REQUEST
LReceiver.OnInlineQuery := MyOnInlineQuery;
// ON MESSAGE RECEIVED
LReceiver.OnMessage := MyOnMessage;
// START SERVICE
LReceiver.Start;
// ADD O NOME DO BOT NO LOG
memConsole.Lines.Add('The Bot Name is : '+ LBot.GetMe.Username); //memConsole is TMemo
except on e:exception do
begin
ShowMessage('Falha ao iniciar o serviço!');
end;
end;
end;
You create your interaction within these new methods MyOnLog, MyOnStart, MyOnStop, MyOnMessage, MyOnChosenInlineResult and MyOnCallbackQuery.
Good luck I will write my own. www.limelect.com