Gianbacchio / ESP8266-TelegramBot

Telegram Bot Library for ESP8266 on Arduino IDE
GNU General Public License v2.0
187 stars 71 forks source link

Re-write to use JsonParser and to extract the Network code from the T… #6

Open witnessmenow opened 8 years ago

witnessmenow commented 8 years ago

…elegram code

I wanted to make a Telegram library for ESP8266 chips that used JsonParser to make handling the responses from Telegram a little easier. I based the code off this Repo here is a pull request with my changes. I think the way you were parsing the messages may suit ESP8266 limited memory better so I completely understand if you would prefer not to incorporate them!

I also understand that normally pull requests are much easier when they are small changes, while this is a big chunk of changes all at once. I am very new to C++ and Arduino too so there may be issues.

I have tested these changes and the examples on my Wemos D1 mini and they seem to work well.

Main changes of the pull request

Thanks!

Gianbacchio commented 8 years ago

Dear Brian, I see you did a huge re-work of my original project, Great!

It's the true that I did not take care of any Json available library and managed the decoding of incoming messages in a very "trivial" way. This is not because of a lack of performances by ESP8266; as you have already tested, I understand that the micorcontroller works fine also with the use of Json library. Simply, it was my lack of specific esperience and time to investigate :)

Now, I'm very happy of your improvements, and for sure I will upgrade the repo with your pull request. Hopefully in the next days I will work on it.

many thanks and best regards.

Ginacarlo

2016-06-07 2:58 GMT+02:00 Brian Lough notifications@github.com:

…elegram code

I wanted to make a Telegram library for ESP8266 chips that used JsonParser to make handling the responses from Telegram a little easier. I based the code off this Repo here is a pull request with my changes. I think the way you were parsing the messages may suit ESP8266 limited memory better so I completely understand if you would prefer not to incorporate them!

I also understand that normally pull requests are much easier when they are small changes, while this is a big chunk of changes all at once. I am very new to C++ and Arduino too so there may be issues.

I have tested these changes and the examples on my Wemos D1 mini and they seem to work well.

Main changes of the pull request

  • Move to JsonParser (Users will now need to install the arduino json library from the library manager)
  • Changed the way messages are returned
  • Limited the number of messages that are received back from telegram (Looks like my Wemos mini when using the Json parser can only allocate enough memory to handle 1 message)
  • Constructor only takes botToken
  • implemented "getMe" api call to get name and username of bot (example of usage in echo bot example)
  • Created a derived class that separates network code from Telegram code - This makes it easier to add new architecture types without needing the change the telegram code to suit. other libraries that support different architecture types such as this one https://github.com/CasaJasmina/TelegramBot-Library. could potentially be merged

Thanks!

You can view, comment on, or merge this pull request online at:

https://github.com/Gianbacchio/ESP8266-TelegramBot/pull/6 Commit Summary

  • Re-write to use JsonParser and to extract the Network code from the Telegram code

File Changes

Patch Links:

— You are receiving this because you are subscribed to this thread. Reply to this email directly, view it on GitHub https://github.com/Gianbacchio/ESP8266-TelegramBot/pull/6, or mute the thread https://github.com/notifications/unsubscribe/ALU0t2hb3jYyHNSh7o1cwYk7lC6kU-5Wks5qJMJMgaJpZM4IvdOq .

Giancarlo Bacchio mob. +39 3313136813 skype: giancarlo_bacchio

witnessmenow commented 8 years ago

Hi Ginacarlo,

Thanks a lot. I added another change there to split the functionality into different files. This will be needed if there was multiple architectures supported.

If you need me to explain anything or improve/change anything please just let me know.

Thanks, Brian

carlosjosetam commented 8 years ago

Hi! I think that's exacly what i was searching and trying to do. The custom keyboard! @Gianbacchio can you put this changes as a new version of the library?

(Sorry, i'm new on git)

witnessmenow commented 8 years ago

Hey @carlosjosetam

I started maintaining a new library as I started to make changes that were very different from this library

The library I made is here: Universal Arduino Telegram Bot

That library supports keyboards. I dont have it very well documented yet but there are examples in that project that shows how to use it (although a friend mentioned last night that he needed to make some changes to them to run compile)

Here is a full example project I have using it, I would use this as reference as its a bit more up to date.

I'll try update the examples now and push them up. Feel free to message me on telegram if you need any help with the library (@witnessmenow)

Gianbacchio commented 8 years ago

Hello Carlos, Hi Brian :)

For sure, the most updated and reliable library today available for Telegram on ESP is the one from Brian. My work is now more than 1 year old and, unfortunately, I cannot maintain it in the next future.

Brian did a huge rework of my routines, I will endorse his pull request.

best regards Giancarlo

2016-07-13 23:32 GMT+02:00 Brian Lough notifications@github.com:

Hey @carlosjosetam https://github.com/carlosjosetam

I started maintaining a new library as I started to make changes that were very ge workdifferent from this library

The library I made is here: Universal Arduino Telegram Bot https://github.com/witnessmenow/Universal-Arduino-Telegram-Bot

That library supports keyboards. I dont have it very well documented yet but there are examples in that project that shows how to use it (although a friend mentioned last night that he needed to make some changes to them to run them)

Here is a full example project I have using it https://github.com/witnessmenow/Immersion-Bot, I would use this as reference as its a bit more up to date.

I'll try update the examples now and push them up. Feel free to message me on telegram if you need any help with the library (@witnessmenow https://github.com/witnessmenow)

— You are receiving this because you were mentioned. Reply to this email directly, view it on GitHub https://github.com/Gianbacchio/ESP8266-TelegramBot/pull/6#issuecomment-232493335, or mute the thread https://github.com/notifications/unsubscribe/ALU0t3N5IfIx4_q4DqdizCWCMmpgDvZfks5qVVl4gaJpZM4IvdOq .

Giancarlo Bacchio mob. +39 3313136813 skype: giancarlo_bacchio