Lucky Penny is the Data Commons Twitter bot.
It tweets under the handle @nih_dcppc
.
This repo contains scriptsfor running the Data Commons Twitter bot using rainbow-mind-machine, the extensible framework for Twitter bot flocks.
To run a Twitter bot, you first need a Twitter OAuth application at apps.twitter.com.
See the rainbow-mind-machine documentation for details about setting up a Twitter OAuth app.
You will need a Consumer Token and a Consumer Secret Token.
Put these into apikeys.json
in the form:
apikeys.json
:
{
"consumer_token" : "AAAAA",
"consumer_token_secret" : "BBBBB"
}
To run the Lucky Penny Twitter bot, use the provided
LuckyPenny.py
script.
The script has three methods:
-
setup()
- performs authentication with the Twitter account that Lucky Penny will be using. This step must be run once to create a bot key. This step is interactive. -
shepherd()
- creates a Shepherd for the Twitter flock and a Sheep for the DCPPC Twitter account. This only creates the Shepherd (and the Sheep), it does not do anything with them. -
favorite()
- continuously searches for tweets containing a given hashtag and favorites them. The user can specify whether the bot should follow each user it retweets, how many tweets it looks at in each cycle, and how often it should look for new tweets.NOTE: If a bot has already favorited a tweet or followed a user and it tries to do so again, nothing will happen.
Quick start instructions:
- Create your Twitter OAuth app
- Put your consumer token and consumer secret token in
apikeys.json
- Run
LuckyPenny.py
, which will create a bot key interactively - Run
LuckyPenny.py
again, which will run thefavorite()
method forever
You can run this anywhere you want, but you can run it on an ASWS node (current approach) or as a Heroku app (in progress).
That's all there is to it!