Inspiration π€π₯π¬πΏ
In my last successful Hackathon, I had created Devscord: the discord bot for developers. That project really made me realize what I enjoyed making the most: discord bots, which is why I opted to make another one for this weekend. Additionally, I considered the question "what would a film buff discord server want?" Anything that I answered, I tried to implement, and that's it!
What it does ββπ§π¬
My discord bot can do a lot! Here are the commands:
!trivia: get a trivia question
!answer: answer the trivia question
!imdb (title): get all information of a movie
!rating (title): get the rating of a movie
!cast (title): get the top cast of a movie
!like (title): get a movie recommendation based on a title
!popceleb: get top 5 celebrities at the moment
!popmovie: get top 5 movies at the moment
How I built it π¨π§
I used Python for the code and discord.py for the commands and discord side of things. I had used this package before so after a quick refresher and occasional documentation reading, I was quite comfortable. I also used the requests package for only the second time and the json package for the first time which was an interesting and extremely important part of the project. I also used the IMDb API and Open Trivia API for the information on movies and trivia, respectively.
Challenges I ran intoπββοΈ
- json package
This was my first time using the json package so I had to plunge into the documentation and watch a tutorial to understand the syntax and use of the package. This was a bit challenging and infuriating because I kept getting errors, but I stuck with it and it turned out pretty great!
- !popceleb command
This command was the hardest to make because I realized it needed an algorithm and 3 API requests to make it. This is because of how the IMDb API is structured but after a cup of coffee and a couple of hours of thinking (watching YouTube videos), the solution hit me and I made a quick algorithm to send 5 messages about the celebrities.
- IMDb API
This API was a bit painful to use because we had to get a movie ID or actor ID every time we needed something else from the API which meant we had to do a couple API requests every time. Every. Single. Time.
Accomplishments that I'm proud of and what I learned ππ¦π§
- json package
As I said, it was my first time using the json package and it was extremely rewarding. By the end, I was very comfortable using this and I will definitely use this with the requests package in the future.
- !popceleb command
The algorithm for this was confusing but I managed to do it in the end which made me extremely proud.
- scopes
I learned about scopes in this project as when I was implementing the Open Trivia API commands, I had to access some variables that I couldn't. To fix that, I realized I had to make them global and give them a global scope which is a very useful tool I'll definitely use in the future.
- IMDb API
The IMDb API was very hard to work with, but I learnt not only how to use it, but how to work with slightly more difficult APIs which is going to be a great skill for future projects.
What's next for IMDbest ββ
I would like to explore the IMDb API to its full extent and add in a bunch more commands which I was restricted to do this time because of time and because of the 500 API request cap on the IMDb API (for the free version). I would also like to add the Marvel and DC APIs to maybe add some context to the Marvel and DC movies, which would be really fun.