You are browsing as a guest. Sign up (or log in) to start making projects!

My first slack bot!

  • 2 Devlogs
  • 1 Total hours

This bot isn't slacking off, it replies to messages 24/7!

Ship #1 Changes requested

Dude Bot is my first Slack bot, built with Node.js + Slack Bolt running in Socket Mode. It has a few slash commands: /dsb-darsh-ping (latency check), /dsb-darsh-help, /dsb-darsh-catfact, and /dsb-darsh-joke (both pull from free APIs).

It also has a full trivia game - /dsb-darsh-trivia asks a multiple-choice question, /dsb-darsh-answer checks it, and /dsb-darsh-score shows a leaderboard that persists across restarts.

Most challenging: getting it deployed and running 24/7. I got it running on a Nest container with a systemd service, then spent way too long fighting GitHub Actions' "Permission denied (publickey)" error before figuring out that Nest sits behind a bastion that only accepts account-registered SSH keys, not the local authorized_keys file. That whole process taught me a lot about how SSH authentication actually works.

Most proud of: the trivia game with persistent scores, and the fact that I documented everything properly - README, deployment guide, Makefile, and CI config - instead of leaving everything as a bunch of commands I'd forget later.

To test: run /dsb-darsh-help to see all commands, then try /dsb-darsh-trivia and answer with /dsb-darsh-answer A. Source code is on GitHub.

Try project → See source code →
Open comments for this post

40m 41s logged

Devlog 02 - Added Trivia

Picked up dude bot again and added a bunch more commands, help, catfact, joke (pulling from free apis), and a trivia game with score tracking. /dsb-darsh-trivia grabs a question from the open trivia db, you answer A/B/C/D, and it keeps a leaderboard that saves to a json file so scores survive restarts. (Try this out)

got it running 24/7 on my nest container with a systemd service instead of just my laptop.

also wrote proper docs - readme, deployment guide, makefile. next: actually finish the auto deploy.

Devlog 02 - Added Trivia

Picked up dude bot again and added a bunch more commands, help, catfact, joke (pulling from free apis), and a trivia game with score tracking. /dsb-darsh-trivia grabs a question from the open trivia db, you answer A/B/C/D, and it keeps a leaderboard that saves to a json file so scores survive restarts. (Try this out)

got it running 24/7 on my nest container with a systemd service instead of just my laptop.

also wrote proper docs - readme, deployment guide, makefile. next: actually finish the auto deploy.

Replying to @darshjain

0
28
Open comments for this post

32m 19s logged

Devlog 01: My First Slack Bot 🎉

ok so this is my first time actually making a slack bot and honestly i didnt expect it to work lol

built it with slack bolt in socket mode. picked socket mode bc i didnt wanna deal with hosting a public url just to test stuff locally. that made it way less painful tbh

started with just one command /dsb-darsh-ping that tells you the latency. seeing it reply in slack the first time was kinda hype so i ended up adding more:

  • /dsb-darsh-ping – latency check
  • /dsb-darsh-help – lists the commands
  • /dsb-darsh-catfact – random cat fact from an api
  • /dsb-darsh-joke – random joke

the api ones were the fun part. you basically ack() the command first (you only get like 3 sec, found that out the annoying way), then fetch with axios and throw it in a try/catch so the whole thing doesnt die if the api is down

also wasted a solid 10 min confused why /dsb-ping wouldnt register… turns out someone in the workspace already used that name and they have to be unique. so i just slapped dsb-darsh- in front of all of mine. also moved my tokens into a .env so i dont accidentally push them to github

anyway small thing but learned a lot.

Devlog 01: My First Slack Bot 🎉

ok so this is my first time actually making a slack bot and honestly i didnt expect it to work lol

built it with slack bolt in socket mode. picked socket mode bc i didnt wanna deal with hosting a public url just to test stuff locally. that made it way less painful tbh

started with just one command /dsb-darsh-ping that tells you the latency. seeing it reply in slack the first time was kinda hype so i ended up adding more:

  • /dsb-darsh-ping – latency check
  • /dsb-darsh-help – lists the commands
  • /dsb-darsh-catfact – random cat fact from an api
  • /dsb-darsh-joke – random joke

the api ones were the fun part. you basically ack() the command first (you only get like 3 sec, found that out the annoying way), then fetch with axios and throw it in a try/catch so the whole thing doesnt die if the api is down

also wasted a solid 10 min confused why /dsb-ping wouldnt register… turns out someone in the workspace already used that name and they have to be unique. so i just slapped dsb-darsh- in front of all of mine. also moved my tokens into a .env so i dont accidentally push them to github

anyway small thing but learned a lot.

Replying to @darshjain

0
66

Followers

Loading…