DEV Community

Andris Jansons
Andris Jansons

Posted on

Chatbot project

Hey, it's Andris

I'll start off with a picture of how the chatbot looks like

It's made with python using simple functionality. It uses API's.
I used slimkrazy's python wrap around for Google Places API, together with pyowm from Open Weather Map and had some fun with Riot's API for League of Legends (I doubt anyone wouldn't recognise the game).

The chatbot was a first year, first semester project. 6 random guys were put together in a group with one task "Make a chatbot." Although at that point of time it seemed like no big deal and we had all these crazy ideas that it has to have a specific personality and should even have some anger issues. We were fantasising how it would buy us stuff from the internet and be a man's best friend.
Don't take the picture for granted. It can make some simple small talk as well I am just shoving off the functionality I specifically made myself.
Little did we know the coding process did not go as planned. More or less everyone knew their tasks, but in the end there was no way to put them all together. One's functions accepted lists as parameters and returned strings, other's had it vice versa and it was a complete mess. Then two of us started making the same functions and while the best one got to the top, the other guy had just wasted his time. Overall code integration had us jumping around in a complete joy.

At this part I'm going to talk a bit about debugging so feel free to skip to the next paragraph as this word never brings good emotions. Especially to first years. We knew a good practice was to surround our code with try-catch blocks so our program wouldn't randomly crash, but when finally something does not work as intended it's almost impossible to find which part of the code went wrong. It's just that we forgot to print out the error itself. And if something works on one computer, that does not mean it will work on another. Furthermore while the code only runs on 32bit python on my laptop, a colleague can only run the same one on 64bit python. Unit testing was a way to go here as you make a function for testing other functions once, but run it every single time you need something to happen. And I don't know about you, but my lecturers have specifically told me to stay away from global variables. Right now I just can't think of how much to thank them as there was this one problem we spent nights trying to figure it out while in the end a single global variable did the trick.

In the end the chatbot is nothing like it was in the beginning. Literally the only thing it inherits is it's name - Snoo.py Snek (pun intended). But even with all the obstacles along the way, I am happy where it has lead me now. With this project I have taught myself more things than I could ever imagine existed. One of them being how to work as a team and what management tricks to use next time. The other - that there is a whole world of API's out there that I'm craving on exploring further.

See you all in the field of action!

GitHub link of course:
https://github.coventry.ac.uk/jonesd37/GroupD3
It's a uni's personal GitHub, so you can't find the repository on the regular GitHub.
To run it - launch "server1.py" and then "GUI.py" and there you go

Top comments (0)