Lightning Projects: I MADE A TWITTER BOT
Note this project is old and offline, and no longer maintained or active.
My twitter bot is @dice_roll.
I don't know how I got that name. It's pretty awesome.
Project link: https://github.com/chaomodus/rollmea
Well this was a pretty neat project, was like "I need to actually finish something" rather than starting and not finishing stuff by getting distracted by making things super generalized, or distracted by stuff that I wasn't immediately aware of how to use.
I'd never written something for Twitter before, aside from minor modifications to TIRCd, and so this was a bit of learning. I chose to use the library tweepy for python. Tweepy isn't amazingly well documented, but there are tutorials a google away.
Two interesting bits about twitter bots:
- Bots need API keys on a particular account. If you find tutorials this isn't completely explained, but basically you need to make the twitter account, and go to apps.twitter.com and make API keys for the twitter account, and in addition to make user keys (these are normally generated in the authentication step for Regular Apps, but you can generate ones for the logged in account too). One additional caveat / annoyance, the bot account must be associated with a mobile phone able to receive text messages in order to be able to post.
- Tuning the API call frequency is tricky and there aren't good resources (that turn up in a google search) for the sleep times for various parts of the operation.
So I learned about the Twitters. I think that I could generalize this code base into a fairly generic twitter bot very easily, and will probably be doing that since there's some demand for it.