I started this project with the goal of making a Slack bot that could respond to custom slash commands. I wasn’t sure what the bot should actually do, so I decided to make it potato-themed and named it Potatonator.
I started with basic commands like:
/potatonator-ping
/potatonator-help
/potatonator-potatofact
For the potato facts, I first learned about APIs and Axios, which lets the bot make requests to an API. I originally considered using an existing API, but decided to make my own potato API instead.
I first ran the API locally, but realized that meant it wouldn’t work when my PC was turned off. I decided to move it to Cloudflare Workers, which gave me a permanent URL:
https://potatonator-api.potatonator.workers.dev
I then connected my Slack bot to this API.
After that, I wanted Potatonator to become more like a game, so I created /potatonator-adopt. Users could permanently adopt a randomly generated potato with stats such as:
Name
Type
Rarity
Power
Crunch
Luck
Level
XP
To save this information, I added a Cloudflare D1 database.
There were a few mistakes along the way. I initially ran a command from the wrong folder, and later discovered that my local D1 database didn’t have the table even though the remote database did. I also had an issue where Axios treated the “already have a potato” response as an error. After fixing these, everything worked.
Now /potatonator-adopt successfully creates a potato and remembers it even after the bot restarts.
Next, I’m planning to add /potatonator-profile, which will let users view their potato and its stats.
Comments 0
No comments yet. Be the first!
Sign in to join the conversation.