Skip to content

Instantly share code, notes, and snippets.

@nathanleclaire
Created October 9, 2012 17:32
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save nathanleclaire/3860215 to your computer and use it in GitHub Desktop.
Save nathanleclaire/3860215 to your computer and use it in GitHub Desktop.
var TrollBot = {
mod_hash: undefined,
postComment: function(to_username, text) {
if (!mod_hash) {
// just wait a second
setTimeout(this.postComment, 1000);
} else {
request.post( //.....blah blah blah
);
}
},
login: function(username, passwd) {
request.post({url: 'http://www.reddit.com/api',
qs: {
username: username,
passwd: passwd,
api_type: 'json'
}},
function (err, res, body) {
this.mod_hash = body['data']['modhash']; // or whatever
});
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment