Closed EdJoPaTo closed 3 years ago
Using a monorepo and symlinking the "core" for the grammy and the telegraf version works relatively well. It is usable with telegraf and grammY but is hard to maintain as the project structure differs hugely from other projects I maintain.
Creating a core repo and using it as a dependency will probably be way simpler.
One hickup: The MediaBody is specific to the library as the Media differs.
Making Body<MediaBla>
and MenuTemplate<Context, MediaBla>
generic can solve this.
The specific library can then export type TelegrafMenuTemplate<Context> = CoreMenuTemplate<Context, TelegrafMediaBla>
(use better names…)
This way the enduser can just import and use MenuTemplate<Context>
the same way as currently as the library abstracts this different MediaBla away.
The effort of supporting both grammY and Telegraf do not really seem worth it to me. My current plan is to create a breaking change which will only support grammY. Personally I think grammY is the way to go and I will need a grammY version for my bots.
The v6 version being compatible with Telegraf will continue to exist and the library will be released under a new name (probably grammy-inline-menu) so they can be used separately from another. The telegraf version will just not be supported as actively anymore then.
If you are reading this and have thoughts about it feel free to comment. I'm interested in suggestions or ideas here.
Currently this library only works with Telegraf. Working with grammY (and Deno) would be nice.
Most of the library is independent from Telegraf anyway. Probably only sendMenu and MenuMiddleware need to be refactored / duplicated and adapted for the specific telegram library.
Maybe get inspired here: https://github.com/grammyjs/rateLimiter