Hello my dear readers (is there someone reading what I write? Sorry, don't believe you!).
Hell if I've not been busy these days: I'm studying for university, studying new technologies online (trying the fresh new Angular 2 and improving my confidence in general with the MEAN stack), and reading a lot of very good literature books advised by my trusted bookseller. Despite all this, I've been able to create something very useful with a friend of mine!
How this Telegram university's bot started
Everything started from one of his ideas. He saw a repository on GitHub where two southern Italian students were publishing their telegram bot for their university. The code was quite simple but written in an awful way (classical example of spaghetti code with one script containing code that even the owners weren't probably able to understand what was in there). So Diego, a friend of mine who had this idea, came to me and showed me that repo. Initially, I was a little skeptical, but within some days he changed my mind and we started this little "adventure" trying to write a telegram bot for our own university with a language that we both didn't know: Python. He works in Spain for a while now and he hadn't the time to contribute much to the code, but without him, all this wasn't possible.
I didn't know Python at all (and I still don't know it very well of course), this is my first project with it and I understand now why it's so appreciated: it's simply awesome, it offers an incredible number of different ways to write code and it really makes programming funny. But coming to the resources, we used this library to communicate with telegram (we hadn't the time nor the willingness to roll out our library) and two more libraries: requests and BeautifulSoup for the intense scraping.
In the beginning, we also tried to parse the university's RSS feed, but it was just ridiculously inconsistent (some news were missing, new news were added late, and so on) and so I was forced to directly scrape the news pages with BeautifulSoup.
We also made this bot able of answering about professors, their emails and phone numbers (with the ability to search for just one of them), timetables of different things such as the canteen, retrieving the last news of the site (actually you can choose how many news you want) and, the more useful for the moment, notify you every time news appears on the website. And we're looking forward to adding also notification and information about the lessons (timetables, teachers, etc.).
All the data are stored in simple JSON files (we absolutely didn't want to complicate stuff introducing databases at the beginning) and, while I'm writing this, I just changed the structure of the entire application, trying to partialize the code even more.
cron (All the files used to scan the website to set up in a Linux OS as cron jobs)
json (The json files that contains the data)
libs (The python packages that I created to partialize the code)
Website and repo
The bot has also a website and a repo (of course) where we hosted our code.
Feel free to give us advice on how to improve the code or what functions we could add to make this bot better, we're absolutely open to any new idea or any kind of opinion about our work.
See you next time, stay awesome guys 😁