Basic Twitter Bot

Basic Twitter Bot Components

The basic twitter bot components introduced in our seminal blog post are now checked into GitHub:

  • Automation
  • Supports Current Followers
  • Seeks Out New Followers
  • Engages Interest


I used cron to schedule automated tasks performed by the twitter-bot. GitHub now contains a very simple shell script to perform the execute the automated tasks.

There is a primary reason for a cron script instead of simply executing the Python code from within cron. The script script sets its working directory to the location of the twitter-bot. Then the python scripts can simply look in the current directory for their configuration files.

Additionally, I have included functionality to allow for configuration in the parent directory of the twitter-bot. This potentially keeps any developer tokens from being mistakenly committed to GitHub. The twitter-bot first checks for a parent configuration upon initialization.

I’ve been executing the cron scripts every 6 hours with the following crontab entry:

33 3,9,15,21 * * * $HOME/twitter-bot/ $HOME/twitter-bot/ >> $HOME/twitter-bot/log/CronLog-`date +\%Y-\%m-\%d_\%H:\%M:\%S`.log 2>&1

Supports Current Followers

The twitter-bot queries the latest posts from the Following Always list and makes sure you’ve liked them. This does not interfere with anything you may wish to like or retweet manually. You can see the items favorited by the twitter-bot from your profile “Likes” tab.

Additionally, the twitter-bot ensures that you always follow anyone on your “Following Always” list.

Seeks Out New Followers

A basic follow-back operation is supported in the twitter-bot. Anyone that follows HellHippie on Twitter, will be followed back at the next automated script execution.

A search query is specified to the twitter-bots method of seekFollowers. The query is designed to discover tweets from people also seeking followers. When a tweet is discovered, the author of the tweet and commenters on the tweet will be followed.

Once a potential new follower is identified, they are placed in FollowerRequests.json for a specified time limit. If they do not follow us back within the specified time limit, they will be unfollowed.

Engages Interest

The twitter-bot can perform additional searches and like the results it finds. The intention of this is to create engagement of our own tweets as well as support interests of the twitter-bot owner.

Twitter Bot
Twitter Bot