xlanor / SIM-UoW-Timetable-bot

Refactored version. A telegram bot to rip timetables from SIMConnect
https://www.hera.jingk.ai
GNU Affero General Public License v3.0
12 stars 1 forks source link

Bot is currently not responsive #72

Closed bchooxg closed 3 years ago

bchooxg commented 3 years ago

Hi just wondering if the bot is still functional ?

Just went to try this out and the bot is not returning any responses

xlanor commented 3 years ago

71 .

Development has stopped as I've more pressing projects at work.

Poonjh95 commented 3 years ago

hi @xlanor, wondering if you could teach me how to get the bot up and running again, it was a really useful tool and i am hoping i could learn something from working on it. 1.5 year more to grad haha

thanks in advance!

xlanor commented 3 years ago

Hi,

To run the bot you need some general experience in running bare metal on linux systems. For your learning process I suggest that you upgrade it instead. It will teach you more about modern practices than just running some legacy code that was written years ago when I was starting out as a developer and still fiddling around

There's some options here, you can either use redis, which is very fast, and deal with caching policies and synchronisation, or you can run a replicated database with a read replica sitting in NL

Tests at the unit level should mainly revolve around the parser code. I come from the school of thought that mocking databases in unit tests is a waste of time due to the frequently changing queries

Tests at the integration level should ideally run a request end to end, but mock the SIM website by spinning up a local server serving HTML code. I'm not sure about the entry point from python telegram bot library, but I think monkeypatching should be available at least to mock some data to suit certain scenarios in the request to save you some trouble. What you can do is to read the upstream API code to see what kind of data is expected to be received at the socket and construct your own requests from there to be used during testing ( to simulate a client calling the telegram bot and telegram relaying the message to you through their bot api server)

At this point you should also spin up a database and constantly populate and repopulate with test datasets to test that your queries work fine and as expected.

I wrote this during my first year at SIM and have not touched it much since then so I do not think that the website has changed much if at all. The scraping code should still be fine, but if not it's simply a case of whipping out chromes developer tools and looking for identifiers in the HTML tree

Beyond that, I cant assist further. I don't have the time for it, and I tried handing the project over to a few people but most of them lost interest pretty quickly.

Based on my time in UOW, almost all of the above, except for containerisation, would have been taught at some point or other in the curriculum. Even though the above suggestions are extremely over engineered for the use case, It would be a good fun project to take on during the holidays and use the opportunity to build on the mainly theoretical knowledge of the above in the curriculum, as well as an opportunity to venture outside of a guided sandbox in the forms of exams and assignments.

If you have any questions about the suggestions for improvements feel free to ask