I wrote this app a couple months ago, but haven’t got the chance to post it on blog. So here we go. This is a twitter bot written in Go. Why built a twitter bot using Go lang? Why not?!
What does this app do exactly?
In short, this app does these things below
1. Read file (twitter credentials stored in file)
2. Connect using twitter api with oauth method
3. Search certain hashtag in twitter public timeline (in this case #edisikrl)
4. Do SELECT and INSERT command to MySQL database (to check/validate tweet)
5. Post a tweet to user timeline (in this case @edisiKRL)
Don’t forget to put this app to run in cron job in your machine. Mine is scheduled every 1 second. That is all.
This is my first attempt to write an app in Go lang, 1-2 hours time and using CnP (Copy and Paste, lol) pattern heavily.
Please check the code on my github. Here is the code for twitter bot written in Go.
Software Engineer, Blogger, Internet Savvy, Tech Enthusiast