PaulSonOfLars / gotgbot

Autogenerated Go wrapper for the telegram API. Inspired by the python-telegram-bot library.
MIT License
469 stars 107 forks source link

Consider transforming the Dispatcher inside the Updater structure into an Interface? #119

Closed lulafun closed 10 months ago

lulafun commented 11 months ago

【Feature requests】

I have a modification requirement and I want to reuse the code of Updater Polling, but I need to change the logic of Dispatcher.

Currently, Dispatcher is a struct field inside Update, which prevents me from implementing custom routing logic inside Dispatcher. So I want to define Dispatcher as an interface.

May I ask what are the considerations for defining Dispatcher as a struct currently? If you have considered this modification, I can contribute code for you; otherwise, I will have to modify this project myself.

Dispatcher

PaulSonOfLars commented 10 months ago

Hi @ajsdhfb , sorry for the late reply - github never notified me about this issue being raised!

I'd be happy to look into moving the Dispatcher to an interface; that makes sense to me.

However, I'd first like to hear what your custom implementation would look like, and what methods you expect to need; this would allow me to make sure that the interface is relevant to your usage. How does that sound to you?

Right now, I would assume that only the Start(...) and Stop() methods are necessary. Does that sound about right?

PaulSonOfLars commented 10 months ago

Resolved by #120. Enjoy!