BattleBot is a fun discord bot where you can play multiple minigames with friends.
Every time you win a game u get points on the leaderboard. What will your position be?
BattleBot also has a level system to make the battles more rewarding and see your progress over time.
/daily command can be used without another player present (single-player)
No followers yet
Once you ship this you can't edit the description of the project, but you'll be able to add more devlogs and re-ship it as you add new features!
-Added math game
-added XP/level system
-added extra commands for the math game and the xp/level system
-added /daily where you can play one round of each game for some extra XP.
-rewrote the lobby system to make it modular for other games
-added GeoGuess game where you get the outline of a country and need to guess the name
-added leaderboard for the GeoGuess game
-fixed bug where you were able to select all options and get the point
-changed the /triviabattle command to accept params, instead of having 2 seperate commands
Since the lobby system for the GeoGuess game was 99% the same, I rewrote the script to be modular and work with any game.
For the GeoGuess game I downloaded a JSON map from https://mapshaper.org/ and got help from AI to write a script to turn this JSON into a outline image. Aside from creating a image we also added every country to our database with 4 countries to choose from (the one in the image and 3 countries next to it)
Then I just displayed an embed with the image and a dropdown with the 4 options.
I wanted the user to be able to change their answer, but with the old answer system I had it remembered all you answers for this round. Because of this you could just select every one of them and get a point. To fix this I changed from a Set() to a Map() and made it so it only saved the last answer from every user.
-added a leaderboard for the triviagame
-fixed the round timer going down using discord relative timestamp
-fixed the answer reveal to be a nice embed after the round ended
At first each round was a new embed, but this really filled the chat, so I changed it to edit the old embed to the new round embed every time.
Originally I told the user if he was correct or wrong when he answered in a message only he could see, but this was very annoying to always click away (especially for phone users). Because of this I change the round to last 20s, then after the round we show the answer for 5s and start new round.
I tried to make the timer count down, but this reset the dropdown menu every time, which is very annoying for the user and potentially game breaking. To fix this I just used the native discord timestamp to display the time left.
-Added 1400 trivia questions ranging from easy to hard
-Made the lobby and challange actually start a trivia game
I found a big library with a lot of trivia questions (https://opentdb.com/), they provided a free API to fetch questions. I wrote a small seeding script that will fetch multiple choice questions with random difficulties from 5 different categories. I opted for a mongodb database because they are fast and fairly easy to work with (and the most important, FREE 😅) Here I stored all the questions and the information with them that I needed.
Then in discord.js when a trivia game is started we just fetch a random question from the pool every round and shuffle the answers to randomize it a bit.
Still need to add a system that it remembers the questions it had and doesn't ask them again in the same game, but the chances for that are very minimal.
I had a lot of issues with the interactions needing to be editted, replied too, followed up. It used to be a lot easier to just send a message in a channel.
For this project I choose node.js with discord.js.
This hour I created a basic discord bot with a /command handler.
I added a command /triviagame with 2 options (start/challange).When you choose start it starts a lobby where unlimited players can join in 60s to play the game with you. When you choose challange you are asked to provide another user, this user will then get a request to play a game of trivia with you.
Currently only the lobby mechanism works, the game doesn't actually start.