Cyber3000 is a Slack bot made for people obsessed over the 2000s era or who are interested on knowing more about it. This bot brings back a wave of nostalgia and retro technology. Coded in Node.js using Slack’s Bolt Framework, also developed two API Endpoints as part of this project (data formatted in JSON).
Commands:
/cyber3000-y2ktech - Gives a piece of info about iconic tech devices from the 2000s era. /cyber3000-nostalgia - Drops a nostalgic memory from the 1990s-2010s. /cyber3000-seek - Gives a summary about the keyword entered. /cyber3000-ascii - Converts the given text into ASCII Art and displays it. /cyber3000-advice - Drops a random piece of advice. /cyber3000-help and /cyber3000-ping - Basic commands
What I Learnt
Thanks to Stardance, I developed my first Slack bot in NodeJS. It was a great experience to express my interests and make a bot on it. Following the guide, writing the code, debugging, writing devlogs and good git commits was a really good journey. For a person like me, who’s very much interested in programming, I loved the idea of proper documentation for a project right from writing my first devlog to what I’m writing now. I learnt many things during the course of developing this bot, especially that coding is not the whole part and presentation is what makes your project the best!
Where I Struggled
Though this project being my first time writing the code for a Slackbot, I did not feel it to be very tough except for displaying the result from the API Endpoint as a response to the user on Slack, which returned [object Object] and [object Promise] multiple times but I soon learnt the reason behind it and solved it. I also didn’t know where know where to use async and await until my project came to an end.
I have added all the commands to Cyber3000 which I wanted to and today is the day to run it 24/7 on Nest.
I started seting up my bot on Nest from my command prompt, following the guide… And after I’ve done it, I opened Slack to try out my bot, just to get shocked that the responses were only visible to me!
Throwback to 3 days ago, while testing my bot on Slack during the time of running my bot locally, I saw that all of it’s responses were ephemeral. I mistook that it was happening because I was running my bot locally.
I had to add a line of code for every response in my code to fix it and I edited the index.js file from my command prompt itself using the command nano index.js (Nano is CLI-based text editor) and restarted the container from Nest.
Now that everything is fixed, I’ve added the demo url to README.md on my Github Repo. Tested all the commands of my bot again and now I think am sure that my project is ready to be shipped!
Do checkout the responses of the bot (it’s not ephemeral anymore!!) 👇🏻
I was tinkering with my project, wondering which feature to add next. That’s when the ASCII Art came into my mind…
For those who don’t know, ASCII was a character encoding standard and ASCII Art was a graphic design technique which used the those characters for art which was widely used during the 80s.
I had known this art for a while and for Cyber3000’s theme, I thought it would be very cool to add it.
Two days ago, I’ve just read the Hackclub guide on making a Slackbot which uses APIs to retrieve data such as a random cat image or a random joke.. And I found APIs interesting right from the start when I was trying to find a theme for making my Slack bot.
I did some research on how basic API Endpoints work and how they retrieve and manage data formatted in JSON.
Today, I started gathering a lot of information about 2000s tech and nostalgic memories of the 1990s-2010s(early) era and I have made two JSON files with the data from which my bot can retrieve the info and drop a random info. about 2000s tech or a nostalgic memory. Though I was not born in that era, I’m definitely very fond of it.
Thought of adding a command which gives a summary of any keyword entered and went for the DuckDuckGO API.
Struggled with catching the proper part I needed from the API and displaying it to the user. As the it returned a lot of information about the keyword(such as links and a lot of specifications related to it), I had to filter the result only to get the short summary.
The bot was replying with [object Promise] until I realised that I’ve missed await when calling the function. The silly part was I’ve entered = instead of === in an if statement.
Started with setting up my bot on Slack API website and wrote the boilerplate code for the bot on VSC in Node.js. Thanks to the Hackclub guide on making a Slack bot, it made my work easy.
Struggled with testing my bot on Slack channel until I realised that my ‘node index.js’ was not running on my Terminal.
Added a ‘/cyber3000-advice’ command which fetches a random advice from the AdviceSlip API