🛠️ Smile Bot — Fixing the Broken Compliment Feature
Heyyyy! After shipping Smile Bot I noticed something embarrassing. 😂
The /smile-bot-compliment command wasn’t actually working…..
Instead of returning a compliment, it kept responding:
“Couldn’t find a compliment right now.”
Soo.. What was happening?
The command depended on an external API: The API was throwing an error, which meant my bot’s fallback response was triggered every time.
The fix:
I realized I didn’t need an external API for something as simple as generating compliments.
Therefore, I replaced the API call with a local collection of compliments and randomly select one whenever the command is used: This means the feature no longer depends on a third-party API being online.
🚀 Deploying the fix
The interesting part was that the bot worked locally, but Slack was still showing the old error.
Turns out my Nest server was still running the previous version of index.js.
I pushed the fix to GitHub, pulled the latest commit onto Nest, restarted the systemd service, and tested it again in Slack.
And finally:
It worked!!!!!!!!!!!!! 🎉🍀🍀
📚 What I learned
This was a small bug, but it taught me an important lesson:
“A working local version doesn’t mean your deployed version has the same code.”
Debugging isn’t always about finding a complicated programming error it’s also about tracing the entire path: 🗿
Code → Git → Server → Process → User
Smile Bot is now a little more reliable than it was when I shipped it. ✨
Another bug squashed and Another lesson learned!!
Comments 0
No comments yet. Be the first!
Sign in to join the conversation.