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

My first slack bot!

  • 22 Devlogs
  • 21 Total hours

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

Ship #2

I made Koizinho, a Slack bot with several fun and useful commands. Some of my favorite commands are /koi-user, which generates a card with information about a selected user, /koi-sound, which lets you choose and listen to animal sounds, and /koi-tts, which converts text into spoken audio.

The most challenging part was definitely /koi-user. I wanted the bot to generate a custom image with information about a user, but working with Canvas in JavaScript was much harder than I expected. I ran into a lot of errors, especially with positioning and generating the image correctly. I also experimented with Python and JavaScript communicating with each other before eventually deciding to keep the image generation in JavaScript. There were many moments where fixing one error somehow created another one. 😭

I’m proud that I managed to keep working on the project even when some parts became really frustrating. I learned a lot about Slack commands, modals, APIs, image generation, audio, and organizing a larger JavaScript project. /koi-user was especially satisfying because it went from being a huge mess of errors to actually working.

  • 15 devlogs
  • 17h
  • 4.36x multiplier
  • 75 Stardust
Try project → See source code →
Open comments for this post

3h 40m 7s logged

DevLog #22

I finally got it working. I discovered the error was in how the commands were being loaded, since they were all being loaded from a “commands” folder via index.js, they were taking too long to respond; because of the response time limit, an error kept popping up. I managed to fix it, though, and now it works =) I also fixed some bugs in other commands.

0
0
8
Open comments for this post

39m 21s logged

DevLog #21

I made some adjustments, I think I’ll rewrite some of the bot’s commands, I fixed some existing errors (and created others =( unfortunately). But I think it’s getting better now.

0
0
13
Open comments for this post

28m 27s logged

DevLog #20

I updated the project’s README; it remains quite simple because the bot is also simple, haha. I gave up on the /koi-user command for now, it was giving me too many headaches, so I’ll leave it for later.

0
0
19
Open comments for this post

25m 26s logged

DevLog #19

I created a command called /koi-help that lists all the bot’s available commands. This will be useful since we already have quite a few commands; I plan to replace that wall of text with a menu where the user can choose a category (general, animals, utilities, games), and the bot will respond with the commands for that category to avoid cluttering the chat.

0
0
16
Open comments for this post

1h 15m 1s logged

DevLog #18

So… this command is really frustrating me; every time I fix something, another error pops up, and I don’t know what to do. At least most of it is already done. I hope I can sort this out soon.

1
0
57
Open comments for this post

1h 4m 48s logged

DevLog #17

Still struggling with this command (/koi-user), it was supposed to be ‘easy,’ but I just ended up complicating the code even further. Well, I’m still trying to organize the elements in the image and fix an error that prevents the bot from sending the card to the user, it’s getting really annoying (why does JS have to be like this?). I hope to finish this command soon; maybe DevLog 18 will be about that, but for now, I’ll keep working on it 🥀🙏

4
0
110
Open comments for this post

23m 36s logged

DevLog #16

Fixing bugs again. I gave up on using Python + JavaScript; honestly, it was getting too difficult. Now I need to sort out the positioning, because when I was porting the code from Python to JS, the elements ended up out of place. I’m not sure if Python and JS handle image pixels differently.

0
0
20
Open comments for this post

32m 7s logged

DevLog #15

I’m reviewing some commands I’ve already implemented and fixing a few issues. Strangely, the bot is taking a while to respond; it keeps displaying the message /koi-calc failed because the app did not respond... repeatedly, yet a few seconds later, the bot actually executes the command which is really odd.

0
0
13
Open comments for this post

51m 44s logged

DevLog #14

Today I added two more simple commands /koi-rps and /koi-calc. /koi-calc actually already existed, but I had ended up deleting it.

/koi-rps is a small Rock, Paper, Scissors game. The user chooses rock, paper, or scissors, and Koizinho makes a random choice. Then, the bot compares the two choices and announces whether the player won, lost, or tied.

0
0
8
Open comments for this post

26m 39s logged

DevLog #12

I discovered that it’s possible to make .py and .js interact with each other. Now I’m learning how this communication works and trying not to explode in the process. XD

0
0
10
Open comments for this post

1h 31m 59s logged

DevLog #11

Well, I finally finished the Easy-PIL part in Python! The card is ready now.

I also set up the system so that data is automatically populated based on a JSON file. When someone uses the /koi-user command, it generates a JSON file with the selected user’s information, and then the Python script uses that data to create the card.

I designed the card myself in Canva. I spent way too much time on something so simple XD, but I really liked the result!

0
0
8
Open comments for this post

2h 12m 54s logged

DevLog #10

I’m changing the user info card. I’m now using Python to generate the images. Honestly, using the JS Canvas is a real pain, and Python’s Easy-PIL turns out to be much easier. Now, the tricky part will be handling the communication between the .js and .py files.

0
0
10
Open comments for this post

1h 23m 34s logged

DevLog #9

I’m developing a new command called /koi-user. It displays information about the user you choose.

Since the arguments of slash commands in Slack aren’t very organized (in the sense of having defined types), I had to work around the problem. In Discord, for example, you can define an argument as user_mention, so Discord itself understands that it’s a user.

In Slack, it doesn’t work that way. You can’t even pass a mention as an argument to the command, lol.

So the solution I found was to create a modal. When you use the command, a window opens with all the users in the workspace, and you can search by name or choose one from the list. After sending, the bot generates an image with some user information and sends the result to you.

(Some text is still in Portuguese because I haven’t translated everything into English yet. ;-;)

0
0
34
Open comments for this post

1h 11m 8s logged

DevLog #8

I decided to continue developing the bot, so here’s what I’ve done since the last update:

1. Code organization

I improved the project’s organization by separating command groups into different files.

Now, each file has a specific responsibility:

  • animals → animal-related commands, such as /koi-duck, /koi-cat, /koi-dog, and others.
  • space → space-related commands, such as /koi-apod. I plan to add more commands in this category later.
  • utility → general commands, such as /koi-say and /koi-tts.

This has made the code much easier to maintain and allows for easier addition of new features.

2. Loading system for responses

One thing that really bothered me was when a command took a while to respond.

On Discord, when a bot is processing something, a “Bot is thinking…” message appears while it works. I couldn’t find an exact equivalent on Slack, so I decided to create my own system.

Now, some commands send a loading message first—for example:

🦆 Looking for a duck…

Once the command finishes, that message is updated with the final response.

This makes for a much better experience; before, it used to look like the bot had stopped working lol.

3. Direct messages with the bot

I finally managed to enable DMs for the bot!

Now you can chat directly with Koizinho in private. It can already respond to simple messages, for example:

User: Hi!
Koizinho: Hello!

I still want to improve this part. Maybe I’ll add some form of AI or a smarter conversation system in the future.

0
0
11
Ship #1

I created a Slack bot using JavaScript. My bot features nine commands, including /koi-ping, which replies with “Pong!” to check if the bot is online; /koi-apod, which uses the NASA API to send the Astronomy Picture of the Day; commands like /koi-cat, /koi-dog, /koi-fox, and /koi-duck, which use APIs to send random animal images; /koi-sound, which sends MP3 animal sounds; /koi-say, which repeats the user’s message; and /koi-tts, which converts text to speech using Microsoft Edge TTS.

To develop the project, I used various APIs, primarily to fetch images from NASA and of animals. I also worked with audio files to implement the commands related to sounds and text-to-speech conversion.

The biggest challenge during development was dealing with file paths. Honestly… who decided it had to work that way? 😭 I spent a long time trying to figure out why the files weren’t being found before I managed to organize everything correctly.

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

40m 28s logged

DevLog #6

Okay… I finally finished the project’s README! 🎉

I think it turned out pretty cool; it’s not super professional yet, but I think it does a good job of showing what the bot can do. I might improve it in the future whenever I can shake off the laziness, haha.

I also realized I used Axios quite a bit in this project. Most of the new commands rely on external APIs.

There isn’t much else to add to this devlog; at least I’m happy it’s not just a bot that replies “pong” 😆

0
0
8
Open comments for this post

36m 31s logged

DevLog #5

New command, wow!! 🎉🎉🎉🎉

Person: “Wait… isn’t that just /koi-say?”

Well… sort of. It’s basically an improved /koi-say.

Meet the new command: /koi-tts.

As the name suggests, TTS stands for Text to Speech. The bot takes the text you send, uses Microsoft Edge’s TTS voices to turn it into an MP3, and then sends the audio back to you. Pretty cool. =)

