node-telegram-bot-api
node-telegram-bot-api copied to clipboard
Discussion: Refactor/Rewrite/Replace some parts of this library
This library has some deprecated libraries e.g. request
. Node.js has also progressed since when the core of this library was written; It has support for native promises/Async await e.t.c.
Some of the proposals are:
-
Replace the bloated and deprecated
request
library with a more light weight alternative. The current proposals include:ethanent/phin, node-fetch/node-fetch, matthew-andrews/isomorphic-fetch, sindresorhus/got
.The replacement library should support most of whatrequest
supported. -
Potentially replace
Event Emitter 3
with a better drop in replacement likemcollina/mqemitter
or nativeEvent Emitter
. This needs more research. -
Replace
bluebird
with native promises/async-await. -
Support Node.js v12+ as per LTS schedule. Any feature/polyfill supporting < v12 should be removed.
-
Replace
pump
withpipeline
.
Feel free to make your own proposals.
- Move the samples/tutorials to a secondary repository
- Possibility of making an interactive documentation using documentationjs
Would transition to TypeScript be considered too?
I could help with that.
Hey I would like to work on replacing the request
library with node-fetch/node-fetch
library
But the problem is what about the options.request
parameter ? It is compatible with the old request
library
https://github.com/request/request#requestoptions-callback
- Replace the bloated and deprecated
request
library with a more light weight alternative. The current proposals include:ethanent/phin, node-fetch/node-fetch, matthew-andrews/isomorphic-fetch, sindresorhus/got
.The replacement library should support most of whatrequest
supported.
node-gyp
goes with https://github.com/npm/make-fetch-happen
I suggest https://github.com/telegraf/client. It's typed, and should be close to supporting https://grammy.dev/advanced/transformers.html.
Agree with @wojpawlik, high time this library used a lite client like telegraf/client
while keeping the API consistent with the current version so that there is no barrier to entry for existing devs.
Maybe even use middleware composition instead of event emitters.
@telegraf/client
was archived and is now being upstreamed into telegraf
: https://github.com/telegraf/telegraf/pull/1705. I suggest you to just copy and adjust it to your needs.
Related to #1007.
https://github.com/telegraf/telegraf/blob/v5/src/input.ts
Do you have any news about migrating this amazing package to more lightwight?
- I have very humble needs just to send a message to a channel - maybe there are simpler and lighter alternatives? I didn't find anything well-documented and maintained like
node-telegram-bot-api
- For now the package size is ~ 600k and startup time ~300ms on my local machine (fast and modern)