CosmicBot
- 5 Devlogs
- 10 Total hours
A Slack Bot which can do many different things and games on the Hack Club Slack!
A Slack Bot which can do many different things and games on the Hack Club Slack!
Cosmic Hot Potato is working now and it’s basically a game where you play hot potato with people on any server you want to by typing /cosmic-bomb. This game could basically go on forever and I feel like it would be fun to play with some friends.
So I feel like I am pretty much done with the bot because I have worked on it for a good amount of time and I am going to ship it soon then.
Ok so this time I added a clicker competition game on the bot which many people can compete in. You just do /cosmic-mine in slack and you start the game. It’s basically behind the theme of mining asteroids for stardust, get it?
The main thing that went wrong with this was the score kept on stacking. So I added code that reset the counter back to zero every time a new game started
It works perfectly now and you can actually compete for stardust without the scoreboard breaking. Looking pretty good ngl. Going to add new things soon.
I just finished making my slack bot trivia game. Getting the commands to work with the chat answers took way too long, but I finally got it to run a game without something going wrong.
The main thing that went wrong was the The Annoying 3-Second Timeout Whenever I typed /cosmic-trivia, Slack would instantly stop and say the app didn’t respond. This happened because Slack has a 3-second limit, and my bot was taking too long to send back the text.
What I fixed: I changed the code so the message sends exactly at the same time the bot connects to slack and the time you send the command.
After last time a few new commands were added and the bot was moved to a 24/7 server so it can be used whenever someone wants to.
Some of the new commands are:
/cosmic-joke - tells a random joke
/cosmic-catfact - gives a random fact about a cat
/cosmic-help - Lists the available commands
So there were a few problems that I had to get past
The git repository wasn’t found, which is solved directly on github. Sometimes the terminals just froze or wouldn’t read the text which I solved through smaller commands or restarting the whole thing. Also I had to debug the code for a little while as the slack commands were not working properly.
Moving the Bot to nest
To make sure the bot stays online even when my computer is closed I cloned and moved the file to a nest server and I also put the.env file on the server to make sure the bot works.
CosmicBot is officially working now, the first bot I’ve made and it’s working so far so well.
I started building the Slack bot using Node.js/javascript and the slack system.
Quick Overview of what I did so far
Used socket mode to work the bot in real time and put the password tokens in a protected place called the .env file
Made my first working command that worked pretty much instantly
I plan on making something no other bot has