friday
- 1 Devlogs
- 1 Total hours
This bot isn't slacking off, it replies to messages 24/7!
This bot isn't slacking off, it replies to messages 24/7!
Friday - Slack Assistant Bot
Overview
Yesterday I started my project, and I wanted to make a slack bot with some custom slash commands. Today my bot named
Friday is running 24/7 on my Hack Club Nest.
First thing first I had to name my bot,
Friday
I created a slack app and linked it to my workspace,
turned on the Socket Mode so my bot wouldn’t require a public url
and
I created custom slash commands that would be “/friday-”
so commands would not be overriden by other apps. My bot was created with
Node.js and JavaScript using slack’s bolt framework. I created the “/friday-ping” command first to make sure my bot was working properly. After that I created and added 11 other commands to my bot for assistance, jokes, quotes, coding help, facts, web searching, github, and the weather.
To make my commands functional I used public rest apis with Axios
I also added error handling so my bot wouldn’t crash when a certain api was down.
After that I learned about the ack() and respond() functions within my slack app.
To make my credential keys secure I created a “.env” file and a “.gitignore” file so those files wouldn’t be pushed to my github.
Next I published my project to my github and pushed all my work there. After that I applied for a Hack Club Nest container where my bot would be hosted 24/7, and I learned how to connect to my server via SSH.
To connect to my Debian server from my Windows PC I created an SSH key,
I installed Git, Node, and NPM to my server,
cloned my GitHub repository to my server, and added my production “.env”.
Finally, I used PM2 to make sure my bot was running on my server, and I detached my laptop from my server. I used my “/friday-ping” command one last time to make sure everything was working fine, and if it was my bot was live and running on my Hack Club Nest!