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

51m 49s logged

Devlog 1

I started by getting the basic Slack Bolt app running through Socket Mode. I chose Socket Mode because I wanted to be able to test the bot directly from my computer without having to set up a public server first.

For my first actual command, I made /clock. I wanted this to be slightly more useful than just displaying the computer’s time, so I used Slack’s user information to find the timezone of whoever ran the command. This means the command doesn’t need a timezone written into the code and should work for different users.

I had to use users_info to get the user’s profile and then use the tz value from it. After getting the timezone, Python’s zoneinfo module can convert the current time to the correct local time.

I tested the command in Slack and checked that the time it returned matched my timezone.

The ‘hard’ part was getting the bot to actually give the time, but it turns out it was giving it to me after all, I was just looking in the wrong spot 😆.

0
16

Comments 0

No comments yet. Be the first!