cotestatnt / AsyncTelegram2

Powerful, flexible and secure Arduino Telegram BOT library. Hardware independent, it can be used with any MCU capable of handling an SSL connection.
MIT License
83 stars 25 forks source link

SendBuffer (and sendStream) result management? #110

Open MassiPi opened 1 year ago

MassiPi commented 1 year ago

Hello, little help here. I send a photo and I check the return value of the sendPhoto function (that is indeed the sendBuffer). But basically this function is never setting the "res" variable to true, so the function is returning false in every case! This seems a regression from old versions (where res was set to true), am i wrong? Thanks

cotestatnt commented 11 months ago

Hi @MassiPi Sorry for big late, but I have very poor free time in this period.

In order to set properly the res variable, it would be necessary to wait blockingly for the response from the server, and this is what you typically don't want to do with this library.

To solve this problem I implemented the addSentCallback() method which allows you to associate a callback function that will be executed every time the message is successfully sent or in case of timeout.

Honestly though I don't remember if this functionality is also active with the methods sendBuffer()and sendStream().

Check this example if you like https://github.com/cotestatnt/AsyncTelegram2/blob/master/examples/sendMessageCallback/sendMessageCallback.ino