grammyjs / grammY

The Telegram Bot Framework.
https://grammy.dev
MIT License
2.21k stars 111 forks source link

Compare grammy with other telegram bot framework #29

Closed njfamirm closed 3 years ago

njfamirm commented 3 years ago

What is the advantage of this framework over other examples? The reason I became interested in grammy was the complete and clear documentation!

KnorpelSenf commented 3 years ago

Speaking of complete docs, have you seen this section linked under Resources? https://grammy.dev/resources/comparison.html

Note that it's hard to be objective about this—so even though the article attempts to be as objective as possible, it makes sense to assume that there is room to be more fair :)

Is there any particular framework that you'd like to see compared against grammY?

njfamirm commented 3 years ago

My criteria for choosing framework as follow:

KnorpelSenf commented 3 years ago

According to my knowledge, grammY currently wins all three of them against all other JS/TS competitors.

njfamirm commented 3 years ago

thanks for your response! @KnorpelSenf

KnorpelSenf commented 3 years ago

Here is a more elaborate answer.

  1. Docs. That is the easiest to answer. grammY has both a documentation website, and a generated API reference. Exported elements of grammY are well-documented and commented by 100 %, which makes the API reference actually useful.
  2. Fast. All frameworks I know of need very few CPU cycles for every incoming message, and grammY is no different here. Whether or not a framework is fast can thus be evaluated more accurately on real-world code that solves actual problems. As an example, many bots need to communicate with a database. A single request more or less here make a huge difference in how responsive your bot is. The lazy sessions of grammY allow you to automatically skip database communication wherever possible. Telegraf cannot do this at all, and manual implementations of database communication are either naïve and slow, or they require significant optimisation effort. There are more cases like this, but I think the point is clear.
  3. Scalable. On Node.js, most bot frameworks that support webhooks are relatively easy to scale because Node.js instances are relatively easy to scale. It gets more interesting when you are running a bot on long polling and you want it to process a lot of updates. I'm happy to say that grammY runner is the fastest available long polling implementation out there. It could handle infinite concurrency, but lets you easily constrain server load, too. Can be integrated in a message queue if you want to scale your bot to several instances using polling.