Coder Social home page Coder Social logo

Comments (5)

limelect avatar limelect commented on May 24, 2024 1

Good luck I will write my own. www.limelect.com

from tinjecttelegram_delphi.

limelect avatar limelect commented on May 24, 2024

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;

from tinjecttelegram_delphi.

dieletro avatar dieletro commented on May 24, 2024

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

from tinjecttelegram_delphi.

limelect avatar limelect commented on May 24, 2024

Well your suggestion did not help since the Certificate exception server error is still there.

from tinjecttelegram_delphi.

dieletro avatar dieletro commented on May 24, 2024

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.

from tinjecttelegram_delphi.

Related Issues (6)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.