@tilde_fortune twitter bot
Mon Oct 13 15:51:02 UTC 2014
In the end it was too easy to set this up. THANKS UNIX. I was planning to have to learn (more) python and choose a python Twitter library etc but in the end I just used TTYtter.pl called from a shell script. I even got to use TR(1) to strip newlines, woo-hoo!
So the bot is made up of:
- TTYtter.pl in my ~/bin directory
- shortfortune, a shell script that does this:
fortune -n 140 -s
- tweet_fortune, a shell script that does this:
shortfortune | tr '\n' ' ' | TTYtter.pl > /dev/null 2>&1
- a cron job that runs tweet_fortune every 20 minutes
It's a demonstration of the power of the Unix Philosophy of small well-defined tools that can be joined together easily.
Tweeting fortunes is fun but I'm thinking about creating a better source of tweets:
- Tweetable quotes about tilde.club from articles about it?
- Tweetable quots from pages on tilde.club, with links to the pages
- User-submitted (anonymized) bash.org style quotes from IRC/Wall?