I have always been having trouble staying hydrated these days… especially at home. For hours, I get absorbed in a book and forget to drink water. This results to my skin and lips getting more dry. Recently, I’ve followed lots of bots to help me with my worldbuilding. Crossing these two ideas together, I thought why not build a bot to remind me to drink water?
I’ve always had this particular post on my reading list on dev.to, and just this week I decided to finally read it. I also stumbled upon this post as I was researching and ended up following it instead of the former.
Tinkering the bot
Now here’s what I wanted to happen (initially). I simply want to make the bot remind me to drink water every 3 hours. So here’s my thought process on how I will achieve this.
- Build a prototype locally. Make it tweet instead of retweet (referring to the first tutorial)
- Make it tweet every 3 hours
- Make it spout ̶r̶a̶n̶d̶o̶m̶ ̶n̶o̶n̶s̶e̶n̶s̶e̶ encouraging words to make me drink water
- Create an algorithm of the sentence generator
Building a prototype
I went to Twit’s documentation and looked for how to tweet instead of retweet. The readme is kinda messy but at it’s understandable so it’s fine.
And bam! Here’s the hello world tweet of my bot.
- Apparently, you cannot post the same tweet in a row, so I appeneded the current timestamp there so it’s unique. (For testing purposes)
- I used the dotenv dependency so I don’t share to the world my sensitive information and keys.
Change of plans
Instead of actually following my list, I started at the deployment process first and then built my sentence generator locally. Here are some funny sentences!
The second tutorial takes advantage of Heroku’s add-on’s. I used a scheduler add-on to run the script every hour (instead of the initial plan 3 hours) and that’s about it.
This post is not a tutorial, just a documentation of my learning experience. If you want to be reminded every hour to drink water, then you can follow @bot_hydrated. 😅 It’s summer and it’s getting hotter and hotter! Gotta stay hydrated guys and gals! If you want to submit a pull request, here’s a link to the repo. Feel free to fork it as well. This is just a fun project and I’m not sure if I’m going to take this one very seriously (for example, improve the bot in the future). I have several other bot ideas, though! So watch out for that. 😅
If you are reading this, thank you for reaching the end. 😎🙏 See y’all on the next ones!
EDIT: Fixed the wrong repo link
Top comments (0)