Replacer Bot

Twitter bot that:


gem install replacer_bot


git clone
cd replacer_bot
rake install


The default config is here, you’ll want to create your own config at ~/.replacer_bot/config.yml to override some of these, something like:

search_term: David Cameron
  - david cameron: "Satan's Little Helper"
  - cameron: Satan
save_file: /Users/sam/.replacer_bot/last.tweet
seen_tweets: /Users/sam/.replacer_bot/seen.tweets


Twitter credentials

You’ll also need some Twitter credentials, store them in ~/.replacer_botrc like this:

CONSUMER_KEY: some_key
CONSUMER_SECRET: some_secret
TOKEN: oauth_token
SECRET: oauth_secret

(and see this for help on setting up Twitter bots)

Running it

You should now be able to run it like so:

➔ replacer tweet
Tweeting: Satan's Little Helper sets out academy 'vision' for every school
Sleeping 60 seconds
Tweeting: Swarm warning: Satan's Little Helper accuses migrants of 'breaking in' to UK


There’s also

➔ replacer dry_run

which does the search and shows what it would have tweeted, without actually tweeting anything

Reducing the noise

It turns out that a lot of Twitter is people (or bots) retweeting the same stuff with minimal changes, like adding extra hashtags or using a different URL shortener (I don’t really understand how this even happens, but whatever). (Actually, I wonder how much of Twitter is just bots yelling at each other in the void. But I digress.) This makes a crude ‘search for this phrase’ bot extremely noisy, so I have come up with some Opinions based on some very crude Reckons. Things that will make the bot consider tweets to be ‘the same’ as tweets we’ve seen before, and therefore ignorable, are:

The above reduced the noise a bit, but not enough to make a substantial difference. So I came up with this:

The 4 words thing is tunable in config.yml:

similarity_weighting: 4

but 4 seems about right for my current use case; it will clearly depend on the popularity of your search term

Back to top