(I hate path😭)

0
0
12
Open comments for this post

15m 44s logged

DevLog #4

Today I added a very simple command: /koi-say.

It does exactly what the name suggests: the bot repeats the message you type. Nothing spectacular, but it’s a classic, useful command for testing interactions.

If you don’t type anything, the bot replies by letting you know that text is required. The message might seem a bit blunt… but remember: it’s just a koizinho. 😭

By the way, I was thinking about how to explain the bot’s name in English. I think the closest equivalent would be something like “little koi”. In Portuguese, we use the suffix -zinho to form a diminutive that often conveys affection or cuteness. So, koizinho would be something like a “little koi” or an affectionate way to refer to the bot.

0
0
12
Open comments for this post

40m 24s logged

DevLog #3

So… continuing the animal saga, I present to you: /koi-sound. 🐾

This command makes the bot send a humble animal selection menu. Then, you just pick one (there are still only a few, hahaha), and the bot replies with an .mp3 file containing the chosen animal’s sound.

The list of animals is still small, but I plan to add many more in future devlogs.

And a quick rant: I hate path. 😭 Who decided that handling file paths had to be done this way?

0
0
17
Open comments for this post

43m 59s logged

DevLog #2

Today I added 4 new commands to the bot. To be honest, it wasn’t very difficult. It was basically copying the code from the first command, changing the API, and adapting it to the particularities of each one.

(Seriously… who decided that each API would return the data in a different way? 😭 I just wanted to grab a humble image.)

The new commands are:

  • 🦆 /koi-duck — shows a picture of a random duck.

  • 🐱 /koi-cat — shows a picture of a random cat.

  • 🐶 /koi-dog — shows a picture of a random dog.

  • 🦊 /koi-fox — shows a picture of a random fox.

It was a short devlog, but at least now the bot is becoming more fun.

0
0
12
Open comments for this post

1h 0m 24s logged

DevLog #1

For this fresh start, I’ve added two commands:

  • /koi-ping — a command that makes the bot reply with “🏓 Pong!”.
  • /koi-apod — fetches NASA’s Astronomy Picture of the Day (APOD) and sends the image along with its description.

Well… I think that’s it for this devlog.

0
0
10

Delete project?

Are you sure you want to permanently delete this project? This action cannot be undone.

All devlogs, followers, and associated data will be removed.

Followers

Loading…