Created
October 9, 2012 17:32
-
-
Save nathanleclaire/3860215 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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