On Github richardwestenra / mensdaybot-talk
Discuss my experience learning how to make a twitter bot.
Great learning project
The story begins a little over a year ago.
Annual event that celebrates women and helps promote feminist goals.
Thousands of men wailing "Wait why isn't there an International Men's Day?"
"I am uncomfortable when we are not about me!"
#Equality
Because of course the most important thing for us to think about on IWD is "what about the mens"?
So these complaints are pretty silly, but they seem even sillier when you consider that…
IMD exists, it's Nov 19th, as these men would know if they had bothered to google it.
Comedian Richard Herring
He is like a superhero and his powers are knowing when IMD is and telling people who don't know.
Don't use your own account
Lots of twitter bot frameworks and examples on Github. Search.
I chose this one because it's in JavaScript and runs on Node.js
It uses Twit.js, a JS Twitter API library.
// tweet 'hello world!' Twit.post('statuses/update', { status: 'hello world!' }, function(error, data, response) { console.log(data); }); // filter the twitter public stream by the word 'mango'. var stream = Twit.stream('statuses/filter', { track: 'mango' }); stream.on('tweet', function (tweet) { console.log(tweet); });
var keywords = [ "international men's day", "international man's day", "international mens day", "international mans day", "national men's day", "national man's day", "national mens day", "national mans day" ]; var reply = "It's November 19th.";
function isValid(tweet) { // Don't reply to tweets mentioning November 19th: var november = hasKeyword(['November','Nov','19','19th'], tweet.text); // Don't reply to Richard Herring var richard = tweet.user.screen_name === 'Herring1967'; // Don't reply to RTs var rt = tweet.retweeted_status !== undefined; return !november && !richard && !rt; }
Heroku is a popular cloud hosting platform. They support most popular languages including JavaScript/Node.js.
You can deploy to using Git.
Bot can't detect sarcasm.
A fast, minimalist Node.js web server framework
// Express server: var express = require('express'); var app = express(); app.set('port', (process.env.PORT || 5000)); app.use(express.static(__dirname + '/public')); app.listen(app.get('port'), function() { console.log("Node app is running at localhost:" + app.get('port')); });
Twitter finally decided to put my bot down at the ripe old age of a year and a day.
richardwestenra.com/mensdaybot-talk
MensDayBot, Simple Twitter Bot and Twit on Github
How to set up a simple JS Twitter bot
If you have any ideas to improve my bot then send me a PR.
I know Oliver wants to improve false-positive detection by cross-referencing twitter users against gamergate blocklists.