eknoes / covidbot

Multi-platform messenger bot which provides updates on current COVID19 situation for Germany
https://covidbot.d-64.org
GNU General Public License v3.0
48 stars 8 forks source link

Move core to a multi-platform Chatbot library #127

Open eknoes opened 3 years ago

eknoes commented 3 years ago

After #117, it would be easy to extract the core of that bot and create a Python Library for Multi-Platform Chatbots.

linux-lukas commented 3 years ago

Is there anything new here, @eknoes ?

eknoes commented 3 years ago

Unfortunately not, sorry. I am currently quite busy.

linux-lukas commented 3 years ago

Okay. Is there any guidance on how to combine the programmed into a library? Because maybe I could have a look at it.

eknoes commented 3 years ago

Not really, one has to make some architectural decisions. Currently, all the functionality is in main.py and the different platforms are in interfaces/. It would be nice to have a library with a common interface and decorators for the chatbot.

linux-lukas commented 3 years ago

https://medium.com/analytics-vidhya/how-to-create-a-python-library-7d5aea80cc3f

I found this post which seems to be quite helpful. What do you think, @eknoes ? This method seems to me (without having actively tested it) to be quite simple to transfer the programmed contents into a bibliohtek.

eknoes commented 3 years ago

Yes, the question is not really how it could be put into a library, but how the library API should be designed.

linux-lukas commented 3 years ago

Yes, the question is not really how it could be put into a library, but how the library API should be designed.

Would much have to be changed structurally?

eknoes commented 3 years ago

Yes! Honestly, I am not sure if you can help a lot regarding this issue, but of course you can give it a try. One must decide how to e.g. annotate a bot who would use this library: Obviously, the functions would return BotResponses (https://github.com/eknoes/covidbot/blob/main/covidbot/interfaces/bot_response.py) and some kind of general structure for all messenger messages. Furthermore, it should provide hooks, so that prior to receiving a general state might be saved. Basically the setup and this function must be extracted (https://github.com/eknoes/covidbot/blob/2d4f1e43124090a3c5d23aa623554b813835f504/covidbot/bot.py#L111). The setup should be replaced through decorators.

linux-lukas commented 2 years ago

Have cleanups or similar changes to the code base changed anything in the initial situation, @eknoes ?

eknoes commented 2 years ago

No, there was no progress or heavy changes here. If you still want to help, you could come up with a suggestion for a general API and we can discuss it. I currently do even not have enough spare time to handle the core issues of the bot.